##// END OF EJS Templates
revlog: fix pure python slicing test when chain contains nullrev...
Boris Feld -
r41110:88d813cd default
parent child Browse files
Show More
@@ -47,11 +47,15 b' class _testrevlog(object):'
47 47 self.index = None
48 48
49 49 def start(self, rev):
50 if rev == nullrev:
51 return 0
50 52 if rev == 0:
51 53 return 0
52 54 return self._data[rev - 1]
53 55
54 56 def end(self, rev):
57 if rev == nullrev:
58 return 0
55 59 return self._data[rev]
56 60
57 61 def length(self, rev):
@@ -61,6 +65,8 b' class _testrevlog(object):'
61 65 return len(self._data)
62 66
63 67 def issnapshot(self, rev):
68 if rev == nullrev:
69 return True
64 70 return rev in self._snapshot
65 71
66 72 def slicechunk(revlog, revs, targetsize=None):
@@ -116,6 +122,12 b' def slicechunk(revlog, revs, targetsize='
116 122 [[0], [11], [13], [15]]
117 123 >>> list(slicechunk(revlog, [0, 11, 13, 15], targetsize=20))
118 124 [[0], [11], [13, 15]]
125
126 Slicing involving nullrev
127 >>> list(slicechunk(revlog, [-1, 0, 11, 13, 15], targetsize=20))
128 [[-1, 0], [11], [13, 15]]
129 >>> list(slicechunk(revlog, [-1, 13, 15], targetsize=5))
130 [[-1], [13], [15]]
119 131 """
120 132 if targetsize is not None:
121 133 targetsize = max(targetsize, revlog._srmingapsize)
General Comments 0
You need to be logged in to leave comments. Login now