-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
- Loading branch information
Felipe Contreras
authored and
Jeff King
committed
Nov 4, 2012
1 parent
46cc3ad
commit 7ee719e
Showing
2 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
TESTS := $(wildcard test*.sh) | ||
|
||
export T := $(addprefix $(CURDIR)/,$(TESTS)) | ||
export MAKE := $(MAKE) -e | ||
export PATH := $(CURDIR):$(PATH) | ||
|
||
test: | ||
$(MAKE) -C ../../t $@ | ||
|
||
$(TESTS): | ||
$(MAKE) -C ../../t $(CURDIR)/$@ | ||
|
||
.PHONY: $(TESTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/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' | ||
|
||
. ./test-lib.sh | ||
|
||
if ! test_have_prereq PYTHON; then | ||
skip_all='skipping remote-hg tests; python not available' | ||
test_done | ||
fi | ||
|
||
if ! "$PYTHON_PATH" -c 'import mercurial'; then | ||
skip_all='skipping remote-hg tests; mercurial not available' | ||
test_done | ||
fi | ||
|
||
check () { | ||
(cd $1 && | ||
git log --format='%s' -1 && | ||
git symbolic-ref HEAD) > actual && | ||
(echo $2 && | ||
echo "refs/heads/$3") > expected && | ||
test_cmp expected actual | ||
} | ||
|
||
test_expect_success 'cloning' ' | ||
test_when_finished "rm -rf gitrepo*" && | ||
( | ||
hg init hgrepo && | ||
cd hgrepo && | ||
echo zero > content && | ||
hg add content && | ||
hg commit -m zero | ||
) && | ||
git clone "hg::$PWD/hgrepo" gitrepo && | ||
check gitrepo zero master | ||
' | ||
|
||
test_expect_success 'cloning with branches' ' | ||
test_when_finished "rm -rf gitrepo*" && | ||
( | ||
cd hgrepo && | ||
hg branch next && | ||
echo next > content && | ||
hg commit -m next | ||
) && | ||
git clone "hg::$PWD/hgrepo" gitrepo && | ||
check gitrepo next next && | ||
(cd hgrepo && hg checkout default) && | ||
git clone "hg::$PWD/hgrepo" gitrepo2 && | ||
check gitrepo2 zero master | ||
' | ||
|
||
test_expect_success 'cloning with bookmarks' ' | ||
test_when_finished "rm -rf gitrepo*" && | ||
( | ||
cd hgrepo && | ||
hg bookmark feature-a && | ||
echo feature-a > content && | ||
hg commit -m feature-a | ||
) && | ||
git clone "hg::$PWD/hgrepo" gitrepo && | ||
check gitrepo feature-a feature-a | ||
' | ||
|
||
test_expect_success 'cloning with detached head' ' | ||
test_when_finished "rm -rf gitrepo*" && | ||
( | ||
cd hgrepo && | ||
hg update -r 0 | ||
) && | ||
git clone "hg::$PWD/hgrepo" gitrepo && | ||
check gitrepo zero master | ||
' | ||
|
||
test_expect_success 'update bookmark' ' | ||
test_when_finished "rm -rf gitrepo*" && | ||
( | ||
cd hgrepo && | ||
hg bookmark devel | ||
) && | ||
( | ||
git clone "hg::$PWD/hgrepo" gitrepo && | ||
cd gitrepo && | ||
git checkout devel && | ||
echo devel > content && | ||
git commit -a -m devel && | ||
git push | ||
) && | ||
hg -R hgrepo bookmarks | grep "devel\s\+3:" | ||
' | ||
|
||
test_done |