unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
@ 2012-02-16  3:04 Leo
  2012-02-19 14:08 ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Leo @ 2012-02-16  3:04 UTC (permalink / raw)
  To: 10822

In a vc-dir buffer with hg backend, hitting `l' (vc-print-log) point is
moved to the first commit in *vc-change-log* buffer. This seems
inconsistent with other backends where point is moved to the newest
commit. I wonder if this is a bug?

Software: Mercurial Distributed SCM (version 2.1)

Leo





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2012-02-19 14:08 UTC (permalink / raw)
  To: Leo; +Cc: 10822

Leo <sdl.web@gmail.com> writes:

> In a vc-dir buffer with hg backend, hitting `l' (vc-print-log) point is
> moved to the first commit in *vc-change-log* buffer. This seems
> inconsistent with other backends where point is moved to the newest
> commit. I wonder if this is a bug?
>
> Software: Mercurial Distributed SCM (version 2.1)

We might as well make it consistent.  Patch welcome.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  2012-02-19 14:08 ` Chong Yidong
@ 2012-03-12 10:54   ` Leo
  2012-03-12 19:17     ` Ivan Kanis
  2012-03-12 20:14     ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Leo @ 2012-03-12 10:54 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Ivan Kanis, 10822

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
 






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  2012-03-12 10:54   ` Leo
@ 2012-03-12 19:17     ` Ivan Kanis
  2012-03-12 20:14     ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Ivan Kanis @ 2012-03-12 19:17 UTC (permalink / raw)
  To: Leo; +Cc: Chong Yidong, 10822

Leo <sdl.web@gmail.com> wrote:

> 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.

Hi,

I haven't touched vc-hg for many years, I can't comment on the patch.
Try someone who's touched the code recently...

Take care,
-- 
Ivan Kanis
http://kanis.fr

A lie gets halfway around the world before the truth has a chance to
get its pants on.
    -- Winston Churchill





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  2012-03-12 10:54   ` Leo
  2012-03-12 19:17     ` Ivan Kanis
@ 2012-03-12 20:14     ` Stefan Monnier
  2012-03-13 10:45       ` Leo
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2012-03-12 20:14 UTC (permalink / raw)
  To: Leo; +Cc: Chong Yidong, Ivan Kanis, 10822

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

It looks good, from the point of view of someone who doesn't use
vc-hg.el (nor Mercurial).  The only doubt I have is whether the
ignore-errors is sufficient to handle all the possible problems.


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  2012-03-12 20:14     ` Stefan Monnier
@ 2012-03-13 10:45       ` Leo
  2012-03-14 10:39         ` Leo
  0 siblings, 1 reply; 7+ messages in thread
From: Leo @ 2012-03-13 10:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, Ivan Kanis, 10822

On 2012-03-13 04:14 +0800, Stefan Monnier wrote:
> It looks good, from the point of view of someone who doesn't use
> vc-hg.el (nor Mercurial).  The only doubt I have is whether the
> ignore-errors is sufficient to handle all the possible problems.

I personally don't use hg much except some python packages I am
interested are using it.

I have checked in the patch (revision 107598) for more testing.

Leo 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#10822: 23.4; `l' in vc-dir with hg backend moves to the first commit
  2012-03-13 10:45       ` Leo
@ 2012-03-14 10:39         ` Leo
  0 siblings, 0 replies; 7+ messages in thread
From: Leo @ 2012-03-14 10:39 UTC (permalink / raw)
  To: 10822-done

Fixed in 24.0.95





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-14 10:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).