# HG changeset patch # User lupus@debian.org # Date 1131572364 28800 # Node ID d07d729ce306158b3732c8f1e8b3b77ff700e582 # Parent 11a58d2cdffb9d4a4b856b879b6335f6f5ef4a54 Added --date option to annotate. diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -87,7 +87,7 @@ addremove [options] [files ...]:: 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 -u -n -c] [files ...]:: +annotate [-r -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 @@ annotate [-r -u -n -c] [files ...] -X, --exclude exclude names matching the given patterns -r, --revision 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) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -538,11 +538,19 @@ def annotate(ui, repo, *pats, **opts): 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 @@ table = { [('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')),