hgext/rebase.py
changeset 44960 78cafd48b9b2
parent 44856 b7808443ed6a
parent 44923 1f114c797961
child 45085 a0192a03216d
--- a/hgext/rebase.py	Fri Jun 12 23:43:56 2020 +0200
+++ b/hgext/rebase.py	Mon Jun 15 12:00:15 2020 -0400
@@ -368,7 +368,9 @@
         skippedset.update(obsoleteextinctsuccessors)
         _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-    def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
+    def _prepareabortorcontinue(
+        self, isabort, backup=True, suppwarns=False, dryrun=False, confirm=False
+    ):
         self.resume = True
         try:
             self.restorestatus()
@@ -391,7 +393,12 @@
 
         if isabort:
             backup = backup and self.backupf
-            return self._abort(backup=backup, suppwarns=suppwarns)
+            return self._abort(
+                backup=backup,
+                suppwarns=suppwarns,
+                dryrun=dryrun,
+                confirm=confirm,
+            )
 
     def _preparenewrebase(self, destmap):
         if not destmap:
@@ -750,7 +757,7 @@
         ):
             bookmarks.activate(repo, self.activebookmark)
 
-    def _abort(self, backup=True, suppwarns=False):
+    def _abort(self, backup=True, suppwarns=False, dryrun=False, confirm=False):
         '''Restore the repository to its original state.'''
 
         repo = self.repo
@@ -794,7 +801,10 @@
 
                 updateifonnodes = set(rebased)
                 updateifonnodes.update(self.destmap.values())
-                updateifonnodes.add(self.originalwd)
+
+                if not dryrun and not confirm:
+                    updateifonnodes.add(self.originalwd)
+
                 shouldupdate = repo[b'.'].rev() in updateifonnodes
 
                 # Update away from the rebase if necessary
@@ -1120,7 +1130,10 @@
                     rbsrt._finishrebase()
                 else:
                     rbsrt._prepareabortorcontinue(
-                        isabort=True, backup=False, suppwarns=True
+                        isabort=True,
+                        backup=False,
+                        suppwarns=True,
+                        confirm=confirm,
                     )
                 needsabort = False
             else:
@@ -1135,7 +1148,10 @@
             if needsabort:
                 # no need to store backup in case of dryrun
                 rbsrt._prepareabortorcontinue(
-                    isabort=True, backup=False, suppwarns=True
+                    isabort=True,
+                    backup=False,
+                    suppwarns=True,
+                    dryrun=opts.get(b'dry_run'),
                 )