Mercurial > hg
annotate tests/test-repair-strip @ 9116:f90bbf1ea09f
inotify: fix issue1375, add a test.
The biggest problem was the data structure, which did not allow changing
a file into a directory or vice versa. This problem is fixed by b55d44719b47.
The walk() method also had an issue in this case:
- we know 'path' as a directory. inotify server sleeps.
- 'path' is deleted
- 'path' is recreated as a file
- the server catches up here, and see the deletion. it instantiates a scan(),
which in its turn calls for walk(repo, path).
- walk() then assumes that 'path' is a directory and calls os.listdir on it,
which raises an OSError(errno.ENOTDIR)
Catch the error, and yield the file instead of the directory contents.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 13 Jul 2009 16:49:05 +0200 |
parents | f00573bc93f8 |
children | 4a1b24dbf753 |
rev | line source |
---|---|
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 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
11 hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/' |
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 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
16 cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/' |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
17 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
|
18 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
|
19 rm -rf .hg/strip-backup |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
20 } |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
21 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
22 hg init test |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
23 cd test |
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 echo a > a |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
26 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
|
27 |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
28 echo b > b |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
29 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
|
30 |
8293
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
31 echo b2 >> b |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
32 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
|
33 |
8073
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
34 echo c > c |
e8a28556a0a8
strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff
changeset
|
35 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
|
36 |
f00573bc93f8
test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
8073
diff
changeset
|
37 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
|
38 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
|
39 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
|
40 |