[Updated] D9074: rebase: add dryrun property to rebaseruntime

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Sep 24 07:35:37 UTC 2020


Closed by commit rHG25e365d5aa8f: rebase: add dryrun property to rebaseruntime (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9074?vs=22811&id=22822

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9074/new/

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

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
@@ -166,7 +166,7 @@
 class rebaseruntime(object):
     """This class is a container for rebase runtime state"""
 
-    def __init__(self, repo, ui, inmemory=False, opts=None):
+    def __init__(self, repo, ui, inmemory=False, dryrun=False, opts=None):
         if opts is None:
             opts = {}
 
@@ -212,6 +212,7 @@
         self.obsoletenotrebased = {}
         self.obsoletewithoutsuccessorindestination = set()
         self.inmemory = inmemory
+        self.dryrun = dryrun
         self.stateobj = statemod.cmdstate(repo, b'rebasestate')
 
     @property
@@ -1088,7 +1089,7 @@
 
 
 def _dryrunrebase(ui, repo, action, opts):
-    rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
+    rbsrt = rebaseruntime(repo, ui, inmemory=True, dryrun=True, opts=opts)
     confirm = opts.get(b'confirm')
     if confirm:
         ui.status(_(b'starting in-memory rebase\n'))
@@ -1102,7 +1103,7 @@
             overrides = {(b'rebase', b'singletransaction'): True}
             with ui.configoverride(overrides, b'rebase'):
                 _origrebase(
-                    ui, repo, action, opts, rbsrt, leaveunfinished=True,
+                    ui, repo, action, opts, rbsrt,
                 )
         except error.InMemoryMergeConflictsError:
             ui.status(_(b'hit a merge conflict\n'))
@@ -1144,11 +1145,11 @@
 
 
 def _dorebase(ui, repo, action, opts, inmemory=False):
-    rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+    rbsrt = rebaseruntime(repo, ui, inmemory, opts=opts)
     return _origrebase(ui, repo, action, opts, rbsrt)
 
 
-def _origrebase(ui, repo, action, opts, rbsrt, leaveunfinished=False):
+def _origrebase(ui, repo, action, opts, rbsrt):
     assert action != b'stop'
     with repo.wlock(), repo.lock():
         if opts.get(b'interactive'):
@@ -1222,7 +1223,7 @@
                 dsguard = dirstateguard.dirstateguard(repo, b'rebase')
             with util.acceptintervention(dsguard):
                 rbsrt._performrebase(tr)
-                if not leaveunfinished:
+                if not rbsrt.dryrun:
                     rbsrt._finishrebase()
 
 



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200924/62fae710/attachment-0002.html>


More information about the Mercurial-patches mailing list