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.
--- 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)