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

Augie Fackler raf at durin42.com
Thu Nov 19 08:58:02 CST 2015


On Thu, Nov 19, 2015 at 9:51 AM, Mathias De Maré
<mathias.demare at gmail.com> wrote:
>
> On Thu, Nov 19, 2015 at 3:36 PM, Yuya Nishihara <yuya at tcha.org> wrote:
>>
>> On Thu, 19 Nov 2015 07:58:16 -0600, Mathias De Maré wrote:
>> > # HG changeset patch
>> > # User Mathias De Maré <mathias.demare at gmail.com>
>> > # Date 1447866343 -3600
>> > #      Wed Nov 18 18:05:43 2015 +0100
>> > # Node ID afb732f543249e09acfd0438747223fbf7a4484f
>> > # Parent  53c668dc6b1601c8bda5098df4e33030dbdb454d
>> > commands: add an option to display only the full id with 'hg id'
>> >
>> > 'hg id --full' can display the full revision id without having to use
>> > --debug.
>> > This avoids potential additional debug messages being printed
>> > and is more intuitive (it's a specific option to 'hg id').
>> >
>> > diff --git a/mercurial/commands.py b/mercurial/commands.py
>> > --- a/mercurial/commands.py
>> > +++ b/mercurial/commands.py
>> > @@ -4165,6 +4165,7 @@
>> >       _('identify the specified revision'), _('REV')),
>> >      ('n', 'num', None, _('show local revision number')),
>> >      ('i', 'id', None, _('show global revision id')),
>> > +    ('', 'full', None, _('show full global revision id')),
>> >      ('b', 'branch', None, _('show branch')),
>> >      ('t', 'tags', None, _('show tags')),
>> >      ('B', 'bookmarks', None, _('show bookmarks')),
>> > @@ -4172,7 +4173,8 @@
>> >      _('[-nibtB] [-r REV] [SOURCE]'),
>> >      optionalrepo=True)
>> >  def identify(ui, repo, source=None, rev=None,
>> > -             num=None, id=None, branch=None, tags=None, bookmarks=None,
>> > **opts):
>> > +             num=None, id=None, branch=None, tags=None, bookmarks=None,
>> > +             full=None, **opts):
>> >      """identify the working directory or specified revision
>> >
>> >      Print a summary identifying the repository state at REV using one
>> > or
>> > @@ -4194,6 +4196,11 @@
>> >
>> >            hg id --id > build-id.dat
>> >
>> > +      - generate a build identifier with the full revision id
>> > +        for the working directory::
>> > +
>> > +          hg id --full > build-id.dat
>>
>> 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.


If we do the templating (which I'm in favor of), then we can have a
little example in the help that prints the full node id.


More information about the Mercurial-devel mailing list