diff -r 57875cf423c9 -r 2372284d9457 hgext/record.py --- a/hgext/record.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/record.py Sun Oct 06 09:45:02 2019 -0400 @@ -30,12 +30,14 @@ testedwith = 'ships-with-hg-core' -@command("record", - # same options as commit + white space diff options - [c for c in commands.table['commit|ci'][1][:] - if c[1] != "interactive"] + cmdutil.diffwsopts, - _('hg record [OPTION]... [FILE]...'), - helpcategory=command.CATEGORY_COMMITTING) +@command( + "record", + # same options as commit + white space diff options + [c for c in commands.table['commit|ci'][1][:] if c[1] != "interactive"] + + cmdutil.diffwsopts, + _('hg record [OPTION]... [FILE]...'), + helpcategory=command.CATEGORY_COMMITTING, +) def record(ui, repo, *pats, **opts): '''interactively select changes to commit @@ -66,14 +68,16 @@ This command is not available when committing a merge.''' if not ui.interactive(): - raise error.Abort(_('running non-interactively, use %s instead') % - 'commit') + raise error.Abort( + _('running non-interactively, use %s instead') % 'commit' + ) opts[r"interactive"] = True overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): return commands.commit(ui, repo, *pats, **opts) + def qrefresh(origfn, ui, repo, *pats, **opts): if not opts[r'interactive']: return origfn(ui, repo, *pats, **opts) @@ -88,15 +92,19 @@ mq.refresh(ui, repo, **opts) # backup all changed files - cmdutil.dorecord(ui, repo, committomq, None, True, - cmdutil.recordfilter, *pats, **opts) + cmdutil.dorecord( + ui, repo, committomq, None, True, cmdutil.recordfilter, *pats, **opts + ) + # This command registration is replaced during uisetup(). -@command('qrecord', +@command( + 'qrecord', [], _('hg qrecord [OPTION]... PATCH [FILE]...'), helpcategory=command.CATEGORY_COMMITTING, - inferrepo=True) + inferrepo=True, +) def qrecord(ui, repo, patch, *pats, **opts): '''interactively record a new patch @@ -105,6 +113,7 @@ ''' return _qrecord('qnew', ui, repo, patch, *pats, **opts) + def _qrecord(cmdsuggest, ui, repo, patch, *pats, **opts): try: mq = extensions.find('mq') @@ -120,8 +129,17 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): cmdutil.checkunfinished(repo) - cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, - cmdutil.recordfilter, *pats, **opts) + cmdutil.dorecord( + ui, + repo, + committomq, + cmdsuggest, + False, + cmdutil.recordfilter, + *pats, + **opts + ) + def qnew(origfn, ui, repo, patch, *args, **opts): if opts[r'interactive']: @@ -140,11 +158,17 @@ # same options as qnew, but copy them so we don't get # -i/--interactive for qrecord and add white space diff options mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts, - _('hg qrecord [OPTION]... PATCH [FILE]...')) + _('hg qrecord [OPTION]... PATCH [FILE]...'), + ) _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch")) - _wrapcmd('qrefresh', mq.cmdtable, qrefresh, - _("interactively select changes to refresh")) + _wrapcmd( + 'qrefresh', + mq.cmdtable, + qrefresh, + _("interactively select changes to refresh"), + ) + def _wrapcmd(cmd, table, wrapfn, msg): entry = extensions.wrapcommand(table, cmd, wrapfn)