all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] vc-hg keep working when hg emits warnings
@ 2010-08-01 16:35 Sascha Wilde
  2010-08-04 17:02 ` Dan Nicolaescu
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Wilde @ 2010-08-01 16:35 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Hi *,

related to my latest post (regarding hgrc handling):

When one works on an hg repository with an .hg/hgrc owned by someone
else, hg emits a warning like:

Not trusting file /home/foo/argh/.hg/hgrc from untrusted user foo, group foo

on stderr.[1]

Despite the warning hg still works as expected (ignoring the
repositories hgrc).  So ignoring the warning is TRTTD for Emacs.
Currently the warning text confuses vc, so that certain commands and the
revision display in the status bare don't work correctly.

The following patch achieves this by simply ignoring all output on
stderr for vc-hg-state and vc-hg-working-revision.

This might seem a little brute force, but its the most simple solution
and I believe it should be free of unwanted side effects:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-vc-hg-ignore-stderr.patch --]
[-- Type: text/x-patch, Size: 1541 bytes --]

changeset:   109608:f8818ac3a2df
branch:      wilde
tag:         tip
user:        Sascha Wilde <wilde@sha-bang.de>
date:        Sun Aug 01 18:18:35 2010 +0200
files:       lisp/ChangeLog lisp/vc/vc-hg.el
description:
Ignore warnings by hg.


diff -r 955b39955186 -r f8818ac3a2df lisp/ChangeLog
--- a/lisp/ChangeLog	Sun Aug 01 17:27:24 2010 +0200
+++ b/lisp/ChangeLog	Sun Aug 01 18:18:35 2010 +0200
@@ -3,6 +3,10 @@
 	* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision): Replaced
 	setting HGRCPATH to "" by some less invasive --config options.
 
+	* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision): Ignore output
+	on stderr to work even when hg emits any warnings.
+
+
 2010-08-01  Chong Yidong  <cyd@stupidchicken.com>
 
 	* emacs-lisp/package.el (package--list-packages): Fix column
diff -r 955b39955186 -r f8818ac3a2df lisp/vc/vc-hg.el
--- a/lisp/vc/vc-hg.el	Sun Aug 01 17:27:24 2010 +0200
+++ b/lisp/vc/vc-hg.el	Sun Aug 01 18:18:35 2010 +0200
@@ -173,7 +173,7 @@
 			     (append (list "TERM=dumb" "LANGUAGE=C")
 				     process-environment)))
 			(process-file
-			 "hg" nil t nil
+			 "hg" nil '(t nil) nil
 			 "--config" "alias.status=status"
 			 "--config" "defaults.status="
 			 "status" "-A" (file-relative-name file)))
@@ -211,7 +211,7 @@
 		      (let ((process-environment avoid-local-env))
 			;; Ignore all errors.
 			(process-file
-			 "hg" nil t nil
+			 "hg" nil '(t nil) nil
 			 "--config" "alias.parents=parents"
 			 "--config" "defaults.parents="
 			 "parents" "--template" "{rev}" (file-relative-name file)))


[-- Attachment #3: Type: text/plain, Size: 367 bytes --]


cheers
sascha

[1]  This is true, unless the user of hg "trusts" the owner of the hgrc
     file -- which is the case handled by the patch in my other post...
-- 
Sascha Wilde
Hauptfunktion einer GUI ist es IMHO, die dadurch verlorene Zeit durch
einen höheren Spaß-Faktor zu kompensieren. Essentiell ein
Computerspiel.  --  Rainer Weikusat in d.c.o.u.d

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

* Re: [PATCH] vc-hg keep working when hg emits warnings
  2010-08-01 16:35 [PATCH] vc-hg keep working when hg emits warnings Sascha Wilde
@ 2010-08-04 17:02 ` Dan Nicolaescu
  2010-08-04 17:16   ` Sascha Wilde
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nicolaescu @ 2010-08-04 17:02 UTC (permalink / raw)
  To: Sascha Wilde; +Cc: emacs-devel

Sascha Wilde <wilde@sha-bang.de> writes:

> Hi *,
>
> related to my latest post (regarding hgrc handling):

BTW, better send patches to bug-gnu-emacs, they won't get lost that way.

> When one works on an hg repository with an .hg/hgrc owned by someone
> else, hg emits a warning like:
>
> Not trusting file /home/foo/argh/.hg/hgrc from untrusted user foo, group foo
>
> on stderr.[1]
>
> Despite the warning hg still works as expected (ignoring the
> repositories hgrc).  So ignoring the warning is TRTTD for Emacs.
> Currently the warning text confuses vc, so that certain commands and the
> revision display in the status bare don't work correctly.
>
> The following patch achieves this by simply ignoring all output on
> stderr for vc-hg-state and vc-hg-working-revision.
>
> This might seem a little brute force, but its the most simple solution
> and I believe it should be free of unwanted side effects:

IMHO this is not good, there might be other reasons for hg to give
warnings, and the user would have no way to find out about it.

Is there a command line flag to turn off this warning?

A more robust option would be to change the parser to deal with the warning...



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

* Re: [PATCH] vc-hg keep working when hg emits warnings
  2010-08-04 17:02 ` Dan Nicolaescu
@ 2010-08-04 17:16   ` Sascha Wilde
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Wilde @ 2010-08-04 17:16 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@gnu.org> wrote:
> Sascha Wilde <wilde@sha-bang.de> writes:
>> Not trusting file /home/foo/argh/.hg/hgrc from untrusted user foo, group foo
>>
>> on stderr.[1]
>>
>> Despite the warning hg still works as expected (ignoring the
>> repositories hgrc).  So ignoring the warning is TRTTD for Emacs.
>> Currently the warning text confuses vc, so that certain commands and the
>> revision display in the status bare don't work correctly.
>>
>> The following patch achieves this by simply ignoring all output on
>> stderr for vc-hg-state and vc-hg-working-revision.
>>
>> This might seem a little brute force, but its the most simple solution
>> and I believe it should be free of unwanted side effects:
>
> IMHO this is not good, there might be other reasons for hg to give
> warnings, and the user would have no way to find out about it.

As there currently is no handling of warning or error messages at all,
the user has no sensible way to find out about them at the moment.
Reading parts of there messages (the whole wont fit in most cases) in
the place of the revision number in the status bar is no "solution"
worth keeping IMO.

> Is there a command line flag to turn off this warning?

Unfortunately, no.  This was my thirst idea, too...

> A more robust option would be to change the parser to deal with the warning...

I fully agree.  But until this is implemented I still think that my
simple patch provides an improvement over the current situation.  As
currently vc-hg stops working in a perfectly regular situation.

cheers
sascha
-- 
Sascha Wilde : "Der Nicht-Denkende glaubt, dass niemand denkt,
             : der Denkende weiss es!"
             : (Gabriel Laub)



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-01 16:35 [PATCH] vc-hg keep working when hg emits warnings Sascha Wilde
2010-08-04 17:02 ` Dan Nicolaescu
2010-08-04 17:16   ` Sascha Wilde

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.