[PATCH] ui: refactor and introduce editfile

Brodie Rao brodie at bitheap.org
Mon Aug 30 20:33:29 CDT 2010


On Aug 30, 2010, at 8:21 AM, Mads Kiilerich wrote:

> On 08/28/2010 04:39 PM, Brodie Rao wrote:
>> What if I want to call ui.editfile() even though there's no  
>> configured
>> username? What should I pass?
>
> Existing uses of ui.edit just passes ui.username() as default.

Yeah, I'm just saying that calling ui.username() in editconfig isn't  
really helpful because it'll raise util.Abort if it's not configured.  
So I'm not sure if I should catch that exception and pass '' instead.  
Or maybe editfile should make username optional and only set it in  
environ if it's not None?

>> Also, it'd be nice if it were documented that HGUSER is available  
>> to the
>> editor. I see at one point long ago it was used in hgeditor when
>> invoking gpg, but it no longer uses it.
>
> I have never understood why it is there. Do you see any usecases?
>
> (A forensic analysis shows that it got started by http://osdir.com/ml/version-control.mercurial.devel/2005-07/msg00466.html 
>  / http://mercurial.selenic.com/hg/hg/rev/b55a78595ef6 to combine http://mercurial.selenic.com/hg/hg/rev/9a2075c0b9b8#l1.22 
>  with http://mercurial.selenic.com/hg/hg/rev/d2994b5298fb )
>
> Removing the last traces of HGUSER will remove some "non-obvious"  
> code and clean up some strange dependencies. Considering that it is  
> undocumented and probably unused I think it could have been removed  
> 5 years ago with http://mercurial.selenic.com/hg/hg/rev/ 
> f93fde8f5027 . I still think it would be a good idea, but it will  
> probably require approval from the committee for backward  
> compatibility.

I guess it would be a backward incompatible change were it removed.  
But is it any different from doing "hg showconfig ui.username" in the  
editor script? Maybe this can be documented as an alternative in the  
release notes for 1.7 if we remove setting HGUSER.


More information about the Mercurial-devel mailing list