emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103484: vc-bzr fix for bug#8025.


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103484: vc-bzr fix for bug#8025.
Date: Wed, 02 Mar 2011 22:25:21 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103484
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-03-02 22:25:21 -0800
message:
  vc-bzr fix for bug#8025.
  
  * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
  Handle dirstate entries with no parents.
modified:
  lisp/ChangeLog
  lisp/vc/vc-bzr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-02 08:31:47 +0000
+++ b/lisp/ChangeLog    2011-03-03 06:25:21 +0000
@@ -1,3 +1,8 @@
+2011-03-03  Glenn Morris  <address@hidden>
+
+       * vc/vc-bzr.el (vc-bzr-state-heuristic): Handle dirstate entries
+       with no parents.  (Bug#8025)
+
 2011-03-02  Glenn Morris  <address@hidden>
 
        * man.el (Man-support-local-filenames): Also handle Red Hat's man.

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2011-02-19 21:23:51 +0000
+++ b/lisp/vc/vc-bzr.el 2011-03-03 06:25:21 +0000
@@ -182,10 +182,19 @@
   ;; format 3' in the first line.
   ;; If the `checkout/dirstate' file cannot be parsed, fall back to
   ;; running `vc-bzr-state'."
+  ;;
+  ;; The format of the dirstate file is explained in bzrlib/dirstate.py
+  ;; in the bzr distribution.  Basically:
+  ;; header-line giving the version of the file format in use.
+  ;; a few lines of stuff
+  ;; entries, one per line, with null-separated fields.  Each line:
+  ;; entry_key = dirname (may be empty), basename, file-id
+  ;; current = common ( = kind, fingerprint, size, executable )
+  ;;           + working ( = packed_stat )
+  ;; parent = common ( as above ) + history ( = rev_id )
+  ;; kinds = (r)elocated, (a)bsent, (d)irectory, (f)ile, (l)ink
   (lexical-let ((root (vc-bzr-root file)))
     (when root    ; Short cut.
-      ;; This looks at internal files.  May break if they change
-      ;; their format.
       (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root)))
         (condition-case nil
             (with-temp-buffer
@@ -210,13 +219,14 @@
                                ;; was executable the last time bzr checked?
                                "[^\0]*\0"
                                "[^\0]*\0"       ;?
-                               "\\([^\0]*\\)\0" ;"a/f/d" a=added?
+                               ;; Parent information.  Absent in a new repo.
+                               "\\(?:\\([^\0]*\\)\0" ;"a/f/d" a=added?
                                "\\([^\0]*\\)\0" ;sha1 again?
                                "\\([^\0]*\\)\0" ;size again?
                                ;; y/n.  Whether or not the repo thinks
                                ;; the file should be executable?
                                "\\([^\0]*\\)\0"
-                               "[^\0]*\0" ;last revid?
+                               "[^\0]*\0\\)?" ;last revid?
                                ;; There are more fields when merges are 
pending.
                                )
                        nil t)
@@ -226,7 +236,10 @@
                       ;; conflict markers).
                       (cond
                        ((eq (char-after (match-beginning 1)) ?a) 'removed)
-                       ((eq (char-after (match-beginning 4)) ?a) 'added)
+                       ;; If there is no parent, this must be a new repo.
+                       ;; If file is in dirstate, can only be added (b#8025).
+                       ((or (not (match-beginning 4))
+                            (eq (char-after (match-beginning 4)) ?a)) 'added)
                        ((or (and (eq (string-to-number (match-string 3))
                                  (nth 7 (file-attributes file)))
                                  (equal (match-string 5)


reply via email to

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