diff options
| author | Kenichi Handa | 2012-09-15 15:14:18 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-09-15 15:14:18 +0900 |
| commit | dcbd9236f7be9da4e658fd559dfbd7454f4b6018 (patch) | |
| tree | df71af7779e1a0da9d0822ce5b89e51bd603bd40 /lisp | |
| parent | ea964864a66828ce2457e44c4c670160d5879ec6 (diff) | |
| parent | 823751606a90e3850551b43e707d58bbf58033dc (diff) | |
| download | emacs-dcbd9236f7be9da4e658fd559dfbd7454f4b6018.tar.gz emacs-dcbd9236f7be9da4e658fd559dfbd7454f4b6018.zip | |
merge trunk
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 20 | ||||
| -rw-r--r-- | lisp/dired-aux.el | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 16 | ||||
| -rw-r--r-- | lisp/vc/vc-bzr.el | 14 | ||||
| -rw-r--r-- | lisp/version.el | 47 |
5 files changed, 76 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7163b4b4989..c9aa7e99356 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,25 @@ | |||
| 1 | 2012-09-15 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * vc/vc-bzr.el (vc-bzr-working-revision): For lightweight local | ||
| 4 | checkouts, check the parent dirstate matches the branch. | ||
| 5 | Add "--tree" to "bzr revno" arguments. Don't try to shorten the | ||
| 6 | empty string. | ||
| 7 | |||
| 8 | * version.el (emacs-bzr-version): Doc fix. | ||
| 9 | (emacs-bzr-version-dirstate): New function. | ||
| 10 | (emacs-bzr-get-version): For lightweight checkouts, if the parent | ||
| 11 | is local try and check that it matches the branch. If not, just | ||
| 12 | use dirstate information. (Bug#12441) | ||
| 13 | |||
| 14 | 2012-09-14 Juri Linkov <juri@jurta.org> | ||
| 15 | |||
| 16 | * dired-aux.el (dired-do-chmod): Use `eq' to detect empty input. | ||
| 17 | (Bug#12399) | ||
| 18 | |||
| 1 | 2012-09-14 Stefan Monnier <monnier@iro.umontreal.ca> | 19 | 2012-09-14 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 20 | ||
| 21 | * emacs-lisp/advice.el (ad-prognify): Remove, use macroexp-progn. | ||
| 22 | |||
| 3 | * emacs-lisp/edebug.el: Miscellaneous cleanup. | 23 | * emacs-lisp/edebug.el: Miscellaneous cleanup. |
| 4 | Remove obsolete byte-compiler hack that tried to silence some warnings. | 24 | Remove obsolete byte-compiler hack that tried to silence some warnings. |
| 5 | (edebug-submit-bug-report): Remove. | 25 | (edebug-submit-bug-report): Remove. |
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index b42df954fe5..e5ca463e8d4 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -281,7 +281,10 @@ Symbolic modes like `g+w' are allowed." | |||
| 281 | "Change mode of %s to: " | 281 | "Change mode of %s to: " |
| 282 | nil 'chmod arg files default)) | 282 | nil 'chmod arg files default)) |
| 283 | num-modes) | 283 | num-modes) |
| 284 | (cond ((equal modes "") | 284 | (cond ((or (equal modes "") |
| 285 | ;; Use `eq' instead of `equal' | ||
| 286 | ;; to detect empty input (bug#12399). | ||
| 287 | (eq modes default)) | ||
| 285 | ;; We used to treat empty input as DEFAULT, but that is not | 288 | ;; We used to treat empty input as DEFAULT, but that is not |
| 286 | ;; such a good idea (Bug#9361). | 289 | ;; such a good idea (Bug#9361). |
| 287 | (error "No file mode specified")) | 290 | (error "No file mode specified")) |
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index f0d277a3f69..d96076d17a6 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -1746,6 +1746,7 @@ | |||
| 1746 | (provide 'advice-preload) | 1746 | (provide 'advice-preload) |
| 1747 | ;; During a normal load this is a noop: | 1747 | ;; During a normal load this is a noop: |
| 1748 | (require 'advice-preload "advice.el") | 1748 | (require 'advice-preload "advice.el") |
| 1749 | (require 'macroexp) | ||
| 1749 | (eval-when-compile (require 'cl-lib)) | 1750 | (eval-when-compile (require 'cl-lib)) |
| 1750 | 1751 | ||
| 1751 | ;; @@ Variable definitions: | 1752 | ;; @@ Variable definitions: |
| @@ -2538,11 +2539,6 @@ For that it has to be fbound with a non-autoload definition." | |||
| 2538 | (byte-compile symbol) | 2539 | (byte-compile symbol) |
| 2539 | (fset function (symbol-function symbol)))))) | 2540 | (fset function (symbol-function symbol)))))) |
| 2540 | 2541 | ||
| 2541 | (defun ad-prognify (forms) | ||
| 2542 | (cond ((<= (length forms) 1) | ||
| 2543 | (car forms)) | ||
| 2544 | (t (cons 'progn forms)))) | ||
| 2545 | |||
| 2546 | ;; @@@ Accessing argument lists: | 2542 | ;; @@@ Accessing argument lists: |
| 2547 | ;; ============================= | 2543 | ;; ============================= |
| 2548 | 2544 | ||
| @@ -2954,7 +2950,7 @@ should be modified. The assembled function will be returned." | |||
| 2954 | before-forms) | 2950 | before-forms) |
| 2955 | (setq before-forms | 2951 | (setq before-forms |
| 2956 | `((unwind-protect | 2952 | `((unwind-protect |
| 2957 | ,(ad-prognify before-forms) | 2953 | ,(macroexp-progn before-forms) |
| 2958 | ,@(ad-body-forms | 2954 | ,@(ad-body-forms |
| 2959 | (ad-advice-definition advice)))))) | 2955 | (ad-advice-definition advice)))))) |
| 2960 | (t (setq before-forms | 2956 | (t (setq before-forms |
| @@ -2971,12 +2967,12 @@ should be modified. The assembled function will be returned." | |||
| 2971 | (ad-substitute-tree | 2967 | (ad-substitute-tree |
| 2972 | (function (lambda (form) (eq form 'ad-do-it))) | 2968 | (function (lambda (form) (eq form 'ad-do-it))) |
| 2973 | (function (lambda (form) around-form)) | 2969 | (function (lambda (form) around-form)) |
| 2974 | (ad-prognify (ad-body-forms (ad-advice-definition advice)))))) | 2970 | (macroexp-progn (ad-body-forms (ad-advice-definition advice)))))) |
| 2975 | 2971 | ||
| 2976 | (setq after-forms | 2972 | (setq after-forms |
| 2977 | (if (and around-form-protected before-forms) | 2973 | (if (and around-form-protected before-forms) |
| 2978 | `((unwind-protect | 2974 | `((unwind-protect |
| 2979 | ,(ad-prognify before-forms) | 2975 | ,(macroexp-progn before-forms) |
| 2980 | ,around-form)) | 2976 | ,around-form)) |
| 2981 | (append before-forms (list around-form)))) | 2977 | (append before-forms (list around-form)))) |
| 2982 | (dolist (advice afters) | 2978 | (dolist (advice afters) |
| @@ -2984,7 +2980,7 @@ should be modified. The assembled function will be returned." | |||
| 2984 | after-forms) | 2980 | after-forms) |
| 2985 | (setq after-forms | 2981 | (setq after-forms |
| 2986 | `((unwind-protect | 2982 | `((unwind-protect |
| 2987 | ,(ad-prognify after-forms) | 2983 | ,(macroexp-progn after-forms) |
| 2988 | ,@(ad-body-forms | 2984 | ,@(ad-body-forms |
| 2989 | (ad-advice-definition advice)))))) | 2985 | (ad-advice-definition advice)))))) |
| 2990 | (t (setq after-forms | 2986 | (t (setq after-forms |
| @@ -3013,7 +3009,7 @@ should be modified. The assembled function will be returned." | |||
| 3013 | (ad-body-forms (ad-advice-definition advice)))) | 3009 | (ad-body-forms (ad-advice-definition advice)))) |
| 3014 | (ad-get-enabled-advices function hook-name)))) | 3010 | (ad-get-enabled-advices function hook-name)))) |
| 3015 | (if hook-forms | 3011 | (if hook-forms |
| 3016 | (ad-prognify (apply 'append hook-forms))))) | 3012 | (macroexp-progn (apply 'append hook-forms))))) |
| 3017 | 3013 | ||
| 3018 | 3014 | ||
| 3019 | ;; @@ Caching: | 3015 | ;; @@ Caching: |
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index c0dafda57b6..1eb33776f6a 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el | |||
| @@ -534,7 +534,9 @@ in the branch repository (or whose status not be determined)." | |||
| 534 | ;; FIXME: maybe it's overkill to check if both these | 534 | ;; FIXME: maybe it's overkill to check if both these |
| 535 | ;; files exist. | 535 | ;; files exist. |
| 536 | (and (file-exists-p branch-format-file) | 536 | (and (file-exists-p branch-format-file) |
| 537 | (file-exists-p lastrev-file))))) | 537 | (file-exists-p lastrev-file) |
| 538 | (equal (emacs-bzr-version-dirstate l-c-parent-dir) | ||
| 539 | (emacs-bzr-version-dirstate rootdir)))))) | ||
| 538 | t))) | 540 | t))) |
| 539 | (with-temp-buffer | 541 | (with-temp-buffer |
| 540 | (insert-file-contents branch-format-file) | 542 | (insert-file-contents branch-format-file) |
| @@ -553,13 +555,17 @@ in the branch repository (or whose status not be determined)." | |||
| 553 | (insert-file-contents lastrev-file) | 555 | (insert-file-contents lastrev-file) |
| 554 | (when (re-search-forward "[0-9]+" nil t) | 556 | (when (re-search-forward "[0-9]+" nil t) |
| 555 | (buffer-substring (match-beginning 0) (match-end 0)))))) | 557 | (buffer-substring (match-beginning 0) (match-end 0)))))) |
| 556 | ;; fallback to calling "bzr revno" | 558 | ;; Fallback to calling "bzr revno --tree". |
| 559 | ;; The "--tree" matters for lightweight checkouts not on the same | ||
| 560 | ;; revision as the parent. | ||
| 557 | (let* ((result (vc-bzr-command-discarding-stderr | 561 | (let* ((result (vc-bzr-command-discarding-stderr |
| 558 | vc-bzr-program "revno" (file-relative-name file))) | 562 | vc-bzr-program "revno" "--tree" |
| 563 | (file-relative-name file))) | ||
| 559 | (exitcode (car result)) | 564 | (exitcode (car result)) |
| 560 | (output (cdr result))) | 565 | (output (cdr result))) |
| 561 | (cond | 566 | (cond |
| 562 | ((eq exitcode 0) (substring output 0 -1)) | 567 | ((and (eq exitcode 0) (not (zerop (length output)))) |
| 568 | (substring output 0 -1)) | ||
| 563 | (t nil)))))) | 569 | (t nil)))))) |
| 564 | 570 | ||
| 565 | (defun vc-bzr-create-repo () | 571 | (defun vc-bzr-create-repo () |
diff --git a/lisp/version.el b/lisp/version.el index e63c51d0d26..47476cb268a 100644 --- a/lisp/version.el +++ b/lisp/version.el | |||
| @@ -87,23 +87,36 @@ to the system configuration; look at `system-configuration' instead." | |||
| 87 | ;; Set during dumping, this is a defvar so that it can be setq'd. | 87 | ;; Set during dumping, this is a defvar so that it can be setq'd. |
| 88 | (defvar emacs-bzr-version nil | 88 | (defvar emacs-bzr-version nil |
| 89 | "String giving the bzr revision from which this Emacs was built. | 89 | "String giving the bzr revision from which this Emacs was built. |
| 90 | Value is the bzr revision number and a revision ID separated by a blank. | 90 | The format is: [revno] revision_id, where revno may be absent. |
| 91 | Value is nil if Emacs was not built from a bzr checkout, or if we could | 91 | Value is nil if Emacs was not built from a bzr checkout, or if we could |
| 92 | not determine the revision.") | 92 | not determine the revision.") |
| 93 | 93 | ||
| 94 | (defun emacs-bzr-version-dirstate (dir) | ||
| 95 | "Try to return as a string the bzr revision ID of directory DIR. | ||
| 96 | This uses the dirstate file's parent revision entry. | ||
| 97 | Returns nil if unable to find this information." | ||
| 98 | (let ((file (expand-file-name ".bzr/checkout/dirstate" dir))) | ||
| 99 | (when (file-readable-p file) | ||
| 100 | (with-temp-buffer | ||
| 101 | (insert-file-contents file) | ||
| 102 | (and (looking-at "#bazaar dirstate flat format 3") | ||
| 103 | (forward-line 3) | ||
| 104 | (looking-at "[0-9]+\0\\([^\0\n]+\\)\0") | ||
| 105 | (match-string 1)))))) | ||
| 106 | |||
| 94 | (defun emacs-bzr-get-version (&optional dir) | 107 | (defun emacs-bzr-get-version (&optional dir) |
| 95 | "Try to return as a string the bzr revision number of the Emacs sources. | 108 | "Try to return as a string the bzr revision of the Emacs sources. |
| 96 | Value is the bzr revision number and a revision ID separated by a blank. | 109 | The format is: [revno] revision_id, where revno may be absent. |
| 97 | Value is nil if the sources do not seem to be under bzr, or if we could | 110 | Value is nil if the sources do not seem to be under bzr, or if we could |
| 98 | not determine the revision. Note that this reports on the current state | 111 | not determine the revision. Note that this reports on the current state |
| 99 | of the sources, which may not correspond to the running Emacs. | 112 | of the sources, which may not correspond to the running Emacs. |
| 100 | 113 | ||
| 101 | Optional argument DIR is a directory to use instead of `source-directory'." | 114 | Optional argument DIR is a directory to use instead of `source-directory'." |
| 102 | (or dir (setq dir source-directory)) | 115 | (or dir (setq dir source-directory)) |
| 103 | (when (file-directory-p (setq dir (expand-file-name ".bzr/branch" dir))) | 116 | (when (file-directory-p (expand-file-name ".bzr/branch" dir)) |
| 104 | (let (file loc) | 117 | (let (file loc rev) |
| 105 | (cond ((file-readable-p | 118 | (cond ((file-readable-p |
| 106 | (setq file (expand-file-name "last-revision" dir))) | 119 | (setq file (expand-file-name ".bzr/branch/last-revision" dir))) |
| 107 | (with-temp-buffer | 120 | (with-temp-buffer |
| 108 | (insert-file-contents file) | 121 | (insert-file-contents file) |
| 109 | (goto-char (point-max)) | 122 | (goto-char (point-max)) |
| @@ -112,14 +125,26 @@ Optional argument DIR is a directory to use instead of `source-directory'." | |||
| 112 | (buffer-string))) | 125 | (buffer-string))) |
| 113 | ;; OK, no last-revision. Is it a lightweight checkout? | 126 | ;; OK, no last-revision. Is it a lightweight checkout? |
| 114 | ((file-readable-p | 127 | ((file-readable-p |
| 115 | (setq file (expand-file-name "location" dir))) | 128 | (setq file (expand-file-name ".bzr/branch/location" dir))) |
| 116 | ;; If the parent branch is local, try looking there for the revid. | 129 | (setq rev (emacs-bzr-version-dirstate dir)) |
| 117 | (if (setq loc (with-temp-buffer | 130 | ;; If the parent branch is local, try looking there for the rev. |
| 131 | ;; Note: there is no guarantee that the parent branch's rev | ||
| 132 | ;; corresponds to this branch. This branch could have | ||
| 133 | ;; been made with a specific -r revno argument, or the | ||
| 134 | ;; parent could have been updated since this branch was created. | ||
| 135 | ;; To try and detect this, we check the dirstate revids | ||
| 136 | ;; to see if they match. | ||
| 137 | (if (and (setq loc (with-temp-buffer | ||
| 118 | (insert-file-contents file) | 138 | (insert-file-contents file) |
| 119 | (if (looking-at "file://\\(.*\\)") | 139 | (if (looking-at "file://\\(.*\\)") |
| 120 | (match-string 1)))) | 140 | (match-string 1)))) |
| 121 | (emacs-bzr-get-version loc))) | 141 | (equal rev (emacs-bzr-version-dirstate loc))) |
| 122 | ;; Could fall back to eg `bzr testament' at this point. | 142 | (emacs-bzr-get-version loc) |
| 143 | ;; If parent does not match, the best we can do without | ||
| 144 | ;; calling external commands is to use the dirstate rev. | ||
| 145 | rev)) | ||
| 146 | ;; At this point, could fall back to: | ||
| 147 | ;; bzr version-info --custom --template='{revno} {revision_id}\n' | ||
| 123 | )))) | 148 | )))) |
| 124 | 149 | ||
| 125 | ;; We put version info into the executable in the form that `ident' uses. | 150 | ;; We put version info into the executable in the form that `ident' uses. |