Show More
@@ -126,17 +126,20 b' def _cmp(a, b):' | |||||
126 | return (a > b) - (a < b) |
|
126 | return (a > b) - (a < b) | |
127 |
|
127 | |||
128 | class _lazymanifest(object): |
|
128 | class _lazymanifest(object): | |
129 |
def __init__(self, data, positions=None, extrainfo=None, extradata=None |
|
129 | def __init__(self, data, positions=None, extrainfo=None, extradata=None, | |
|
130 | hasremovals=False): | |||
130 | if positions is None: |
|
131 | if positions is None: | |
131 | self.positions = self.findlines(data) |
|
132 | self.positions = self.findlines(data) | |
132 | self.extrainfo = [0] * len(self.positions) |
|
133 | self.extrainfo = [0] * len(self.positions) | |
133 | self.data = data |
|
134 | self.data = data | |
134 | self.extradata = [] |
|
135 | self.extradata = [] | |
|
136 | self.hasremovals = False | |||
135 | else: |
|
137 | else: | |
136 | self.positions = positions[:] |
|
138 | self.positions = positions[:] | |
137 | self.extrainfo = extrainfo[:] |
|
139 | self.extrainfo = extrainfo[:] | |
138 | self.extradata = extradata[:] |
|
140 | self.extradata = extradata[:] | |
139 | self.data = data |
|
141 | self.data = data | |
|
142 | self.hasremovals = hasremovals | |||
140 |
|
143 | |||
141 | def findlines(self, data): |
|
144 | def findlines(self, data): | |
142 | if not data: |
|
145 | if not data: | |
@@ -244,6 +247,7 b' class _lazymanifest(object):' | |||||
244 | self.extrainfo = self.extrainfo[:needle] + self.extrainfo[needle + 1:] |
|
247 | self.extrainfo = self.extrainfo[:needle] + self.extrainfo[needle + 1:] | |
245 | if cur >= 0: |
|
248 | if cur >= 0: | |
246 | self.data = self.data[:cur] + '\x00' + self.data[cur + 1:] |
|
249 | self.data = self.data[:cur] + '\x00' + self.data[cur + 1:] | |
|
250 | self.hasremovals = True | |||
247 |
|
251 | |||
248 | def __setitem__(self, key, value): |
|
252 | def __setitem__(self, key, value): | |
249 | if not isinstance(key, bytes): |
|
253 | if not isinstance(key, bytes): | |
@@ -279,11 +283,11 b' class _lazymanifest(object):' | |||||
279 | def copy(self): |
|
283 | def copy(self): | |
280 | # XXX call _compact like in C? |
|
284 | # XXX call _compact like in C? | |
281 | return _lazymanifest(self.data, self.positions, self.extrainfo, |
|
285 | return _lazymanifest(self.data, self.positions, self.extrainfo, | |
282 | self.extradata) |
|
286 | self.extradata, self.hasremovals) | |
283 |
|
287 | |||
284 | def _compact(self): |
|
288 | def _compact(self): | |
285 | # hopefully not called TOO often |
|
289 | # hopefully not called TOO often | |
286 | if len(self.extradata) == 0: |
|
290 | if len(self.extradata) == 0 and not self.hasremovals: | |
287 | return |
|
291 | return | |
288 | l = [] |
|
292 | l = [] | |
289 | i = 0 |
|
293 | i = 0 | |
@@ -298,6 +302,16 b' class _lazymanifest(object):' | |||||
298 | i += 1 |
|
302 | i += 1 | |
299 | if i == len(self.positions) or self.positions[i] < 0: |
|
303 | if i == len(self.positions) or self.positions[i] < 0: | |
300 | break |
|
304 | break | |
|
305 | ||||
|
306 | # A removed file has no positions[] entry, but does have an | |||
|
307 | # overwritten first byte. Break out and find the end of the | |||
|
308 | # current good entry/entries if there is a removed file | |||
|
309 | # before the next position. | |||
|
310 | if (self.hasremovals | |||
|
311 | and self.data.find('\n\x00', cur, | |||
|
312 | self.positions[i]) != -1): | |||
|
313 | break | |||
|
314 | ||||
301 | offset += self.positions[i] - cur |
|
315 | offset += self.positions[i] - cur | |
302 | cur = self.positions[i] |
|
316 | cur = self.positions[i] | |
303 | end_cut = self.data.find('\n', cur) |
|
317 | end_cut = self.data.find('\n', cur) | |
@@ -316,6 +330,7 b' class _lazymanifest(object):' | |||||
316 | offset += len(l[-1]) |
|
330 | offset += len(l[-1]) | |
317 | i += 1 |
|
331 | i += 1 | |
318 | self.data = ''.join(l) |
|
332 | self.data = ''.join(l) | |
|
333 | self.hasremovals = False | |||
319 | self.extradata = [] |
|
334 | self.extradata = [] | |
320 |
|
335 | |||
321 | def _pack(self, d): |
|
336 | def _pack(self, d): |
@@ -219,7 +219,7 b' will be contiguous spans of existing ent' | |||||
219 | > manifest = $TESTTMP/manifest.py |
|
219 | > manifest = $TESTTMP/manifest.py | |
220 | > EOF |
|
220 | > EOF | |
221 |
|
221 | |||
222 |
|
|
222 | Pure removes should actually remove all dropped entries | |
223 |
|
223 | |||
224 | $ hg init repo |
|
224 | $ hg init repo | |
225 | $ cd repo |
|
225 | $ cd repo | |
@@ -239,32 +239,25 b' BROKEN: Pure removes should actually rem' | |||||
239 | $ hg debugdata -m 1 |
|
239 | $ hg debugdata -m 1 | |
240 | a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc) |
|
240 | a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc) | |
241 | aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc) |
|
241 | aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc) | |
242 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) |
|
|||
243 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
242 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
244 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
243 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
245 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
244 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
246 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) |
|
|||
247 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
245 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
248 |
|
246 | |||
249 | $ hg up -C . 2>&1 | grep ValueError || true |
|
247 | $ hg up -qC . | |
250 | raise ValueError("Manifest lines not in sorted order.") (pure !) |
|
|||
251 | ValueError: Manifest lines not in sorted order. (pure !) |
|
|||
252 |
|
248 | |||
253 |
$ hg verify |
|
249 | $ hg verify | |
254 | checking changesets |
|
250 | checking changesets | |
255 | checking manifests |
|
251 | checking manifests | |
256 | manifest@1: reading delta c1f6b2f803ac: Non-hexadecimal digit found (pure !) |
|
|||
257 | crosschecking files in changesets and manifests |
|
252 | crosschecking files in changesets and manifests | |
258 | checking files |
|
253 | checking files | |
259 | checked 2 changesets with 8 changes to 8 files |
|
254 | checked 2 changesets with 8 changes to 8 files | |
260 | 1 integrity errors encountered! (pure !) |
|
|||
261 | (first damaged changeset appears to be 1) (pure !) |
|
|||
262 |
|
255 | |||
263 | $ hg rollback -q --config ui.rollback=True |
|
256 | $ hg rollback -q --config ui.rollback=True | |
264 | $ hg rm b.txt d.txt |
|
257 | $ hg rm b.txt d.txt | |
265 | $ echo bb > bb.txt |
|
258 | $ echo bb > bb.txt | |
266 |
|
259 | |||
267 |
|
|
260 | A mix of adds and removes should remove all dropped entries. | |
268 |
|
261 | |||
269 | $ hg ci -Aqm 'remove b and d; add bb' |
|
262 | $ hg ci -Aqm 'remove b and d; add bb' | |
270 |
|
263 | |||
@@ -275,20 +268,11 b' BROKEN: A mix of adds and removes should' | |||||
275 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
268 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
276 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
269 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
277 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
270 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
278 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) |
|
|||
279 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) |
|
271 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
280 |
|
272 | |||
281 | $ hg up -C . 2>&1 | grep ValueError || true |
|
273 | $ hg verify | |
282 | raise ValueError("Manifest lines not in sorted order.") (pure !) |
|
|||
283 | ValueError: Manifest lines not in sorted order. (pure !) |
|
|||
284 |
|
||||
285 | $ hg verify || true |
|
|||
286 | checking changesets |
|
274 | checking changesets | |
287 | checking manifests |
|
275 | checking manifests | |
288 | manifest@1: reading delta 0a0385480090: Manifest lines not in sorted order. (pure !) |
|
|||
289 | crosschecking files in changesets and manifests |
|
276 | crosschecking files in changesets and manifests | |
290 | bb.txt@1: in changeset but not in manifest (pure !) |
|
|||
291 | checking files |
|
277 | checking files | |
292 | checked 2 changesets with 9 changes to 9 files |
|
278 | checked 2 changesets with 9 changes to 9 files | |
293 | 2 integrity errors encountered! (pure !) |
|
|||
294 | (first damaged changeset appears to be 1) (pure !) |
|
General Comments 0
You need to be logged in to leave comments.
Login now