Patchwork D3856: rebase: split _origrebase() for conveniece in dryrun

login
register
mail settings
Submitter phabricator
Date June 28, 2018, 8:10 p.m.
Message ID <differential-rev-PHID-DREV-eawqogyisgwypycfqg4m-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32491/
State Superseded
Headers show

Comments

phabricator - June 28, 2018, 8:10 p.m.
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch split _origrebase() method by extracting rbsrt part
  from that to make it easy to implement dryrun in more elegant way
  than before.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -836,27 +836,27 @@ 
             # and re-run as an on-disk merge.
             overrides = {('rebase', 'singletransaction'): True}
             with ui.configoverride(overrides, 'rebase'):
-                return _origrebase(ui, repo, inmemory=inmemory, **opts)
+                return _dorebase(ui, repo, inmemory=inmemory, **opts)
         except error.InMemoryMergeConflictsError:
             ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
                       ' merge\n'))
-            _origrebase(ui, repo, abort=True)
-            return _origrebase(ui, repo, inmemory=False, **opts)
+            _dorebase(ui, repo, abort=True)
+            return _dorebase(ui, repo, inmemory=False, **opts)
     else:
-        return _origrebase(ui, repo, **opts)
+        return _dorebase(ui, repo, **opts)
 
 def _dryrunrebase(ui, repo, rbsrt, **opts):
     overrides = {('rebase', 'singletransaction'): True}
     with ui.configoverride(overrides, 'rebase'):
-        return _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-                           leaveunfinished=True, **opts)
-
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
-                **opts):
+        return _origrebase(ui, repo, rbsrt, inmemory=True, leaveunfinished=True,
+                           **opts)
+
+def _dorebase(ui, repo, inmemory=False, **opts):
     opts = pycompat.byteskwargs(opts)
-    if not rbsrt:
-        rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-
+    rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+    return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
+
+def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, **opts):
     with repo.wlock(), repo.lock():
         # Validate input and define rebasing points
         destf = opts.get('dest', None)