[PATCH] commands: add an option to display only the full id with 'hg id'

Matt Harbison mharbison72 at gmail.com
Mon Nov 23 20:32:32 CST 2015


On Mon, 23 Nov 2015 00:13:27 -0500, Pierre-Yves David  
<pierre-yves.david at ens-lyon.org> wrote:

>
>
> On 11/22/2015 08:08 AM, Yuya Nishihara wrote:
>> On Sun, 22 Nov 2015 09:24:38 +0100, Mathias De Maré wrote:
>>> On Fri, Nov 20, 2015 at 4:09 AM, Pierre-Yves David <
>>> pierre-yves.david at ens-lyon.org> wrote:
>>>> On 11/19/2015 06:51 AM, Mathias De Maré wrote:
>>>>> On Thu, Nov 19, 2015 at 3:36 PM, Yuya Nishihara <yuya at tcha.org
>>>>>      I don't think --full is intuitive because it does two things,  
>>>>> select
>>>>>      --id
>>>>>      and enable full hash. Perhaps we should avoid bloating  
>>>>> formatting
>>>>>      options by
>>>>>      -T template.
>>>>>
>>>>> I thought it would be useful to have a single option for this. The
>>>>> templating makes it less obvious for an average user.
>>>>> I could change '--full' so it enables the full hash, but does not  
>>>>> select
>>>>> --id.
>>>>>
>>>>
>>>> I'm in favor of keeping this at the templating level.
>>>>
>>> Would this be the full templating system also used for log?
>>> Just to clarify (since this will make 'hg id' a lot more advanced).
>>
>> It will use ui.formatter(), but I think it won't be simple.
>
> I'm thinking about pointing people from `hg id -r x --debug`
> to `hg log -T {node} -r x`
>
> We probably can't really introduces templater support for `hg id`. This  
> is one of this antediluvian command with a strange contract. `hg id` can  
> be used on a remote repository (to know the hash of various name there).  
> In the remote case we do not have any infrastructure to build changectx  
> and feed them to the templater.
>
> (Well we could make stuff work for the local case, but meh)
>
> Pointing at hg log -T and hg summary is probably a better experience for  
> current `hg id` user.

The only thing I missed using log instead of id is the '+' when dirty.   
Yuya's workaround [1] was good enough for me because it was scripted and  
forgotten about, but it's definitely way more obscure than `hg id -i  
--debug`.  I had a patch for a dirty keyword [2], but that obviously only  
applies to wdir(), so it wasn't taken.

[1] https://selenic.com/pipermail/mercurial-devel/2015-June/071588.html
[2] https://selenic.com/pipermail/mercurial-devel/2015-June/071472.html


More information about the Mercurial-devel mailing list