diff options
| author | Kenichi Handa <handa@gnu.org> | 2012-09-15 15:14:18 +0900 |
|---|---|---|
| committer | Kenichi Handa <handa@gnu.org> | 2012-09-15 15:14:18 +0900 |
| commit | dcbd9236f7be9da4e658fd559dfbd7454f4b6018 (patch) | |
| tree | df71af7779e1a0da9d0822ce5b89e51bd603bd40 /lisp | |
| parent | ea964864a66828ce2457e44c4c670160d5879ec6 (diff) | |
| parent | 823751606a90e3850551b43e707d58bbf58033dc (diff) | |
| download | emacs-dcbd9236f7be9da4e658fd559dfbd7454f4b6018.tar.gz | |
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 @@ +2012-09-15 Glenn Morris <rgm@gnu.org> + + * vc/vc-bzr.el (vc-bzr-working-revision): For lightweight local + checkouts, check the parent dirstate matches the branch. + Add "--tree" to "bzr revno" arguments. Don't try to shorten the + empty string. + + * version.el (emacs-bzr-version): Doc fix. + (emacs-bzr-version-dirstate): New function. + (emacs-bzr-get-version): For lightweight checkouts, if the parent + is local try and check that it matches the branch. If not, just + use dirstate information. (Bug#12441) + +2012-09-14 Juri Linkov <juri@jurta.org> + + * dired-aux.el (dired-do-chmod): Use `eq' to detect empty input. + (Bug#12399) + 2012-09-14 Stefan Monnier <monnier@iro.umontreal.ca> + * emacs-lisp/advice.el (ad-prognify): Remove, use macroexp-progn. + * emacs-lisp/edebug.el: Miscellaneous cleanup. Remove obsolete byte-compiler hack that tried to silence some warnings. (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." "Change mode of %s to: " nil 'chmod arg files default)) num-modes) - (cond ((equal modes "") + (cond ((or (equal modes "") + ;; Use `eq' instead of `equal' + ;; to detect empty input (bug#12399). + (eq modes default)) ;; We used to treat empty input as DEFAULT, but that is not ;; such a good idea (Bug#9361). (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 @@ (provide 'advice-preload) ;; During a normal load this is a noop: (require 'advice-preload "advice.el") +(require 'macroexp) (eval-when-compile (require 'cl-lib)) ;; @@ Variable definitions: @@ -2538,11 +2539,6 @@ For that it has to be fbound with a non-autoload definition." (byte-compile symbol) (fset function (symbol-function symbol)))))) -(defun ad-prognify (forms) - (cond ((<= (length forms) 1) - (car forms)) - (t (cons 'progn forms)))) - ;; @@@ Accessing argument lists: ;; ============================= @@ -2954,7 +2950,7 @@ should be modified. The assembled function will be returned." before-forms) (setq before-forms `((unwind-protect - ,(ad-prognify before-forms) + ,(macroexp-progn before-forms) ,@(ad-body-forms (ad-advice-definition advice)))))) (t (setq before-forms @@ -2971,12 +2967,12 @@ should be modified. The assembled function will be returned." (ad-substitute-tree (function (lambda (form) (eq form 'ad-do-it))) (function (lambda (form) around-form)) - (ad-prognify (ad-body-forms (ad-advice-definition advice)))))) + (macroexp-progn (ad-body-forms (ad-advice-definition advice)))))) (setq after-forms (if (and around-form-protected before-forms) `((unwind-protect - ,(ad-prognify before-forms) + ,(macroexp-progn before-forms) ,around-form)) (append before-forms (list around-form)))) (dolist (advice afters) @@ -2984,7 +2980,7 @@ should be modified. The assembled function will be returned." after-forms) (setq after-forms `((unwind-protect - ,(ad-prognify after-forms) + ,(macroexp-progn after-forms) ,@(ad-body-forms (ad-advice-definition advice)))))) (t (setq after-forms @@ -3013,7 +3009,7 @@ should be modified. The assembled function will be returned." (ad-body-forms (ad-advice-definition advice)))) (ad-get-enabled-advices function hook-name)))) (if hook-forms - (ad-prognify (apply 'append hook-forms))))) + (macroexp-progn (apply 'append hook-forms))))) ;; @@ 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)." ;; FIXME: maybe it's overkill to check if both these ;; files exist. (and (file-exists-p branch-format-file) - (file-exists-p lastrev-file))))) + (file-exists-p lastrev-file) + (equal (emacs-bzr-version-dirstate l-c-parent-dir) + (emacs-bzr-version-dirstate rootdir)))))) t))) (with-temp-buffer (insert-file-contents branch-format-file) @@ -553,13 +555,17 @@ in the branch repository (or whose status not be determined)." (insert-file-contents lastrev-file) (when (re-search-forward "[0-9]+" nil t) (buffer-substring (match-beginning 0) (match-end 0)))))) - ;; fallback to calling "bzr revno" + ;; Fallback to calling "bzr revno --tree". + ;; The "--tree" matters for lightweight checkouts not on the same + ;; revision as the parent. (let* ((result (vc-bzr-command-discarding-stderr - vc-bzr-program "revno" (file-relative-name file))) + vc-bzr-program "revno" "--tree" + (file-relative-name file))) (exitcode (car result)) (output (cdr result))) (cond - ((eq exitcode 0) (substring output 0 -1)) + ((and (eq exitcode 0) (not (zerop (length output)))) + (substring output 0 -1)) (t nil)))))) (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." ;; Set during dumping, this is a defvar so that it can be setq'd. (defvar emacs-bzr-version nil "String giving the bzr revision from which this Emacs was built. -Value is the bzr revision number and a revision ID separated by a blank. +The format is: [revno] revision_id, where revno may be absent. Value is nil if Emacs was not built from a bzr checkout, or if we could not determine the revision.") +(defun emacs-bzr-version-dirstate (dir) + "Try to return as a string the bzr revision ID of directory DIR. +This uses the dirstate file's parent revision entry. +Returns nil if unable to find this information." + (let ((file (expand-file-name ".bzr/checkout/dirstate" dir))) + (when (file-readable-p file) + (with-temp-buffer + (insert-file-contents file) + (and (looking-at "#bazaar dirstate flat format 3") + (forward-line 3) + (looking-at "[0-9]+\0\\([^\0\n]+\\)\0") + (match-string 1)))))) + (defun emacs-bzr-get-version (&optional dir) - "Try to return as a string the bzr revision number of the Emacs sources. -Value is the bzr revision number and a revision ID separated by a blank. + "Try to return as a string the bzr revision of the Emacs sources. +The format is: [revno] revision_id, where revno may be absent. Value is nil if the sources do not seem to be under bzr, or if we could not determine the revision. Note that this reports on the current state of the sources, which may not correspond to the running Emacs. Optional argument DIR is a directory to use instead of `source-directory'." (or dir (setq dir source-directory)) - (when (file-directory-p (setq dir (expand-file-name ".bzr/branch" dir))) - (let (file loc) + (when (file-directory-p (expand-file-name ".bzr/branch" dir)) + (let (file loc rev) (cond ((file-readable-p - (setq file (expand-file-name "last-revision" dir))) + (setq file (expand-file-name ".bzr/branch/last-revision" dir))) (with-temp-buffer (insert-file-contents file) (goto-char (point-max)) @@ -112,14 +125,26 @@ Optional argument DIR is a directory to use instead of `source-directory'." (buffer-string))) ;; OK, no last-revision. Is it a lightweight checkout? ((file-readable-p - (setq file (expand-file-name "location" dir))) - ;; If the parent branch is local, try looking there for the revid. - (if (setq loc (with-temp-buffer + (setq file (expand-file-name ".bzr/branch/location" dir))) + (setq rev (emacs-bzr-version-dirstate dir)) + ;; If the parent branch is local, try looking there for the rev. + ;; Note: there is no guarantee that the parent branch's rev + ;; corresponds to this branch. This branch could have + ;; been made with a specific -r revno argument, or the + ;; parent could have been updated since this branch was created. + ;; To try and detect this, we check the dirstate revids + ;; to see if they match. + (if (and (setq loc (with-temp-buffer (insert-file-contents file) (if (looking-at "file://\\(.*\\)") (match-string 1)))) - (emacs-bzr-get-version loc))) - ;; Could fall back to eg `bzr testament' at this point. + (equal rev (emacs-bzr-version-dirstate loc))) + (emacs-bzr-get-version loc) + ;; If parent does not match, the best we can do without + ;; calling external commands is to use the dirstate rev. + rev)) + ;; At this point, could fall back to: + ;; bzr version-info --custom --template='{revno} {revision_id}\n' )))) ;; We put version info into the executable in the form that `ident' uses. |
