diff --git a/hgext/rebase.py b/hgext/rebase.py index 2b1ffaaab01f4068f4e1b1291654bf49d334d5d9_aGdleHQvcmViYXNlLnB5..57d35d3c1cf170513cc150c5021f5e3e0d7cdafb_aGdleHQvcmViYXNlLnB5 100644 --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -449,6 +449,9 @@ # restore original working directory # (we do this before stripping) newwd = state.get(originalwd, originalwd) + if newwd < 0: + # original directory is a parent of rebase set root or ignored + newwd = originalwd if newwd not in [c.rev() for c in repo[None].parents()]: ui.note(_("update back to initial working directory parent\n")) hg.updaterepo(repo, newwd, False) diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t index 2b1ffaaab01f4068f4e1b1291654bf49d334d5d9_dGVzdHMvdGVzdC1yZWJhc2Utc2NlbmFyaW8tZ2xvYmFsLnQ=..57d35d3c1cf170513cc150c5021f5e3e0d7cdafb_dGVzdHMvdGVzdC1yZWJhc2Utc2NlbmFyaW8tZ2xvYmFsLnQ= 100644 --- a/tests/test-rebase-scenario-global.t +++ b/tests/test-rebase-scenario-global.t @@ -300,5 +300,7 @@ Check rebasing mutable changeset Source phase greater or equal to destination phase: new changeset get the phase of source: + $ hg id -n + 5 $ hg rebase -s9 -d0 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-backup.hg (glob) @@ -303,5 +305,7 @@ $ hg rebase -s9 -d0 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-backup.hg (glob) + $ hg id -n # check we updated back to parent + 5 $ hg log --template "{phase}\n" -r 9 draft $ hg rebase -s9 -d1