[PATCH] annotate: added --message/-m option to list the commit message (issue3117)

Jesús Espino jespinog at gmail.com
Mon Feb 13 16:03:51 CST 2012


Almost sure, but it depends on screen size and messages length (this
problem can be applied to really long usernames in the -u option, less
common but possible, and anyway a user election), and with a small
screen or long messages can be useful redirecting the output to a
file, anyway, in my laptop (1366x768) resolution, and with the the hg
repository viewing the Makefile blame -m, for example, looks
acceptable.

I have more doubts about using the templatefilter firstline as part of
the implementation, is correct, or better use a copy of the firstline
implementation?

Greetings.

2012/2/13 Matt Mackall <mpm at selenic.com>:
> On Sun, 2012-02-12 at 16:59 +0100, Jesús Espino wrote:
>> # HG changeset patch
>> # User Jesus Espino Garcia <jesus.espino at kaleidos.net>
>> # Date 1329062320 -3600
>> # Node ID c86ea5f3221f2c1d3313b7013a6e41d0254e492c
>> # Parent  cb756482c1aad808add481a6967e2eb7a5aead21
>> annotate: added --message/-m option to list the commit message (issue3117)
>
> Seems like it will be disastrously ugly with all but the shortest commit
> messages?
>
>> diff -r cb756482c1aa -r c86ea5f3221f contrib/zsh_completion
>> --- a/contrib/zsh_completion  Fri Feb 10 17:09:23 2012 -0600
>> +++ b/contrib/zsh_completion  Sun Feb 12 16:58:40 2012 +0100
>> @@ -428,6 +428,7 @@
>>    '(--text -a)'{-a,--text}'[treat all files as text]' \
>>    '(--user -u)'{-u,--user}'[list the author]' \
>>    '(--date -d)'{-d,--date}'[list the date]' \
>> +  '(--message -m)'{-m,--message}'[list the commit message]' \
>>    '(--number -n)'{-n,--number}'[list the revision number (default)]' \
>>    '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
>>    '*:files:_hg_files'
>> diff -r cb756482c1aa -r c86ea5f3221f mercurial/commands.py
>> --- a/mercurial/commands.py   Fri Feb 10 17:09:23 2012 -0600
>> +++ b/mercurial/commands.py   Sun Feb 12 16:58:40 2012 +0100
>> @@ -18,6 +18,7 @@
>>  import dagparser, context, simplemerge
>>  import random, setdiscovery, treediscovery, dagutil
>>  import phases
>> +from templatefilters import firstline
>>
>>  table = {}
>>
>> @@ -218,6 +219,7 @@
>>      ('d', 'date', None, _('list the date (short with -q)')),
>>      ('n', 'number', None, _('list the revision number (default)')),
>>      ('c', 'changeset', None, _('list the changeset')),
>> +    ('m', 'message', None, _('list the commit message')),
>>      ('l', 'line-number', None, _('show line number at the first appearance'))
>>      ] + diffwsopts + walkopts,
>>      _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'))
>> @@ -252,6 +254,7 @@
>>
>>      opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())),
>>               ('number', ' ', lambda x: str(x[0].rev())),
>> +             ('message', ' ', lambda x: firstline(str(x[0].description()))),
>>               ('changeset', ' ', lambda x: hexfn(x[0].node())),
>>               ('date', ' ', getdate),
>>               ('file', ' ', lambda x: x[0].path()),
>> @@ -259,7 +262,8 @@
>>              ]
>>
>>      if (not opts.get('user') and not opts.get('changeset')
>> -        and not opts.get('date') and not opts.get('file')):
>> +        and not opts.get('date') and not opts.get('file')
>> +        and not opts.get('message')):
>>          opts['number'] = True
>>
>>      linenumber = opts.get('line_number') is not None
>> diff -r cb756482c1aa -r c86ea5f3221f tests/test-debugcomplete.t
>> --- a/tests/test-debugcomplete.t      Fri Feb 10 17:09:23 2012 -0600
>> +++ b/tests/test-debugcomplete.t      Sun Feb 12 16:58:40 2012 +0100
>> @@ -190,7 +190,7 @@
>>  Show all commands + options
>>    $ hg debugcommands
>>    add: include, exclude, subrepos, dry-run
>> -  annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude
>> +  annotate: rev, follow, no-follow, text, user, file, date, number, changeset, message, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude
>>    clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
>>    commit: addremove, close-branch, include, exclude, message, logfile, date, user, subrepos
>>    diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>


More information about the Mercurial-devel mailing list