Commit 2793b89e authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case

of any kind of error (e.g. when "sha1sum" is not found).
parent d3b396e4
2009-05-17 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-bzr.el (vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
of any kind of error (e.g. when "sha1sum" is not found).
2009-05-15 Martin Rudalics <rudalics@gmx.at>
 
* dired.el (dired-pop-to-buffer): Try to make this behave the
......@@ -434,11 +439,11 @@
 
2009-04-07 Chong Yidong <cyd@stupidchicken.com>
 
* vc-bzr.el (vc-bzr-log-view-mode): Tweak
log-view-message-re (Bug#2872).
* vc-bzr.el (vc-bzr-log-view-mode):
Tweak log-view-message-re (Bug#2872).
 
* descr-text.el (describe-property-list, describe-char): Add
follow-link properties to buttons that need them.
* descr-text.el (describe-property-list, describe-char):
Add follow-link properties to buttons that need them.
 
* tooltip.el (tooltip-show-help-non-mode): Don't save the last
message if it was also a help message (Bug#2895).
......@@ -446,8 +451,7 @@
2009-04-06 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
 
* textmodes/bibtex.el (bibtex-format-entry)
(bibtex-search-crossref): Allow OPT prefix for name of crossref
field.
(bibtex-search-crossref): Allow OPT prefix for name of crossref field.
 
2009-04-06 Sam Steingold <sds@gnu.org>
 
......
......@@ -143,7 +143,7 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and
(defun vc-bzr-state-heuristic (file)
"Like `vc-bzr-state' but hopefully without running Bzr."
;; `bzr status' is excrutiatingly slow with large histories and
;; `bzr status' was excrutiatingly slow with large histories and
;; pending merges, so try to avoid using it until they fix their
;; performance problems.
;; This function tries first to parse Bzr internal file
......@@ -158,50 +158,55 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and
;; This looks at internal files. May break if they change
;; their format.
(lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root)))
(if (not (file-readable-p dirstate))
(vc-bzr-state file) ; Expensive.
(with-temp-buffer
(insert-file-contents dirstate)
(goto-char (point-min))
(if (not (looking-at "#bazaar dirstate flat format 3"))
(vc-bzr-state file) ; Some other unknown format?
(let* ((relfile (file-relative-name file root))
(reldir (file-name-directory relfile)))
(if (re-search-forward
(concat "^\0"
(if reldir (regexp-quote
(directory-file-name reldir)))
"\0"
(regexp-quote (file-name-nondirectory relfile))
"\0"
"[^\0]*\0" ;id?
"\\([^\0]*\\)\0" ;"a/f/d", a=removed?
"[^\0]*\0" ;sha1 (empty if conflicted)?
"\\([^\0]*\\)\0" ;size?
"[^\0]*\0" ;"y/n", executable?
"[^\0]*\0" ;?
"\\([^\0]*\\)\0" ;"a/f/d" a=added?
"\\([^\0]*\\)\0" ;sha1 again?
"[^\0]*\0" ;size again?
"[^\0]*\0" ;"y/n", executable again?
"[^\0]*\0" ;last revid?
;; There are more fields when merges are pending.
)
nil t)
;; Apparently the second sha1 is the one we want: when
;; there's a conflict, the first sha1 is absent (and the
;; first size seems to correspond to the file with
;; conflict markers).
(cond
((eq (char-after (match-beginning 1)) ?a) 'removed)
((eq (char-after (match-beginning 3)) ?a) 'added)
((and (eq (string-to-number (match-string 2))
(nth 7 (file-attributes file)))
(equal (match-string 4)
(vc-bzr-sha1 file)))
'up-to-date)
(t 'edited))
'unregistered)))))))))
(condition-case nil
(with-temp-buffer
(insert-file-contents dirstate)
(goto-char (point-min))
(if (not (looking-at "#bazaar dirstate flat format 3"))
(vc-bzr-state file) ; Some other unknown format?
(let* ((relfile (file-relative-name file root))
(reldir (file-name-directory relfile)))
(if (re-search-forward
(concat "^\0"
(if reldir (regexp-quote
(directory-file-name reldir)))
"\0"
(regexp-quote (file-name-nondirectory relfile))
"\0"
"[^\0]*\0" ;id?
"\\([^\0]*\\)\0" ;"a/f/d", a=removed?
"[^\0]*\0" ;sha1 (empty if conflicted)?
"\\([^\0]*\\)\0" ;size?
"[^\0]*\0" ;"y/n", executable?
"[^\0]*\0" ;?
"\\([^\0]*\\)\0" ;"a/f/d" a=added?
"\\([^\0]*\\)\0" ;sha1 again?
"[^\0]*\0" ;size again?
"[^\0]*\0" ;"y/n", executable again?
"[^\0]*\0" ;last revid?
;; There are more fields when merges are pending.
)
nil t)
;; Apparently the second sha1 is the one we want: when
;; there's a conflict, the first sha1 is absent (and the
;; first size seems to correspond to the file with
;; conflict markers).
(cond
((eq (char-after (match-beginning 1)) ?a) 'removed)
((eq (char-after (match-beginning 3)) ?a) 'added)
((and (eq (string-to-number (match-string 2))
(nth 7 (file-attributes file)))
(equal (match-string 4)
(vc-bzr-sha1 file)))
'up-to-date)
(t 'edited))
'unregistered))))
;; Either the dirstate file can't be read, or the sha1
;; executable is missing, or ...
;; In either case, recent versions of Bzr aren't that slow
;; any more.
(error (vc-bzr-state file)))))))
(defun vc-bzr-registered (file)
"Return non-nil if FILE is registered with bzr."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment