From 5e4b8bd3a5a415b58b18dc44a64f91cfb0eb21b3 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Fri, 12 Jan 2018 19:32:46 -0800 Subject: [PATCH] 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 --- hgext/pushrebase.py | 4 ++-- tests/test-pushrebase-withmerges.t | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hgext/pushrebase.py b/hgext/pushrebase.py index e51f87e1d8..de6dbe6f1f 100644 --- a/hgext/pushrebase.py +++ b/hgext/pushrebase.py @@ -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 diff --git a/tests/test-pushrebase-withmerges.t b/tests/test-pushrebase-withmerges.t index bde67fb8ba..40dd405ef9 100644 --- a/tests/test-pushrebase-withmerges.t +++ b/tests/test-pushrebase-withmerges.t @@ -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]