. ./test-lib.sh
-if ! test_have_prereq PYTHON; then
+if ! test_have_prereq PYTHON
+then
skip_all='skipping remote-bzr tests; python not available'
test_done
fi
-if ! python -c 'import bzrlib'; then
+if ! python -c 'import bzrlib'
+then
skip_all='skipping remote-bzr tests; bzr not available'
test_done
fi
check () {
- echo $3 > expected &&
- git --git-dir=$1/.git log --format='%s' -1 $2 > actual
+ echo $3 >expected &&
+ git --git-dir=$1/.git log --format='%s' -1 $2 >actual
test_cmp expected actual
}
(
bzr init bzrrepo &&
cd bzrrepo &&
- echo one > content &&
+ echo one >content &&
bzr add content &&
bzr commit -m one
) &&
test_expect_success 'pulling' '
(
cd bzrrepo &&
- echo two > content &&
+ echo two >content &&
bzr commit -m two
) &&
test_expect_success 'pushing' '
(
cd gitrepo &&
- echo three > content &&
+ echo three >content &&
git commit -a -m three &&
git push
) &&
- echo three > expected &&
- cat bzrrepo/content > actual &&
+ echo three >expected &&
+ cat bzrrepo/content >actual &&
test_cmp expected actual
'
(
cd gitrepo &&
git pull &&
- git log --format="%s" -1 origin/master > actual
+ git log --format="%s" -1 origin/master >actual
) &&
- echo three > expected &&
+ echo three >expected &&
test_cmp expected actual &&
(cd gitrepo && git push && git pull) &&
(
cd bzrrepo &&
- echo four > content &&
+ echo four >content &&
bzr commit -m four
) &&
(
cd gitrepo &&
- echo five > content &&
+ echo five >content &&
git commit -a -m five &&
git push && git pull
) &&
(cd bzrrepo && bzr revert) &&
- echo five > expected &&
- cat bzrrepo/content > actual &&
+ echo five >expected &&
+ cat bzrrepo/content >actual &&
test_cmp expected actual
'
-cat > expected <<EOF
+cat >expected <<\EOF
100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
test_expect_success 'special modes' '
(
cd bzrrepo &&
- echo exec > executable
+ echo exec >executable
chmod +x executable &&
bzr add executable
bzr commit -m exec &&
(
cd gitrepo &&
git pull
- git ls-tree HEAD > ../actual
+ git ls-tree HEAD >../actual
) &&
test_cmp expected actual &&
(
cd gitrepo &&
- git cat-file -p HEAD:link > ../actual
+ git cat-file -p HEAD:link >../actual
) &&
- printf content > expected &&
+ printf content >expected &&
test_cmp expected actual
'
-cat > expected <<EOF
+cat >expected <<\EOF
100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
(
cd bzrrepo &&
mkdir movedir &&
- echo one > movedir/one &&
- echo two > movedir/two &&
+ echo one >movedir/one &&
+ echo two >movedir/two &&
bzr add movedir &&
bzr commit -m movedir &&
bzr mv movedir movedir-new &&
(
cd gitrepo &&
git pull &&
- git ls-tree HEAD > ../actual
+ git ls-tree HEAD >../actual
) &&
test_cmp expected actual
test_expect_success 'different authors' '
(
cd bzrrepo &&
- echo john >> content &&
+ echo john >>content &&
bzr commit -m john \
--author "Jane Rey <jrey@example.com>" \
--author "John Doe <jdoe@example.com>"
(
cd gitrepo &&
git pull &&
- git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
+ git show --format="%an <%ae>, %cn <%ce>" --quiet >../actual
) &&
- echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
+ echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" >expected &&
test_cmp expected actual
'
bzr init bzrrepo &&
cd bzrrepo &&
- echo test >> "ærø" &&
+ echo test >>"ærø" &&
bzr add "ærø" &&
- echo test >> "ø~?" &&
+ echo test >>"ø~?" &&
bzr add "ø~?" &&
bzr commit -m add-utf-8 &&
- echo test >> "ærø" &&
+ echo test >>"ærø" &&
bzr commit -m test-utf-8 &&
bzr rm "ø~?" &&
bzr mv "ærø" "ø~?" &&
(
git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
- git -c core.quotepath=false ls-files > ../actual
+ git -c core.quotepath=false ls-files >../actual
) &&
- echo "ø~?" > expected &&
+ echo "ø~?" >expected &&
test_cmp expected actual
'
bzr init bzrrepo &&
cd bzrrepo &&
- echo one >> content &&
+ echo one >>content &&
bzr add content &&
bzr commit -m one
) &&
git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
- echo test >> "ærø" &&
+ echo test >>"ærø" &&
git add "ærø" &&
git commit -m utf-8 &&
git push
) &&
- (cd bzrrepo && bzr ls > ../actual) &&
- printf "content\nærø\n" > expected &&
+ (cd bzrrepo && bzr ls >../actual) &&
+ printf "content\nærø\n" >expected &&
test_cmp expected actual
'
(
bzr init bzrrepo &&
cd bzrrepo &&
- echo one > content &&
+ echo one >content &&
bzr add content &&
bzr commit -m one
) &&
(
cd bzrrepo &&
- echo two > content &&
+ echo two >content &&
bzr commit -m two
) &&
(
cd gitrepo &&
- echo three > content &&
+ echo three >content &&
git commit -a -m three &&
git fetch &&
git merge origin/master || true &&
- echo three > content &&
+ echo three >content &&
git commit -a --no-edit &&
git push
) &&
- echo three > expected &&
- cat bzrrepo/content > actual &&
+ echo three >expected &&
+ cat bzrrepo/content >actual &&
test_cmp expected actual
'
-cat > expected <<EOF
+cat >expected <<\EOF
origin/HEAD
origin/branch
origin/trunk
(
bzr init bzrrepo/trunk &&
cd bzrrepo/trunk &&
- echo one >> content &&
+ echo one >>content &&
bzr add content &&
bzr commit -m one
) &&
(
bzr branch bzrrepo/trunk bzrrepo/branch &&
cd bzrrepo/branch &&
- echo two >> content &&
+ echo two >>content &&
bzr commit -m one
) &&
(
git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
- git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
+ git for-each-ref --format "%(refname:short)" refs/remotes/origin >../actual
) &&
test_cmp expected actual
bzr init bzrrepo &&
cd bzrrepo &&
- echo one >> content &&
+ echo one >>content &&
bzr add content &&
bzr commit -m one &&
- echo two >> content &&
+ echo two >>content &&
bzr commit -m two
) &&
cd bzrrepo &&
bzr uncommit --force &&
- echo three >> content &&
+ echo three >>content &&
bzr commit -m three &&
- echo four >> content &&
+ echo four >>content &&
bzr commit -m four &&
- bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
+ bzr log --line | sed -e "s/^[0-9][0-9]*: //" >../expected
) &&
(
cd gitrepo &&
git fetch &&
- git log --format="%an %ad %s" --date=short origin/master > ../actual
+ git log --format="%an %ad %s" --date=short origin/master >../actual
) &&
test_cmp expected actual
(
git init gitrepo &&
cd gitrepo &&
- echo greg >> content &&
+ echo greg >>content &&
git add content &&
git commit -m one &&
git remote add bzr "bzr::../bzrrepo" &&
(
cd bzrrepo &&
- bzr log | grep "^committer: " > ../actual
+ bzr log | grep "^committer: " >../actual
) &&
- echo "committer: Grégoire <committer@example.com>" > expected &&
+ echo "committer: Grégoire <committer@example.com>" >expected &&
test_cmp expected actual
'
. ./test-lib.sh
-if ! test_have_prereq PYTHON; then
+if ! test_have_prereq PYTHON
+then
skip_all='skipping remote-hg tests; python not available'
test_done
fi
-if ! python -c 'import mercurial'; then
+if ! python -c 'import mercurial'
+then
skip_all='skipping remote-hg tests; mercurial not available'
test_done
fi
git checkout -q -b tmp &&
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
git checkout -q @{-1} &&
- git branch -q -D tmp 2> /dev/null || true
+ git branch -q -D tmp 2>/dev/null || true
)
}
echo "tag = -d \"0 0\""
echo "[extensions]"
echo "graphlog ="
- ) >> "$HOME"/.hgrc &&
+ ) >>"$HOME"/.hgrc &&
git config --global remote-hg.hg-git-compat true
git config --global remote-hg.track-branches true
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add älphà" &&
GIT_AUTHOR_NAME="tést èncödîng" &&
export GIT_AUTHOR_NAME &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta" &&
- echo gamma > gamma &&
+ echo gamma >gamma &&
git add gamma &&
git commit -m "add gämmâ" &&
: TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
+ echo delta >delta &&
git add delta &&
git commit -m "add déltà"
) &&
git_clone hgrepo gitrepo2 &&
hg_clone gitrepo2 hgrepo2 &&
- HGENCODING=utf-8 hg_log hgrepo > expected &&
- HGENCODING=utf-8 hg_log hgrepo2 > actual &&
+ HGENCODING=utf-8 hg_log hgrepo >expected &&
+ HGENCODING=utf-8 hg_log hgrepo2 >actual &&
test_cmp expected actual
'
(
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta"
mkdir foo &&
- echo blah > foo/bar &&
+ echo blah >foo/bar &&
git add foo &&
git commit -m "add foo" &&
git rm alpha &&
git_clone hgrepo gitrepo2 &&
hg_clone gitrepo2 hgrepo2 &&
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
+ hg_log hgrepo >expected &&
+ hg_log hgrepo2 >actual &&
test_cmp expected actual
'
git init -q gitrepo &&
cd gitrepo &&
git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
git tag alpha &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta" &&
git tag -a -m "added tag beta" beta
git_clone hgrepo gitrepo2 &&
hg_clone gitrepo2 hgrepo2 &&
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
+ hg_log hgrepo >expected &&
+ hg_log hgrepo2 >actual &&
test_cmp expected actual
'
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -q -m "add alpha" &&
git checkout -q -b not-master
: Back to the common revision &&
(cd hgrepo && hg checkout default) &&
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
+ hg_log hgrepo >expected &&
+ hg_log hgrepo2 >actual &&
test_cmp expected actual
'
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
git checkout -q -b not-master
hg_push hgrepo gitrepo &&
hg_clone gitrepo hgrepo2 &&
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
+ hg_log hgrepo >expected &&
+ hg_log hgrepo2 >actual &&
test_cmp expected actual
'
. ./test-lib.sh
-if ! test_have_prereq PYTHON; then
+if ! test_have_prereq PYTHON
+then
skip_all='skipping remote-hg tests; python not available'
test_done
fi
-if ! python -c 'import mercurial'; then
+if ! python -c 'import mercurial'
+then
skip_all='skipping remote-hg tests; mercurial not available'
test_done
fi
-if ! python -c 'import hggit'; then
+if ! python -c 'import hggit'
+then
skip_all='skipping remote-hg tests; hg-git not available'
test_done
fi
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
git branch -D default &&
git checkout -q @{-1} &&
- git branch -q -D tmp 2> /dev/null || true
+ git branch -q -D tmp 2>/dev/null || true
)
}
echo "hgext.bookmarks ="
echo "hggit ="
echo "graphlog ="
- ) >> "$HOME"/.hgrc &&
+ ) >>"$HOME"/.hgrc &&
git config --global receive.denycurrentbranch warn
git config --global remote-hg.hg-git-compat true
git config --global remote-hg.track-branches false
(
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
chmod 0644 alpha &&
git add alpha &&
git commit -m "add alpha" &&
git commit -m "clear executable bit"
) &&
- for x in hg git; do
+ for x in hg git
+ do
(
hg_clone_$x gitrepo hgrepo-$x &&
cd hgrepo-$x &&
hg_log . &&
hg manifest -r 1 -v &&
hg manifest -v
- ) > output-$x &&
+ ) >output-$x &&
git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
+ git_log gitrepo2-$x >log-$x
done &&
test_cmp output-hg output-git &&
(
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
ln -s alpha beta &&
git commit -m "add beta"
) &&
- for x in hg git; do
+ for x in hg git
+ do
(
hg_clone_$x gitrepo hgrepo-$x &&
cd hgrepo-$x &&
hg_log . &&
hg manifest -v
- ) > output-$x &&
+ ) >output-$x &&
git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
+ git_log gitrepo2-$x >log-$x
done &&
test_cmp output-hg output-git &&
(
hg init hgrepo1 &&
cd hgrepo1 &&
- echo A > afile &&
+ echo A >afile &&
hg add afile &&
hg ci -m "origin" &&
- echo B > afile &&
+ echo B >afile &&
hg ci -m "A->B" &&
hg up -r0 &&
- echo C > afile &&
+ echo C >afile &&
hg ci -m "A->C" &&
hg merge -r1 &&
- echo C > afile &&
+ echo C >afile &&
hg resolve -m afile &&
hg ci -m "merge to C"
) &&
- for x in hg git; do
+ for x in hg git
+ do
git_clone_$x hgrepo1 gitrepo-$x &&
hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
+ hg_log hgrepo2-$x >hg-log-$x &&
+ git_log gitrepo-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
(
hg init hgrepo1 &&
cd hgrepo1 &&
- echo A > afile &&
+ echo A >afile &&
hg add afile &&
hg ci -m "origin" &&
- echo B > afile &&
+ echo B >afile &&
hg ci -m "A->B" &&
hg up -r0 &&
- echo C > afile &&
+ echo C >afile &&
hg ci -m "A->C" &&
hg merge -r1 || true &&
- echo B > afile &&
+ echo B >afile &&
hg resolve -m afile &&
hg ci -m "merge to B"
) &&
- for x in hg git; do
+ for x in hg git
+ do
git_clone_$x hgrepo1 gitrepo-$x &&
hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
+ hg_log hgrepo2-$x >hg-log-$x &&
+ git_log gitrepo-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
(
hg init hgrepo1 &&
cd hgrepo1 &&
- echo A > afile &&
+ echo A >afile &&
hg add afile &&
hg ci -m "origin" &&
- echo B > afile &&
+ echo B >afile &&
hg ci -m "A->B" &&
- echo C > afile &&
+ echo C >afile &&
hg ci -m "B->C" &&
hg up -r0 &&
- echo C > afile &&
+ echo C >afile &&
hg ci -m "A->C" &&
hg merge -r2 || true &&
hg ci -m "merge"
) &&
- for x in hg git; do
+ for x in hg git
+ do
git_clone_$x hgrepo1 gitrepo-$x &&
hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
+ hg_log hgrepo2-$x >hg-log-$x &&
+ git_log gitrepo-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add älphà" &&
GIT_AUTHOR_NAME="tést èncödîng" &&
export GIT_AUTHOR_NAME &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta" &&
- echo gamma > gamma &&
+ echo gamma >gamma &&
git add gamma &&
git commit -m "add gämmâ" &&
: TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
+ echo delta >delta &&
git add delta &&
git commit -m "add déltà"
) &&
- for x in hg git; do
+ for x in hg git
+ do
hg_clone_$x gitrepo hgrepo-$x &&
git_clone_$x hgrepo-$x gitrepo2-$x &&
- HGENCODING=utf-8 hg_log hgrepo-$x > hg-log-$x &&
- git_log gitrepo2-$x > git-log-$x
+ HGENCODING=utf-8 hg_log hgrepo-$x >hg-log-$x &&
+ git_log gitrepo2-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
(
git init -q gitrepo &&
cd gitrepo &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta"
mkdir foo &&
- echo blah > foo/bar &&
+ echo blah >foo/bar &&
git add foo &&
git commit -m "add foo" &&
git rm alpha &&
git commit -m "remove foo/bar"
) &&
- for x in hg git; do
+ for x in hg git
+ do
(
hg_clone_$x gitrepo hgrepo-$x &&
cd hgrepo-$x &&
hg_log . &&
hg manifest -r 3 &&
hg manifest
- ) > output-$x &&
+ ) >output-$x &&
git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
+ git_log gitrepo2-$x >log-$x
done &&
test_cmp output-hg output-git &&
git init -q gitrepo &&
cd gitrepo &&
git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
git tag alpha &&
- echo beta > beta &&
+ echo beta >beta &&
git add beta &&
git commit -m "add beta" &&
git tag -a -m "added tag beta" beta
) &&
- for x in hg git; do
+ for x in hg git
+ do
hg_clone_$x gitrepo hgrepo-$x &&
- hg_log hgrepo-$x > log-$x
+ hg_log hgrepo-$x >log-$x
done &&
test_cmp log-hg log-git
test_expect_success 'hg author' '
test_when_finished "rm -rf gitrepo* hgrepo*" &&
- for x in hg git; do
+ for x in hg git
+ do
(
git init -q gitrepo-$x &&
cd gitrepo-$x &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
git checkout -q -b not-master
cd hgrepo-$x &&
hg co master &&
- echo beta > beta &&
+ echo beta >beta &&
hg add beta &&
hg commit -u "test" -m "add beta" &&
- echo gamma >> beta &&
+ echo gamma >>beta &&
hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
- echo gamma > gamma &&
+ echo gamma >gamma &&
hg add gamma &&
hg commit -u "<test@example.com>" -m "add gamma" &&
- echo delta > delta &&
+ echo delta >delta &&
hg add delta &&
hg commit -u "name<test@example.com>" -m "add delta" &&
- echo epsilon > epsilon &&
+ echo epsilon >epsilon &&
hg add epsilon &&
hg commit -u "name <test@example.com" -m "add epsilon" &&
- echo zeta > zeta &&
+ echo zeta >zeta &&
hg add zeta &&
hg commit -u " test " -m "add zeta" &&
- echo eta > eta &&
+ echo eta >eta &&
hg add eta &&
hg commit -u "test < test@example.com >" -m "add eta" &&
- echo theta > theta &&
+ echo theta >theta &&
hg add theta &&
hg commit -u "test >test@example.com>" -m "add theta" &&
- echo iota > iota &&
+ echo iota >iota &&
hg add iota &&
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 &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
+ hg_log hgrepo2-$x >hg-log-$x &&
+ git_log gitrepo-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
test_expect_success 'hg branch' '
test_when_finished "rm -rf gitrepo* hgrepo*" &&
- for x in hg git; do
+ for x in hg git
+ do
(
git init -q gitrepo-$x &&
cd gitrepo-$x &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -q -m "add alpha" &&
git checkout -q -b not-master
hg_push_$x hgrepo-$x gitrepo-$x &&
hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
+ hg_log hgrepo2-$x >hg-log-$x &&
+ git_log gitrepo-$x >git-log-$x
done &&
test_cmp hg-log-hg hg-log-git &&
test_expect_success 'hg tags' '
test_when_finished "rm -rf gitrepo* hgrepo*" &&
- for x in hg git; do
+ for x in hg git
+ do
(
git init -q gitrepo-$x &&
cd gitrepo-$x &&
- echo alpha > alpha &&
+ echo alpha >alpha &&
git add alpha &&
git commit -m "add alpha" &&
git checkout -q -b not-master
git --git-dir=gitrepo-$x/.git tag -l &&
hg_log hgrepo2-$x &&
cat hgrepo2-$x/.hgtags
- ) > output-$x
+ ) >output-$x
done &&
test_cmp output-hg output-git
. ./test-lib.sh
-if ! test_have_prereq PYTHON; then
+if ! test_have_prereq PYTHON
+then
skip_all='skipping remote-hg tests; python not available'
test_done
fi
-if ! python -c 'import mercurial'; then
+if ! python -c 'import mercurial'
+then
skip_all='skipping remote-hg tests; mercurial not available'
test_done
fi
check () {
- echo $3 > expected &&
- git --git-dir=$1/.git log --format='%s' -1 $2 > actual
+ echo $3 >expected &&
+ git --git-dir=$1/.git log --format='%s' -1 $2 >actual
test_cmp expected actual
}
check_branch () {
- if [ -n "$3" ]; then
- echo $3 > expected &&
- hg -R $1 log -r $2 --template '{desc}\n' > actual &&
+ if test -n "$3"
+ then
+ echo $3 >expected &&
+ hg -R $1 log -r $2 --template '{desc}\n' >actual &&
test_cmp expected actual
else
- hg -R $1 branches > out &&
+ hg -R $1 branches >out &&
! grep $2 out
fi
}
check_bookmark () {
- if [ -n "$3" ]; then
- echo $3 > expected &&
- hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual &&
+ if test -n "$3"
+ then
+ echo $3 >expected &&
+ hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' >actual &&
test_cmp expected actual
else
- hg -R $1 bookmarks > out &&
+ hg -R $1 bookmarks >out &&
! grep $2 out
fi
}
local expected_ret=$1 ret=0 ref_ret=0 IFS=':'
shift
- git push origin "$@" 2> error
+ git push origin "$@" 2>error
ret=$?
cat error
echo "username = H G Wells <wells@example.com>"
echo "[extensions]"
echo "mq ="
- ) >> "$HOME"/.hgrc &&
+ ) >>"$HOME"/.hgrc &&
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" &&
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" &&
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero
) &&
(
cd hgrepo &&
hg branch next &&
- echo next > content &&
+ echo next >content &&
hg commit -m next
) &&
cd hgrepo &&
hg checkout default &&
hg bookmark feature-a &&
- echo feature-a > content &&
+ echo feature-a >content &&
hg commit -m feature-a
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git checkout --quiet devel &&
- echo devel > content &&
+ echo devel >content &&
git commit -a -m devel &&
git push --quiet
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git checkout --quiet -b feature-b &&
- echo feature-b > content &&
+ echo feature-b >content &&
git commit -a -m feature-b &&
git push --quiet origin feature-b
) &&
rm -rf hgrepo
author_test () {
- echo $1 >> content &&
+ echo $1 >>content &&
hg commit -u "$2" -m "add $1" &&
- echo "$3" >> ../expected
+ echo "$3" >>../expected
}
test_expect_success 'authors' '
touch content &&
hg add content &&
- > ../expected &&
+ >../expected &&
author_test alpha "" "H G Wells <wells@example.com>" &&
author_test beta "test" "test <unknown>" &&
author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&
) &&
git clone "hg::hgrepo" gitrepo &&
- git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual &&
+ git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" >actual &&
test_cmp expected actual
'
hg init hgrepo &&
cd hgrepo &&
- echo one >> content &&
+ echo one >>content &&
hg add content &&
hg commit -m one &&
- echo two >> content &&
+ echo two >>content &&
hg commit -m two
) &&
cd hgrepo &&
hg strip 1 &&
- echo three >> content &&
+ echo three >>content &&
hg commit -m three &&
- echo four >> content &&
+ echo four >>content &&
hg commit -m four
) &&
(
cd gitrepo &&
git fetch &&
- git log --format="%s" origin/master > ../actual
+ git log --format="%s" origin/master >../actual
) &&
- hg -R hgrepo log --template "{desc}\n" > expected &&
+ hg -R hgrepo log --template "{desc}\n" >expected &&
test_cmp actual expected
'
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero &&
hg bookmark master &&
- echo one > content &&
+ echo one >content &&
hg commit -m one
) &&
(
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
- echo two > content &&
+ echo two >content &&
git commit -a -m two &&
git push
) &&
check_branch hgrepo default two
'
-cat > expected <<EOF
+cat >expected <<\EOF
changeset: 0:6e2126489d3d
tag: tip
user: A U Thor <author@example.com>
git init gitrepo &&
cd gitrepo &&
git remote add origin "hg::../hgrepo" &&
- echo one > content &&
+ echo one >content &&
git add content &&
git commit -a -m one &&
git push origin master
) &&
- hg -R hgrepo log > actual &&
+ hg -R hgrepo log >actual &&
cat actual &&
test_cmp expected actual &&
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git checkout --quiet devel &&
- echo devel > content &&
+ echo devel >content &&
git commit -a -m devel &&
git push --quiet
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git checkout --quiet -b feature-b &&
- echo feature-b > content &&
+ echo feature-b >content &&
git commit -a -m feature-b &&
git push --quiet origin feature-b
) &&
(
cd hgrepo &&
hg checkout default &&
- echo bump > content &&
+ echo bump >content &&
hg commit -m bump
) &&
(
cd gitrepo &&
- echo diverge > content &&
+ echo diverge >content &&
git commit -a -m diverged &&
- check_push 1 <<-EOF
+ check_push 1 <<-\EOF
master:non-fast-forward
EOF
) &&
(
cd hgrepo &&
- echo "bump bookmark" > content &&
+ echo "bump bookmark" >content &&
hg commit -m "bump bookmark"
) &&
(
cd gitrepo &&
git checkout --quiet diverge &&
- echo diverge > content &&
+ echo diverge >content &&
git commit -a -m diverge &&
- check_push 1 <<-EOF
+ check_push 1 <<-\EOF
diverge:fetch-first
EOF
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git checkout --quiet -b feature-c HEAD^ &&
- echo feature-c > content &&
+ echo feature-c >content &&
git commit -a -m feature-c &&
git push --quiet origin feature-c
) &&
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero &&
hg bookmark bad_bmark1 &&
- echo one > content &&
+ echo one >content &&
hg commit -m one &&
hg bookmark bad_bmark2 &&
hg bookmark good_bmark &&
hg bookmark -i good_bmark &&
hg -q branch good_branch &&
- echo "good branch" > content &&
+ echo "good branch" >content &&
hg commit -m "good branch" &&
hg -q branch bad_branch &&
- echo "bad branch" > content &&
+ echo "bad branch" >content &&
hg commit -m "bad branch"
) &&
(
cd gitrepo &&
- echo two > content &&
+ echo two >content &&
git commit -q -a -m two &&
git checkout -q good_bmark &&
- echo three > content &&
+ echo three >content &&
git commit -q -a -m three &&
git checkout -q bad_bmark1 &&
git reset --hard HEAD^ &&
- echo four > content &&
+ echo four >content &&
git commit -q -a -m four &&
git checkout -q bad_bmark2 &&
git reset --hard HEAD^ &&
- echo five > content &&
+ echo five >content &&
git commit -q -a -m five &&
git checkout -q -b new_bmark master &&
- echo six > content &&
+ echo six >content &&
git commit -q -a -m six &&
git checkout -q branches/good_branch &&
- echo seven > content &&
+ echo seven >content &&
git commit -q -a -m seven &&
- echo eight > content &&
+ echo eight >content &&
git commit -q -a -m eight &&
git checkout -q branches/bad_branch &&
git reset --hard HEAD^ &&
- echo nine > content &&
+ echo nine >content &&
git commit -q -a -m nine &&
git checkout -q -b branches/new_branch master &&
- echo ten > content &&
+ echo ten >content &&
git commit -q -a -m ten
)
}
(
cd gitrepo &&
- check_push 1 --all <<-EOF
+ check_push 1 --all <<-\EOF
master
good_bmark
branches/good_branch
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero &&
hg bookmark bad_bmark &&
hg bookmark good_bmark &&
hg bookmark -i good_bmark &&
hg -q branch good_branch &&
- echo "good branch" > content &&
+ echo "good branch" >content &&
hg commit -m "good branch" &&
hg -q branch bad_branch &&
- echo "bad branch" > content &&
+ echo "bad branch" >content &&
hg commit -m "bad branch"
) &&
(
cd hgrepo &&
hg bookmark -f bad_bmark &&
- echo update_bmark > content &&
+ echo update_bmark >content &&
hg commit -m "update bmark"
) &&
(
cd gitrepo &&
- echo two > content &&
+ echo two >content &&
git commit -q -a -m two &&
git checkout -q good_bmark &&
- echo three > content &&
+ echo three >content &&
git commit -q -a -m three &&
git checkout -q bad_bmark &&
- echo four > content &&
+ echo four >content &&
git commit -q -a -m four &&
git checkout -q branches/bad_branch &&
- echo five > content &&
+ echo five >content &&
git commit -q -a -m five &&
- check_push 1 --all <<-EOF &&
+ check_push 1 --all <<-\EOF &&
master
good_bmark
bad_bmark:fetch-first
git fetch &&
- check_push 1 --all <<-EOF
+ check_push 1 --all <<-\EOF
master
good_bmark
bad_bmark:non-fast-forward
(
cd gitrepo &&
- check_push 0 --force --all <<-EOF
+ check_push 0 --force --all <<-\EOF
master
good_bmark
branches/good_branch
(
cd gitrepo &&
- check_push 1 --dry-run --all <<-EOF &&
+ check_push 1 --dry-run --all <<-\EOF &&
master
good_bmark
branches/good_branch
branches/bad_branch:non-fast-forward
EOF
- check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-EOF
+ check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-\EOF
master
good_bmark
branches/good_branch
(
hg init hgrepo &&
cd hgrepo &&
- echo zero > content &&
+ echo zero >content &&
hg add content &&
hg commit -m zero &&
- echo one > content &&
+ echo one >content &&
hg commit -m one
) &&
git clone "hg::hgrepo" gitrepo &&
cd gitrepo &&
git reset --hard HEAD^ &&
- echo two > content &&
+ echo two >content &&
git commit -a -m two &&
test_expect_code 1 git push &&
test_expect_code 1 git push