mercurial/commands.py
changeset 3165 5c93dd0ae413
parent 3159 e43fd1623fe1
child 3174 3637d5d17cbc
equal deleted inserted replaced
3164:706277866251 3165:5c93dd0ae413
   610         raise util.Abort(_('at least one file name or pattern required'))
   610         raise util.Abort(_('at least one file name or pattern required'))
   611 
   611 
   612     opmap = [['user', lambda x: ui.shortuser(x.user())],
   612     opmap = [['user', lambda x: ui.shortuser(x.user())],
   613              ['number', lambda x: str(x.rev())],
   613              ['number', lambda x: str(x.rev())],
   614              ['changeset', lambda x: short(x.node())],
   614              ['changeset', lambda x: short(x.node())],
   615              ['date', getdate]]
   615              ['date', getdate], ['follow', lambda x: x.path()]]
   616     if not opts['user'] and not opts['changeset'] and not opts['date']:
   616     if (not opts['user'] and not opts['changeset'] and not opts['date']
       
   617         and not opts['follow']):
   617         opts['number'] = 1
   618         opts['number'] = 1
   618 
   619 
   619     ctx = repo.changectx(opts['rev'])
   620     ctx = repo.changectx(opts['rev'])
   620 
   621 
   621     for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
   622     for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
   623         fctx = ctx.filectx(abs)
   624         fctx = ctx.filectx(abs)
   624         if not opts['text'] and util.binary(fctx.data()):
   625         if not opts['text'] and util.binary(fctx.data()):
   625             ui.write(_("%s: binary file\n") % ((pats and rel) or abs))
   626             ui.write(_("%s: binary file\n") % ((pats and rel) or abs))
   626             continue
   627             continue
   627 
   628 
   628         lines = fctx.annotate()
   629         lines = fctx.annotate(follow=opts.get('follow'))
   629         pieces = []
   630         pieces = []
   630 
   631 
   631         for o, f in opmap:
   632         for o, f in opmap:
   632             if opts[o]:
   633             if opts[o]:
   633                 l = [f(n) for n, dummy in lines]
   634                 l = [f(n) for n, dummy in lines]
  2669            _('guess renamed files by similarity (0<=s<=1)'))],
  2670            _('guess renamed files by similarity (0<=s<=1)'))],
  2670          _('hg addremove [OPTION]... [FILE]...')),
  2671          _('hg addremove [OPTION]... [FILE]...')),
  2671     "^annotate":
  2672     "^annotate":
  2672         (annotate,
  2673         (annotate,
  2673          [('r', 'rev', '', _('annotate the specified revision')),
  2674          [('r', 'rev', '', _('annotate the specified revision')),
       
  2675           ('f', 'follow', None, _('follow file copies and renames')),
  2674           ('a', 'text', None, _('treat all files as text')),
  2676           ('a', 'text', None, _('treat all files as text')),
  2675           ('u', 'user', None, _('list the author')),
  2677           ('u', 'user', None, _('list the author')),
  2676           ('d', 'date', None, _('list the date')),
  2678           ('d', 'date', None, _('list the date')),
  2677           ('n', 'number', None, _('list the revision number (default)')),
  2679           ('n', 'number', None, _('list the revision number (default)')),
  2678           ('c', 'changeset', None, _('list the changeset')),
  2680           ('c', 'changeset', None, _('list the changeset')),