[Request] [+- ] D10892: rebase: use str-keyed opts in remaining places

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 21 17:59:12 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10892

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -190,18 +190,18 @@
         self.destmap = {}
         self.skipped = set()
 
-        self.collapsef = opts.get(b'collapse', False)
-        self.collapsemsg = cmdutil.logmessage(ui, opts)
-        self.date = opts.get(b'date', None)
+        self.collapsef = opts.get('collapse', False)
+        self.collapsemsg = cmdutil.logmessage(ui, pycompat.byteskwargs(opts))
+        self.date = opts.get('date', None)
 
-        e = opts.get(b'extrafn')  # internal, used by e.g. hgsubversion
+        e = opts.get('extrafn')  # internal, used by e.g. hgsubversion
         self.extrafns = [_savegraft]
         if e:
             self.extrafns = [e]
 
         self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
-        self.keepf = opts.get(b'keep', False)
-        self.keepbranchesf = opts.get(b'keepbranches', False)
+        self.keepf = opts.get('keep', False)
+        self.keepbranchesf = opts.get('keepbranches', False)
         self.skipemptysuccessorf = rewriteutil.skip_empty_successor(
             repo.ui, b'rebase'
         )
@@ -630,7 +630,7 @@
                 repo.ui.debug(b'resuming interrupted rebase\n')
                 self.resume = False
             else:
-                overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
+                overrides = {(b'ui', b'forcemerge'): opts.get('tool', b'')}
                 with ui.configoverride(overrides, b'rebase'):
                     try:
                         rebasenode(
@@ -677,9 +677,7 @@
             if not self.collapsef:
                 merging = p2 != nullrev
                 editform = cmdutil.mergeeditform(merging, b'rebase')
-                editor = cmdutil.getcommiteditor(
-                    editform=editform, **pycompat.strkwargs(opts)
-                )
+                editor = cmdutil.getcommiteditor(editform=editform, **opts)
                 # We need to set parents again here just in case we're continuing
                 # a rebase started with an old hg version (before 9c9cfecd4600),
                 # because those old versions would have left us with two dirstate
@@ -727,7 +725,7 @@
 
     def _finishrebase(self):
         repo, ui, opts = self.repo, self.ui, self.opts
-        fm = ui.formatter(b'rebase', opts)
+        fm = ui.formatter(b'rebase', pycompat.byteskwargs(opts))
         fm.startitem()
         if self.collapsef:
             p1, p2, _base = defineparents(
@@ -738,7 +736,7 @@
                 self.skipped,
                 self.obsolete_with_successor_in_destination,
             )
-            editopt = opts.get(b'edit')
+            editopt = opts.get('edit')
             editform = b'rebase.collapse'
             if self.collapsemsg:
                 commitmsg = self.collapsemsg
@@ -762,7 +760,7 @@
                     self.state[oldrev] = newrev
 
         if b'qtip' in repo.tags():
-            updatemq(repo, self.state, self.skipped, **pycompat.strkwargs(opts))
+            updatemq(repo, self.state, self.skipped, **opts)
 
         # restore original working directory
         # (we do this before stripping)
@@ -1091,8 +1089,7 @@
         opts['rev'] = [revsetlang.formatspec(b'%ld and orphan()', userrevs)]
         opts['dest'] = b'_destautoorphanrebase(SRC)'
 
-    opts = pycompat.byteskwargs(opts)
-    if opts.get(b'dry_run') or opts.get(b'confirm'):
+    if opts.get('dry_run') or opts.get('confirm'):
         return _dryrunrebase(ui, repo, action, opts)
     elif action == 'stop':
         rbsrt = rebaseruntime(repo, ui)
@@ -1143,7 +1140,7 @@
 
 def _dryrunrebase(ui, repo, action, opts):
     rbsrt = rebaseruntime(repo, ui, inmemory=True, dryrun=True, opts=opts)
-    confirm = opts.get(b'confirm')
+    confirm = opts.get('confirm')
     if confirm:
         ui.status(_(b'starting in-memory rebase\n'))
     else:
@@ -1200,7 +1197,7 @@
                     isabort=True,
                     backup=False,
                     suppwarns=True,
-                    dryrun=opts.get(b'dry_run'),
+                    dryrun=opts.get('dry_run'),
                 )
 
 
@@ -1212,7 +1209,7 @@
 def _origrebase(ui, repo, action, opts, rbsrt):
     assert action != 'stop'
     with repo.wlock(), repo.lock():
-        if opts.get(b'interactive'):
+        if opts.get('interactive'):
             try:
                 if extensions.find(b'histedit'):
                     enablehistedit = b''
@@ -1238,7 +1235,7 @@
                 raise error.InputError(
                     _(b'cannot use collapse with continue or abort')
                 )
-            if action == 'abort' and opts.get(b'tool', False):
+            if action == 'abort' and opts.get('tool', False):
                 ui.warn(_(b'tool option will be ignored\n'))
             if action == 'continue':
                 ms = mergestatemod.mergestate.read(repo)
@@ -1250,15 +1247,15 @@
         else:
             # search default destination in this space
             # used in the 'hg pull --rebase' case, see issue 5214.
-            destspace = opts.get(b'_destspace')
+            destspace = opts.get('_destspace')
             destmap = _definedestmap(
                 ui,
                 repo,
                 rbsrt.inmemory,
-                opts.get(b'dest', None),
-                opts.get(b'source', []),
-                opts.get(b'base', []),
-                opts.get(b'rev', []),
+                opts.get('dest', None),
+                opts.get('source', []),
+                opts.get('base', []),
+                opts.get('rev', []),
                 destspace=destspace,
             )
             retcode = rbsrt._preparenewrebase(destmap)



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210621/eae3d9b6/attachment-0001.html>


More information about the Mercurial-patches mailing list