3 # Copyright (c) 2012 Felipe Contreras
5 # Base commands from hg-git tests:
6 # https://bitbucket.org/durin42/hg-git/src
9 test_description
='Test remote-hg'
13 if ! test_have_prereq PYTHON
; then
14 skip_all
='skipping remote-hg tests; python not available'
18 if ! python
-c 'import mercurial'; then
19 skip_all
='skipping remote-hg tests; mercurial not available'
26 git log
--format='%s' -1 &&
33 test_cmp expected actual
39 echo "username = H G Wells <wells@example.com>"
47 test_expect_success
'cloning' '
48 test_when_finished "rm -rf gitrepo*" &&
53 echo zero > content &&
58 git clone "hg::hgrepo" gitrepo &&
59 check gitrepo zero master
62 test_expect_success
'cloning with branches' '
63 test_when_finished "rm -rf gitrepo*" &&
68 echo next > content &&
72 git clone "hg::hgrepo" gitrepo &&
73 check gitrepo next next &&
75 (cd hgrepo && hg checkout default) &&
77 git clone "hg::hgrepo" gitrepo2 &&
78 check gitrepo2 zero master
81 test_expect_success
'cloning with bookmarks' '
82 test_when_finished "rm -rf gitrepo*" &&
86 hg bookmark feature-a &&
87 echo feature-a > content &&
88 hg commit -m feature-a
91 git clone "hg::hgrepo" gitrepo &&
92 check gitrepo feature-a feature-a
95 test_expect_success
'cloning with detached head' '
96 test_when_finished "rm -rf gitrepo*" &&
103 git clone "hg::hgrepo" gitrepo &&
104 check gitrepo zero master
107 test_expect_success
'update bookmark' '
108 test_when_finished "rm -rf gitrepo*" &&
116 git clone "hg::hgrepo" gitrepo &&
118 git checkout --quiet devel &&
119 echo devel > content &&
120 git commit -a -m devel &&
124 hg -R hgrepo bookmarks | egrep "devel[ ]+3:"
127 # cleanup previous stuff
131 echo $1 >> content
&&
132 hg commit
-u "$2" -m "add $1" &&
133 echo "$3" >> ..
/expected
136 test_expect_success
'authors' '
137 test_when_finished "rm -rf hgrepo gitrepo" &&
147 author_test alpha "" "H G Wells <wells@example.com>" &&
148 author_test beta "test" "test <unknown>" &&
149 author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&
150 author_test gamma "<test@example.com>" "Unknown <test@example.com>" &&
151 author_test delta "name<test@example.com>" "name <test@example.com>" &&
152 author_test epsilon "name <test@example.com" "name <test@example.com>" &&
153 author_test zeta " test " "test <unknown>" &&
154 author_test eta "test < test@example.com >" "test <test@example.com>" &&
155 author_test theta "test >test@example.com>" "test <test@example.com>" &&
156 author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
157 author_test kappa "test@example.com" "Unknown <test@example.com>"
160 git clone "hg::hgrepo" gitrepo &&
161 git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual &&
163 test_cmp expected actual
166 test_expect_success
'strip' '
167 test_when_finished "rm -rf hgrepo gitrepo" &&
173 echo one >> content &&
177 echo two >> content &&
181 git clone "hg::hgrepo" gitrepo &&
187 echo three >> content &&
188 hg commit -m three &&
190 echo four >> content &&
197 git log --format="%s" origin/master > ../actual
200 hg -R hgrepo log --template "{desc}\n" > expected &&
201 test_cmp actual expected