emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99756: Fix the version number for


From: Dan Nicolaescu
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99756: Fix the version number for added files.
Date: Sat, 17 Apr 2010 09:10:19 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99756
committer: Dan Nicolaescu <address@hidden>
branch nick: emacs-23
timestamp: Sat 2010-04-17 09:10:19 -0700
message:
  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).
modified:
  lisp/ChangeLog
  lisp/vc-hg.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-17 02:07:48 +0000
+++ b/lisp/ChangeLog    2010-04-17 16:10:19 +0000
@@ -1,3 +1,9 @@
+2010-04-17  Dan Nicolaescu  <address@hidden>
+
+       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  <address@hidden>
 
        * htmlfontify.el (htmlfontify-buffer)

=== modified file 'lisp/vc-hg.el'
--- a/lisp/vc-hg.el     2010-04-17 00:28:19 +0000
+++ b/lisp/vc-hg.el     2010-04-17 16:10:19 +0000
@@ -196,16 +196,16 @@
   (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 @@
                     ;; 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
 


reply via email to

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