pushrebase: correctly track lastdestnode when rebasing merges

Summary:
The initial value of lastdestnode should be the commit onto which the rebase is
happening.

It should be updated whenever a new commit is added for which the p1 parent is
the old last dest node.

Test Plan: Run the new test, and show it now works.

Reviewers: durham, rmcelroy, #mercurial

Reviewed By: rmcelroy

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D6709108

Signature: 6709108:1515760332:32bef9892792c7c94117b8fe14364937d98ebbac
This commit is contained in:
Mark Thomas 2018-01-12 19:32:46 -08:00
parent 88d034ad12
commit 5e4b8bd3a5
2 changed files with 5 additions and 6 deletions

View File

@ -1040,7 +1040,7 @@ def runrebase(op, revs, oldonto, onto):
# Seed the mapping with oldonto->onto
mapping[oldonto.node()] = onto.node()
lastdestnode = None
lastdestnode = onto.node()
for rev in revs:
newrev = _graft(op, rev, mapping, lastdestnode)
@ -1054,7 +1054,7 @@ def runrebase(op, revs, oldonto, onto):
# Track which commit contains the original rebase destination
# contents, so we can preserve the appropriate side's content during
# merges.
if not lastdestnode or oldnode == lastdestnode:
if lastdestnode == new.p1().node():
lastdestnode = newnode
return added, replacements

View File

@ -101,13 +101,13 @@ Push in from the client.
3 new obsolescence markers
updating bookmark @
obsoleted 3 changesets
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ log
@ merge alpha and beta [public:9:2ab54dd114a6]
@ merge alpha and beta [public:9:8c1abab9fd04]
|\
| o merge beta [public:8:f71e1c3a925c]
| |\
o---+ merge alpha [public:7:1b013a99a33f]
o---+ merge alpha [public:7:a9138cc95bb3]
| | |
| | o other [public:6:7fd651906bb3]
| | |
@ -118,4 +118,3 @@ Push in from the client.
o base [public:0:d20a80d4def3]
$ test -f other
[1]