diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -696,6 +696,7 @@ editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) revtoreuse = max(self.state) + self.wctx.setparents(repo[p1].node(), repo[self.external].node()) newnode = self._concludenode( revtoreuse, p1, self.external, editor, commitmsg=commitmsg ) @@ -1433,7 +1434,6 @@ if b'branch' in extra: branch = extra[b'branch'] - wctx.setparents(repo[p1].node(), repo[p2].node()) memctx = wctx.tomemctx( commitmsg, date=date, @@ -1454,8 +1454,6 @@ if not repo.ui.configbool(b'rebase', b'singletransaction'): dsguard = dirstateguard.dirstateguard(repo, b'rebase') with dsguard: - repo.setparents(repo[p1].node(), repo[p2].node()) - # Commit might fail if unresolved files exist newnode = repo.commit( text=commitmsg, user=user, date=date, extra=extra, editor=editor diff --git a/tests/test-copytrace-heuristics.t b/tests/test-copytrace-heuristics.t --- a/tests/test-copytrace-heuristics.t +++ b/tests/test-copytrace-heuristics.t @@ -290,6 +290,7 @@ $ hg rebase -s 1 -d 2 rebasing 1:472e38d57782 "mv a b" + warning: can't find ancestor for 'b' copied from 'a'! saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-17d50e29-rebase.hg $ hg up -q c492ed3c7e35dcd1dc938053b8adf56e2cfbd062 $ ls