From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
Daniel Barkalow <barkalow@iabervon.org>,
Jeff King <peff@peff.net>,
Michael J Gruber <git@drmicha.warpmail.net>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v3 5/6] tests: add remote-hg tests
Date: Sun, 21 Oct 2012 19:49:03 +0200 [thread overview]
Message-ID: <1350841744-21564-6-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1350841744-21564-1-git-send-email-felipe.contreras@gmail.com>
>From the original remote-hg.
You need git-remote-hg already in your path to run them.
I'm not proposing to include this patch like this, but should make it easier to
test.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
t/t5801-remote-hg.sh | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)
create mode 100755 t/t5801-remote-hg.sh
diff --git a/t/t5801-remote-hg.sh b/t/t5801-remote-hg.sh
new file mode 100755
index 0000000..2e68372
--- /dev/null
+++ b/t/t5801-remote-hg.sh
@@ -0,0 +1,143 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Sverre Rabbelier
+#
+
+test_description='Test remote-helper import and export commands'
+
+. ./test-lib.sh
+
+if test_have_prereq PYTHON && "$PYTHON_PATH" -c '
+import sys
+if sys.hexversion < 0x02040000:
+ sys.exit(1)
+'
+then
+ :
+else
+ skip_all='skipping git remote-hg tests: requires Python 2.4 or newer'
+ test_done
+fi
+
+if ! type hg >/dev/null 2>&1
+then
+ skip_all='skipping git remote-hg tests: requires hg'
+ test_done
+fi
+
+# Call cmp with the arguments -x ".hg" -x ".git" <left> <right>
+
+vcs_cmp () {
+ $DIFF -u -x ".hg" -x ".git" $1 $2
+}
+
+ROOT=$PWD
+
+test_expect_success 'setup repository' '
+ printf "[ui]\nusername = A U Thor <author@example.com>" > \
+ ${HOME}/.hgrc &&
+ mkdir server &&
+ hg init server/.hg &&
+ hg clone "$ROOT/server" public &&
+ (cd public &&
+ echo content >file &&
+ hg add file &&
+ hg commit -m one &&
+ hg push)
+'
+
+test_expect_success 'cloning from local repo' '
+ git clone "hg::file://${ROOT}/server" localclone &&
+ vcs_cmp public localclone
+'
+
+test_expect_success 'cloning from remote repo' '
+ git clone "hg::remote://${ROOT}/server" clone &&
+ vcs_cmp public clone
+'
+
+test_expect_success 'create new commit on remote' '
+ (cd public &&
+ echo content >>file &&
+ hg commit -A -m two &&
+ hg push)
+'
+
+test_expect_success 'pulling from local repo' '
+ (cd localclone && git pull) &&
+ vcs_cmp public localclone
+'
+
+test_expect_success 'pulling from remote remote' '
+ (cd clone && git pull) &&
+ vcs_cmp public clone
+'
+
+test_expect_success 'pushing to local empty repo' '
+ hg init localempty &&
+ (cd localclone &&
+ git push --all "hg::file://${ROOT}/localempty") &&
+ (cd localempty &&
+ hg up tip) &&
+ vcs_cmp localclone localempty
+'
+
+test_expect_success 'pushing to remote empty repo' '
+ hg init empty &&
+ (cd localclone &&
+ git push --all "hg::remote://${ROOT}/empty") &&
+ (cd empty &&
+ hg up tip) &&
+ vcs_cmp localclone empty
+'
+
+test_expect_success 'pushing to local repo' '
+ (cd localclone &&
+ echo content >>file &&
+ git commit -a -m three &&
+ git push) &&
+ (cd server &&
+ hg up tip) &&
+ vcs_cmp localclone server
+'
+
+test_expect_success 'synch with changes from localclone' '
+ (cd clone &&
+ git pull)
+'
+
+test_expect_success 'pushing remote local repo' '
+ (cd clone &&
+ echo content >>file &&
+ git commit -a -m four &&
+ git push) &&
+ (cd server &&
+ hg up tip) &&
+ vcs_cmp clone server
+'
+
+test_expect_success 'creating new branch' '
+ (cd public &&
+ hg branch different-branch &&
+ echo different >> file &&
+ hg commit -m five &&
+ hg push -f)
+'
+
+test_expect_success 'pull in new branch to local repository' '
+ (cd localclone &&
+ git fetch origin default &&
+ test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
+ git fetch &&
+ git rev-parse --no-revs --verify refs/remotes/origin/different-branch)
+'
+
+test_expect_success 'pull in new branch to remote repository' '
+ (cd clone &&
+ git fetch origin default &&
+ test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
+ git fetch &&
+ git rev-parse --no-revs --verify refs/remotes/origin/different-branch)
+'
+
+test_done
--
1.8.0.rc2.7.g0961fdf.dirty
next prev parent reply other threads:[~2012-10-21 17:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-21 17:48 [PATCH v3 0/6] New remote-hg helper Felipe Contreras
2012-10-21 17:48 ` [PATCH v3 1/6] Add new remote-hg transport helper Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 2/6] remote-hg: add support for pushing Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 3/6] remote-hg: add support for remote pushing Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 4/6] remote-hg: add support for trivial features Felipe Contreras
2012-10-21 17:49 ` Felipe Contreras [this message]
2012-10-21 21:02 ` [PATCH v3 5/6] tests: add remote-hg tests Sverre Rabbelier
2012-10-24 15:47 ` Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 6/6] tests: fix remote-hg warnings for modern git Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350841744-21564-6-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=barkalow@iabervon.org \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilari.liusvaara@elisanet.fi \
--cc=peff@peff.net \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox