diff options
| author | Glenn Morris | 2011-03-02 22:25:21 -0800 |
|---|---|---|
| committer | Glenn Morris | 2011-03-02 22:25:21 -0800 |
| commit | f96dc50fc0abc28c244a4095ca4d825e16a93eff (patch) | |
| tree | 60f08d5a7c3ba7bddc58af5fa09c18ec5a61ea1d /lisp | |
| parent | 5aef9e9a95ba8ce1a91e004cea845c43917c3a56 (diff) | |
| download | emacs-f96dc50fc0abc28c244a4095ca4d825e16a93eff.tar.gz emacs-f96dc50fc0abc28c244a4095ca4d825e16a93eff.zip | |
vc-bzr fix for bug#8025.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Handle dirstate entries with no parents.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc/vc-bzr.el | 23 |
2 files changed, 23 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c91a30df54..fe4847614c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-03-03 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * vc/vc-bzr.el (vc-bzr-state-heuristic): Handle dirstate entries | ||
| 4 | with no parents. (Bug#8025) | ||
| 5 | |||
| 1 | 2011-03-02 Glenn Morris <rgm@gnu.org> | 6 | 2011-03-02 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * man.el (Man-support-local-filenames): Also handle Red Hat's man. | 8 | * man.el (Man-support-local-filenames): Also handle Red Hat's man. |
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 5e6e054924c..99b70b06882 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el | |||
| @@ -182,10 +182,19 @@ in the repository root directory of FILE." | |||
| 182 | ;; format 3' in the first line. | 182 | ;; format 3' in the first line. |
| 183 | ;; If the `checkout/dirstate' file cannot be parsed, fall back to | 183 | ;; If the `checkout/dirstate' file cannot be parsed, fall back to |
| 184 | ;; running `vc-bzr-state'." | 184 | ;; running `vc-bzr-state'." |
| 185 | ;; | ||
| 186 | ;; The format of the dirstate file is explained in bzrlib/dirstate.py | ||
| 187 | ;; in the bzr distribution. Basically: | ||
| 188 | ;; header-line giving the version of the file format in use. | ||
| 189 | ;; a few lines of stuff | ||
| 190 | ;; entries, one per line, with null-separated fields. Each line: | ||
| 191 | ;; entry_key = dirname (may be empty), basename, file-id | ||
| 192 | ;; current = common ( = kind, fingerprint, size, executable ) | ||
| 193 | ;; + working ( = packed_stat ) | ||
| 194 | ;; parent = common ( as above ) + history ( = rev_id ) | ||
| 195 | ;; kinds = (r)elocated, (a)bsent, (d)irectory, (f)ile, (l)ink | ||
| 185 | (lexical-let ((root (vc-bzr-root file))) | 196 | (lexical-let ((root (vc-bzr-root file))) |
| 186 | (when root ; Short cut. | 197 | (when root ; Short cut. |
| 187 | ;; This looks at internal files. May break if they change | ||
| 188 | ;; their format. | ||
| 189 | (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) | 198 | (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) |
| 190 | (condition-case nil | 199 | (condition-case nil |
| 191 | (with-temp-buffer | 200 | (with-temp-buffer |
| @@ -210,13 +219,14 @@ in the repository root directory of FILE." | |||
| 210 | ;; was executable the last time bzr checked? | 219 | ;; was executable the last time bzr checked? |
| 211 | "[^\0]*\0" | 220 | "[^\0]*\0" |
| 212 | "[^\0]*\0" ;? | 221 | "[^\0]*\0" ;? |
| 213 | "\\([^\0]*\\)\0" ;"a/f/d" a=added? | 222 | ;; Parent information. Absent in a new repo. |
| 223 | "\\(?:\\([^\0]*\\)\0" ;"a/f/d" a=added? | ||
| 214 | "\\([^\0]*\\)\0" ;sha1 again? | 224 | "\\([^\0]*\\)\0" ;sha1 again? |
| 215 | "\\([^\0]*\\)\0" ;size again? | 225 | "\\([^\0]*\\)\0" ;size again? |
| 216 | ;; y/n. Whether or not the repo thinks | 226 | ;; y/n. Whether or not the repo thinks |
| 217 | ;; the file should be executable? | 227 | ;; the file should be executable? |
| 218 | "\\([^\0]*\\)\0" | 228 | "\\([^\0]*\\)\0" |
| 219 | "[^\0]*\0" ;last revid? | 229 | "[^\0]*\0\\)?" ;last revid? |
| 220 | ;; There are more fields when merges are pending. | 230 | ;; There are more fields when merges are pending. |
| 221 | ) | 231 | ) |
| 222 | nil t) | 232 | nil t) |
| @@ -226,7 +236,10 @@ in the repository root directory of FILE." | |||
| 226 | ;; conflict markers). | 236 | ;; conflict markers). |
| 227 | (cond | 237 | (cond |
| 228 | ((eq (char-after (match-beginning 1)) ?a) 'removed) | 238 | ((eq (char-after (match-beginning 1)) ?a) 'removed) |
| 229 | ((eq (char-after (match-beginning 4)) ?a) 'added) | 239 | ;; If there is no parent, this must be a new repo. |
| 240 | ;; If file is in dirstate, can only be added (b#8025). | ||
| 241 | ((or (not (match-beginning 4)) | ||
| 242 | (eq (char-after (match-beginning 4)) ?a)) 'added) | ||
| 230 | ((or (and (eq (string-to-number (match-string 3)) | 243 | ((or (and (eq (string-to-number (match-string 3)) |
| 231 | (nth 7 (file-attributes file))) | 244 | (nth 7 (file-attributes file))) |
| 232 | (equal (match-string 5) | 245 | (equal (match-string 5) |