diff options
author | Dan Nicolaescu <dann@ics.uci.edu> | 2010-04-17 09:10:19 -0700 |
---|---|---|
committer | Dan Nicolaescu <dann@ics.uci.edu> | 2010-04-17 09:10:19 -0700 |
commit | bce318302431190bd0f20507da1b03808f0599d8 (patch) | |
tree | f8d4503d01f6318d29f50219fbfb9b78ec8216cc | |
parent | 0433ffa6c7921dbcc7fa7f7b9542586a1597bc53 (diff) | |
download | emacs-bce318302431190bd0f20507da1b03808f0599d8.tar.gz |
Fix the version number for added files.
* vc-hg.el (vc-hg-working-revision): Check if the file is
registered after hg parent fails (Bug#5961).
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/vc-hg.el | 26 |
2 files changed, 27 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1cba0e853b4..a337f8f5a8c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-04-17 Dan Nicolaescu <dann@ics.uci.edu> + + Fix the version number for added files. + * vc-hg.el (vc-hg-working-revision): Check if the file is + registered after hg parent fails (Bug#5961). + 2010-04-17 Glenn Morris <rgm@gnu.org> * htmlfontify.el (htmlfontify-buffer) diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index ca83b7edf2f..2438da63670 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el @@ -196,16 +196,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (let* ((status nil) (default-directory (file-name-directory file)) + ;; Avoid localization of messages so we can parse the output. + (avoid-local-env (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") + process-environment)) (out (with-output-to-string (with-current-buffer standard-output (setq status (condition-case nil - (let ((process-environment - ;; Avoid localization of messages so we can parse the output. - (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") - process-environment))) + (let ((process-environment avoid-local-env)) ;; Ignore all errors. (process-file "hg" nil t nil @@ -213,7 +213,23 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." ;; Some problem happened. E.g. We can't find an `hg' ;; executable. (error nil))))))) - (when (eq 0 status) out))) + (if (eq 0 status) + out + ;; Check if the file is in the 'added state, the above hg + ;; command does not distinguish between 'added and 'unregistered. + (setq status + (condition-case nil + (let ((process-environment avoid-local-env)) + (process-file + "hg" nil nil nil + ;; We use "log" here, if there's a faster command + ;; that returns true for an 'added file and false + ;; for an 'unregistered one, we could use that. + "log" "-l1" (file-relative-name file))) + ;; Some problem happened. E.g. We can't find an `hg' + ;; executable. + (error nil))) + (when (eq 0 status) "0")))) ;;; History functions |