hgkw/keyword.py
changeset 460 d9aae4cd69be
parent 457 5e2be38cb3dd
parent 459 df56cd11458d
child 461 2275041e7deb
equal deleted inserted replaced
457:5e2be38cb3dd 460:d9aae4cd69be
   410     _kwfwrite(ui, repo, False, *pats, **opts)
   410     _kwfwrite(ui, repo, False, *pats, **opts)
   411 
   411 
   412 
   412 
   413 def uisetup(ui):
   413 def uisetup(ui):
   414     '''Collects [keyword] config in kwtools.
   414     '''Collects [keyword] config in kwtools.
   415     Monkeypatch dispatch._runcommand if needed to grab command for kwtools.'''
   415     Monkeypatches dispatch._parse if needed.'''
   416 
   416 
   417     for pat, opt in ui.configitems('keyword'):
   417     for pat, opt in ui.configitems('keyword'):
   418         if opt != 'ignore':
   418         if opt != 'ignore':
   419             kwtools['inc'].append(pat)
   419             kwtools['inc'].append(pat)
   420         else:
   420         else:
   421             kwtools['exc'].append(pat)
   421             kwtools['exc'].append(pat)
   422 
   422 
   423     if kwtools['inc']:
   423     if kwtools['inc']:
   424         def kwdispatch_runcommand(ui, options, cmd, cmdfunc):
   424         def kwdispatch_parse(ui, args):
       
   425             '''Monkeypatch dispatch._parse to obtain running hg command.'''
       
   426             cmd, func, args, options, cmdoptions = dispatch_parse(ui, args)
   425             kwtools['hgcmd'] = cmd
   427             kwtools['hgcmd'] = cmd
   426             return dispatch_runcommand(ui, options, cmd, cmdfunc)
   428             return cmd, func, args, options, cmdoptions
   427 
   429 
   428         dispatch_runcommand = dispatch._runcommand
   430         dispatch_parse = dispatch._parse
   429         dispatch._runcommand = kwdispatch_runcommand
   431         dispatch._parse = kwdispatch_parse
   430 
   432 
   431 def reposetup(ui, repo):
   433 def reposetup(ui, repo):
   432     '''Sets up repo as kwrepo for keyword substitution.
   434     '''Sets up repo as kwrepo for keyword substitution.
   433     Overrides file method to return kwfilelog instead of filelog
   435     Overrides file method to return kwfilelog instead of filelog
   434     if file matches user configuration.
   436     if file matches user configuration.