summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-09-14 21:11:52 -0400
committerGlenn Morris <rgm@gnu.org>2012-09-14 21:11:52 -0400
commit823751606a90e3850551b43e707d58bbf58033dc (patch)
tree8e874c386bc308a5bc9a0f7c127be619f69a1879
parentfea895b1d20c919021a99d9595248a53bcaff88c (diff)
downloademacs-823751606a90e3850551b43e707d58bbf58033dc.tar.gz
Improve vc-bzr-working-revision for lightweight checkouts
* lisp/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.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc/vc-bzr.el14
2 files changed, 15 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 34c6d981481..c9aa7e99356 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
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
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 ()