GNU bug report logs - #10822
23.4; `l' in vc-dir with hg backend moves to the first commit

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Thu, 16 Feb 2012 03:10:02 UTC

Severity: minor

Found in version 23.4

Done: Leo <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 10822 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Chong Yidong <cyd <at> gnu.org>
Cc: Ivan Kanis <ivan.kanis <at> googlemail.com>, 10822 <at> debbugs.gnu.org
Subject: Re: bug#10822: 23.4;
	`l' in vc-dir with hg backend moves to the first commit
Date: Mon, 12 Mar 2012 18:54:40 +0800
On 2012-02-19 22:08 +0800, Chong Yidong wrote:
> We might as well make it consistent.  Patch welcome.

It turns out the bug I am seeing is due to the broken
vc-hg-working-revision.

I intend to install the following fix in the next few days. Could you
comment on the this patch? Thanks.

=== modified file 'lisp/vc/vc-hg.el'
--- lisp/vc/vc-hg.el	2012-02-25 04:29:09 +0000
+++ lisp/vc/vc-hg.el	2012-03-12 10:47:55 +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))))
+    (with-output-to-string
+      (ignore-errors
+        (process-file vc-hg-program nil standard-output nil
+                      "log" "-l" "1" "--template" "{rev}"
+                      (file-relative-name file))))))
 
 ;;; History functions
 





This bug report was last modified 13 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.