all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5961: 23.1 regression: vc-hg does not show 0 version number for 'added files
@ 2010-04-16 20:06 Dan Nicolaescu
  2010-04-17  0:30 ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nicolaescu @ 2010-04-16 20:06 UTC (permalink / raw)
  To: 5961


After this change:

  Show working revision correctly for mercurial.
  * vc-hg.el (vc-hg-working-revision): Use hg parent instead of
  hg log as suggested by Alex Harsanyi <alexharsanyi@gmail.com>,


the mode-line show Hg@ instead of Hg@0 for files in the VC 'added state.  This is a regression from 23.1.

The problem is that the "hg parent " command does not distinguish
between the 'added and 'unregistered files.

Should the patch below go into the 23.2 branch?

=== modified file 'lisp/vc-hg.el'
--- lisp/vc-hg.el	2010-04-07 05:56:35 +0000
+++ lisp/vc-hg.el	2010-04-16 19:36:29 +0000
@@ -196,16 +196,16 @@ If nil, use the value of `vc-diff-switch
   (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,21 @@ If nil, use the value of `vc-diff-switch
                     ;; 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))
+		  ;; Ignore all errors.
+		  (process-file
+		   "hg" nil nil nil
+		   "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
 








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

* bug#5961: 23.1 regression: vc-hg does not show 0 version number for 'added files
  2010-04-16 20:06 bug#5961: 23.1 regression: vc-hg does not show 0 version number for 'added files Dan Nicolaescu
@ 2010-04-17  0:30 ` Chong Yidong
  2010-04-17 16:10   ` Dan Nicolaescu
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2010-04-17  0:30 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 5961

Dan Nicolaescu <dann@gnu.org> writes:

> After this change:
>
>   Show working revision correctly for mercurial.
>   * vc-hg.el (vc-hg-working-revision): Use hg parent instead of
>   hg log as suggested by Alex Harsanyi <alexharsanyi@gmail.com>,
>
> the mode-line show Hg@ instead of Hg@0 for files in the VC 'added
> state.  This is a regression from 23.1.
>
> The problem is that the "hg parent " command does not distinguish
> between the 'added and 'unregistered files.
>
> Should the patch below go into the 23.2 branch?

Yes please.  I don't have hg installed at the moment, so it's
inconvenient for me to double check your work, but if you're confident
it's correct then please go ahead and commit it.

Thanks.






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

* bug#5961: 23.1 regression: vc-hg does not show 0 version number for 'added files
  2010-04-17  0:30 ` Chong Yidong
@ 2010-04-17 16:10   ` Dan Nicolaescu
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Nicolaescu @ 2010-04-17 16:10 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 5961-done

Chong Yidong <cyd@stupidchicken.com> writes:

> Dan Nicolaescu <dann@gnu.org> writes:
>
>> After this change:
>>
>>   Show working revision correctly for mercurial.
>>   * vc-hg.el (vc-hg-working-revision): Use hg parent instead of
>>   hg log as suggested by Alex Harsanyi <alexharsanyi@gmail.com>,
>>
>> the mode-line show Hg@ instead of Hg@0 for files in the VC 'added
>> state.  This is a regression from 23.1.
>>
>> The problem is that the "hg parent " command does not distinguish
>> between the 'added and 'unregistered files.
>>
>> Should the patch below go into the 23.2 branch?
>
> Yes please.  I don't have hg installed at the moment, so it's
> inconvenient for me to double check your work, but if you're confident
> it's correct then please go ahead and commit it.

Thanks, done.






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

end of thread, other threads:[~2010-04-17 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16 20:06 bug#5961: 23.1 regression: vc-hg does not show 0 version number for 'added files Dan Nicolaescu
2010-04-17  0:30 ` Chong Yidong
2010-04-17 16:10   ` Dan Nicolaescu

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.