author | David Soria Parra <dsp@php.net> |
Sun, 07 Dec 2008 08:47:02 +0100 | |
changeset 7485 | ecfb683675ed |
parent 1785 | 81ca1a9bd061 |
permissions | -rwxr-xr-x |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 |
#!/bin/sh |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
# |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
3 |
# Corrupt an hg repo with two pulls. |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 |
# |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
6 |
# create one repo with a long history |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 |
hg init source1 |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 |
cd source1 |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 |
touch foo |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 |
hg add foo |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 |
for i in 1 2 3 4 5 6 7 8 9 10; do |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 |
echo $i >> foo |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 |
hg ci -m $i |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
14 |
done |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 |
cd .. |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
16 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
17 |
# create one repo with a shorter history |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
18 |
hg clone -r 0 source1 source2 |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 |
cd source2 |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
20 |
echo a >> foo |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 |
hg ci -m a |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 |
cd .. |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
23 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
24 |
# create a third repo to pull both other repos into it |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
25 |
hg init corrupted |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
26 |
cd corrupted |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
27 |
# use a hook to make the second pull start while the first one is still running |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
28 |
echo '[hooks]' >> .hg/hgrc |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
29 |
echo 'prechangegroup = sleep 5' >> .hg/hgrc |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
30 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
31 |
# start a pull... |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
32 |
hg pull ../source1 & |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
33 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
34 |
# ... and start another pull before the first one has finished |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
35 |
sleep 1 |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
36 |
hg pull ../source2 2>/dev/null |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
37 |
|
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
38 |
# see the result |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
39 |
wait |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
40 |
hg verify |
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
41 |