| 1 |
Enable obsolete markers |
| 2 |
|
| 3 |
$ cat >> $HGRCPATH << EOF |
| 4 |
> [experimental] |
| 5 |
> evolution.createmarkers=True |
| 6 |
> [phases] |
| 7 |
> publish=False |
| 8 |
> EOF |
| 9 |
|
| 10 |
Build a repo with some cacheable bits: |
| 11 |
|
| 12 |
$ hg init a |
| 13 |
$ cd a |
| 14 |
|
| 15 |
$ echo a > a |
| 16 |
$ hg ci -qAm0 |
| 17 |
$ hg tag t1 |
| 18 |
$ hg book -i bk1 |
| 19 |
|
| 20 |
$ hg branch -q b2 |
| 21 |
$ hg ci -Am1 |
| 22 |
$ hg tag t2 |
| 23 |
|
| 24 |
$ echo dumb > dumb |
| 25 |
$ hg ci -qAmdumb |
| 26 |
$ hg debugobsolete b1174d11b69e63cb0c5726621a43c859f0858d7f |
| 27 |
1 new obsolescence markers |
| 28 |
obsoleted 1 changesets |
| 29 |
|
| 30 |
$ hg phase -pr t1 |
| 31 |
$ hg phase -fsr t2 |
| 32 |
|
| 33 |
Make a helper function to check cache damage invariants: |
| 34 |
|
| 35 |
- command output shouldn't change |
| 36 |
- cache should be present after first use |
| 37 |
- corruption/repair should be silent (no exceptions or warnings) |
| 38 |
- cache should survive deletion, overwrite, and append |
| 39 |
- unreadable / unwriteable caches should be ignored |
| 40 |
- cache should be rebuilt after corruption |
| 41 |
|
| 42 |
$ damage() { |
| 43 |
> CMD=$1 |
| 44 |
> CACHE=.hg/cache/$2 |
| 45 |
> CLEAN=$3 |
| 46 |
> hg $CMD > before |
| 47 |
> test -f $CACHE || echo "not present" |
| 48 |
> echo bad > $CACHE |
| 49 |
> test -z "$CLEAN" || $CLEAN |
| 50 |
> hg $CMD > after |
| 51 |
> "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption" |
| 52 |
> echo corruption >> $CACHE |
| 53 |
> test -z "$CLEAN" || $CLEAN |
| 54 |
> hg $CMD > after |
| 55 |
> "$RUNTESTDIR/pdiff" before after || echo "*** append corruption" |
| 56 |
> rm $CACHE |
| 57 |
> mkdir $CACHE |
| 58 |
> test -z "$CLEAN" || $CLEAN |
| 59 |
> hg $CMD > after |
| 60 |
> "$RUNTESTDIR/pdiff" before after || echo "*** read-only corruption" |
| 61 |
> test -d $CACHE || echo "*** directory clobbered" |
| 62 |
> rmdir $CACHE |
| 63 |
> test -z "$CLEAN" || $CLEAN |
| 64 |
> hg $CMD > after |
| 65 |
> "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption" |
| 66 |
> test -f $CACHE || echo "not rebuilt" |
| 67 |
> } |
| 68 |
|
| 69 |
Beat up tags caches: |
| 70 |
|
| 71 |
$ damage "tags --hidden" tags2 |
| 72 |
$ damage tags tags2-visible |
| 73 |
$ damage "tag -f t3" hgtagsfnodes1 |
| 74 |
1 new orphan changesets |
| 75 |
1 new orphan changesets |
| 76 |
1 new orphan changesets |
| 77 |
1 new orphan changesets |
| 78 |
1 new orphan changesets |
| 79 |
|
| 80 |
Beat up branch caches: |
| 81 |
|
| 82 |
$ damage branches branch2-base "rm .hg/cache/branch2-[vs]*" |
| 83 |
$ damage branches branch2-served "rm .hg/cache/branch2-[bv]*" |
| 84 |
$ damage branches branch2-visible |
| 85 |
$ damage "log -r branch(.)" rbc-names-v2 |
| 86 |
$ damage "log -r branch(default)" rbc-names-v2 |
| 87 |
$ damage "log -r branch(b2)" rbc-revs-v2 |
| 88 |
|
| 89 |
We currently can't detect an rbc cache with unknown names: |
| 90 |
|
| 91 |
$ damage "log -qr branch(b2)" rbc-names-v2 |
| 92 |
--- before * (glob) |
| 93 |
+++ after * (glob) |
| 94 |
@@ -1,8 +?,0 @@ (glob) |
| 95 |
-2:5fb7d38b9dc4 |
| 96 |
-3:60b597ffdafa |
| 97 |
-4:b1174d11b69e |
| 98 |
-5:6354685872c0 |
| 99 |
-6:5ebc725f1bef |
| 100 |
-7:7b76eec2f273 |
| 101 |
-8:ef3428d9d644 |
| 102 |
-9:ba7a936bc03c |
| 103 |
*** append corruption |