emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107598: * lisp/vc/vc-hg.el (vc-hg-wo


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107598: * lisp/vc/vc-hg.el (vc-hg-working-revision): Rework to work with both
Date: Tue, 13 Mar 2012 18:40:29 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107598
fixes bug(s): http://debbugs.gnu.org/10822
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Tue 2012-03-13 18:40:29 +0800
message:
  * lisp/vc/vc-hg.el (vc-hg-working-revision): Rework to work with both
  directory and file as argument.
modified:
  lisp/ChangeLog
  lisp/vc/vc-hg.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-13 07:07:10 +0000
+++ b/lisp/ChangeLog    2012-03-13 10:40:29 +0000
@@ -1,3 +1,8 @@
+2012-03-13  Leo Liu  <address@hidden>
+
+       * vc/vc-hg.el (vc-hg-working-revision): Rework to work with both
+       directory and file as argument (Bug#10822).
+
 2012-03-13  Kaushik Srenevasan  <address@hidden>  (tiny change)
 
        * progmodes/gdb-mi.el (gdb-invalidate-disassembly):

=== modified file 'lisp/vc/vc-hg.el'
--- a/lisp/vc/vc-hg.el  2012-02-25 04:29:09 +0000
+++ b/lisp/vc/vc-hg.el  2012-03-13 10:40:29 +0000
@@ -226,45 +226,14 @@
 
 (defun vc-hg-working-revision (file)
   "Hg-specific version of `vc-working-revision'."
-  (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")
-                                    process-environment))
-       (out
-        (with-output-to-string
-          (with-current-buffer
-              standard-output
-            (setq status
-                  (condition-case nil
-                     (let ((process-environment avoid-local-env))
-                       ;; Ignore all errors.
-                       (process-file
-                        vc-hg-program nil t nil
-                        "--config" "alias.parents=parents"
-                        "--config" "defaults.parents="
-                        "parents" "--template" "{rev}" (file-relative-name 
file)))
-                    ;; Some problem happened.  E.g. We can't find an `hg'
-                    ;; executable.
-                    (error nil)))))))
-    (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
-                  vc-hg-program 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"))))
+  (let ((default-directory (if (file-directory-p file)
+                               (file-name-as-directory file)
+                             (file-name-directory file))))
+    (ignore-errors
+      (with-output-to-string
+        (process-file vc-hg-program nil standard-output nil
+                      "log" "-l" "1" "--template" "{rev}"
+                      (file-relative-name file))))))
 
 ;;; History functions
 


reply via email to

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