tests/test-clone-pull-corruption
changeset 1785 81ca1a9bd061
equal deleted inserted replaced
1784:2e0a288ca93e 1785:81ca1a9bd061
       
     1 #!/bin/sh
       
     2 #
       
     3 # Corrupt an hg repo with a pull started during an aborted commit
       
     4 #
       
     5 
       
     6 # Create two repos, so that one of them can pull from the other one.
       
     7 hg init source
       
     8 cd source
       
     9 touch foo
       
    10 hg add foo
       
    11 hg ci -m 'add foo'
       
    12 hg clone . ../corrupted
       
    13 echo >> foo
       
    14 hg ci -m 'change foo'
       
    15 
       
    16 # Add a hook to wait 5 seconds and then abort the commit
       
    17 cd ../corrupted
       
    18 echo '[hooks]' >> .hg/hgrc
       
    19 echo 'pretxncommit = sleep 5; exit 1' >> .hg/hgrc
       
    20 
       
    21 # start a commit...
       
    22 touch bar
       
    23 hg add bar
       
    24 hg ci -m 'add bar' &
       
    25 
       
    26 # ... and start a pull while the commit is still running
       
    27 sleep 1
       
    28 hg pull ../source 2>/dev/null
       
    29 
       
    30 # see what happened
       
    31 wait
       
    32 hg verify