| 1 |
#require unix-permissions no-root |
| 2 |
|
| 3 |
$ cat > $TESTTMP/dumpjournal.py <<EOF |
| 4 |
> import sys |
| 5 |
> for entry in sys.stdin.read().split('\n'): |
| 6 |
> if entry: |
| 7 |
> print(entry.split('\x00')[0]) |
| 8 |
> EOF |
| 9 |
|
| 10 |
$ echo "[extensions]" >> $HGRCPATH |
| 11 |
$ echo "mq=">> $HGRCPATH |
| 12 |
|
| 13 |
$ teststrip() { |
| 14 |
> hg -q up -C $1 |
| 15 |
> echo % before update $1, strip $2 |
| 16 |
> hg parents |
| 17 |
> chmod -$3 $4 |
| 18 |
> hg strip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/' |
| 19 |
> echo % after update $1, strip $2 |
| 20 |
> chmod +$3 $4 |
| 21 |
> hg verify |
| 22 |
> echo % journal contents |
| 23 |
> if [ -f .hg/store/journal ]; then |
| 24 |
> cat .hg/store/journal | "$PYTHON" $TESTTMP/dumpjournal.py |
| 25 |
> else |
| 26 |
> echo "(no journal)" |
| 27 |
> fi |
| 28 |
> if ls .hg/store/journal >/dev/null 2>&1; then |
| 29 |
> hg recover --verify |
| 30 |
> fi |
| 31 |
> ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/* |
| 32 |
> rm -rf .hg/strip-backup |
| 33 |
> } |
| 34 |
|
| 35 |
$ hg init test |
| 36 |
$ cd test |
| 37 |
$ echo a > a |
| 38 |
$ hg -q ci -m "a" -A |
| 39 |
$ echo b > b |
| 40 |
$ hg -q ci -m "b" -A |
| 41 |
$ echo b2 >> b |
| 42 |
$ hg -q ci -m "b2" -A |
| 43 |
$ echo c > c |
| 44 |
$ hg -q ci -m "c" -A |
| 45 |
$ teststrip 0 2 w .hg/store/data/b.i |
| 46 |
% before update 0, strip 2 |
| 47 |
changeset: 0:cb9a9f314b8b |
| 48 |
user: test |
| 49 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 50 |
summary: a |
| 51 |
|
| 52 |
saved backup bundle |
| 53 |
transaction abort! |
| 54 |
failed to truncate data/b.i |
| 55 |
rollback failed - please run hg recover |
| 56 |
(failure reason: [Errno *] $EACCES$ .hg/store/data/b.i') (glob) |
| 57 |
strip failed, backup bundle |
| 58 |
abort: $EACCES$ .hg/store/data/b.i' |
| 59 |
% after update 0, strip 2 |
| 60 |
abandoned transaction found - run hg recover |
| 61 |
checking changesets |
| 62 |
checking manifests |
| 63 |
crosschecking files in changesets and manifests |
| 64 |
checking files |
| 65 |
b@?: rev 1 points to nonexistent changeset 2 |
| 66 |
(expected 1) |
| 67 |
b@?: 736c29771fba not in manifests |
| 68 |
not checking dirstate because of previous errors |
| 69 |
checked 2 changesets with 3 changes to 2 files |
| 70 |
1 warnings encountered! |
| 71 |
2 integrity errors encountered! |
| 72 |
% journal contents |
| 73 |
00changelog.d |
| 74 |
00changelog.i |
| 75 |
00manifest.i |
| 76 |
data/b.i |
| 77 |
data/c.i |
| 78 |
rolling back interrupted transaction |
| 79 |
checking changesets |
| 80 |
checking manifests |
| 81 |
crosschecking files in changesets and manifests |
| 82 |
checking files |
| 83 |
checking dirstate |
| 84 |
checked 2 changesets with 2 changes to 2 files |
| 85 |
$ teststrip 0 2 r .hg/store/data/b.i |
| 86 |
% before update 0, strip 2 |
| 87 |
changeset: 0:cb9a9f314b8b |
| 88 |
user: test |
| 89 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 90 |
summary: a |
| 91 |
|
| 92 |
abort: $EACCES$ .hg/store/data/b.i' |
| 93 |
% after update 0, strip 2 |
| 94 |
checking changesets |
| 95 |
checking manifests |
| 96 |
crosschecking files in changesets and manifests |
| 97 |
checking files |
| 98 |
checking dirstate |
| 99 |
checked 4 changesets with 4 changes to 3 files |
| 100 |
% journal contents |
| 101 |
(no journal) |
| 102 |
$ teststrip 0 2 w .hg/store/00manifest.i |
| 103 |
% before update 0, strip 2 |
| 104 |
changeset: 0:cb9a9f314b8b |
| 105 |
user: test |
| 106 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 107 |
summary: a |
| 108 |
|
| 109 |
saved backup bundle |
| 110 |
transaction abort! |
| 111 |
failed to truncate 00manifest.i |
| 112 |
rollback failed - please run hg recover |
| 113 |
(failure reason: [Errno *] $EACCES$ .hg/store/00manifest.i') (glob) |
| 114 |
strip failed, backup bundle |
| 115 |
abort: $EACCES$ .hg/store/00manifest.i' |
| 116 |
% after update 0, strip 2 |
| 117 |
abandoned transaction found - run hg recover |
| 118 |
checking changesets |
| 119 |
checking manifests |
| 120 |
manifest@?: rev 2 points to nonexistent changeset 2 |
| 121 |
manifest@?: 3362547cdf64 not in changesets |
| 122 |
manifest@?: rev 3 points to nonexistent changeset 3 |
| 123 |
manifest@?: 265a85892ecb not in changesets |
| 124 |
crosschecking files in changesets and manifests |
| 125 |
c@3: in manifest but not in changeset |
| 126 |
checking files |
| 127 |
b@?: rev 1 points to nonexistent changeset 2 |
| 128 |
(expected 1) |
| 129 |
warning: revlog 'data/c.i' not in fncache! |
| 130 |
c@?: rev 0 points to nonexistent changeset 3 |
| 131 |
not checking dirstate because of previous errors |
| 132 |
checked 2 changesets with 4 changes to 3 files |
| 133 |
2 warnings encountered! |
| 134 |
hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
| 135 |
7 integrity errors encountered! |
| 136 |
(first damaged changeset appears to be 3) |
| 137 |
% journal contents |
| 138 |
00changelog.d |
| 139 |
00changelog.i |
| 140 |
00manifest.i |
| 141 |
data/b.i |
| 142 |
data/c.i |
| 143 |
rolling back interrupted transaction |
| 144 |
checking changesets |
| 145 |
checking manifests |
| 146 |
crosschecking files in changesets and manifests |
| 147 |
checking files |
| 148 |
checking dirstate |
| 149 |
checked 2 changesets with 2 changes to 2 files |
| 150 |
|
| 151 |
$ cd .. |