Patchwork D640: rebase: do not crash rebasing merge with a parent having hidden successor

login
register
mail settings
Submitter phabricator
Date Sept. 11, 2017, 6:01 p.m.
Message ID <dfdb45b3a4291b4a83db6ebedb521661@localhost.localdomain>
Download mbox | patch
Permalink /patch/23782/
State Not Applicable
Headers show

Comments

phabricator - Sept. 11, 2017, 6:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8a8e7a94ba07: rebase: do not crash rebasing merge with a parent having hidden successor (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D640?vs=1637&id=1717

REVISION DETAIL
  https://phab.mercurial-scm.org/D640

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS




To: quark, #hg-reviewers, phillco, durham
Cc: mercurial-devel

Patch

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: