Show More
@@ -1,41 +1,70 b'' | |||
|
1 | #!/bin/sh | |
|
2 | # | |
|
3 | # Corrupt an hg repo with two pulls. | |
|
4 | # | |
|
1 | Corrupt an hg repo with two pulls. | |
|
2 | create one repo with a long history | |
|
3 | ||
|
4 | $ hg init source1 | |
|
5 | $ cd source1 | |
|
6 | $ touch foo | |
|
7 | $ hg add foo | |
|
8 | $ for i in 1 2 3 4 5 6 7 8 9 10; do | |
|
9 | > echo $i >> foo | |
|
10 | > hg ci -m $i | |
|
11 | > done | |
|
12 | $ cd .. | |
|
13 | ||
|
14 | create one repo with a shorter history | |
|
5 | 15 | |
|
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 | $ hg clone -r 0 source1 source2 | |
|
17 | requesting all changes | |
|
18 | adding changesets | |
|
19 | adding manifests | |
|
20 | adding file changes | |
|
21 | added 1 changesets with 1 changes to 1 files | |
|
22 | updating to branch default | |
|
23 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
24 | $ cd source2 | |
|
25 | $ echo a >> foo | |
|
26 | $ hg ci -m a | |
|
27 | $ cd .. | |
|
28 | ||
|
29 | create a third repo to pull both other repos into it | |
|
30 | ||
|
31 | $ hg init corrupted | |
|
32 | $ cd corrupted | |
|
33 | ||
|
34 | use a hook to make the second pull start while the first one is still running | |
|
16 | 35 | |
|
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 .. | |
|
36 | $ echo '[hooks]' >> .hg/hgrc | |
|
37 | $ echo 'prechangegroup = sleep 5' >> .hg/hgrc | |
|
38 | ||
|
39 | start a pull... | |
|
40 | ||
|
41 | $ hg pull ../source1 & | |
|
42 | ||
|
43 | ... and start another pull before the first one has finished | |
|
23 | 44 | |
|
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 | |
|
45 | $ sleep 1 | |
|
46 | $ hg pull ../source2 2>/dev/null | |
|
47 | pulling from ../source2 | |
|
48 | pulling from ../source1 | |
|
49 | requesting all changes | |
|
50 | adding changesets | |
|
51 | adding manifests | |
|
52 | adding file changes | |
|
53 | added 10 changesets with 10 changes to 1 files | |
|
54 | (run 'hg update' to get a working copy) | |
|
55 | searching for changes | |
|
56 | adding changesets | |
|
57 | adding manifests | |
|
58 | adding file changes | |
|
59 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
60 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
|
30 | 61 | |
|
31 | # start a pull... | |
|
32 | hg pull ../source1 & | |
|
62 | see the result | |
|
33 | 63 | |
|
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 | ||
|
64 | $ wait | |
|
65 | $ hg verify | |
|
66 | checking changesets | |
|
67 | checking manifests | |
|
68 | crosschecking files in changesets and manifests | |
|
69 | checking files | |
|
70 | 1 files, 11 changesets, 11 total revisions |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now