2012-11-04 03:13:35 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Felipe Contreras
|
|
|
|
#
|
|
|
|
# Base commands from hg-git tests:
|
|
|
|
# https://bitbucket.org/durin42/hg-git/src
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='Test remote-hg output compared to hg-git'
|
|
|
|
|
2014-04-09 20:50:00 +02:00
|
|
|
test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
|
|
|
|
. "$TEST_DIRECTORY"/test-lib.sh
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
if ! test_have_prereq PYTHON
|
|
|
|
then
|
2012-11-04 03:13:35 +01:00
|
|
|
skip_all='skipping remote-hg tests; python not available'
|
|
|
|
test_done
|
|
|
|
fi
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
if ! python -c 'import mercurial'
|
|
|
|
then
|
2012-11-04 03:13:35 +01:00
|
|
|
skip_all='skipping remote-hg tests; mercurial not available'
|
|
|
|
test_done
|
|
|
|
fi
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
if ! python -c 'import hggit'
|
|
|
|
then
|
2012-11-04 03:13:35 +01:00
|
|
|
skip_all='skipping remote-hg tests; hg-git not available'
|
|
|
|
test_done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# clone to a git repo with git
|
|
|
|
git_clone_git () {
|
2013-05-25 04:29:34 +02:00
|
|
|
git clone -q "hg::$1" $2 &&
|
|
|
|
(cd $2 && git checkout master && git branch -D default)
|
2012-11-04 03:13:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# clone to an hg repo with git
|
|
|
|
hg_clone_git () {
|
|
|
|
(
|
|
|
|
hg init $2 &&
|
2013-04-11 14:23:01 +02:00
|
|
|
hg -R $2 bookmark -i master &&
|
2012-11-04 03:13:35 +01:00
|
|
|
cd $1 &&
|
2013-05-25 04:29:22 +02:00
|
|
|
git push -q "hg::../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
|
2012-11-04 03:13:35 +01:00
|
|
|
) &&
|
|
|
|
|
|
|
|
(cd $2 && hg -q update)
|
|
|
|
}
|
|
|
|
|
|
|
|
# clone to a git repo with hg
|
|
|
|
git_clone_hg () {
|
|
|
|
(
|
|
|
|
git init -q $2 &&
|
|
|
|
cd $1 &&
|
2013-04-11 14:23:02 +02:00
|
|
|
hg bookmark -i -f -r tip master &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg -q push -r master ../$2 || true
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
# clone to an hg repo with hg
|
|
|
|
hg_clone_hg () {
|
|
|
|
hg -q clone $1 $2
|
|
|
|
}
|
|
|
|
|
|
|
|
# push an hg repo with git
|
|
|
|
hg_push_git () {
|
|
|
|
(
|
|
|
|
cd $2
|
|
|
|
git checkout -q -b tmp &&
|
2013-05-25 04:29:22 +02:00
|
|
|
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
|
2013-05-25 04:29:34 +02:00
|
|
|
git branch -D default &&
|
2013-05-25 04:29:23 +02:00
|
|
|
git checkout -q @{-1} &&
|
2013-08-29 23:10:04 +02:00
|
|
|
git branch -q -D tmp 2>/dev/null || true
|
2012-11-04 03:13:35 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
# push an hg git repo with hg
|
|
|
|
hg_push_hg () {
|
|
|
|
(
|
|
|
|
cd $1 &&
|
|
|
|
hg -q push ../$2 || true
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
hg_log () {
|
2013-04-11 14:23:17 +02:00
|
|
|
hg -R $1 log --graph --debug >log &&
|
|
|
|
grep -v 'tag: *default/' log
|
2012-11-04 03:13:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
git_log () {
|
|
|
|
git --git-dir=$1/.git fast-export --branches
|
|
|
|
}
|
|
|
|
|
|
|
|
setup () {
|
|
|
|
(
|
|
|
|
echo "[ui]"
|
|
|
|
echo "username = A U Thor <author@example.com>"
|
|
|
|
echo "[defaults]"
|
|
|
|
echo "backout = -d \"0 0\""
|
|
|
|
echo "commit = -d \"0 0\""
|
|
|
|
echo "debugrawcommit = -d \"0 0\""
|
|
|
|
echo "tag = -d \"0 0\""
|
|
|
|
echo "[extensions]"
|
|
|
|
echo "hgext.bookmarks ="
|
|
|
|
echo "hggit ="
|
2013-04-11 14:23:17 +02:00
|
|
|
echo "graphlog ="
|
2013-08-29 23:10:04 +02:00
|
|
|
) >>"$HOME"/.hgrc &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git config --global receive.denycurrentbranch warn
|
|
|
|
git config --global remote-hg.hg-git-compat true
|
2013-05-14 06:36:26 +02:00
|
|
|
git config --global remote-hg.track-branches false
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-05-17 23:10:08 +02:00
|
|
|
HGEDITOR=true
|
|
|
|
HGMERGE=true
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-04-26 11:17:43 +02:00
|
|
|
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
|
|
|
|
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
|
2013-05-17 23:10:08 +02:00
|
|
|
export HGEDITOR HGMERGE GIT_AUTHOR_DATE GIT_COMMITTER_DATE
|
2012-11-04 03:13:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
setup
|
|
|
|
|
2013-01-15 14:02:39 +01:00
|
|
|
test_expect_success 'executable bit' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2013-01-15 14:02:39 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
git init -q gitrepo &&
|
|
|
|
cd gitrepo &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2013-01-15 14:02:39 +01:00
|
|
|
chmod 0644 alpha &&
|
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
|
|
|
chmod 0755 alpha &&
|
|
|
|
git add alpha &&
|
|
|
|
git commit -m "set executable bit" &&
|
|
|
|
chmod 0644 alpha &&
|
|
|
|
git add alpha &&
|
|
|
|
git commit -m "clear executable bit"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2013-01-15 14:02:39 +01:00
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo hgrepo-$x &&
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
hg_log . &&
|
|
|
|
hg manifest -r 1 -v &&
|
|
|
|
hg manifest -v
|
2013-08-29 23:20:18 +02:00
|
|
|
) >"output-$x" &&
|
2013-01-15 14:02:39 +01:00
|
|
|
|
|
|
|
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
git_log gitrepo2-$x >"log-$x"
|
2013-01-15 14:02:39 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp output-hg output-git &&
|
|
|
|
test_cmp log-hg log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'symlink' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2013-01-15 14:02:39 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
git init -q gitrepo &&
|
|
|
|
cd gitrepo &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2013-01-15 14:02:39 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
|
|
|
ln -s alpha beta &&
|
|
|
|
git add beta &&
|
|
|
|
git commit -m "add beta"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2013-01-15 14:02:39 +01:00
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo hgrepo-$x &&
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
hg_log . &&
|
|
|
|
hg manifest -v
|
2013-08-29 23:20:18 +02:00
|
|
|
) >"output-$x" &&
|
2013-01-15 14:02:39 +01:00
|
|
|
|
|
|
|
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
git_log gitrepo2-$x >"log-$x"
|
2013-01-15 14:02:39 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp output-hg output-git &&
|
|
|
|
test_cmp log-hg log-git
|
|
|
|
'
|
|
|
|
|
2012-11-04 03:13:35 +01:00
|
|
|
test_expect_success 'merge conflict 1' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
hg init hgrepo1 &&
|
|
|
|
cd hgrepo1 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo A >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add afile &&
|
|
|
|
hg ci -m "origin" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo B >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->B" &&
|
|
|
|
|
|
|
|
hg up -r0 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo C >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->C" &&
|
|
|
|
|
2013-05-17 23:10:08 +02:00
|
|
|
hg merge -r1 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo C >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg resolve -m afile &&
|
|
|
|
hg ci -m "merge to C"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
git_clone_$x hgrepo1 gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo2-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge conflict 2' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
hg init hgrepo1 &&
|
|
|
|
cd hgrepo1 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo A >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add afile &&
|
|
|
|
hg ci -m "origin" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo B >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->B" &&
|
|
|
|
|
|
|
|
hg up -r0 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo C >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->C" &&
|
|
|
|
|
|
|
|
hg merge -r1 || true &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo B >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg resolve -m afile &&
|
|
|
|
hg ci -m "merge to B"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
git_clone_$x hgrepo1 gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo2-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'converged merge' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
hg init hgrepo1 &&
|
|
|
|
cd hgrepo1 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo A >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add afile &&
|
|
|
|
hg ci -m "origin" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo B >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->B" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo C >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "B->C" &&
|
|
|
|
|
|
|
|
hg up -r0 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo C >afile &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg ci -m "A->C" &&
|
|
|
|
|
|
|
|
hg merge -r2 || true &&
|
|
|
|
hg ci -m "merge"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
git_clone_$x hgrepo1 gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo2-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'encoding' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
git init -q gitrepo &&
|
|
|
|
cd gitrepo &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add älphà" &&
|
|
|
|
|
2013-04-26 11:17:43 +02:00
|
|
|
GIT_AUTHOR_NAME="tést èncödîng" &&
|
|
|
|
export GIT_AUTHOR_NAME &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo beta >beta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add beta &&
|
|
|
|
git commit -m "add beta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo gamma >gamma &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add gamma &&
|
|
|
|
git commit -m "add gämmâ" &&
|
|
|
|
|
|
|
|
: TODO git config i18n.commitencoding latin-1 &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo delta >delta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add delta &&
|
|
|
|
git commit -m "add déltà"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
hg_clone_$x gitrepo hgrepo-$x &&
|
|
|
|
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
|
|
|
|
2013-08-29 23:20:18 +02:00
|
|
|
HGENCODING=utf-8 hg_log hgrepo-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo2-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'file removal' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
git init -q gitrepo &&
|
|
|
|
cd gitrepo &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo beta >beta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add beta &&
|
|
|
|
git commit -m "add beta"
|
|
|
|
mkdir foo &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo blah >foo/bar &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add foo &&
|
|
|
|
git commit -m "add foo" &&
|
|
|
|
git rm alpha &&
|
|
|
|
git commit -m "remove alpha" &&
|
|
|
|
git rm foo/bar &&
|
|
|
|
git commit -m "remove foo/bar"
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo hgrepo-$x &&
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
hg_log . &&
|
|
|
|
hg manifest -r 3 &&
|
|
|
|
hg manifest
|
2013-08-29 23:20:18 +02:00
|
|
|
) >"output-$x" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
git_log gitrepo2-$x >"log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp output-hg output-git &&
|
|
|
|
test_cmp log-hg log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git tags' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
git init -q gitrepo &&
|
|
|
|
cd gitrepo &&
|
|
|
|
git config receive.denyCurrentBranch ignore &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
|
|
|
git tag alpha &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo beta >beta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add beta &&
|
|
|
|
git commit -m "add beta" &&
|
|
|
|
git tag -a -m "added tag beta" beta
|
|
|
|
) &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
hg_clone_$x gitrepo hgrepo-$x &&
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo-$x >"log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp log-hg log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'hg author' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
(
|
|
|
|
git init -q gitrepo-$x &&
|
|
|
|
cd gitrepo-$x &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
|
|
|
git checkout -q -b not-master
|
|
|
|
) &&
|
|
|
|
|
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
|
|
|
|
hg co master &&
|
2013-08-29 23:10:04 +02:00
|
|
|
echo beta >beta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add beta &&
|
|
|
|
hg commit -u "test" -m "add beta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo gamma >>beta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo gamma >gamma &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add gamma &&
|
|
|
|
hg commit -u "<test@example.com>" -m "add gamma" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo delta >delta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add delta &&
|
|
|
|
hg commit -u "name<test@example.com>" -m "add delta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo epsilon >epsilon &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add epsilon &&
|
|
|
|
hg commit -u "name <test@example.com" -m "add epsilon" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo zeta >zeta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add zeta &&
|
|
|
|
hg commit -u " test " -m "add zeta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo eta >eta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add eta &&
|
|
|
|
hg commit -u "test < test@example.com >" -m "add eta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo theta >theta &&
|
2012-11-04 03:13:35 +01:00
|
|
|
hg add theta &&
|
2012-11-04 03:13:36 +01:00
|
|
|
hg commit -u "test >test@example.com>" -m "add theta" &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo iota >iota &&
|
2012-11-04 03:13:36 +01:00
|
|
|
hg add iota &&
|
|
|
|
hg commit -u "test <test <at> example <dot> com>" -m "add iota"
|
2012-11-04 03:13:35 +01:00
|
|
|
) &&
|
|
|
|
|
|
|
|
hg_push_$x hgrepo-$x gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
|
|
|
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo2-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'hg branch' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
(
|
|
|
|
git init -q gitrepo-$x &&
|
|
|
|
cd gitrepo-$x &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -q -m "add alpha" &&
|
|
|
|
git checkout -q -b not-master
|
|
|
|
) &&
|
|
|
|
|
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
|
|
|
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
hg -q co master &&
|
|
|
|
hg mv alpha beta &&
|
|
|
|
hg -q commit -m "rename alpha to beta" &&
|
|
|
|
hg branch gamma | grep -v "permanent and global" &&
|
|
|
|
hg -q commit -m "started branch gamma"
|
|
|
|
) &&
|
|
|
|
|
|
|
|
hg_push_$x hgrepo-$x gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
|
|
|
|
2013-08-29 23:20:18 +02:00
|
|
|
hg_log hgrepo2-$x >"hg-log-$x" &&
|
|
|
|
git_log gitrepo-$x >"git-log-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp hg-log-hg hg-log-git &&
|
|
|
|
test_cmp git-log-hg git-log-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'hg tags' '
|
2013-05-25 04:29:21 +02:00
|
|
|
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
2012-11-04 03:13:35 +01:00
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
for x in hg git
|
|
|
|
do
|
2012-11-04 03:13:35 +01:00
|
|
|
(
|
|
|
|
git init -q gitrepo-$x &&
|
|
|
|
cd gitrepo-$x &&
|
|
|
|
|
2013-08-29 23:10:04 +02:00
|
|
|
echo alpha >alpha &&
|
2012-11-04 03:13:35 +01:00
|
|
|
git add alpha &&
|
|
|
|
git commit -m "add alpha" &&
|
|
|
|
git checkout -q -b not-master
|
|
|
|
) &&
|
|
|
|
|
|
|
|
(
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
|
|
|
|
|
|
|
cd hgrepo-$x &&
|
|
|
|
hg co master &&
|
|
|
|
hg tag alpha
|
|
|
|
) &&
|
|
|
|
|
|
|
|
hg_push_$x hgrepo-$x gitrepo-$x &&
|
|
|
|
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
|
|
|
|
|
|
|
(
|
|
|
|
git --git-dir=gitrepo-$x/.git tag -l &&
|
|
|
|
hg_log hgrepo2-$x &&
|
|
|
|
cat hgrepo2-$x/.hgtags
|
2013-08-29 23:20:18 +02:00
|
|
|
) >"output-$x"
|
2012-11-04 03:13:35 +01:00
|
|
|
done &&
|
|
|
|
|
|
|
|
test_cmp output-hg output-git
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|