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