##// END OF EJS Templates
record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall -
r15184:351a9292 1.9.3 stable
parent child Browse files
Show More
@@ -386,7 +386,10 b' def record(ui, repo, *pats, **opts):'
386
386
387 dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
387 dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
388
388
389 def qrefresh(ui, repo, *pats, **opts):
389 def qrefresh(origfn, ui, repo, *pats, **opts):
390 if not opts['interactive']:
391 return origfn(ui, repo, *pats, **opts)
392
390 mq = extensions.find('mq')
393 mq = extensions.find('mq')
391
394
392 def committomq(ui, repo, *pats, **opts):
395 def committomq(ui, repo, *pats, **opts):
@@ -419,6 +422,11 b' def qrecord(ui, repo, patch, *pats, **op'
419
422
420 dorecord(ui, repo, committomq, 'qnew', False, *pats, **opts)
423 dorecord(ui, repo, committomq, 'qnew', False, *pats, **opts)
421
424
425 def qnew(origfn, ui, repo, patch, *args, **opts):
426 if opts['interactive']:
427 return qrecord(ui, repo, patch, *args, **opts)
428 return origfn(ui, repo, patch, *args, **opts)
429
422 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts):
430 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts):
423 if not ui.interactive():
431 if not ui.interactive():
424 raise util.Abort(_('running non-interactively, use %s instead') %
432 raise util.Abort(_('running non-interactively, use %s instead') %
@@ -584,15 +592,10 b' def uisetup(ui):'
584 mq.cmdtable['^qnew'][1][:] + diffopts,
592 mq.cmdtable['^qnew'][1][:] + diffopts,
585 _('hg qrecord [OPTION]... PATCH [FILE]...'))
593 _('hg qrecord [OPTION]... PATCH [FILE]...'))
586
594
587 _wrapcmd('qnew', mq.cmdtable, qrecord, _("interactively record a new patch"))
595 _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
588 _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
596 _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
589 _("interactively select changes to refresh"))
597 _("interactively select changes to refresh"))
590
598
591 def _wrapcmd(cmd, table, wrapfn, msg):
599 def _wrapcmd(cmd, table, wrapfn, msg):
592 '''wrap the command'''
600 entry = extensions.wrapcommand(table, cmd, wrapfn)
593 def wrapper(orig, *args, **kwargs):
594 if kwargs['interactive']:
595 return wrapfn(*args, **kwargs)
596 return orig(*args, **kwargs)
597 entry = extensions.wrapcommand(table, cmd, wrapper)
598 entry[1].append(('i', 'interactive', None, msg))
601 entry[1].append(('i', 'interactive', None, msg))
General Comments 0
You need to be logged in to leave comments. Login now