Debian Codegraph @

tests/test-clone-pull-corruption.t

raw
1 Corrupt an hg repo with a pull started during an aborted commit
2 Create two repos, so that one of them can pull from the other one.
3
4 $ hg init source
5 $ cd source
6 $ touch foo
7 $ hg add foo
8 $ hg ci -m 'add foo'
9 $ hg clone . ../corrupted
10 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ echo >> foo
13 $ hg ci -m 'change foo'
14
15 Add a hook to wait 5 seconds and then abort the commit
16
17 $ cd ../corrupted
18 $ echo "[hooks]" >> .hg/hgrc
19 $ echo 'pretxncommit = sh -c "sleep 5; exit 1"' >> .hg/hgrc
20
21 start a commit...
22
23 $ touch bar
24 $ hg add bar
25 $ hg ci -m 'add bar' &
26
27 ... and start a pull while the commit is still running
28
29 $ sleep 1
30 $ hg pull ../source 2>/dev/null
31 pulling from ../source
32 transaction abort!
33 rollback completed
34 abort: pretxncommit hook exited with status 1
35 searching for changes
36 adding changesets
37 adding manifests
38 adding file changes
39 added 1 changesets with 1 changes to 1 files
40 new changesets 52998019f625
41 (run 'hg update' to get a working copy)
42
43 see what happened
44
45 $ wait
46 $ hg verify -q
47
48 $ cd ..