D640: rebase: do not crash rebasing merge with a parent having hidden successor
quark (Jun Wu)
phabricator at mercurial-scm.org
Wed Sep 6 19:48:04 UTC 2017
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The added test will crash with previous code.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D640
AFFECTED FILES
hgext/rebase.py
tests/test-rebase-obsolete.t
CHANGE DETAILS
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 @@
|/
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
+
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1072,7 +1072,8 @@
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:
To: quark, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list