Added --date option to annotate.
--- a/doc/hg.1.txt Wed Nov 09 13:38:46 2005 -0800
+++ b/doc/hg.1.txt Wed Nov 09 13:39:24 2005 -0800
@@ -87,7 +87,7 @@
New files are ignored if they match any of the patterns in .hgignore. As
with add, these changes take effect at the next commit.
-annotate [-r <rev> -u -n -c] [files ...]::
+annotate [-r <rev> -u -n -c -d] [files ...]::
List changes in files, showing the revision id responsible for each line
This command is useful to discover who did a change or when a change took
@@ -103,6 +103,7 @@
-X, --exclude <pat> exclude names matching the given patterns
-r, --revision <rev> annotate the specified revision
-u, --user list the author
+ -d, --date list the commit date
-c, --changeset list the changeset
-n, --number list the revision number (default)
--- a/mercurial/commands.py Wed Nov 09 13:38:46 2005 -0800
+++ b/mercurial/commands.py Wed Nov 09 13:39:24 2005 -0800
@@ -538,11 +538,19 @@
cl = repo.changelog.read(repo.changelog.node(rev))
return trimuser(ui, cl[1], rev, ucache)
+ dcache = {}
+ def getdate(rev):
+ datestr = dcache.get(rev)
+ if datestr is None:
+ cl = repo.changelog.read(repo.changelog.node(rev))
+ datestr = dcache[rev] = util.datestr(cl[2])
+ return datestr
+
if not pats:
raise util.Abort(_('at least one file name or pattern required'))
- opmap = [['user', getname], ['number', str], ['changeset', getnode]]
- if not opts['user'] and not opts['changeset']:
+ opmap = [['user', getname], ['number', str], ['changeset', getnode], ['date', getdate]]
+ if not opts['user'] and not opts['changeset'] and not opts['date']:
opts['number'] = 1
if opts['rev']:
@@ -2140,6 +2148,7 @@
[('r', 'rev', '', _('annotate the specified revision')),
('a', 'text', None, _('treat all files as text')),
('u', 'user', None, _('list the author')),
+ ('d', 'date', None, _('list the date')),
('n', 'number', None, _('list the revision number (default)')),
('c', 'changeset', None, _('list the changeset')),
('I', 'include', [], _('include names matching the given patterns')),