tests/test-clone-pull-corruption.t
changeset 12412 2dbb9e5e3454
parent 1785 81ca1a9bd061
child 15445 7cbb81c47025
equal deleted inserted replaced
12411:5d3c28a339cb 12412:2dbb9e5e3454
       
     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 = 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   (run 'hg update' to get a working copy)
       
    41 
       
    42 see what happened
       
    43 
       
    44   $ wait
       
    45   $ hg verify
       
    46   checking changesets
       
    47   checking manifests
       
    48   crosschecking files in changesets and manifests
       
    49   checking files
       
    50   1 files, 2 changesets, 2 total revisions