tests/test-pull-pull-corruption
changeset 12481 70ef9b470efe
parent 12480 4a5048c359d7
child 12482 2f8740c639e4
equal deleted inserted replaced
12480:4a5048c359d7 12481:70ef9b470efe
     1 #!/bin/sh
       
     2 #
       
     3 # Corrupt an hg repo with two pulls.
       
     4 #
       
     5 
       
     6 # create one repo with a long history
       
     7 hg init source1
       
     8 cd source1
       
     9 touch foo
       
    10 hg add foo
       
    11 for i in 1 2 3 4 5 6 7 8 9 10; do
       
    12     echo $i >> foo
       
    13     hg ci -m $i
       
    14 done
       
    15 cd ..
       
    16 
       
    17 # create one repo with a shorter history
       
    18 hg clone -r 0 source1 source2
       
    19 cd source2
       
    20 echo a >> foo
       
    21 hg ci -m a
       
    22 cd ..
       
    23 
       
    24 # create a third repo to pull both other repos into it
       
    25 hg init corrupted
       
    26 cd corrupted
       
    27 # use a hook to make the second pull start while the first one is still running
       
    28 echo '[hooks]' >> .hg/hgrc
       
    29 echo 'prechangegroup = sleep 5' >> .hg/hgrc
       
    30 
       
    31 # start a pull...
       
    32 hg pull ../source1 &
       
    33 
       
    34 # ... and start another pull before the first one has finished
       
    35 sleep 1
       
    36 hg pull ../source2 2>/dev/null
       
    37 
       
    38 # see the result
       
    39 wait
       
    40 hg verify
       
    41