536 ucache = {} |
536 ucache = {} |
537 def getname(rev): |
537 def getname(rev): |
538 cl = repo.changelog.read(repo.changelog.node(rev)) |
538 cl = repo.changelog.read(repo.changelog.node(rev)) |
539 return trimuser(ui, cl[1], rev, ucache) |
539 return trimuser(ui, cl[1], rev, ucache) |
540 |
540 |
|
541 dcache = {} |
|
542 def getdate(rev): |
|
543 datestr = dcache.get(rev) |
|
544 if datestr is None: |
|
545 cl = repo.changelog.read(repo.changelog.node(rev)) |
|
546 datestr = dcache[rev] = util.datestr(cl[2]) |
|
547 return datestr |
|
548 |
541 if not pats: |
549 if not pats: |
542 raise util.Abort(_('at least one file name or pattern required')) |
550 raise util.Abort(_('at least one file name or pattern required')) |
543 |
551 |
544 opmap = [['user', getname], ['number', str], ['changeset', getnode]] |
552 opmap = [['user', getname], ['number', str], ['changeset', getnode], ['date', getdate]] |
545 if not opts['user'] and not opts['changeset']: |
553 if not opts['user'] and not opts['changeset'] and not opts['date']: |
546 opts['number'] = 1 |
554 opts['number'] = 1 |
547 |
555 |
548 if opts['rev']: |
556 if opts['rev']: |
549 node = repo.changelog.lookup(opts['rev']) |
557 node = repo.changelog.lookup(opts['rev']) |
550 else: |
558 else: |
2138 "^annotate": |
2146 "^annotate": |
2139 (annotate, |
2147 (annotate, |
2140 [('r', 'rev', '', _('annotate the specified revision')), |
2148 [('r', 'rev', '', _('annotate the specified revision')), |
2141 ('a', 'text', None, _('treat all files as text')), |
2149 ('a', 'text', None, _('treat all files as text')), |
2142 ('u', 'user', None, _('list the author')), |
2150 ('u', 'user', None, _('list the author')), |
|
2151 ('d', 'date', None, _('list the date')), |
2143 ('n', 'number', None, _('list the revision number (default)')), |
2152 ('n', 'number', None, _('list the revision number (default)')), |
2144 ('c', 'changeset', None, _('list the changeset')), |
2153 ('c', 'changeset', None, _('list the changeset')), |
2145 ('I', 'include', [], _('include names matching the given patterns')), |
2154 ('I', 'include', [], _('include names matching the given patterns')), |
2146 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
2155 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
2147 _('hg annotate [OPTION]... FILE...')), |
2156 _('hg annotate [OPTION]... FILE...')), |