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>"
45 test_expect_success
'cloning' '
46 test_when_finished "rm -rf gitrepo*" &&
51 echo zero > content &&
56 git clone "hg::hgrepo" gitrepo &&
57 check gitrepo zero master
60 test_expect_success
'cloning with branches' '
61 test_when_finished "rm -rf gitrepo*" &&
66 echo next > content &&
70 git clone "hg::hgrepo" gitrepo &&
71 check gitrepo next next &&
73 (cd hgrepo && hg checkout default) &&
75 git clone "hg::hgrepo" gitrepo2 &&
76 check gitrepo2 zero master
79 test_expect_success
'cloning with bookmarks' '
80 test_when_finished "rm -rf gitrepo*" &&
84 hg bookmark feature-a &&
85 echo feature-a > content &&
86 hg commit -m feature-a
89 git clone "hg::hgrepo" gitrepo &&
90 check gitrepo feature-a feature-a
93 test_expect_success
'cloning with detached head' '
94 test_when_finished "rm -rf gitrepo*" &&
101 git clone "hg::hgrepo" gitrepo &&
102 check gitrepo zero master
105 test_expect_success
'update bookmark' '
106 test_when_finished "rm -rf gitrepo*" &&
114 git clone "hg::hgrepo" gitrepo &&
116 git checkout --quiet devel &&
117 echo devel > content &&
118 git commit -a -m devel &&
122 hg -R hgrepo bookmarks | egrep "devel[ ]+3:"
125 # cleanup previous stuff
129 echo $1 >> content
&&
130 hg commit
-u "$2" -m "add $1" &&
131 echo "$3" >> ..
/expected
134 test_expect_success
'authors' '
135 test_when_finished "rm -rf hgrepo gitrepo" &&
145 author_test alpha "" "H G Wells <wells@example.com>" &&
146 author_test beta "test" "test <unknown>" &&
147 author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&
148 author_test gamma "<test@example.com>" "Unknown <test@example.com>" &&
149 author_test delta "name<test@example.com>" "name <test@example.com>" &&
150 author_test epsilon "name <test@example.com" "name <test@example.com>" &&
151 author_test zeta " test " "test <unknown>" &&
152 author_test eta "test < test@example.com >" "test <test@example.com>" &&
153 author_test theta "test >test@example.com>" "test <test@example.com>" &&
154 author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
155 author_test kappa "test@example.com" "Unknown <test@example.com>"
158 git clone "hg::hgrepo" gitrepo &&
159 git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual &&
161 test_cmp expected actual