Debian Codegraph @

tests/test-pull-pull-corruption.t

raw
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
15
16 $ hg clone -r 0 source1 source2
17 adding changesets
18 adding manifests
19 adding file changes
20 added 1 changesets with 1 changes to 1 files
21 new changesets 495a0ec48aaf
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
35
36 $ echo '[hooks]' >> .hg/hgrc
37 $ echo 'prechangegroup = sleep 5' >> .hg/hgrc
38
39 start a pull...
40
41 $ hg pull ../source1 > pull.out 2>&1 &
42
43 ... and start another pull before the first one has finished
44
45 $ sleep 1
46 $ hg pull ../source2 2>/dev/null
47 pulling from ../source2
48 searching for changes
49 adding changesets
50 adding manifests
51 adding file changes
52 added 1 changesets with 1 changes to 1 files (+1 heads)
53 new changesets ca3c05af513e
54 (run 'hg heads' to see heads, 'hg merge' to merge)
55 $ cat pull.out
56 pulling from ../source1
57 requesting all changes
58 adding changesets
59 adding manifests
60 adding file changes
61 added 10 changesets with 10 changes to 1 files
62 new changesets 495a0ec48aaf:1e7b6c812ca8
63 (run 'hg update' to get a working copy)
64
65 see the result
66
67 $ wait
68 $ hg verify -q
69
70 $ cd ..