hgkw/keyword.py
branch0.9.2compat
changeset 350 83aa851f0d84
parent 348 63ebc698d06b
child 352 a71e2086fe6e
equal deleted inserted replaced
348:63ebc698d06b 350:83aa851f0d84
   186 
   186 
   187 fancyopts.fancyopts = _fancyopts
   187 fancyopts.fancyopts = _fancyopts
   188 
   188 
   189 
   189 
   190 commands.optionalrepo += ' kwdemo'
   190 commands.optionalrepo += ' kwdemo'
       
   191 
       
   192 # handle for external callers
       
   193 externalcall = None, None, {}
       
   194 
       
   195 # hook for external callers
       
   196 def externalcmdhook(hgcmd, *args, **opts):
       
   197     global externalcall
       
   198     externalcall = hgcmd.__name__, args, opts
   191 
   199 
   192 # hg commands that trigger expansion only when writing to working dir,
   200 # hg commands that trigger expansion only when writing to working dir,
   193 # not when reading filelog, and unexpand when reading from working dir
   201 # not when reading filelog, and unexpand when reading from working dir
   194 restricted = ('diff1', 'record',
   202 restricted = ('diff1', 'record',
   195               'qfold', 'qimport', 'qnew', 'qpush', 'qrefresh', 'qrecord')
   203               'qfold', 'qimport', 'qnew', 'qpush', 'qrefresh', 'qrecord')
   513     nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy',
   521     nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy',
   514                     'export', 'grep', 'identify', 'incoming', 'init',
   522                     'export', 'grep', 'identify', 'incoming', 'init',
   515                     'log', 'outgoing', 'push', 'remove', 'rename',
   523                     'log', 'outgoing', 'push', 'remove', 'rename',
   516                     'rollback', 'tip',
   524                     'rollback', 'tip',
   517                     'convert')
   525                     'convert')
   518     hgcmd, func, args, opts, cmdopts = _parse(ui, sys.argv[1:])
   526     try:
       
   527         hgcmd, func, args, opts, cmdopts = _parse(ui, sys.argv[1:])
       
   528     except cmdutil.UnknownCommand:
       
   529         hgcmd, args, cmdopts = externalcall
       
   530         if hgcmd is None:  # no command was specified from outside
       
   531             raise
   519     if hgcmd in nokwcommands:
   532     if hgcmd in nokwcommands:
   520         return
   533         return
   521 
   534 
   522     if hgcmd == 'diff':
   535     if hgcmd == 'diff':
   523         # only expand if comparing against working dir
   536         # only expand if comparing against working dir