changeset 4146:f7aa0ecae3a4

pullbundle: deal with another special case introduced by arbitrary ranges previous, we dealt with the case where the tippest subrange of the stable parent was too long. Now, we need to deal with the case where it is too small.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 26 Sep 2018 17:17:11 +0200
parents 08b3c370e8b3
children 88e922eca4e2
files hgext3rd/evolve/stablerange.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py	Wed Sep 26 13:15:40 2018 +0200
+++ b/hgext3rd/evolve/stablerange.py	Wed Sep 26 17:17:11 2018 +0200
@@ -419,9 +419,16 @@
             # (and the top range is always the same)
             subranges = self.subranges(repo, stable_parent_range)[:]
             parenttop = subranges.pop()
-            if (stable_parent_depth - slicepoint) < self.rangelength(repo, parenttop):
-                # possible case when we reduce an arbitrary range to its
-                # canonical parts
+            lenparenttop = self.rangelength(repo, parenttop)
+            skimfromparent = stable_parent_depth - slicepoint
+            if lenparenttop < skimfromparent:
+                # dropping the first subrange of the stable parent range is not
+                # enough to skip what we need to skip, change in approach is needed
+                subranges = self._slicesrangeat(repo, stable_parent_range, slicepoint)
+                subranges.pop()
+            elif lenparenttop > skimfromparent:
+                # The first subrange of the parent is longer that what we want
+                # to drop, we need to keep some of it.
                 midranges = self._slicesrangeat(repo, parenttop, slicepoint)
                 subranges.extend(midranges[:-1])
             subranges.append(top_range)