Show More
@@ -0,0 +1,32 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # | |||
|
3 | # Corrupt an hg repo with a pull started during an aborted commit | |||
|
4 | # | |||
|
5 | ||||
|
6 | # Create two repos, so that one of them can pull from the other one. | |||
|
7 | hg init source | |||
|
8 | cd source | |||
|
9 | touch foo | |||
|
10 | hg add foo | |||
|
11 | hg ci -m 'add foo' | |||
|
12 | hg clone . ../corrupted | |||
|
13 | echo >> foo | |||
|
14 | hg ci -m 'change foo' | |||
|
15 | ||||
|
16 | # Add a hook to wait 5 seconds and then abort the commit | |||
|
17 | cd ../corrupted | |||
|
18 | echo '[hooks]' >> .hg/hgrc | |||
|
19 | echo 'pretxncommit = sleep 5; exit 1' >> .hg/hgrc | |||
|
20 | ||||
|
21 | # start a commit... | |||
|
22 | touch bar | |||
|
23 | hg add bar | |||
|
24 | hg ci -m 'add bar' & | |||
|
25 | ||||
|
26 | # ... and start a pull while the commit is still running | |||
|
27 | sleep 1 | |||
|
28 | hg pull ../source 2>/dev/null | |||
|
29 | ||||
|
30 | # see what happened | |||
|
31 | wait | |||
|
32 | hg verify |
@@ -0,0 +1,15 b'' | |||||
|
1 | pulling from ../source | |||
|
2 | abort: pretxncommit hook exited with status 1 | |||
|
3 | transaction abort! | |||
|
4 | rollback completed | |||
|
5 | searching for changes | |||
|
6 | adding changesets | |||
|
7 | adding manifests | |||
|
8 | adding file changes | |||
|
9 | added 1 changesets with 1 changes to 1 files | |||
|
10 | (run 'hg update' to get a working copy) | |||
|
11 | checking changesets | |||
|
12 | checking manifests | |||
|
13 | crosschecking files in changesets and manifests | |||
|
14 | checking files | |||
|
15 | 1 files, 2 changesets, 2 total revisions |
@@ -0,0 +1,41 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # | |||
|
3 | # Corrupt an hg repo with two pulls. | |||
|
4 | # | |||
|
5 | ||||
|
6 | # create one repo with a long history | |||
|
7 | hg init source1 | |||
|
8 | cd source1 | |||
|
9 | touch foo | |||
|
10 | hg add foo | |||
|
11 | for i in 1 2 3 4 5 6 7 8 9 10; do | |||
|
12 | echo $i >> foo | |||
|
13 | hg ci -m $i | |||
|
14 | done | |||
|
15 | cd .. | |||
|
16 | ||||
|
17 | # create one repo with a shorter history | |||
|
18 | hg clone -r 0 source1 source2 | |||
|
19 | cd source2 | |||
|
20 | echo a >> foo | |||
|
21 | hg ci -m a | |||
|
22 | cd .. | |||
|
23 | ||||
|
24 | # create a third repo to pull both other repos into it | |||
|
25 | hg init corrupted | |||
|
26 | cd corrupted | |||
|
27 | # use a hook to make the second pull start while the first one is still running | |||
|
28 | echo '[hooks]' >> .hg/hgrc | |||
|
29 | echo 'prechangegroup = sleep 5' >> .hg/hgrc | |||
|
30 | ||||
|
31 | # start a pull... | |||
|
32 | hg pull ../source1 & | |||
|
33 | ||||
|
34 | # ... and start another pull before the first one has finished | |||
|
35 | sleep 1 | |||
|
36 | hg pull ../source2 2>/dev/null | |||
|
37 | ||||
|
38 | # see the result | |||
|
39 | wait | |||
|
40 | hg verify | |||
|
41 |
@@ -0,0 +1,24 b'' | |||||
|
1 | requesting all changes | |||
|
2 | adding changesets | |||
|
3 | adding manifests | |||
|
4 | adding file changes | |||
|
5 | added 1 changesets with 1 changes to 1 files | |||
|
6 | pulling from ../source2 | |||
|
7 | pulling from ../source1 | |||
|
8 | requesting all changes | |||
|
9 | adding changesets | |||
|
10 | adding manifests | |||
|
11 | adding file changes | |||
|
12 | added 10 changesets with 10 changes to 1 files | |||
|
13 | (run 'hg update' to get a working copy) | |||
|
14 | searching for changes | |||
|
15 | adding changesets | |||
|
16 | adding manifests | |||
|
17 | adding file changes | |||
|
18 | added 1 changesets with 1 changes to 1 files (+1 heads) | |||
|
19 | (run 'hg update' to get a working copy) | |||
|
20 | checking changesets | |||
|
21 | checking manifests | |||
|
22 | crosschecking files in changesets and manifests | |||
|
23 | checking files | |||
|
24 | 1 files, 11 changesets, 11 total revisions |
General Comments 0
You need to be logged in to leave comments.
Login now