unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: Chong Yidong <cyd@gnu.org>
Cc: Ivan Kanis <ivan.kanis@googlemail.com>, 10822@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <m1pqcif5sf.fsf@gmail.com> (raw)
In-Reply-To: <87ty2m29wm.fsf@gnu.org> (Chong Yidong's message of "Sun, 19 Feb 2012 22:08:25 +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
 






  reply	other threads:[~2012-03-12 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  3:04 bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit Leo
2012-02-19 14:08 ` Chong Yidong
2012-03-12 10:54   ` Leo [this message]
2012-03-12 19:17     ` Ivan Kanis
2012-03-12 20:14     ` Stefan Monnier
2012-03-13 10:45       ` Leo
2012-03-14 10:39         ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1pqcif5sf.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=10822@debbugs.gnu.org \
    --cc=cyd@gnu.org \
    --cc=ivan.kanis@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).