annotate tests/test-clone-pull-corruption @ 5149:ad6b97132b81

merge: fix a copy detection bug (issue672) When merging rev1 and rev2, we want to search for copies that happened in rev1 but not in rev2 and vice-versa. We were starting the search at rev1/rev2 and then going back, stopping as soon as we reached the revno of the ancestor, but that can miss some cases (see the new test-issue672). Now we calculate the revisions that are ancestors of rev1 or rev2 (but not both) and make sure the search doesn't stop too early. Simplified test provided by mpm, based on a test case provided by Edward Lee.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 12 Aug 2007 12:15:10 -0300
parents 81ca1a9bd061
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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 a pull started during an aborted commit
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 two repos, so that one of them can pull from the other one.
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 hg init source
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8 cd source
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 hg ci -m 'add foo'
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 hg clone . ../corrupted
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 echo >> foo
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14 hg ci -m 'change foo'
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 # Add a hook to wait 5 seconds and then abort the commit
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 cd ../corrupted
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18 echo '[hooks]' >> .hg/hgrc
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 echo 'pretxncommit = sleep 5; exit 1' >> .hg/hgrc
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
20
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
21 # start a commit...
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
22 touch bar
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
23 hg add bar
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
24 hg ci -m 'add bar' &
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
25
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26 # ... and start a pull while the commit is still running
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
27 sleep 1
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
28 hg pull ../source 2>/dev/null
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
29
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
30 # see what happened
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
31 wait
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
32 hg verify