##// END OF EJS Templates
tests: unify test-clone
Adrian Buehlmann -
r11806:fd66a181 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (599 lines changed) Show them Hide them
@@ -1,212 +1,433 b''
1 #!/bin/sh
1 Prepare repo a:
2
3 $ mkdir a
4 $ cd a
5 $ hg init
6 $ echo a > a
7 $ hg add a
8 $ hg commit -m test
9 $ echo first line > b
10 $ hg add b
11
12 Create a non-inlined filelog:
13
14 $ python -c 'for x in range(10000): print x' >> data1
15 $ for j in 0 1 2 3 4 5 6 7 8 9; do
16 > cat data1 >> b
17 > hg commit -m test
18 > done
19
20 List files in store/data (should show a 'b.d'):
21
22 $ for i in .hg/store/data/*; do
23 > echo $i
24 > done
25 .hg/store/data/a.i
26 .hg/store/data/b.d
27 .hg/store/data/b.i
28
29 Default operation:
2 30
3 echo
4 echo % prepare repo a
5 mkdir a
6 cd a
7 hg init
8 echo a > a
9 hg add a
10 hg commit -m test
11 echo first line > b
12 hg add b
13 # create a non-inlined filelog
14 python -c 'for x in range(10000): print x' >> data1
15 for j in 0 1 2 3 4 5 6 7 8 9; do
16 cat data1 >> b
17 hg commit -m test
18 done
19 echo % "list files in store/data (should show a 'b.d')"
20 for i in .hg/store/data/*; do
21 echo $i
22 done
31 $ hg clone . ../b
32 updating to branch default
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ cd ../b
35 $ cat a
36 a
37 $ hg verify
38 checking changesets
39 checking manifests
40 crosschecking files in changesets and manifests
41 checking files
42 2 files, 11 changesets, 11 total revisions
43
44 No update, with debug option:
45
46 $ hg --debug clone -U . ../c
47 linked 8 files
48 $ cd ../c
49 $ cat a 2>/dev/null || echo "a not present"
50 a not present
51 $ hg verify
52 checking changesets
53 checking manifests
54 crosschecking files in changesets and manifests
55 checking files
56 2 files, 11 changesets, 11 total revisions
23 57
24 echo
25 echo % default operation
26 hg clone . ../b
27 cd ../b
28 cat a
29 hg verify
58 Default destination:
59
60 $ mkdir ../d
61 $ cd ../d
62 $ hg clone ../a
63 destination directory: a
64 updating to branch default
65 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 $ cd a
67 $ hg cat a
68 a
69 $ cd ../..
30 70
31 echo
32 echo % no update, with debug option
33 hg --debug clone -U . ../c
34 cd ../c
35 cat a 2>/dev/null || echo "a not present"
36 hg verify
71 Check that we drop the 'file:' from the path before writing the .hgrc:
72
73 $ hg clone file:a e
74 updating to branch default
75 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 $ grep 'file:' e/.hg/hgrc
77
78 Check that path aliases are expanded:
79
80 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
81 $ hg -R f showconfig paths.default
82 .*/a#0
83
84 Use --pull:
37 85
38 echo
39 echo % default destination
40 mkdir ../d
41 cd ../d
42 hg clone ../a
43 cd a
44 hg cat a
86 $ hg clone --pull a g
87 requesting all changes
88 adding changesets
89 adding manifests
90 adding file changes
91 added 11 changesets with 11 changes to 2 files
92 updating to branch default
93 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 $ hg -R g verify
95 checking changesets
96 checking manifests
97 crosschecking files in changesets and manifests
98 checking files
99 2 files, 11 changesets, 11 total revisions
100
101 Clone to '.':
102
103 $ mkdir h
104 $ cd h
105 $ hg clone ../a .
106 updating to branch default
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 $ cd ..
109
110
111 *** Tests for option -u ***
45 112
46 echo
47 echo % "check that we drop the file: from the path before"
48 echo % "writing the .hgrc"
49 cd ../..
50 hg clone file:a e
51 grep 'file:' e/.hg/hgrc
113 Adding some more history to repo a:
114
115 $ cd a
116 $ hg tag ref1
117 $ echo the quick brown fox >a
118 $ hg ci -m "hacked default"
119 $ hg up ref1
120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 $ hg branch stable
122 marked working directory as branch stable
123 $ echo some text >a
124 $ hg ci -m "starting branch stable"
125 $ hg tag ref2
126 $ echo some more text >a
127 $ hg ci -m "another change for branch stable"
128 $ hg up ref2
129 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
130 $ hg parents
131 changeset: 13:e8ece76546a6
132 branch: stable
133 tag: ref2
134 parent: 10:a7949464abda
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: starting branch stable
138
52 139
53 echo
54 echo % check that path aliases are expanded
55 hg clone -q -U --config 'paths.foobar=a#0' foobar f
56 hg -R f showconfig paths.default | sed -e 's,.*/,,'
140 Repo a has two heads:
57 141
58 echo
59 echo % use --pull
60 hg clone --pull a g
61 hg -R g verify
142 $ hg heads
143 changeset: 15:0aae7cf88f0d
144 branch: stable
145 tag: tip
146 user: test
147 date: Thu Jan 01 00:00:00 1970 +0000
148 summary: another change for branch stable
149
150 changeset: 12:f21241060d6a
151 user: test
152 date: Thu Jan 01 00:00:00 1970 +0000
153 summary: hacked default
154
155
156 $ cd ..
157
158
159 Testing --noupdate with --updaterev (must abort):
160
161 $ hg clone --noupdate --updaterev 1 a ua
162 abort: cannot specify both --noupdate and --updaterev
163
164
165 Testing clone -u:
62 166
63 echo
64 echo % clone to '.'
65 mkdir h
66 cd h
67 hg clone ../a .
68 cd ..
167 $ hg clone -u . a ua
168 updating to branch stable
169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
170
171 Repo ua has both heads:
69 172
70 echo
71 echo
72 echo % "*** tests for option -u ***"
73 echo
173 $ hg -R ua heads
174 changeset: 15:0aae7cf88f0d
175 branch: stable
176 tag: tip
177 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
179 summary: another change for branch stable
180
181 changeset: 12:f21241060d6a
182 user: test
183 date: Thu Jan 01 00:00:00 1970 +0000
184 summary: hacked default
185
186
187 Same revision checked out in repo a and ua:
188
189 $ hg -R a parents --template "{node|short}\n"
190 e8ece76546a6
191 $ hg -R ua parents --template "{node|short}\n"
192 e8ece76546a6
193
194 $ rm -r ua
74 195
75 196
76 echo
77 echo % "adding some more history to repo a"
78 cd a
79 echo % "tag ref1"
80 hg tag ref1
81 echo the quick brown fox >a
82 hg ci -m "hacked default"
83 echo % "updating back to ref1"
84 hg up ref1
85 echo
86 echo % "add branch 'stable' to repo a for later tests"
87 hg branch stable
88 echo some text >a
89 hg ci -m "starting branch stable"
90 echo % "tag ref2"
91 hg tag ref2
92 echo some more text >a
93 hg ci -m "another change for branch stable"
94 echo
95 echo % "updating back to ref2"
96 hg up ref2
97 echo
98 echo % "parents of repo a"
99 hg parents
100 echo
101 echo % "repo a has two heads"
102 hg heads
103 cd ..
197 Testing clone --pull -u:
198
199 $ hg clone --pull -u . a ua
200 requesting all changes
201 adding changesets
202 adding manifests
203 adding file changes
204 added 16 changesets with 16 changes to 3 files (+1 heads)
205 updating to branch stable
206 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
207
208 Repo ua has both heads:
209
210 $ hg -R ua heads
211 changeset: 15:0aae7cf88f0d
212 branch: stable
213 tag: tip
214 user: test
215 date: Thu Jan 01 00:00:00 1970 +0000
216 summary: another change for branch stable
217
218 changeset: 12:f21241060d6a
219 user: test
220 date: Thu Jan 01 00:00:00 1970 +0000
221 summary: hacked default
222
223
224 Same revision checked out in repo a and ua:
104 225
105 echo
106 echo % "testing clone -U -u 1 a ua (must abort)"
107 hg clone -U -u 1 a ua
226 $ hg -R a parents --template "{node|short}\n"
227 e8ece76546a6
228 $ hg -R ua parents --template "{node|short}\n"
229 e8ece76546a6
230
231 $ rm -r ua
232
233
234 Testing clone -u <branch>:
235
236 $ hg clone -u stable a ua
237 updating to branch stable
238 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
239
240 Repo ua has both heads:
241
242 $ hg -R ua heads
243 changeset: 15:0aae7cf88f0d
244 branch: stable
245 tag: tip
246 user: test
247 date: Thu Jan 01 00:00:00 1970 +0000
248 summary: another change for branch stable
249
250 changeset: 12:f21241060d6a
251 user: test
252 date: Thu Jan 01 00:00:00 1970 +0000
253 summary: hacked default
254
108 255
109 echo
110 echo % "testing clone -u . a ua"
111 hg clone -u . a ua
112 echo
113 echo % "repo ua has both heads"
114 hg -R ua heads
115 echo
116 echo % "same revision checked out in repo a and ua"
117 hg -R a parents --template "{node|short}\n"
118 hg -R ua parents --template "{node|short}\n"
119 rm -r ua
256 Branch 'stable' is checked out:
257
258 $ hg -R ua parents
259 changeset: 15:0aae7cf88f0d
260 branch: stable
261 tag: tip
262 user: test
263 date: Thu Jan 01 00:00:00 1970 +0000
264 summary: another change for branch stable
265
266
267 $ rm -r ua
268
269
270 Testing default checkout:
271
272 $ hg clone a ua
273 updating to branch default
274 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
275
276 Repo ua has both heads:
120 277
121 echo
122 echo % "testing clone --pull -u . a ua"
123 hg clone --pull -u . a ua
124 echo
125 echo % "repo ua has both heads"
126 hg -R ua heads
127 echo
128 echo % "same revision checked out in repo a and ua"
129 hg -R a parents --template "{node|short}\n"
130 hg -R ua parents --template "{node|short}\n"
131 rm -r ua
278 $ hg -R ua heads
279 changeset: 15:0aae7cf88f0d
280 branch: stable
281 tag: tip
282 user: test
283 date: Thu Jan 01 00:00:00 1970 +0000
284 summary: another change for branch stable
285
286 changeset: 12:f21241060d6a
287 user: test
288 date: Thu Jan 01 00:00:00 1970 +0000
289 summary: hacked default
290
291
292 Branch 'default' is checked out:
132 293
133 echo
134 echo % "testing clone -u stable a ua"
135 hg clone -u stable a ua
136 echo
137 echo % "repo ua has both heads"
138 hg -R ua heads
139 echo
140 echo % "branch stable is checked out"
141 hg -R ua parents
142 rm -r ua
294 $ hg -R ua parents
295 changeset: 12:f21241060d6a
296 user: test
297 date: Thu Jan 01 00:00:00 1970 +0000
298 summary: hacked default
299
300
301 $ rm -r ua
302
303
304 Testing #<branch>:
305
306 $ hg clone -u . a#stable ua
307 requesting all changes
308 adding changesets
309 adding manifests
310 adding file changes
311 added 14 changesets with 14 changes to 3 files
312 updating to branch stable
313 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 314
144 echo
145 echo % "testing clone a ua"
146 hg clone a ua
147 echo
148 echo % "repo ua has both heads"
149 hg -R ua heads
150 echo
151 echo % "branch default is checked out"
152 hg -R ua parents
153 rm -r ua
315 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
316
317 $ hg -R ua heads
318 changeset: 13:0aae7cf88f0d
319 branch: stable
320 tag: tip
321 user: test
322 date: Thu Jan 01 00:00:00 1970 +0000
323 summary: another change for branch stable
324
325 changeset: 10:a7949464abda
326 user: test
327 date: Thu Jan 01 00:00:00 1970 +0000
328 summary: test
329
330
331 Same revision checked out in repo a and ua:
332
333 $ hg -R a parents --template "{node|short}\n"
334 e8ece76546a6
335 $ hg -R ua parents --template "{node|short}\n"
336 e8ece76546a6
337
338 $ rm -r ua
339
340
341 Testing -u -r <branch>:
154 342
155 echo
156 echo % "testing clone -u . a#stable ua"
157 hg clone -u . a#stable ua
158 echo
159 echo % "repo ua has only branch stable"
160 hg -R ua heads
161 echo
162 echo % "same revision checked out in repo a and ua"
163 hg -R a parents --template "{node|short}\n"
164 hg -R ua parents --template "{node|short}\n"
165 rm -r ua
343 $ hg clone -u . -r stable a ua
344 requesting all changes
345 adding changesets
346 adding manifests
347 adding file changes
348 added 14 changesets with 14 changes to 3 files
349 updating to branch stable
350 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
351
352 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
166 353
167 echo
168 echo % "testing clone -u . -r stable a ua"
169 hg clone -u . -r stable a ua
170 echo
171 echo % "repo ua has only branch stable"
172 hg -R ua heads
173 echo
174 echo % "same revision checked out in repo a and ua"
175 hg -R a parents --template "{node|short}\n"
176 hg -R ua parents --template "{node|short}\n"
177 rm -r ua
354 $ hg -R ua heads
355 changeset: 13:0aae7cf88f0d
356 branch: stable
357 tag: tip
358 user: test
359 date: Thu Jan 01 00:00:00 1970 +0000
360 summary: another change for branch stable
361
362 changeset: 10:a7949464abda
363 user: test
364 date: Thu Jan 01 00:00:00 1970 +0000
365 summary: test
366
367
368 Same revision checked out in repo a and ua:
369
370 $ hg -R a parents --template "{node|short}\n"
371 e8ece76546a6
372 $ hg -R ua parents --template "{node|short}\n"
373 e8ece76546a6
178 374
179 echo
180 echo % "testing clone -r stable a ua"
181 hg clone -r stable a ua
182 echo
183 echo % "repo ua has only branch stable"
184 hg -R ua heads
185 echo
186 echo % "branch stable is checked out"
187 hg -R ua parents
188 rm -r ua
375 $ rm -r ua
376
377
378 Testing -r <branch>:
379
380 $ hg clone -r stable a ua
381 requesting all changes
382 adding changesets
383 adding manifests
384 adding file changes
385 added 14 changesets with 14 changes to 3 files
386 updating to branch stable
387 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
388
389 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
390
391 $ hg -R ua heads
392 changeset: 13:0aae7cf88f0d
393 branch: stable
394 tag: tip
395 user: test
396 date: Thu Jan 01 00:00:00 1970 +0000
397 summary: another change for branch stable
398
399 changeset: 10:a7949464abda
400 user: test
401 date: Thu Jan 01 00:00:00 1970 +0000
402 summary: test
403
189 404
190 echo
191 echo % "testing clone -u . -r stable -r default a ua"
192 hg clone -u . -r stable -r default a ua
193 echo
194 echo % "repo ua has two heads"
195 hg -R ua heads
196 echo
197 echo % "same revision checked out in repo a and ua"
198 hg -R a parents --template "{node|short}\n"
199 hg -R ua parents --template "{node|short}\n"
200 rm -r ua
405 Branch 'stable' is checked out:
406
407 $ hg -R ua parents
408 changeset: 13:0aae7cf88f0d
409 branch: stable
410 tag: tip
411 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: another change for branch stable
414
415
416 $ rm -r ua
417
201 418
202 cat <<EOF > simpleclone.py
203 from mercurial import ui, hg
204 myui = ui.ui()
205 repo = hg.repository(myui, 'a')
206 hg.clone(myui, repo, dest="ua")
207 EOF
419 Testing issue2267:
208 420
209 python simpleclone.py
210 rm -r ua
421 $ cat <<EOF > simpleclone.py
422 > from mercurial import ui, hg
423 > myui = ui.ui()
424 > repo = hg.repository(myui, 'a')
425 > hg.clone(myui, repo, dest="ua")
426 > EOF
211 427
212 exit 0
428 $ python simpleclone.py
429 updating to branch default
430 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
431
432 $ rm -r ua
433
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now