pullbundle: deal with another special case introduced by arbitrary ranges
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 26 Sep 2018 17:17:11 +0200
changeset 4146 f7aa0ecae3a4
parent 4145 08b3c370e8b3
child 4147 88e922eca4e2
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.
hgext3rd/evolve/stablerange.py
--- 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)