author | Martin Geisler <mg@lazybytes.net> |
Sat, 19 Jun 2010 17:19:14 +0200 | |
changeset 11392 | a87906461835 |
parent 11197 | 4bb4895e1693 |
permissions | -rwxr-xr-x |
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
1 |
#!/bin/sh |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
2 |
|
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
3 |
echo "[extensions]" >> $HGRCPATH |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
4 |
echo "mq=">> $HGRCPATH |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
5 |
|
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
6 |
teststrip() { |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
7 |
hg -q up -C $1 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
8 |
echo % before update $1, strip $2 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
9 |
hg parents |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
10 |
chmod -$3 $4 |
11197
4bb4895e1693
strip: be quiet about temporary internal bundle
Matt Mackall <mpm@selenic.com>
parents:
9284
diff
changeset
|
11 |
hg strip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/' |
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
12 |
echo % after update $1, strip $2 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
13 |
chmod +$3 $4 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
14 |
hg verify |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
15 |
echo % journal contents |
9284
4a1b24dbf753
test-repair-strip: Don't rely on cat error message
Mads Kiilerich <mads@kiilerich.com>
parents:
8293
diff
changeset
|
16 |
if [ -f .hg/store/journal ]; then |
4a1b24dbf753
test-repair-strip: Don't rely on cat error message
Mads Kiilerich <mads@kiilerich.com>
parents:
8293
diff
changeset
|
17 |
sed -e 's/\.i[^\n]*/\.i/' .hg/store/journal |
4a1b24dbf753
test-repair-strip: Don't rely on cat error message
Mads Kiilerich <mads@kiilerich.com>
parents:
8293
diff
changeset
|
18 |
else |
4a1b24dbf753
test-repair-strip: Don't rely on cat error message
Mads Kiilerich <mads@kiilerich.com>
parents:
8293
diff
changeset
|
19 |
echo "(no journal)" |
4a1b24dbf753
test-repair-strip: Don't rely on cat error message
Mads Kiilerich <mads@kiilerich.com>
parents:
8293
diff
changeset
|
20 |
fi |
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
21 |
ls .hg/store/journal >/dev/null 2>&1 && hg recover |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
22 |
ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/* |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
23 |
rm -rf .hg/strip-backup |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
24 |
} |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
25 |
|
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
26 |
hg init test |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
27 |
cd test |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
28 |
|
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
29 |
echo a > a |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
30 |
hg -q ci -m "a" -A |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
31 |
|
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
32 |
echo b > b |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
33 |
hg -q ci -m "b" -A |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
34 |
|
8293
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
35 |
echo b2 >> b |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
36 |
hg -q ci -m "b2" -A |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
37 |
|
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
38 |
echo c > c |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
39 |
hg -q ci -m "c" -A |
8293
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
40 |
|
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
41 |
teststrip 0 2 w .hg/store/data/b.i |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
42 |
teststrip 0 2 r .hg/store/data/b.i |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
43 |
teststrip 0 2 w .hg/store/00manifest.i |
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
44 |