mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-17 08:20:38 +01:00
test: hg-git: general cleanup
Now that we don't have to run hg-git the code is much simpler. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
109
test/hg-git.t
109
test/hg-git.t
@@ -26,8 +26,7 @@ then
|
|||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clone to a git repo with git
|
git_clone () {
|
||||||
git_clone_git () {
|
|
||||||
git clone -q "hg::$1" $2 &&
|
git clone -q "hg::$1" $2 &&
|
||||||
(
|
(
|
||||||
cd $2 &&
|
cd $2 &&
|
||||||
@@ -36,8 +35,7 @@ git_clone_git () {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# clone to an hg repo with git
|
hg_clone () {
|
||||||
hg_clone_git () {
|
|
||||||
(
|
(
|
||||||
hg init $2 &&
|
hg init $2 &&
|
||||||
hg -R $2 bookmark -i master &&
|
hg -R $2 bookmark -i master &&
|
||||||
@@ -48,8 +46,7 @@ hg_clone_git () {
|
|||||||
(cd $2 && hg -q update)
|
(cd $2 && hg -q update)
|
||||||
}
|
}
|
||||||
|
|
||||||
# push an hg repo with git
|
hg_push () {
|
||||||
hg_push_git () {
|
|
||||||
(
|
(
|
||||||
cd $2
|
cd $2
|
||||||
git checkout -q -b tmp &&
|
git checkout -q -b tmp &&
|
||||||
@@ -70,43 +67,34 @@ git_log () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_cmp_expected () {
|
test_cmp_expected () {
|
||||||
test_cmp "$EXPECTED_DIR/$test_id/$1" "${1}-git"
|
test_cmp "$EXPECTED_DIR/$test_id/$1" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_hg_to_git_log () {
|
cmp_hg_to_git_log () {
|
||||||
for x in git
|
hg_log hgrepo2 > hg-log &&
|
||||||
do
|
git_log gitrepo > git-log &&
|
||||||
hg_log hgrepo2-$x > "hg-log-$x" &&
|
|
||||||
git_log gitrepo-$x > "git-log-$x"
|
|
||||||
done &&
|
|
||||||
|
|
||||||
test_cmp_expected hg-log &&
|
test_cmp_expected hg-log &&
|
||||||
test_cmp_expected git-log
|
test_cmp_expected git-log
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_hg_to_git_log_hgrepo1 () {
|
cmp_hg_to_git_log_hgrepo1 () {
|
||||||
for x in git
|
git_clone hgrepo1 gitrepo &&
|
||||||
do
|
hg_clone gitrepo hgrepo2 &&
|
||||||
git_clone_$x hgrepo1 gitrepo-$x &&
|
|
||||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
|
||||||
done &&
|
|
||||||
|
|
||||||
cmp_hg_to_git_log
|
cmp_hg_to_git_log
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_hg_to_git_manifest () {
|
cmp_hg_to_git_manifest () {
|
||||||
for x in git
|
|
||||||
do
|
|
||||||
(
|
(
|
||||||
hg_clone_$x gitrepo hgrepo-$x &&
|
hg_clone gitrepo hgrepo &&
|
||||||
cd hgrepo-$x &&
|
cd hgrepo &&
|
||||||
hg_log . &&
|
hg_log . &&
|
||||||
eval "$1"
|
eval "$1"
|
||||||
) > "output-$x" &&
|
) > output &&
|
||||||
|
|
||||||
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
git_clone hgrepo gitrepo2 &&
|
||||||
git_log gitrepo2-$x > "log-$x"
|
git_log gitrepo2 > log &&
|
||||||
done &&
|
|
||||||
|
|
||||||
test_cmp_expected output &&
|
test_cmp_expected output &&
|
||||||
test_cmp_expected log
|
test_cmp_expected log
|
||||||
@@ -291,14 +279,11 @@ test_expect_success 'encoding' '
|
|||||||
git commit -m "add déltà"
|
git commit -m "add déltà"
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
for x in git
|
hg_clone gitrepo hgrepo &&
|
||||||
do
|
git_clone hgrepo gitrepo2 &&
|
||||||
hg_clone_$x gitrepo hgrepo-$x &&
|
|
||||||
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
|
||||||
|
|
||||||
HGENCODING=utf-8 hg_log hgrepo-$x > "hg-log-$x" &&
|
HGENCODING=utf-8 hg_log hgrepo > hg-log &&
|
||||||
git_log gitrepo2-$x > "git-log-$x"
|
git_log gitrepo2 > git-log &&
|
||||||
done &&
|
|
||||||
|
|
||||||
test_cmp_expected hg-log &&
|
test_cmp_expected hg-log &&
|
||||||
test_cmp_expected git-log
|
test_cmp_expected git-log
|
||||||
@@ -343,21 +328,16 @@ test_expect_success 'git tags' '
|
|||||||
git tag -a -m "added tag beta" beta
|
git tag -a -m "added tag beta" beta
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
for x in git
|
hg_clone gitrepo hgrepo &&
|
||||||
do
|
hg_log hgrepo > log &&
|
||||||
hg_clone_$x gitrepo hgrepo-$x &&
|
|
||||||
hg_log hgrepo-$x > "log-$x"
|
|
||||||
done &&
|
|
||||||
|
|
||||||
test_cmp_expected log
|
test_cmp_expected log
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'hg author' '
|
test_expect_success 'hg author' '
|
||||||
for x in git
|
|
||||||
do
|
|
||||||
(
|
(
|
||||||
git init -q gitrepo-$x &&
|
git init -q gitrepo &&
|
||||||
cd gitrepo-$x &&
|
cd gitrepo &&
|
||||||
|
|
||||||
echo alpha > alpha &&
|
echo alpha > alpha &&
|
||||||
git add alpha &&
|
git add alpha &&
|
||||||
@@ -366,8 +346,8 @@ test_expect_success 'hg author' '
|
|||||||
) &&
|
) &&
|
||||||
|
|
||||||
(
|
(
|
||||||
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
hg_clone gitrepo hgrepo &&
|
||||||
cd hgrepo-$x &&
|
cd hgrepo &&
|
||||||
|
|
||||||
hg co master &&
|
hg co master &&
|
||||||
echo beta > beta &&
|
echo beta > beta &&
|
||||||
@@ -406,19 +386,16 @@ test_expect_success 'hg author' '
|
|||||||
hg commit -u "test <test <at> example <dot> com>" -m "add iota"
|
hg commit -u "test <test <at> example <dot> com>" -m "add iota"
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
hg_push_$x hgrepo-$x gitrepo-$x &&
|
hg_push hgrepo gitrepo &&
|
||||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
hg_clone gitrepo hgrepo2 &&
|
||||||
done &&
|
|
||||||
|
|
||||||
cmp_hg_to_git_log
|
cmp_hg_to_git_log
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'hg branch' '
|
test_expect_success 'hg branch' '
|
||||||
for x in git
|
|
||||||
do
|
|
||||||
(
|
(
|
||||||
git init -q gitrepo-$x &&
|
git init -q gitrepo &&
|
||||||
cd gitrepo-$x &&
|
cd gitrepo &&
|
||||||
|
|
||||||
echo alpha > alpha &&
|
echo alpha > alpha &&
|
||||||
git add alpha &&
|
git add alpha &&
|
||||||
@@ -427,9 +404,9 @@ test_expect_success 'hg branch' '
|
|||||||
) &&
|
) &&
|
||||||
|
|
||||||
(
|
(
|
||||||
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
hg_clone gitrepo hgrepo &&
|
||||||
|
|
||||||
cd hgrepo-$x &&
|
cd hgrepo &&
|
||||||
hg -q co master &&
|
hg -q co master &&
|
||||||
hg mv alpha beta &&
|
hg mv alpha beta &&
|
||||||
hg -q commit -m "rename alpha to beta" &&
|
hg -q commit -m "rename alpha to beta" &&
|
||||||
@@ -437,19 +414,16 @@ test_expect_success 'hg branch' '
|
|||||||
hg -q commit -m "started branch gamma"
|
hg -q commit -m "started branch gamma"
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
hg_push_$x hgrepo-$x gitrepo-$x &&
|
hg_push hgrepo gitrepo &&
|
||||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
hg_clone gitrepo hgrepo2 &&
|
||||||
done &&
|
|
||||||
|
|
||||||
cmp_hg_to_git_log
|
cmp_hg_to_git_log
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'hg tags' '
|
test_expect_success 'hg tags' '
|
||||||
for x in git
|
|
||||||
do
|
|
||||||
(
|
(
|
||||||
git init -q gitrepo-$x &&
|
git init -q gitrepo &&
|
||||||
cd gitrepo-$x &&
|
cd gitrepo &&
|
||||||
|
|
||||||
echo alpha > alpha &&
|
echo alpha > alpha &&
|
||||||
git add alpha &&
|
git add alpha &&
|
||||||
@@ -458,22 +432,21 @@ test_expect_success 'hg tags' '
|
|||||||
) &&
|
) &&
|
||||||
|
|
||||||
(
|
(
|
||||||
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
hg_clone gitrepo hgrepo &&
|
||||||
|
|
||||||
cd hgrepo-$x &&
|
cd hgrepo &&
|
||||||
hg co master &&
|
hg co master &&
|
||||||
hg tag alpha
|
hg tag alpha
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
hg_push_$x hgrepo-$x gitrepo-$x &&
|
hg_push hgrepo gitrepo &&
|
||||||
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
hg_clone gitrepo hgrepo2 &&
|
||||||
|
|
||||||
(
|
(
|
||||||
git --git-dir=gitrepo-$x/.git tag -l &&
|
git --git-dir=gitrepo/.git tag -l &&
|
||||||
hg_log hgrepo2-$x &&
|
hg_log hgrepo2 &&
|
||||||
cat hgrepo2-$x/.hgtags
|
cat hgrepo2/.hgtags
|
||||||
) > "output-$x"
|
) > output &&
|
||||||
done &&
|
|
||||||
|
|
||||||
test_cmp_expected output
|
test_cmp_expected output
|
||||||
'
|
'
|
||||||
|
|||||||
Reference in New Issue
Block a user