rebase: isolate command options from internal flags
authorYuya Nishihara <yuya@tcha.org>
Sat, 30 Jun 2018 11:29:48 +0900
changeset 38500 02004e5c6b56
parent 38499 999e5c218daf
child 38501 53800d6eed26
rebase: isolate command options from internal flags I want to get rid of per-function byteskwargs(opts).
hgext/rebase.py
--- a/hgext/rebase.py	Fri Jun 29 01:05:08 2018 +0530
+++ b/hgext/rebase.py	Sat Jun 30 11:29:48 2018 +0900
@@ -819,31 +819,31 @@
         opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
     if dryrun:
-        return _dryrunrebase(ui, repo, **opts)
+        return _dryrunrebase(ui, repo, opts)
     elif inmemory:
         try:
             # in-memory merge doesn't support conflicts, so if we hit any, abort
             # and re-run as an on-disk merge.
             overrides = {('rebase', 'singletransaction'): True}
             with ui.configoverride(overrides, 'rebase'):
-                return _dorebase(ui, repo, inmemory=inmemory, **opts)
+                return _dorebase(ui, repo, opts, inmemory=inmemory)
         except error.InMemoryMergeConflictsError:
             ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
                       ' merge\n'))
-            _dorebase(ui, repo, abort=True)
-            return _dorebase(ui, repo, inmemory=False, **opts)
+            _dorebase(ui, repo, {r'abort': True})
+            return _dorebase(ui, repo, opts, inmemory=False)
     else:
-        return _dorebase(ui, repo, **opts)
+        return _dorebase(ui, repo, opts)
 
-def _dryrunrebase(ui, repo, **opts):
+def _dryrunrebase(ui, repo, opts):
     rbsrt = rebaseruntime(repo, ui, inmemory=True,
                           opts=pycompat.byteskwargs(opts))
     with repo.wlock(), repo.lock():
         try:
             overrides = {('rebase', 'singletransaction'): True}
             with ui.configoverride(overrides, 'rebase'):
-                _origrebase(ui, repo, rbsrt, inmemory=True,
-                            leaveunfinished=True, **opts)
+                _origrebase(ui, repo, opts, rbsrt, inmemory=True,
+                            leaveunfinished=True)
         except error.InMemoryMergeConflictsError:
             ui.status(_('hit a merge conflict\n'))
             return 1
@@ -855,11 +855,11 @@
             rbsrt._prepareabortorcontinue(isabort=True, backup=False,
                                           suppwarns=True)
 
-def _dorebase(ui, repo, inmemory=False, **opts):
+def _dorebase(ui, repo, opts, inmemory=False):
     rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
-    return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
+    return _origrebase(ui, repo, opts, rbsrt, inmemory=inmemory)
 
-def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, **opts):
+def _origrebase(ui, repo, opts, rbsrt, inmemory=False, leaveunfinished=False):
     opts = pycompat.byteskwargs(opts)
     with repo.wlock(), repo.lock():
         # Validate input and define rebasing points