hgext/record.py
changeset 14426 1df64ccef23e
parent 14425 e89534504fb9
child 14427 9d4cabd189df
equal deleted inserted replaced
14425:e89534504fb9 14426:1df64ccef23e
   374 
   374 
   375     This command is not available when committing a merge.'''
   375     This command is not available when committing a merge.'''
   376 
   376 
   377     dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
   377     dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
   378 
   378 
       
   379 def qrefresh(ui, repo, *pats, **opts):
       
   380     mq = extensions.find('mq')
       
   381 
       
   382     def committomq(ui, repo, *pats, **opts):
       
   383         # At this point the working copy contains only changes that
       
   384         # were accepted. All other changes were reverted.
       
   385         # We can't pass *pats here since qrefresh will undo all other
       
   386         # changed files in the patch that aren't in pats.
       
   387         mq.refresh(ui, repo, **opts)
       
   388 
       
   389     # backup all changed files
       
   390     dorecord(ui, repo, committomq, 'qrefresh', True, *pats, **opts)
   379 
   391 
   380 def qrecord(ui, repo, patch, *pats, **opts):
   392 def qrecord(ui, repo, patch, *pats, **opts):
   381     '''interactively record a new patch
   393     '''interactively record a new patch
   382 
   394 
   383     See :hg:`help qnew` & :hg:`help record` for more information and
   395     See :hg:`help qnew` & :hg:`help record` for more information and
   553         return
   565         return
   554 
   566 
   555     cmdtable["qrecord"] = \
   567     cmdtable["qrecord"] = \
   556         (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
   568         (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
   557          _('hg qrecord [OPTION]... PATCH [FILE]...'))
   569          _('hg qrecord [OPTION]... PATCH [FILE]...'))
       
   570 
       
   571     _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
       
   572              _("interactively select changes to refresh"))
       
   573 
       
   574 def _wrapcmd(cmd, table, wrapfn, msg):
       
   575     '''wrap the command'''
       
   576     def wrapper(orig, *args, **kwargs):
       
   577         if kwargs['interactive']:
       
   578             return wrapfn(*args, **kwargs)
       
   579         return orig(*args, **kwargs)
       
   580     entry = extensions.wrapcommand(table, cmd, wrapper)
       
   581     entry[1].append(('i', 'interactive', None, msg))