##// 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
31 $ hg clone . ../b
4 echo % prepare repo a
32 updating to branch default
5 mkdir a
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
6 cd a
34 $ cd ../b
7 hg init
35 $ cat a
8 echo a > a
36 a
9 hg add a
37 $ hg verify
10 hg commit -m test
38 checking changesets
11 echo first line > b
39 checking manifests
12 hg add b
40 crosschecking files in changesets and manifests
13 # create a non-inlined filelog
41 checking files
14 python -c 'for x in range(10000): print x' >> data1
42 2 files, 11 changesets, 11 total revisions
15 for j in 0 1 2 3 4 5 6 7 8 9; do
43
16 cat data1 >> b
44 No update, with debug option:
17 hg commit -m test
45
18 done
46 $ hg --debug clone -U . ../c
19 echo % "list files in store/data (should show a 'b.d')"
47 linked 8 files
20 for i in .hg/store/data/*; do
48 $ cd ../c
21 echo $i
49 $ cat a 2>/dev/null || echo "a not present"
22 done
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
58 Default destination:
25 echo % default operation
59
26 hg clone . ../b
60 $ mkdir ../d
27 cd ../b
61 $ cd ../d
28 cat a
62 $ hg clone ../a
29 hg verify
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
71 Check that we drop the 'file:' from the path before writing the .hgrc:
32 echo % no update, with debug option
72
33 hg --debug clone -U . ../c
73 $ hg clone file:a e
34 cd ../c
74 updating to branch default
35 cat a 2>/dev/null || echo "a not present"
75 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 hg verify
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
86 $ hg clone --pull a g
39 echo % default destination
87 requesting all changes
40 mkdir ../d
88 adding changesets
41 cd ../d
89 adding manifests
42 hg clone ../a
90 adding file changes
43 cd a
91 added 11 changesets with 11 changes to 2 files
44 hg cat a
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
113 Adding some more history to repo a:
47 echo % "check that we drop the file: from the path before"
114
48 echo % "writing the .hgrc"
115 $ cd a
49 cd ../..
116 $ hg tag ref1
50 hg clone file:a e
117 $ echo the quick brown fox >a
51 grep 'file:' e/.hg/hgrc
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
140 Repo a has two heads:
54 echo % check that path aliases are expanded
141
55 hg clone -q -U --config 'paths.foobar=a#0' foobar f
142 $ hg heads
56 hg -R f showconfig paths.default | sed -e 's,.*/,,'
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
57
149
58 echo
150 changeset: 12:f21241060d6a
59 echo % use --pull
151 user: test
60 hg clone --pull a g
152 date: Thu Jan 01 00:00:00 1970 +0000
61 hg -R g verify
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
167 $ hg clone -u . a ua
64 echo % clone to '.'
168 updating to branch stable
65 mkdir h
169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 cd h
170
67 hg clone ../a .
171 Repo ua has both heads:
68 cd ..
172
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
69
180
70 echo
181 changeset: 12:f21241060d6a
71 echo
182 user: test
72 echo % "*** tests for option -u ***"
183 date: Thu Jan 01 00:00:00 1970 +0000
73 echo
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
197 Testing clone --pull -u:
77 echo % "adding some more history to repo a"
198
78 cd a
199 $ hg clone --pull -u . a ua
79 echo % "tag ref1"
200 requesting all changes
80 hg tag ref1
201 adding changesets
81 echo the quick brown fox >a
202 adding manifests
82 hg ci -m "hacked default"
203 adding file changes
83 echo % "updating back to ref1"
204 added 16 changesets with 16 changes to 3 files (+1 heads)
84 hg up ref1
205 updating to branch stable
85 echo
206 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 echo % "add branch 'stable' to repo a for later tests"
207
87 hg branch stable
208 Repo ua has both heads:
88 echo some text >a
209
89 hg ci -m "starting branch stable"
210 $ hg -R ua heads
90 echo % "tag ref2"
211 changeset: 15:0aae7cf88f0d
91 hg tag ref2
212 branch: stable
92 echo some more text >a
213 tag: tip
93 hg ci -m "another change for branch stable"
214 user: test
94 echo
215 date: Thu Jan 01 00:00:00 1970 +0000
95 echo % "updating back to ref2"
216 summary: another change for branch stable
96 hg up ref2
217
97 echo
218 changeset: 12:f21241060d6a
98 echo % "parents of repo a"
219 user: test
99 hg parents
220 date: Thu Jan 01 00:00:00 1970 +0000
100 echo
221 summary: hacked default
101 echo % "repo a has two heads"
222
102 hg heads
223
103 cd ..
224 Same revision checked out in repo a and ua:
104
225
105 echo
226 $ hg -R a parents --template "{node|short}\n"
106 echo % "testing clone -U -u 1 a ua (must abort)"
227 e8ece76546a6
107 hg clone -U -u 1 a ua
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
256 Branch 'stable' is checked out:
110 echo % "testing clone -u . a ua"
257
111 hg clone -u . a ua
258 $ hg -R ua parents
112 echo
259 changeset: 15:0aae7cf88f0d
113 echo % "repo ua has both heads"
260 branch: stable
114 hg -R ua heads
261 tag: tip
115 echo
262 user: test
116 echo % "same revision checked out in repo a and ua"
263 date: Thu Jan 01 00:00:00 1970 +0000
117 hg -R a parents --template "{node|short}\n"
264 summary: another change for branch stable
118 hg -R ua parents --template "{node|short}\n"
265
119 rm -r ua
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
278 $ hg -R ua heads
122 echo % "testing clone --pull -u . a ua"
279 changeset: 15:0aae7cf88f0d
123 hg clone --pull -u . a ua
280 branch: stable
124 echo
281 tag: tip
125 echo % "repo ua has both heads"
282 user: test
126 hg -R ua heads
283 date: Thu Jan 01 00:00:00 1970 +0000
127 echo
284 summary: another change for branch stable
128 echo % "same revision checked out in repo a and ua"
285
129 hg -R a parents --template "{node|short}\n"
286 changeset: 12:f21241060d6a
130 hg -R ua parents --template "{node|short}\n"
287 user: test
131 rm -r ua
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
294 $ hg -R ua parents
134 echo % "testing clone -u stable a ua"
295 changeset: 12:f21241060d6a
135 hg clone -u stable a ua
296 user: test
136 echo
297 date: Thu Jan 01 00:00:00 1970 +0000
137 echo % "repo ua has both heads"
298 summary: hacked default
138 hg -R ua heads
299
139 echo
300
140 echo % "branch stable is checked out"
301 $ rm -r ua
141 hg -R ua parents
302
142 rm -r ua
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
315 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
145 echo % "testing clone a ua"
316
146 hg clone a ua
317 $ hg -R ua heads
147 echo
318 changeset: 13:0aae7cf88f0d
148 echo % "repo ua has both heads"
319 branch: stable
149 hg -R ua heads
320 tag: tip
150 echo
321 user: test
151 echo % "branch default is checked out"
322 date: Thu Jan 01 00:00:00 1970 +0000
152 hg -R ua parents
323 summary: another change for branch stable
153 rm -r ua
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
343 $ hg clone -u . -r stable a ua
156 echo % "testing clone -u . a#stable ua"
344 requesting all changes
157 hg clone -u . a#stable ua
345 adding changesets
158 echo
346 adding manifests
159 echo % "repo ua has only branch stable"
347 adding file changes
160 hg -R ua heads
348 added 14 changesets with 14 changes to 3 files
161 echo
349 updating to branch stable
162 echo % "same revision checked out in repo a and ua"
350 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 hg -R a parents --template "{node|short}\n"
351
164 hg -R ua parents --template "{node|short}\n"
352 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
165 rm -r ua
166
353
167 echo
354 $ hg -R ua heads
168 echo % "testing clone -u . -r stable a ua"
355 changeset: 13:0aae7cf88f0d
169 hg clone -u . -r stable a ua
356 branch: stable
170 echo
357 tag: tip
171 echo % "repo ua has only branch stable"
358 user: test
172 hg -R ua heads
359 date: Thu Jan 01 00:00:00 1970 +0000
173 echo
360 summary: another change for branch stable
174 echo % "same revision checked out in repo a and ua"
361
175 hg -R a parents --template "{node|short}\n"
362 changeset: 10:a7949464abda
176 hg -R ua parents --template "{node|short}\n"
363 user: test
177 rm -r ua
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
375 $ rm -r ua
180 echo % "testing clone -r stable a ua"
376
181 hg clone -r stable a ua
377
182 echo
378 Testing -r <branch>:
183 echo % "repo ua has only branch stable"
379
184 hg -R ua heads
380 $ hg clone -r stable a ua
185 echo
381 requesting all changes
186 echo % "branch stable is checked out"
382 adding changesets
187 hg -R ua parents
383 adding manifests
188 rm -r ua
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
405 Branch 'stable' is checked out:
191 echo % "testing clone -u . -r stable -r default a ua"
406
192 hg clone -u . -r stable -r default a ua
407 $ hg -R ua parents
193 echo
408 changeset: 13:0aae7cf88f0d
194 echo % "repo ua has two heads"
409 branch: stable
195 hg -R ua heads
410 tag: tip
196 echo
411 user: test
197 echo % "same revision checked out in repo a and ua"
412 date: Thu Jan 01 00:00:00 1970 +0000
198 hg -R a parents --template "{node|short}\n"
413 summary: another change for branch stable
199 hg -R ua parents --template "{node|short}\n"
414
200 rm -r ua
415
416 $ rm -r ua
417
201
418
202 cat <<EOF > simpleclone.py
419 Testing issue2267:
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
208
420
209 python simpleclone.py
421 $ cat <<EOF > simpleclone.py
210 rm -r ua
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now