hgext/fastannotate/commands.py
changeset 43506 9f70512ae2cf
parent 43117 8ff1ecfadcd1
child 44452 9d2b2df2c2ba
equal deleted inserted replaced
43505:47fac1692ede 43506:9f70512ae2cf
    80         for p in ctx.walk(m):
    80         for p in ctx.walk(m):
    81             yield p
    81             yield p
    82 
    82 
    83 
    83 
    84 fastannotatecommandargs = {
    84 fastannotatecommandargs = {
    85     r'options': [
    85     'options': [
    86         (b'r', b'rev', b'.', _(b'annotate the specified revision'), _(b'REV')),
    86         (b'r', b'rev', b'.', _(b'annotate the specified revision'), _(b'REV')),
    87         (b'u', b'user', None, _(b'list the author (long with -v)')),
    87         (b'u', b'user', None, _(b'list the author (long with -v)')),
    88         (b'f', b'file', None, _(b'list the filename')),
    88         (b'f', b'file', None, _(b'list the filename')),
    89         (b'd', b'date', None, _(b'list the date (short with -q)')),
    89         (b'd', b'date', None, _(b'list the date (short with -q)')),
    90         (b'n', b'number', None, _(b'list the revision number (default)')),
    90         (b'n', b'number', None, _(b'list the revision number (default)')),
   131         ),
   131         ),
   132     ]
   132     ]
   133     + commands.diffwsopts
   133     + commands.diffwsopts
   134     + commands.walkopts
   134     + commands.walkopts
   135     + commands.formatteropts,
   135     + commands.formatteropts,
   136     r'synopsis': _(b'[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
   136     'synopsis': _(b'[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
   137     r'inferrepo': True,
   137     'inferrepo': True,
   138 }
   138 }
   139 
   139 
   140 
   140 
   141 def fastannotate(ui, repo, *pats, **opts):
   141 def fastannotate(ui, repo, *pats, **opts):
   142     """show changeset information by line for each file
   142     """show changeset information by line for each file
   255 
   255 
   256 
   256 
   257 _newopts = set()
   257 _newopts = set()
   258 _knownopts = {
   258 _knownopts = {
   259     opt[1].replace(b'-', b'_')
   259     opt[1].replace(b'-', b'_')
   260     for opt in (fastannotatecommandargs[r'options'] + commands.globalopts)
   260     for opt in (fastannotatecommandargs['options'] + commands.globalopts)
   261 }
   261 }
   262 
   262 
   263 
   263 
   264 def _annotatewrapper(orig, ui, repo, *pats, **opts):
   264 def _annotatewrapper(orig, ui, repo, *pats, **opts):
   265     """used by wrapdefault"""
   265     """used by wrapdefault"""
   267     if ui.configbool(b'fastannotate', b'unfilteredrepo'):
   267     if ui.configbool(b'fastannotate', b'unfilteredrepo'):
   268         repo = repo.unfiltered()
   268         repo = repo.unfiltered()
   269 
   269 
   270     # treat the file as text (skip the isbinary check)
   270     # treat the file as text (skip the isbinary check)
   271     if ui.configbool(b'fastannotate', b'forcetext'):
   271     if ui.configbool(b'fastannotate', b'forcetext'):
   272         opts[r'text'] = True
   272         opts['text'] = True
   273 
   273 
   274     # check if we need to do prefetch (client-side)
   274     # check if we need to do prefetch (client-side)
   275     rev = opts.get(r'rev')
   275     rev = opts.get('rev')
   276     if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
   276     if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
   277         paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
   277         paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
   278         repo.prefetchfastannotate(paths)
   278         repo.prefetchfastannotate(paths)
   279 
   279 
   280     return orig(ui, repo, *pats, **opts)
   280     return orig(ui, repo, *pats, **opts)