remote-hg: add tests for 'master' bookmark
We want to make sure everything works correctly, even if there's a 'master' bookmark in Mercurial. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
May 24, 2013 at 21:29 UTC
9f36d61e7b63618cc7931f948b7b57cdcd11bd7a
1 file changed
+67
-1
contrib/remote-helpers/test-hg.sh
+67
-1
@@ -26,13 +26,23 @@ check () {
26
test_cmp expected actual
27
}
28
29
+check_branch () {
30
+ echo $3 > expected &&
31
+ hg -R $1 log -r $2 --template '{desc}\n' > actual &&
32
+ test_cmp expected actual
33
+}
34
+
35
setup () {
36
(
37
echo "[ui]"
38
echo "username = H G Wells <wells@example.com>"
39
echo "[extensions]"
40
echo "mq ="
35
- ) >> "$HOME"/.hgrc
41
+ ) >> "$HOME"/.hgrc &&
42
+
43
+ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" &&
44
+ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" &&
45
+ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
46
}
47
48
setup
@@ -178,4 +188,60 @@ test_expect_success 'strip' '
188
test_cmp actual expected
189
'
190
191
+test_expect_success 'remote push with master bookmark' '
192
+ test_when_finished "rm -rf hgrepo gitrepo*" &&
193
+
194
+ (
195
+ hg init hgrepo &&
196
+ cd hgrepo &&
197
+ echo zero > content &&
198
+ hg add content &&
199
+ hg commit -m zero &&
200
+ hg bookmark master &&
201
+ echo one > content &&
202
+ hg commit -m one
203
+ ) &&
204
+
205
+ (
206
+ git clone "hg::hgrepo" gitrepo &&
207
+ cd gitrepo &&
208
+ echo two > content &&
209
+ git commit -a -m two &&
210
+ git push
211
+ ) &&
212
+
213
+ check_branch hgrepo default two
214
+'
215
+
216
+cat > expected <<EOF
217
+changeset: 0:6e2126489d3d
218
+tag: tip
219
+user: A U Thor <author@example.com>
220
+date: Mon Jan 01 00:00:00 2007 +0230
221
+summary: one
222
+
223
+EOF
224
+
225
+test_expect_success 'remote push from master branch' '
226
+ test_when_finished "rm -rf hgrepo gitrepo*" &&
227
+
228
+ hg init hgrepo &&
229
+
230
+ (
231
+ git init gitrepo &&
232
+ cd gitrepo &&
233
+ git remote add origin "hg::../hgrepo" &&
234
+ echo one > content &&
235
+ git add content &&
236
+ git commit -a -m one &&
237
+ git push origin master
238
+ ) &&
239
+
240
+ hg -R hgrepo log > actual &&
241
+ cat actual &&
242
+ test_cmp expected actual &&
243
+
244
+ check_branch hgrepo default one
245
+'
246
+
247
test_done