aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-09-14 21:11:52 -0400
committerGlenn Morris2012-09-14 21:11:52 -0400
commit823751606a90e3850551b43e707d58bbf58033dc (patch)
tree8e874c386bc308a5bc9a0f7c127be619f69a1879
parentfea895b1d20c919021a99d9595248a53bcaff88c (diff)
downloademacs-823751606a90e3850551b43e707d58bbf58033dc.tar.gz
emacs-823751606a90e3850551b43e707d58bbf58033dc.zip
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 @@
12012-09-15 Glenn Morris <rgm@gnu.org> 12012-09-15 Glenn Morris <rgm@gnu.org>
2 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
3 * version.el (emacs-bzr-version): Doc fix. 8 * version.el (emacs-bzr-version): Doc fix.
4 (emacs-bzr-version-dirstate): New function. 9 (emacs-bzr-version-dirstate): New function.
5 (emacs-bzr-get-version): For lightweight checkouts, if the parent 10 (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)."
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 ()