view tests/test-conflict-1 @ 407:3a58fe455b0b

test-conflict-{1,2}: cope with minor hg output variations
author Augie Fackler <durin42@gmail.com>
date Wed, 25 May 2011 09:25:34 -0500
parents 070f1cfdb80f
children 553dd7078058
line wrap: on
line source

#!/bin/sh

# Fails for some reason, need to investigate
# "$TESTDIR/hghave" git || exit 80

# bail if the user does not have dulwich
python -c 'import dulwich, dulwich.repo' || exit 80

# bail early if the user is already running git-daemon
echo hi | nc localhost 9418 2>/dev/null && exit 80

echo "[extensions]" >> $HGRCPATH
echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
echo 'hgext.graphlog =' >> $HGRCPATH
echo 'hgext.bookmarks =' >> $HGRCPATH

hg init hgrepo1
cd hgrepo1
echo A > afile
hg add afile
hg ci -m "origin"

echo B > afile
hg ci -m "A->B"

hg up -r0
echo C > afile
hg ci -m "A->C"

hg merge -r1 | sed 's/-C ./-C/' | grep -v 'merging afile'
# resolve using first parent
echo C > afile
hg resolve -m afile
hg ci -m "merge to C"

hg log --graph --style compact | sed 's/\[.*\]//g'

cd ..

mkdir gitrepo
cd gitrepo
git init --bare | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')"

# dulwich does not presently support local git repos, workaround
cd ..
git daemon --base-path="$(pwd)"\
 --listen=localhost\
 --export-all\
 --pid-file="$DAEMON_PIDS" \
 --detach --reuseaddr \
 --enable=receive-pack

cd hgrepo1
hg bookmark -r tip master
hg push -r master git://localhost/gitrepo
cd ..

hg clone git://localhost/gitrepo hgrepo2 | grep -v '^updating'
cd hgrepo2
echo % expect the same revision ids as above
hg log --graph --style compact | sed 's/\[.*\]//g'

cd ..