3 # Copyright (c) 2010 Sverre Rabbelier
6 test_description
='Test remote-helper import and export commands'
10 if test_have_prereq PYTHON
&& "$PYTHON_PATH" -c '
12 if sys.hexversion < 0x02040000:
18 skip_all
='skipping git remote-hg tests: requires Python 2.4 or newer'
22 if ! type hg
>/dev
/null
2>&1
24 skip_all
='skipping git remote-hg tests: requires hg'
28 # Call cmp with the arguments -x ".hg" -x ".git" <left> <right>
31 $DIFF -u -x ".hg" -x ".git" $1 $2
36 test_expect_success
'setup repository' '
37 printf "[ui]\nusername = A U Thor <author@example.com>" > \
41 hg clone "$ROOT/server" public &&
49 test_expect_success
'cloning from local repo' '
50 git clone "hg::file://${ROOT}/server" localclone &&
51 vcs_cmp public localclone
54 test_expect_success
'cloning from remote repo' '
55 git clone "hg::remote://${ROOT}/server" clone &&
59 test_expect_success
'create new commit on remote' '
61 echo content >>file &&
62 hg commit -A -m two &&
66 test_expect_success
'pulling from local repo' '
67 (cd localclone && git pull) &&
68 vcs_cmp public localclone
71 test_expect_success
'pulling from remote remote' '
72 (cd clone && git pull) &&
76 test_expect_success
'pushing to local empty repo' '
79 git push --all "hg::file://${ROOT}/localempty") &&
82 vcs_cmp localclone localempty
85 test_expect_success
'pushing to remote empty repo' '
88 git push --all "hg::remote://${ROOT}/empty") &&
91 vcs_cmp localclone empty
94 test_expect_success
'pushing to local repo' '
96 echo content >>file &&
97 git commit -a -m three &&
101 vcs_cmp localclone server
104 test_expect_success
'synch with changes from localclone' '
109 test_expect_success
'pushing remote local repo' '
111 echo content >>file &&
112 git commit -a -m four &&
119 test_expect_success
'creating new branch' '
121 hg branch different-branch &&
122 echo different >> file &&
127 test_expect_success
'pull in new branch to local repository' '
129 git fetch origin default &&
130 test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
132 git rev-parse --no-revs --verify refs/remotes/origin/different-branch)
135 test_expect_success
'pull in new branch to remote repository' '
137 git fetch origin default &&
138 test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
140 git rev-parse --no-revs --verify refs/remotes/origin/different-branch)