tests/test-clone-pull-corruption
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Tue, 20 Jul 2010 14:13:33 +0900
changeset 11631 dbb98d8fbcaf
parent 1785 81ca1a9bd061
permissions -rwxr-xr-x
log: slowpath: only walk specified revision range during preparation Even with --removed, it does not make sense to examine changesets outside of the revision range that was specified by the user: the last phase only yields a subset of (revs), preparation phase hence only has to examine (revs) to fill correctly fncache.

#!/bin/sh
#
# Corrupt an hg repo with a pull started during an aborted commit
#

# Create two repos, so that one of them can pull from the other one.
hg init source
cd source
touch foo
hg add foo
hg ci -m 'add foo'
hg clone . ../corrupted
echo >> foo
hg ci -m 'change foo'

# Add a hook to wait 5 seconds and then abort the commit
cd ../corrupted
echo '[hooks]' >> .hg/hgrc
echo 'pretxncommit = sleep 5; exit 1' >> .hg/hgrc

# start a commit...
touch bar
hg add bar
hg ci -m 'add bar' &

# ... and start a pull while the commit is still running
sleep 1
hg pull ../source 2>/dev/null

# see what happened
wait
hg verify