changeset 38183:69d1cafe75f2 stable

rebase: avoid RevlogError when computing obsoletenotrebased (issue5907) The key to reproducing this seems to be missing an obsolete node that is not an ancestor of the destination.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 05 Jun 2018 23:49:54 -0400
parents 79c54e7c0c52
children ca473c05bd10
files hgext/rebase.py tests/test-rebase-obsolete.t
diffstat 2 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Jun 02 13:44:44 2018 -0400
+++ b/hgext/rebase.py	Tue Jun 05 23:49:54 2018 -0400
@@ -1815,7 +1815,8 @@
                 # If 'srcrev' has a successor in rebase set but none in
                 # destination (which would be catched above), we shall skip it
                 # and its descendants to avoid divergence.
-                if any(nodemap[s] in destmap for s in successors):
+                if any(nodemap[s] in destmap for s in successors
+                       if s in nodemap):
                     obsoletewithoutsuccessorindestination.add(srcrev)
 
     return (
--- a/tests/test-rebase-obsolete.t	Sat Jun 02 13:44:44 2018 -0400
+++ b/tests/test-rebase-obsolete.t	Tue Jun 05 23:49:54 2018 -0400
@@ -1493,6 +1493,38 @@
   
   $ cd ..
 
+  $ hg init p2-succ-in-dest-c
+  $ cd p2-succ-in-dest-c
+
+The scenario here was that B::D were developed on default.  B was queued on
+stable, but amended before being push to hg-committed.  C was queued on default,
+along with unrelated J.
+
+  $ hg debugdrawdag <<EOF
+  > J
+  > |
+  > F
+  > |
+  > E
+  > | D
+  > | |
+  > | C      # replace: C -> F
+  > | |  H I # replace: B -> H -> I
+  > | B  |/
+  > |/   G
+  > A
+  > EOF
+  1 new orphan changesets
+
+This strip seems to be the key to avoid an early divergence warning.
+  $ hg --config extensions.strip= --hidden strip -qr H
+  1 new orphan changesets
+
+  $ hg rebase -b 'desc("D")' -d 'desc("J")'
+  abort: this rebase will cause divergences from: 112478962961
+  (to force the rebase please set experimental.evolution.allowdivergence=True)
+  [255]
+
 Rebase merge where both parents have successors in destination
 
   $ hg init p12-succ-in-dest