Show More
@@ -35,6 +35,9 b' from .utils import (' | |||
|
35 | 35 | parsers = policy.importmod(r'parsers') |
|
36 | 36 | propertycache = util.propertycache |
|
37 | 37 | |
|
38 | # Allow tests to more easily test the alternate path in manifestdict.fastdelta() | |
|
39 | FASTDELTA_TEXTDIFF_THRESHOLD = 1000 | |
|
40 | ||
|
38 | 41 | def _parse(data): |
|
39 | 42 | # This method does a little bit of excessive-looking |
|
40 | 43 | # precondition checking. This is so that the behavior of this |
@@ -558,7 +561,7 b' class manifestdict(object):' | |||
|
558 | 561 | addbuf = util.buffer(base) |
|
559 | 562 | |
|
560 | 563 | changes = list(changes) |
|
561 |
if len(changes) < |
|
|
564 | if len(changes) < FASTDELTA_TEXTDIFF_THRESHOLD: | |
|
562 | 565 | # start with a readonly loop that finds the offset of |
|
563 | 566 | # each line and creates the deltas |
|
564 | 567 | for f, todelete in changes: |
@@ -201,3 +201,94 b' hg update should warm the cache too' | |||
|
201 | 201 | total cache data size 425 bytes, on-disk 425 bytes |
|
202 | 202 | $ hg log -r '0' --debug | grep 'manifest:' |
|
203 | 203 | manifest: 0:fce2a30dedad1eef4da95ca1dc0004157aa527cf |
|
204 | ||
|
205 | Test file removal (especially with pure). The tests are crafted such that there | |
|
206 | will be contiguous spans of existing entries to ensure that is handled properly. | |
|
207 | (In this case, a.txt, aa.txt and c.txt, cc.txt, and ccc.txt) | |
|
208 | ||
|
209 | $ cat > $TESTTMP/manifest.py <<EOF | |
|
210 | > from mercurial import ( | |
|
211 | > extensions, | |
|
212 | > manifest, | |
|
213 | > ) | |
|
214 | > def extsetup(ui): | |
|
215 | > manifest.FASTDELTA_TEXTDIFF_THRESHOLD = 0 | |
|
216 | > EOF | |
|
217 | $ cat >> $HGRCPATH <<EOF | |
|
218 | > [extensions] | |
|
219 | > manifest = $TESTTMP/manifest.py | |
|
220 | > EOF | |
|
221 | ||
|
222 | BROKEN: Pure removes should actually remove all dropped entries | |
|
223 | ||
|
224 | $ hg init repo | |
|
225 | $ cd repo | |
|
226 | $ echo a > a.txt | |
|
227 | $ echo aa > aa.txt | |
|
228 | $ echo b > b.txt | |
|
229 | $ echo c > c.txt | |
|
230 | $ echo c > cc.txt | |
|
231 | $ echo c > ccc.txt | |
|
232 | $ echo b > d.txt | |
|
233 | $ echo c > e.txt | |
|
234 | $ hg ci -Aqm 'a-e' | |
|
235 | ||
|
236 | $ hg rm b.txt d.txt | |
|
237 | $ hg ci -m 'remove b and d' | |
|
238 | ||
|
239 | $ hg debugdata -m 1 | |
|
240 | a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc) | |
|
241 | aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc) | |
|
242 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) | |
|
243 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
244 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
245 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
246 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) | |
|
247 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
248 | ||
|
249 | $ hg up -C . 2>&1 | grep ValueError || true | |
|
250 | raise ValueError("Manifest lines not in sorted order.") (pure !) | |
|
251 | ValueError: Manifest lines not in sorted order. (pure !) | |
|
252 | ||
|
253 | $ hg verify || true | |
|
254 | checking changesets | |
|
255 | checking manifests | |
|
256 | manifest@1: reading delta c1f6b2f803ac: Non-hexadecimal digit found (pure !) | |
|
257 | crosschecking files in changesets and manifests | |
|
258 | checking files | |
|
259 | 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 | ||
|
263 | $ hg rollback -q --config ui.rollback=True | |
|
264 | $ hg rm b.txt d.txt | |
|
265 | $ echo bb > bb.txt | |
|
266 | ||
|
267 | BROKEN: A mix of adds and removes should remove all dropped entries. | |
|
268 | ||
|
269 | $ hg ci -Aqm 'remove b and d; add bb' | |
|
270 | ||
|
271 | $ hg debugdata -m 1 | |
|
272 | a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc) | |
|
273 | aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc) | |
|
274 | bb.txt\x0004c6faf8a9fdd848a5304dfc1704749a374dff44 (esc) | |
|
275 | c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
276 | cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
277 | ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
278 | \x00.txt\x001e88685f5ddec574a34c70af492f95b6debc8741 (esc) (pure !) | |
|
279 | e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc) | |
|
280 | ||
|
281 | $ hg up -C . 2>&1 | grep ValueError || true | |
|
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 | |
|
287 | checking manifests | |
|
288 | manifest@1: reading delta 0a0385480090: Manifest lines not in sorted order. (pure !) | |
|
289 | crosschecking files in changesets and manifests | |
|
290 | bb.txt@1: in changeset but not in manifest (pure !) | |
|
291 | checking files | |
|
292 | 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