New tests for round-trip fidelity of merge conflicts resolved using one parent.

First one currently fails.
This commit is contained in:
Christian Walther 2011-05-22 20:49:17 +02:00
parent da1c5f2996
commit 0ce3373b35
4 changed files with 210 additions and 0 deletions

63
tests/test-conflict-1 Executable file
View File

@ -0,0 +1,63 @@
#!/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
# 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 ..

42
tests/test-conflict-1.out Normal file
View File

@ -0,0 +1,42 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging afile
warning: conflicts during merge.
merging afile failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
@ 3:2,1 6c53bc0f062f 1970-01-01 00:00 +0000 test
|\ merge to C
| |
| o 2:0 ea82b67264a1 1970-01-01 00:00 +0000 test
| | A->C
| |
o | 1 7205e83b5a3f 1970-01-01 00:00 +0000 test
|/ A->B
|
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin
Initialized empty Git repository in gitrepo/
pushing to git://localhost/gitrepo
exporting hg objects to git
creating and sending data
Counting objects: 10, done.
Compressing objects: 25% (1/4) Compressing objects: 50% (2/4) Compressing objects: 75% (3/4) Compressing objects: 100% (4/4) Compressing objects: 100% (4/4), done.
Total 10 (delta 0), reused 0 (delta 0)
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% expect the same revision ids as above
@ 3:1,2 6c53bc0f062f 1970-01-01 00:00 +0000 test
|\ merge to C
| |
| o 2:0 7205e83b5a3f 1970-01-01 00:00 +0000 test
| | A->B
| |
o | 1 ea82b67264a1 1970-01-01 00:00 +0000 test
|/ A->C
|
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin

63
tests/test-conflict-2 Executable file
View File

@ -0,0 +1,63 @@
#!/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
# resolve using second parent
echo B > afile
hg resolve -m afile
hg ci -m "merge to B"
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 ..

42
tests/test-conflict-2.out Normal file
View File

@ -0,0 +1,42 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging afile
warning: conflicts during merge.
merging afile failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
@ 3:2,1 120385945d08 1970-01-01 00:00 +0000 test
|\ merge to B
| |
| o 2:0 ea82b67264a1 1970-01-01 00:00 +0000 test
| | A->C
| |
o | 1 7205e83b5a3f 1970-01-01 00:00 +0000 test
|/ A->B
|
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin
Initialized empty Git repository in gitrepo/
pushing to git://localhost/gitrepo
exporting hg objects to git
creating and sending data
Counting objects: 10, done.
Compressing objects: 25% (1/4) Compressing objects: 50% (2/4) Compressing objects: 75% (3/4) Compressing objects: 100% (4/4) Compressing objects: 100% (4/4), done.
Total 10 (delta 0), reused 0 (delta 0)
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% expect the same revision ids as above
@ 3:1,2 120385945d08 1970-01-01 00:00 +0000 test
|\ merge to B
| |
| o 2:0 7205e83b5a3f 1970-01-01 00:00 +0000 test
| | A->B
| |
o | 1 ea82b67264a1 1970-01-01 00:00 +0000 test
|/ A->C
|
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin