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'
25 git
--git-dir=$1/.git log
--format='%s' -1 $2 > actual
26 test_cmp expected actual
32 echo "username = H G Wells <wells@example.com>"
40 test_expect_success
'cloning' '
41 test_when_finished "rm -rf gitrepo*" &&
46 echo zero > content &&
51 git clone "hg::hgrepo" gitrepo &&
52 check gitrepo HEAD zero
55 test_expect_success
'cloning with branches' '
56 test_when_finished "rm -rf gitrepo*" &&
61 echo next > content &&
65 git clone "hg::hgrepo" gitrepo &&
66 check gitrepo origin/branches/next next
69 test_expect_success
'cloning with bookmarks' '
70 test_when_finished "rm -rf gitrepo*" &&
74 hg checkout default &&
75 hg bookmark feature-a &&
76 echo feature-a > content &&
77 hg commit -m feature-a
80 git clone "hg::hgrepo" gitrepo &&
81 check gitrepo origin/feature-a feature-a
84 test_expect_success
'update bookmark' '
85 test_when_finished "rm -rf gitrepo*" &&
93 git clone "hg::hgrepo" gitrepo &&
95 git checkout --quiet devel &&
96 echo devel > content &&
97 git commit -a -m devel &&
101 hg -R hgrepo bookmarks | egrep "devel[ ]+3:"
104 # cleanup previous stuff
108 echo $1 >> content
&&
109 hg commit
-u "$2" -m "add $1" &&
110 echo "$3" >> ..
/expected
113 test_expect_success
'authors' '
114 test_when_finished "rm -rf hgrepo gitrepo" &&
124 author_test alpha "" "H G Wells <wells@example.com>" &&
125 author_test beta "test" "test <unknown>" &&
126 author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&
127 author_test gamma "<test@example.com>" "Unknown <test@example.com>" &&
128 author_test delta "name<test@example.com>" "name <test@example.com>" &&
129 author_test epsilon "name <test@example.com" "name <test@example.com>" &&
130 author_test zeta " test " "test <unknown>" &&
131 author_test eta "test < test@example.com >" "test <test@example.com>" &&
132 author_test theta "test >test@example.com>" "test <test@example.com>" &&
133 author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
134 author_test kappa "test@example.com" "Unknown <test@example.com>"
137 git clone "hg::hgrepo" gitrepo &&
138 git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual &&
140 test_cmp expected actual
143 test_expect_success
'strip' '
144 test_when_finished "rm -rf hgrepo gitrepo" &&
150 echo one >> content &&
154 echo two >> content &&
158 git clone "hg::hgrepo" gitrepo &&
164 echo three >> content &&
165 hg commit -m three &&
167 echo four >> content &&
174 git log --format="%s" origin/master > ../actual
177 hg -R hgrepo log --template "{desc}\n" > expected &&
178 test_cmp actual expected