hgkw/keyword.py
changeset 695 31b9e6615cec
parent 688 13bb123ad894
child 696 2305f9255f04
equal deleted inserted replaced
694:13b10c2621a5 695:31b9e6615cec
   248 
   248 
   249 def _status(ui, repo, kwt, *pats, **opts):
   249 def _status(ui, repo, kwt, *pats, **opts):
   250     '''Bails out if [keyword] configuration is not active.
   250     '''Bails out if [keyword] configuration is not active.
   251     Returns status of working directory.'''
   251     Returns status of working directory.'''
   252     if kwt:
   252     if kwt:
   253         unknown = (opts.get('unknown') or opts.get('all')
       
   254                    or opts.get('untracked'))
       
   255         return repo.status(match=cmdutil.match(repo, pats, opts), clean=True,
   253         return repo.status(match=cmdutil.match(repo, pats, opts), clean=True,
   256                            unknown=unknown)
   254                            unknown=opts.get('unknown') or opts.get('all'))
   257     if ui.configitems('keyword'):
   255     if ui.configitems('keyword'):
   258         raise util.Abort(_('[keyword] patterns cannot match'))
   256         raise util.Abort(_('[keyword] patterns cannot match'))
   259     raise util.Abort(_('no [keyword] patterns configured'))
   257     raise util.Abort(_('no [keyword] patterns configured'))
   260 
   258 
   261 def _kwfwrite(ui, repo, expand, *pats, **opts):
   259 def _kwfwrite(ui, repo, expand, *pats, **opts):
   393     kwt = kwtools['templater']
   391     kwt = kwtools['templater']
   394     status = _status(ui, repo, kwt, *pats, **opts)
   392     status = _status(ui, repo, kwt, *pats, **opts)
   395     cwd = pats and repo.getcwd() or ''
   393     cwd = pats and repo.getcwd() or ''
   396     modified, added, removed, deleted, unknown, ignored, clean = status
   394     modified, added, removed, deleted, unknown, ignored, clean = status
   397     files = []
   395     files = []
   398     if not (opts.get('unknown') or opts.get('untracked')) or opts.get('all'):
   396     if not opts.get('unknown') or opts.get('all'):
   399         files = sorted(modified + added + clean)
   397         files = sorted(modified + added + clean)
   400     wctx = repo[None]
   398     wctx = repo[None]
   401     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
   399     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
   402     kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
   400     kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
   403     if not opts.get('ignore') or opts.get('all'):
   401     if not opts.get('ignore') or opts.get('all'):
   529     'kwfiles':
   527     'kwfiles':
   530         (files,
   528         (files,
   531          [('A', 'all', None, _('show keyword status flags of all files')),
   529          [('A', 'all', None, _('show keyword status flags of all files')),
   532           ('i', 'ignore', None, _('show files excluded from expansion')),
   530           ('i', 'ignore', None, _('show files excluded from expansion')),
   533           ('u', 'unknown', None, _('only show unknown (not tracked) files')),
   531           ('u', 'unknown', None, _('only show unknown (not tracked) files')),
   534           ('a', 'all', None,
       
   535            _('show keyword status flags of all files (DEPRECATED)')),
       
   536           ('u', 'untracked', None, _('only show untracked files (DEPRECATED)')),
       
   537          ] + commands.walkopts,
   532          ] + commands.walkopts,
   538          _('hg kwfiles [OPTION]... [FILE]...')),
   533          _('hg kwfiles [OPTION]... [FILE]...')),
   539     'kwshrink': (shrink, commands.walkopts,
   534     'kwshrink': (shrink, commands.walkopts,
   540                  _('hg kwshrink [OPTION]... [FILE]...')),
   535                  _('hg kwshrink [OPTION]... [FILE]...')),
   541 }
   536 }