emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110034: Improve vc-bzr-working-revis


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110034: Improve vc-bzr-working-revision for lightweight checkouts
Date: Fri, 14 Sep 2012 21:11:52 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110034
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2012-09-14 21:11:52 -0400
message:
  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.
modified:
  lisp/ChangeLog
  lisp/vc/vc-bzr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-15 00:33:40 +0000
+++ b/lisp/ChangeLog    2012-09-15 01:11:52 +0000
@@ -1,5 +1,10 @@
 2012-09-15  Glenn Morris  <address@hidden>
 
+       * 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

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2012-07-19 14:38:01 +0000
+++ b/lisp/vc/vc-bzr.el 2012-09-15 01:11:52 +0000
@@ -534,7 +534,9 @@
                         ;; 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 @@
             (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 ()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]