mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-17 00:10:39 +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
|
||||
fi
|
||||
|
||||
# clone to a git repo with git
|
||||
git_clone_git () {
|
||||
git_clone () {
|
||||
git clone -q "hg::$1" $2 &&
|
||||
(
|
||||
cd $2 &&
|
||||
@@ -36,8 +35,7 @@ git_clone_git () {
|
||||
)
|
||||
}
|
||||
|
||||
# clone to an hg repo with git
|
||||
hg_clone_git () {
|
||||
hg_clone () {
|
||||
(
|
||||
hg init $2 &&
|
||||
hg -R $2 bookmark -i master &&
|
||||
@@ -48,8 +46,7 @@ hg_clone_git () {
|
||||
(cd $2 && hg -q update)
|
||||
}
|
||||
|
||||
# push an hg repo with git
|
||||
hg_push_git () {
|
||||
hg_push () {
|
||||
(
|
||||
cd $2
|
||||
git checkout -q -b tmp &&
|
||||
@@ -70,43 +67,34 @@ git_log () {
|
||||
}
|
||||
|
||||
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 () {
|
||||
for x in git
|
||||
do
|
||||
hg_log hgrepo2-$x > "hg-log-$x" &&
|
||||
git_log gitrepo-$x > "git-log-$x"
|
||||
done &&
|
||||
hg_log hgrepo2 > hg-log &&
|
||||
git_log gitrepo > git-log &&
|
||||
|
||||
test_cmp_expected hg-log &&
|
||||
test_cmp_expected git-log
|
||||
}
|
||||
|
||||
cmp_hg_to_git_log_hgrepo1 () {
|
||||
for x in git
|
||||
do
|
||||
git_clone_$x hgrepo1 gitrepo-$x &&
|
||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
||||
done &&
|
||||
git_clone hgrepo1 gitrepo &&
|
||||
hg_clone gitrepo hgrepo2 &&
|
||||
|
||||
cmp_hg_to_git_log
|
||||
}
|
||||
|
||||
cmp_hg_to_git_manifest () {
|
||||
for x in git
|
||||
do
|
||||
(
|
||||
hg_clone_$x gitrepo hgrepo-$x &&
|
||||
cd hgrepo-$x &&
|
||||
hg_clone gitrepo hgrepo &&
|
||||
cd hgrepo &&
|
||||
hg_log . &&
|
||||
eval "$1"
|
||||
) > "output-$x" &&
|
||||
) > output &&
|
||||
|
||||
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
||||
git_log gitrepo2-$x > "log-$x"
|
||||
done &&
|
||||
git_clone hgrepo gitrepo2 &&
|
||||
git_log gitrepo2 > log &&
|
||||
|
||||
test_cmp_expected output &&
|
||||
test_cmp_expected log
|
||||
@@ -291,14 +279,11 @@ test_expect_success 'encoding' '
|
||||
git commit -m "add déltà"
|
||||
) &&
|
||||
|
||||
for x in git
|
||||
do
|
||||
hg_clone_$x gitrepo hgrepo-$x &&
|
||||
git_clone_$x hgrepo-$x gitrepo2-$x &&
|
||||
hg_clone gitrepo hgrepo &&
|
||||
git_clone hgrepo gitrepo2 &&
|
||||
|
||||
HGENCODING=utf-8 hg_log hgrepo-$x > "hg-log-$x" &&
|
||||
git_log gitrepo2-$x > "git-log-$x"
|
||||
done &&
|
||||
HGENCODING=utf-8 hg_log hgrepo > hg-log &&
|
||||
git_log gitrepo2 > git-log &&
|
||||
|
||||
test_cmp_expected hg-log &&
|
||||
test_cmp_expected git-log
|
||||
@@ -343,21 +328,16 @@ test_expect_success 'git tags' '
|
||||
git tag -a -m "added tag beta" beta
|
||||
) &&
|
||||
|
||||
for x in git
|
||||
do
|
||||
hg_clone_$x gitrepo hgrepo-$x &&
|
||||
hg_log hgrepo-$x > "log-$x"
|
||||
done &&
|
||||
hg_clone gitrepo hgrepo &&
|
||||
hg_log hgrepo > log &&
|
||||
|
||||
test_cmp_expected log
|
||||
'
|
||||
|
||||
test_expect_success 'hg author' '
|
||||
for x in git
|
||||
do
|
||||
(
|
||||
git init -q gitrepo-$x &&
|
||||
cd gitrepo-$x &&
|
||||
git init -q gitrepo &&
|
||||
cd gitrepo &&
|
||||
|
||||
echo alpha > alpha &&
|
||||
git add alpha &&
|
||||
@@ -366,8 +346,8 @@ test_expect_success 'hg author' '
|
||||
) &&
|
||||
|
||||
(
|
||||
hg_clone_$x gitrepo-$x hgrepo-$x &&
|
||||
cd hgrepo-$x &&
|
||||
hg_clone gitrepo hgrepo &&
|
||||
cd hgrepo &&
|
||||
|
||||
hg co master &&
|
||||
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_push_$x hgrepo-$x gitrepo-$x &&
|
||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
||||
done &&
|
||||
hg_push hgrepo gitrepo &&
|
||||
hg_clone gitrepo hgrepo2 &&
|
||||
|
||||
cmp_hg_to_git_log
|
||||
'
|
||||
|
||||
test_expect_success 'hg branch' '
|
||||
for x in git
|
||||
do
|
||||
(
|
||||
git init -q gitrepo-$x &&
|
||||
cd gitrepo-$x &&
|
||||
git init -q gitrepo &&
|
||||
cd gitrepo &&
|
||||
|
||||
echo alpha > 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 mv alpha 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_push_$x hgrepo-$x gitrepo-$x &&
|
||||
hg_clone_$x gitrepo-$x hgrepo2-$x
|
||||
done &&
|
||||
hg_push hgrepo gitrepo &&
|
||||
hg_clone gitrepo hgrepo2 &&
|
||||
|
||||
cmp_hg_to_git_log
|
||||
'
|
||||
|
||||
test_expect_success 'hg tags' '
|
||||
for x in git
|
||||
do
|
||||
(
|
||||
git init -q gitrepo-$x &&
|
||||
cd gitrepo-$x &&
|
||||
git init -q gitrepo &&
|
||||
cd gitrepo &&
|
||||
|
||||
echo alpha > 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 tag alpha
|
||||
) &&
|
||||
|
||||
hg_push_$x hgrepo-$x gitrepo-$x &&
|
||||
hg_clone_$x gitrepo-$x hgrepo2-$x &&
|
||||
hg_push hgrepo gitrepo &&
|
||||
hg_clone gitrepo hgrepo2 &&
|
||||
|
||||
(
|
||||
git --git-dir=gitrepo-$x/.git tag -l &&
|
||||
hg_log hgrepo2-$x &&
|
||||
cat hgrepo2-$x/.hgtags
|
||||
) > "output-$x"
|
||||
done &&
|
||||
git --git-dir=gitrepo/.git tag -l &&
|
||||
hg_log hgrepo2 &&
|
||||
cat hgrepo2/.hgtags
|
||||
) > output &&
|
||||
|
||||
test_cmp_expected output
|
||||
'
|
||||
|
||||
Reference in New Issue
Block a user