diff hgext/rebase.py @ 50340:9f33d12f6f48 stable

rebase: do not cleanup the working copy when --dry-run is used (issue6802) Since we did not touch the working copy, we don't need to clean it up. This will avoid wiping exiting changes out.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 13 Apr 2023 04:12:31 +0200
parents a44e489940e0
children 771294224bf6
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Apr 11 17:06:08 2023 +0200
+++ b/hgext/rebase.py	Thu Apr 13 04:12:31 2023 +0200
@@ -838,6 +838,7 @@
                 cleanup = False
 
             if cleanup:
+
                 if rebased:
                     strippoints = [
                         c.node() for c in repo.set(b'roots(%ld)', rebased)
@@ -846,13 +847,17 @@
                 updateifonnodes = set(rebased)
                 updateifonnodes.update(self.destmap.values())
 
-                if not dryrun and not confirm:
+                if not confirm:
+                    # note: when dry run is set the `rebased` and `destmap`
+                    # variables seem to contain "bad" contents, so do not
+                    # rely on them. As dryrun does not need this part of
+                    # the cleanup, this is "fine"
                     updateifonnodes.add(self.originalwd)
 
                 shouldupdate = repo[b'.'].rev() in updateifonnodes
 
                 # Update away from the rebase if necessary
-                if shouldupdate:
+                if not dryrun and shouldupdate:
                     mergemod.clean_update(repo[self.originalwd])
 
                 # Strip from the first rebased revision