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

Jesús Espino jespinog at gmail.com
Sun Feb 12 15:59:05 UTC 2012


# 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)

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



More information about the Mercurial-devel mailing list