French translation: copy -> copie.
[git/dscho.git] / t / t5801-remote-hg.sh
blob2e68372d5921eea881b711312aaadc3a040d05f3
1 #!/bin/sh
3 # Copyright (c) 2010 Sverre Rabbelier
6 test_description='Test remote-helper import and export commands'
8 . ./test-lib.sh
10 if test_have_prereq PYTHON && "$PYTHON_PATH" -c '
11 import sys
12 if sys.hexversion < 0x02040000:
13 sys.exit(1)
15 then
17 else
18 skip_all='skipping git remote-hg tests: requires Python 2.4 or newer'
19 test_done
22 if ! type hg >/dev/null 2>&1
23 then
24 skip_all='skipping git remote-hg tests: requires hg'
25 test_done
28 # Call cmp with the arguments -x ".hg" -x ".git" <left> <right>
30 vcs_cmp () {
31 $DIFF -u -x ".hg" -x ".git" $1 $2
34 ROOT=$PWD
36 test_expect_success 'setup repository' '
37 printf "[ui]\nusername = A U Thor <author@example.com>" > \
38 ${HOME}/.hgrc &&
39 mkdir server &&
40 hg init server/.hg &&
41 hg clone "$ROOT/server" public &&
42 (cd public &&
43 echo content >file &&
44 hg add file &&
45 hg commit -m one &&
46 hg push)
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 &&
56 vcs_cmp public clone
59 test_expect_success 'create new commit on remote' '
60 (cd public &&
61 echo content >>file &&
62 hg commit -A -m two &&
63 hg push)
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) &&
73 vcs_cmp public clone
76 test_expect_success 'pushing to local empty repo' '
77 hg init localempty &&
78 (cd localclone &&
79 git push --all "hg::file://${ROOT}/localempty") &&
80 (cd localempty &&
81 hg up tip) &&
82 vcs_cmp localclone localempty
85 test_expect_success 'pushing to remote empty repo' '
86 hg init empty &&
87 (cd localclone &&
88 git push --all "hg::remote://${ROOT}/empty") &&
89 (cd empty &&
90 hg up tip) &&
91 vcs_cmp localclone empty
94 test_expect_success 'pushing to local repo' '
95 (cd localclone &&
96 echo content >>file &&
97 git commit -a -m three &&
98 git push) &&
99 (cd server &&
100 hg up tip) &&
101 vcs_cmp localclone server
104 test_expect_success 'synch with changes from localclone' '
105 (cd clone &&
106 git pull)
109 test_expect_success 'pushing remote local repo' '
110 (cd clone &&
111 echo content >>file &&
112 git commit -a -m four &&
113 git push) &&
114 (cd server &&
115 hg up tip) &&
116 vcs_cmp clone server
119 test_expect_success 'creating new branch' '
120 (cd public &&
121 hg branch different-branch &&
122 echo different >> file &&
123 hg commit -m five &&
124 hg push -f)
127 test_expect_success 'pull in new branch to local repository' '
128 (cd localclone &&
129 git fetch origin default &&
130 test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
131 git fetch &&
132 git rev-parse --no-revs --verify refs/remotes/origin/different-branch)
135 test_expect_success 'pull in new branch to remote repository' '
136 (cd clone &&
137 git fetch origin default &&
138 test_must_fail git rev-parse -q --verify refs/remotes/origin/different-branch &&
139 git fetch &&
140 git rev-parse --no-revs --verify refs/remotes/origin/different-branch)
143 test_done