##// END OF EJS Templates
revlog: deal with nodemap deletion within the index...
marmoute -
r43839:5b556d46 default draft
parent child Browse files
Show More
@@ -93,7 +93,6 b' class bundlerevlog(revlog.revlog):'
93 93 node,
94 94 )
95 95 self.index.append(e)
96 self.nodemap[node] = n
97 96 self.bundlerevs.add(n)
98 97 n += 1
99 98
@@ -55,6 +55,12 b' class BaseIndexObject(object):'
55 55 nodemap[n] = r
56 56 return nodemap
57 57
58 def _stripnodes(self, start):
59 if 'nodemap' in vars(self):
60 for r in range(start, len(self)):
61 n = self[r][7]
62 del self.nodemap[n]
63
58 64 def clearcaches(self):
59 65 self.__dict__.pop('nodemap', None)
60 66
@@ -103,6 +109,7 b' class IndexObject(BaseIndexObject):'
103 109 raise ValueError(b"deleting slices only supports a:-1 with step 1")
104 110 i = i.start
105 111 self._check_index(i)
112 self._stripnodes(i)
106 113 if i < self._lgt:
107 114 self._data = self._data[: i * indexsize]
108 115 self._lgt = i
@@ -140,6 +147,7 b' class InlinedIndexObject(BaseIndexObject'
140 147 raise ValueError(b"deleting slices only supports a:-1 with step 1")
141 148 i = i.start
142 149 self._check_index(i)
150 self._stripnodes(i)
143 151 if i < self._lgt:
144 152 self._offsets = self._offsets[:i]
145 153 self._lgt = i
@@ -217,6 +217,13 b' class revlogoldindex(list):'
217 217 self.nodemap[tup[7]] = len(self)
218 218 super(revlogoldindex, self).append(tup)
219 219
220 def __delitem__(self, i):
221 if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
222 raise ValueError(b"deleting slices only supports a:-1 with step 1")
223 for r in pycompat.xrange(i.start, len(self)):
224 del self.nodemap[self[r][7]]
225 super(revlogoldindex, self).__delitem__(i)
226
220 227 def clearcaches(self):
221 228 self.__dict__.pop('nodemap', None)
222 229
@@ -2431,8 +2438,6 b' class revlog(object):'
2431 2438 self._revisioncache = None
2432 2439 self._chaininfocache = {}
2433 2440 self._chunkclear()
2434 for x in pycompat.xrange(rev, len(self)):
2435 del self.nodemap[self.node(x)]
2436 2441
2437 2442 del self.index[rev:-1]
2438 2443 self._nodepos = None
@@ -83,7 +83,6 b' class unionrevlog(revlog.revlog):'
83 83 node,
84 84 )
85 85 self.index.append(e)
86 self.nodemap[node] = n
87 86 self.bundlerevs.add(n)
88 87 n += 1
89 88
General Comments 0
You need to be logged in to leave comments. Login now