comparison tests/test-repair-strip @ 8073:e8a28556a0a8

strip: make repair.strip transactional to avoid repository corruption Uses a transaction instance from the local repository to journal the truncation of revlog files, such that if a strip only partially completes, hg recover will be able to finish the truncate of all the files. The potential unbundling of changes that have been backed up to be restored later will, in case of an error, have to be unbundled manually. The difference is that it will be possible to recover the repository state so the unbundle can actually succeed.
author Henrik Stuart <henrik.stuart@edlund.dk>
date Thu, 16 Apr 2009 15:34:03 +0200
parents
children f00573bc93f8
comparison
equal deleted inserted replaced
8072:ecf7795479d5 8073:e8a28556a0a8
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "mq=">> $HGRCPATH
5
6 teststrip() {
7 hg -q up -C $1
8 echo % before update $1, strip $2
9 hg parents
10 chmod -$3 $4
11 hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
12 echo % after update $1, strip $2
13 chmod +$3 $4
14 hg verify
15 echo % journal contents
16 cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/'
17 ls .hg/store/journal >/dev/null 2>&1 && hg recover
18 ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/*
19 rm -rf .hg/strip-backup
20 }
21
22 hg init test
23 cd test
24
25 echo a > a
26 hg -q ci -m "a" -A
27
28 echo b > b
29 hg -q ci -m "b" -A
30
31 echo c > c
32 hg -q ci -m "c" -A
33
34 teststrip 0 1 w .hg/store/data/b.i
35 teststrip 0 1 r .hg/store/data/b.i
36 teststrip 0 1 w .hg/store/00changelog.i