# HG changeset patch # User Jun Wu # Date 2017-09-06 19:40:00 # Node ID 8a8e7a94ba0748cd3fa1e5069ef97469a1b04887 # Parent bbdca7e460c0d9e332c733b48715d81f7a565e3f rebase: do not crash rebasing merge with a parent having hidden successor The added test will crash with previous code. Differential Revision: https://phab.mercurial-scm.org/D640 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1072,7 +1072,8 @@ def defineparents(repo, rev, destmap, st The new parents of a merge is slightly more complicated. See the comment block below. """ - cl = repo.changelog + # use unfiltered changelog since successorrevs may return filtered nodes + cl = repo.unfiltered().changelog def isancestor(a, b): # take revision numbers instead of nodes if a == b: diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -1267,3 +1267,37 @@ parent gets moved: |/ o A +Rebasing a merge with one of its parent having a hidden successor + + $ hg init $TESTTMP/merge-p1-hidden-successor + $ cd $TESTTMP/merge-p1-hidden-successor + + $ hg debugdrawdag <<'EOS' + > E + > | + > B3 B2 # amend: B1 -> B2 -> B3 + > |/ # B2 is hidden + > | D + > | |\ + > | B1 C + > |/ + > A + > EOS + + $ eval `hg tags -T '{tag}={node}\n'` + $ rm .hg/localtags + + $ hg rebase -r $D -d $E + rebasing 5:9e62094e4d94 "D" + + $ hg log -G + o 7:a699d059adcf D + |\ + | o 6:ecc93090a95c E + | | + | o 4:0dc878468a23 B3 + | | + o | 1:96cc3511f894 C + / + o 0:426bada5c675 A +