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