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