diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -838,6 +838,7 @@ class rebaseruntime: cleanup = False if cleanup: + if rebased: strippoints = [ c.node() for c in repo.set(b'roots(%ld)', rebased) @@ -846,13 +847,17 @@ class rebaseruntime: 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 diff --git a/tests/test-rebase-dry-run.t b/tests/test-rebase-dry-run.t --- a/tests/test-rebase-dry-run.t +++ b/tests/test-rebase-dry-run.t @@ -83,17 +83,15 @@ f03 is modified committing changelog rebase merging completed dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase - resolving manifests (known-bad-output !) - getting f03.txt (known-bad-output !) f03 changes are lost $ hg st - M f03.txt (missing-correct-output !) + M f03.txt $ hg diff - diff -r ab62441498e5 f03.txt (missing-correct-output !) - --- a/f03.txt Thu Jan 01 00:00:00 1970 +0000 (missing-correct-output !) - +++ b/f03.txt Thu Jan 01 00:00:00 1970 +0000 (missing-correct-output !) - @@ -1,1 +1,2 @@ (missing-correct-output !) - three (missing-correct-output !) - +add-to-three (missing-correct-output !) + diff -r ab62441498e5 f03.txt + --- a/f03.txt Thu Jan 01 00:00:00 1970 +0000 + +++ b/f03.txt Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,2 @@ + three + +add-to-three