##// END OF EJS Templates
clone: add tests for unsafe ssh url (SEC)
Sean Farley -
r33709:f9134e96 stable
parent child Browse files
Show More
@@ -1,1094 +1,1116 b''
1 Prepare repo a:
1 Prepare repo a:
2
2
3 $ hg init a
3 $ hg init a
4 $ cd a
4 $ cd a
5 $ echo a > a
5 $ echo a > a
6 $ hg add a
6 $ hg add a
7 $ hg commit -m test
7 $ hg commit -m test
8 $ echo first line > b
8 $ echo first line > b
9 $ hg add b
9 $ hg add b
10
10
11 Create a non-inlined filelog:
11 Create a non-inlined filelog:
12
12
13 $ $PYTHON -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
13 $ $PYTHON -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 > cat data1 >> b
15 > cat data1 >> b
16 > hg commit -m test
16 > hg commit -m test
17 > done
17 > done
18
18
19 List files in store/data (should show a 'b.d'):
19 List files in store/data (should show a 'b.d'):
20
20
21 $ for i in .hg/store/data/*; do
21 $ for i in .hg/store/data/*; do
22 > echo $i
22 > echo $i
23 > done
23 > done
24 .hg/store/data/a.i
24 .hg/store/data/a.i
25 .hg/store/data/b.d
25 .hg/store/data/b.d
26 .hg/store/data/b.i
26 .hg/store/data/b.i
27
27
28 Trigger branchcache creation:
28 Trigger branchcache creation:
29
29
30 $ hg branches
30 $ hg branches
31 default 10:a7949464abda
31 default 10:a7949464abda
32 $ ls .hg/cache
32 $ ls .hg/cache
33 branch2-served
33 branch2-served
34 checkisexec (execbit !)
34 checkisexec (execbit !)
35 checklink (symlink !)
35 checklink (symlink !)
36 checklink-target (symlink !)
36 checklink-target (symlink !)
37 checknoexec (execbit !)
37 checknoexec (execbit !)
38 rbc-names-v1
38 rbc-names-v1
39 rbc-revs-v1
39 rbc-revs-v1
40
40
41 Default operation:
41 Default operation:
42
42
43 $ hg clone . ../b
43 $ hg clone . ../b
44 updating to branch default
44 updating to branch default
45 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ cd ../b
46 $ cd ../b
47
47
48 Ensure branchcache got copied over:
48 Ensure branchcache got copied over:
49
49
50 $ ls .hg/cache
50 $ ls .hg/cache
51 branch2-served
51 branch2-served
52 checkisexec (execbit !)
52 checkisexec (execbit !)
53 checklink (symlink !)
53 checklink (symlink !)
54 checklink-target (symlink !)
54 checklink-target (symlink !)
55
55
56 $ cat a
56 $ cat a
57 a
57 a
58 $ hg verify
58 $ hg verify
59 checking changesets
59 checking changesets
60 checking manifests
60 checking manifests
61 crosschecking files in changesets and manifests
61 crosschecking files in changesets and manifests
62 checking files
62 checking files
63 2 files, 11 changesets, 11 total revisions
63 2 files, 11 changesets, 11 total revisions
64
64
65 Invalid dest '' must abort:
65 Invalid dest '' must abort:
66
66
67 $ hg clone . ''
67 $ hg clone . ''
68 abort: empty destination path is not valid
68 abort: empty destination path is not valid
69 [255]
69 [255]
70
70
71 No update, with debug option:
71 No update, with debug option:
72
72
73 #if hardlink
73 #if hardlink
74 $ hg --debug clone -U . ../c --config progress.debug=true
74 $ hg --debug clone -U . ../c --config progress.debug=true
75 linking: 1
75 linking: 1
76 linking: 2
76 linking: 2
77 linking: 3
77 linking: 3
78 linking: 4
78 linking: 4
79 linking: 5
79 linking: 5
80 linking: 6
80 linking: 6
81 linking: 7
81 linking: 7
82 linking: 8
82 linking: 8
83 linked 8 files
83 linked 8 files
84 #else
84 #else
85 $ hg --debug clone -U . ../c --config progress.debug=true
85 $ hg --debug clone -U . ../c --config progress.debug=true
86 linking: 1
86 linking: 1
87 copying: 2
87 copying: 2
88 copying: 3
88 copying: 3
89 copying: 4
89 copying: 4
90 copying: 5
90 copying: 5
91 copying: 6
91 copying: 6
92 copying: 7
92 copying: 7
93 copying: 8
93 copying: 8
94 copied 8 files
94 copied 8 files
95 #endif
95 #endif
96 $ cd ../c
96 $ cd ../c
97
97
98 Ensure branchcache got copied over:
98 Ensure branchcache got copied over:
99
99
100 $ ls .hg/cache
100 $ ls .hg/cache
101 branch2-served
101 branch2-served
102
102
103 $ cat a 2>/dev/null || echo "a not present"
103 $ cat a 2>/dev/null || echo "a not present"
104 a not present
104 a not present
105 $ hg verify
105 $ hg verify
106 checking changesets
106 checking changesets
107 checking manifests
107 checking manifests
108 crosschecking files in changesets and manifests
108 crosschecking files in changesets and manifests
109 checking files
109 checking files
110 2 files, 11 changesets, 11 total revisions
110 2 files, 11 changesets, 11 total revisions
111
111
112 Default destination:
112 Default destination:
113
113
114 $ mkdir ../d
114 $ mkdir ../d
115 $ cd ../d
115 $ cd ../d
116 $ hg clone ../a
116 $ hg clone ../a
117 destination directory: a
117 destination directory: a
118 updating to branch default
118 updating to branch default
119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd a
120 $ cd a
121 $ hg cat a
121 $ hg cat a
122 a
122 a
123 $ cd ../..
123 $ cd ../..
124
124
125 Check that we drop the 'file:' from the path before writing the .hgrc:
125 Check that we drop the 'file:' from the path before writing the .hgrc:
126
126
127 $ hg clone file:a e
127 $ hg clone file:a e
128 updating to branch default
128 updating to branch default
129 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 $ grep 'file:' e/.hg/hgrc
130 $ grep 'file:' e/.hg/hgrc
131 [1]
131 [1]
132
132
133 Check that path aliases are expanded:
133 Check that path aliases are expanded:
134
134
135 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
135 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
136 $ hg -R f showconfig paths.default
136 $ hg -R f showconfig paths.default
137 $TESTTMP/a#0 (glob)
137 $TESTTMP/a#0 (glob)
138
138
139 Use --pull:
139 Use --pull:
140
140
141 $ hg clone --pull a g
141 $ hg clone --pull a g
142 requesting all changes
142 requesting all changes
143 adding changesets
143 adding changesets
144 adding manifests
144 adding manifests
145 adding file changes
145 adding file changes
146 added 11 changesets with 11 changes to 2 files
146 added 11 changesets with 11 changes to 2 files
147 updating to branch default
147 updating to branch default
148 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 $ hg -R g verify
149 $ hg -R g verify
150 checking changesets
150 checking changesets
151 checking manifests
151 checking manifests
152 crosschecking files in changesets and manifests
152 crosschecking files in changesets and manifests
153 checking files
153 checking files
154 2 files, 11 changesets, 11 total revisions
154 2 files, 11 changesets, 11 total revisions
155
155
156 Invalid dest '' with --pull must abort (issue2528):
156 Invalid dest '' with --pull must abort (issue2528):
157
157
158 $ hg clone --pull a ''
158 $ hg clone --pull a ''
159 abort: empty destination path is not valid
159 abort: empty destination path is not valid
160 [255]
160 [255]
161
161
162 Clone to '.':
162 Clone to '.':
163
163
164 $ mkdir h
164 $ mkdir h
165 $ cd h
165 $ cd h
166 $ hg clone ../a .
166 $ hg clone ../a .
167 updating to branch default
167 updating to branch default
168 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 $ cd ..
169 $ cd ..
170
170
171
171
172 *** Tests for option -u ***
172 *** Tests for option -u ***
173
173
174 Adding some more history to repo a:
174 Adding some more history to repo a:
175
175
176 $ cd a
176 $ cd a
177 $ hg tag ref1
177 $ hg tag ref1
178 $ echo the quick brown fox >a
178 $ echo the quick brown fox >a
179 $ hg ci -m "hacked default"
179 $ hg ci -m "hacked default"
180 $ hg up ref1
180 $ hg up ref1
181 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
181 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
182 $ hg branch stable
182 $ hg branch stable
183 marked working directory as branch stable
183 marked working directory as branch stable
184 (branches are permanent and global, did you want a bookmark?)
184 (branches are permanent and global, did you want a bookmark?)
185 $ echo some text >a
185 $ echo some text >a
186 $ hg ci -m "starting branch stable"
186 $ hg ci -m "starting branch stable"
187 $ hg tag ref2
187 $ hg tag ref2
188 $ echo some more text >a
188 $ echo some more text >a
189 $ hg ci -m "another change for branch stable"
189 $ hg ci -m "another change for branch stable"
190 $ hg up ref2
190 $ hg up ref2
191 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
191 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
192 $ hg parents
192 $ hg parents
193 changeset: 13:e8ece76546a6
193 changeset: 13:e8ece76546a6
194 branch: stable
194 branch: stable
195 tag: ref2
195 tag: ref2
196 parent: 10:a7949464abda
196 parent: 10:a7949464abda
197 user: test
197 user: test
198 date: Thu Jan 01 00:00:00 1970 +0000
198 date: Thu Jan 01 00:00:00 1970 +0000
199 summary: starting branch stable
199 summary: starting branch stable
200
200
201
201
202 Repo a has two heads:
202 Repo a has two heads:
203
203
204 $ hg heads
204 $ hg heads
205 changeset: 15:0aae7cf88f0d
205 changeset: 15:0aae7cf88f0d
206 branch: stable
206 branch: stable
207 tag: tip
207 tag: tip
208 user: test
208 user: test
209 date: Thu Jan 01 00:00:00 1970 +0000
209 date: Thu Jan 01 00:00:00 1970 +0000
210 summary: another change for branch stable
210 summary: another change for branch stable
211
211
212 changeset: 12:f21241060d6a
212 changeset: 12:f21241060d6a
213 user: test
213 user: test
214 date: Thu Jan 01 00:00:00 1970 +0000
214 date: Thu Jan 01 00:00:00 1970 +0000
215 summary: hacked default
215 summary: hacked default
216
216
217
217
218 $ cd ..
218 $ cd ..
219
219
220
220
221 Testing --noupdate with --updaterev (must abort):
221 Testing --noupdate with --updaterev (must abort):
222
222
223 $ hg clone --noupdate --updaterev 1 a ua
223 $ hg clone --noupdate --updaterev 1 a ua
224 abort: cannot specify both --noupdate and --updaterev
224 abort: cannot specify both --noupdate and --updaterev
225 [255]
225 [255]
226
226
227
227
228 Testing clone -u:
228 Testing clone -u:
229
229
230 $ hg clone -u . a ua
230 $ hg clone -u . a ua
231 updating to branch stable
231 updating to branch stable
232 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
233
233
234 Repo ua has both heads:
234 Repo ua has both heads:
235
235
236 $ hg -R ua heads
236 $ hg -R ua heads
237 changeset: 15:0aae7cf88f0d
237 changeset: 15:0aae7cf88f0d
238 branch: stable
238 branch: stable
239 tag: tip
239 tag: tip
240 user: test
240 user: test
241 date: Thu Jan 01 00:00:00 1970 +0000
241 date: Thu Jan 01 00:00:00 1970 +0000
242 summary: another change for branch stable
242 summary: another change for branch stable
243
243
244 changeset: 12:f21241060d6a
244 changeset: 12:f21241060d6a
245 user: test
245 user: test
246 date: Thu Jan 01 00:00:00 1970 +0000
246 date: Thu Jan 01 00:00:00 1970 +0000
247 summary: hacked default
247 summary: hacked default
248
248
249
249
250 Same revision checked out in repo a and ua:
250 Same revision checked out in repo a and ua:
251
251
252 $ hg -R a parents --template "{node|short}\n"
252 $ hg -R a parents --template "{node|short}\n"
253 e8ece76546a6
253 e8ece76546a6
254 $ hg -R ua parents --template "{node|short}\n"
254 $ hg -R ua parents --template "{node|short}\n"
255 e8ece76546a6
255 e8ece76546a6
256
256
257 $ rm -r ua
257 $ rm -r ua
258
258
259
259
260 Testing clone --pull -u:
260 Testing clone --pull -u:
261
261
262 $ hg clone --pull -u . a ua
262 $ hg clone --pull -u . a ua
263 requesting all changes
263 requesting all changes
264 adding changesets
264 adding changesets
265 adding manifests
265 adding manifests
266 adding file changes
266 adding file changes
267 added 16 changesets with 16 changes to 3 files (+1 heads)
267 added 16 changesets with 16 changes to 3 files (+1 heads)
268 updating to branch stable
268 updating to branch stable
269 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
270
270
271 Repo ua has both heads:
271 Repo ua has both heads:
272
272
273 $ hg -R ua heads
273 $ hg -R ua heads
274 changeset: 15:0aae7cf88f0d
274 changeset: 15:0aae7cf88f0d
275 branch: stable
275 branch: stable
276 tag: tip
276 tag: tip
277 user: test
277 user: test
278 date: Thu Jan 01 00:00:00 1970 +0000
278 date: Thu Jan 01 00:00:00 1970 +0000
279 summary: another change for branch stable
279 summary: another change for branch stable
280
280
281 changeset: 12:f21241060d6a
281 changeset: 12:f21241060d6a
282 user: test
282 user: test
283 date: Thu Jan 01 00:00:00 1970 +0000
283 date: Thu Jan 01 00:00:00 1970 +0000
284 summary: hacked default
284 summary: hacked default
285
285
286
286
287 Same revision checked out in repo a and ua:
287 Same revision checked out in repo a and ua:
288
288
289 $ hg -R a parents --template "{node|short}\n"
289 $ hg -R a parents --template "{node|short}\n"
290 e8ece76546a6
290 e8ece76546a6
291 $ hg -R ua parents --template "{node|short}\n"
291 $ hg -R ua parents --template "{node|short}\n"
292 e8ece76546a6
292 e8ece76546a6
293
293
294 $ rm -r ua
294 $ rm -r ua
295
295
296
296
297 Testing clone -u <branch>:
297 Testing clone -u <branch>:
298
298
299 $ hg clone -u stable a ua
299 $ hg clone -u stable a ua
300 updating to branch stable
300 updating to branch stable
301 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
302
302
303 Repo ua has both heads:
303 Repo ua has both heads:
304
304
305 $ hg -R ua heads
305 $ hg -R ua heads
306 changeset: 15:0aae7cf88f0d
306 changeset: 15:0aae7cf88f0d
307 branch: stable
307 branch: stable
308 tag: tip
308 tag: tip
309 user: test
309 user: test
310 date: Thu Jan 01 00:00:00 1970 +0000
310 date: Thu Jan 01 00:00:00 1970 +0000
311 summary: another change for branch stable
311 summary: another change for branch stable
312
312
313 changeset: 12:f21241060d6a
313 changeset: 12:f21241060d6a
314 user: test
314 user: test
315 date: Thu Jan 01 00:00:00 1970 +0000
315 date: Thu Jan 01 00:00:00 1970 +0000
316 summary: hacked default
316 summary: hacked default
317
317
318
318
319 Branch 'stable' is checked out:
319 Branch 'stable' is checked out:
320
320
321 $ hg -R ua parents
321 $ hg -R ua parents
322 changeset: 15:0aae7cf88f0d
322 changeset: 15:0aae7cf88f0d
323 branch: stable
323 branch: stable
324 tag: tip
324 tag: tip
325 user: test
325 user: test
326 date: Thu Jan 01 00:00:00 1970 +0000
326 date: Thu Jan 01 00:00:00 1970 +0000
327 summary: another change for branch stable
327 summary: another change for branch stable
328
328
329
329
330 $ rm -r ua
330 $ rm -r ua
331
331
332
332
333 Testing default checkout:
333 Testing default checkout:
334
334
335 $ hg clone a ua
335 $ hg clone a ua
336 updating to branch default
336 updating to branch default
337 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
337 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
338
338
339 Repo ua has both heads:
339 Repo ua has both heads:
340
340
341 $ hg -R ua heads
341 $ hg -R ua heads
342 changeset: 15:0aae7cf88f0d
342 changeset: 15:0aae7cf88f0d
343 branch: stable
343 branch: stable
344 tag: tip
344 tag: tip
345 user: test
345 user: test
346 date: Thu Jan 01 00:00:00 1970 +0000
346 date: Thu Jan 01 00:00:00 1970 +0000
347 summary: another change for branch stable
347 summary: another change for branch stable
348
348
349 changeset: 12:f21241060d6a
349 changeset: 12:f21241060d6a
350 user: test
350 user: test
351 date: Thu Jan 01 00:00:00 1970 +0000
351 date: Thu Jan 01 00:00:00 1970 +0000
352 summary: hacked default
352 summary: hacked default
353
353
354
354
355 Branch 'default' is checked out:
355 Branch 'default' is checked out:
356
356
357 $ hg -R ua parents
357 $ hg -R ua parents
358 changeset: 12:f21241060d6a
358 changeset: 12:f21241060d6a
359 user: test
359 user: test
360 date: Thu Jan 01 00:00:00 1970 +0000
360 date: Thu Jan 01 00:00:00 1970 +0000
361 summary: hacked default
361 summary: hacked default
362
362
363 Test clone with a branch named "@" (issue3677)
363 Test clone with a branch named "@" (issue3677)
364
364
365 $ hg -R ua branch @
365 $ hg -R ua branch @
366 marked working directory as branch @
366 marked working directory as branch @
367 $ hg -R ua commit -m 'created branch @'
367 $ hg -R ua commit -m 'created branch @'
368 $ hg clone ua atbranch
368 $ hg clone ua atbranch
369 updating to branch default
369 updating to branch default
370 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 $ hg -R atbranch heads
371 $ hg -R atbranch heads
372 changeset: 16:798b6d97153e
372 changeset: 16:798b6d97153e
373 branch: @
373 branch: @
374 tag: tip
374 tag: tip
375 parent: 12:f21241060d6a
375 parent: 12:f21241060d6a
376 user: test
376 user: test
377 date: Thu Jan 01 00:00:00 1970 +0000
377 date: Thu Jan 01 00:00:00 1970 +0000
378 summary: created branch @
378 summary: created branch @
379
379
380 changeset: 15:0aae7cf88f0d
380 changeset: 15:0aae7cf88f0d
381 branch: stable
381 branch: stable
382 user: test
382 user: test
383 date: Thu Jan 01 00:00:00 1970 +0000
383 date: Thu Jan 01 00:00:00 1970 +0000
384 summary: another change for branch stable
384 summary: another change for branch stable
385
385
386 changeset: 12:f21241060d6a
386 changeset: 12:f21241060d6a
387 user: test
387 user: test
388 date: Thu Jan 01 00:00:00 1970 +0000
388 date: Thu Jan 01 00:00:00 1970 +0000
389 summary: hacked default
389 summary: hacked default
390
390
391 $ hg -R atbranch parents
391 $ hg -R atbranch parents
392 changeset: 12:f21241060d6a
392 changeset: 12:f21241060d6a
393 user: test
393 user: test
394 date: Thu Jan 01 00:00:00 1970 +0000
394 date: Thu Jan 01 00:00:00 1970 +0000
395 summary: hacked default
395 summary: hacked default
396
396
397
397
398 $ rm -r ua atbranch
398 $ rm -r ua atbranch
399
399
400
400
401 Testing #<branch>:
401 Testing #<branch>:
402
402
403 $ hg clone -u . a#stable ua
403 $ hg clone -u . a#stable ua
404 adding changesets
404 adding changesets
405 adding manifests
405 adding manifests
406 adding file changes
406 adding file changes
407 added 14 changesets with 14 changes to 3 files
407 added 14 changesets with 14 changes to 3 files
408 updating to branch stable
408 updating to branch stable
409 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
410
410
411 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
411 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
412
412
413 $ hg -R ua heads
413 $ hg -R ua heads
414 changeset: 13:0aae7cf88f0d
414 changeset: 13:0aae7cf88f0d
415 branch: stable
415 branch: stable
416 tag: tip
416 tag: tip
417 user: test
417 user: test
418 date: Thu Jan 01 00:00:00 1970 +0000
418 date: Thu Jan 01 00:00:00 1970 +0000
419 summary: another change for branch stable
419 summary: another change for branch stable
420
420
421 changeset: 10:a7949464abda
421 changeset: 10:a7949464abda
422 user: test
422 user: test
423 date: Thu Jan 01 00:00:00 1970 +0000
423 date: Thu Jan 01 00:00:00 1970 +0000
424 summary: test
424 summary: test
425
425
426
426
427 Same revision checked out in repo a and ua:
427 Same revision checked out in repo a and ua:
428
428
429 $ hg -R a parents --template "{node|short}\n"
429 $ hg -R a parents --template "{node|short}\n"
430 e8ece76546a6
430 e8ece76546a6
431 $ hg -R ua parents --template "{node|short}\n"
431 $ hg -R ua parents --template "{node|short}\n"
432 e8ece76546a6
432 e8ece76546a6
433
433
434 $ rm -r ua
434 $ rm -r ua
435
435
436
436
437 Testing -u -r <branch>:
437 Testing -u -r <branch>:
438
438
439 $ hg clone -u . -r stable a ua
439 $ hg clone -u . -r stable a ua
440 adding changesets
440 adding changesets
441 adding manifests
441 adding manifests
442 adding file changes
442 adding file changes
443 added 14 changesets with 14 changes to 3 files
443 added 14 changesets with 14 changes to 3 files
444 updating to branch stable
444 updating to branch stable
445 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
446
446
447 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
447 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
448
448
449 $ hg -R ua heads
449 $ hg -R ua heads
450 changeset: 13:0aae7cf88f0d
450 changeset: 13:0aae7cf88f0d
451 branch: stable
451 branch: stable
452 tag: tip
452 tag: tip
453 user: test
453 user: test
454 date: Thu Jan 01 00:00:00 1970 +0000
454 date: Thu Jan 01 00:00:00 1970 +0000
455 summary: another change for branch stable
455 summary: another change for branch stable
456
456
457 changeset: 10:a7949464abda
457 changeset: 10:a7949464abda
458 user: test
458 user: test
459 date: Thu Jan 01 00:00:00 1970 +0000
459 date: Thu Jan 01 00:00:00 1970 +0000
460 summary: test
460 summary: test
461
461
462
462
463 Same revision checked out in repo a and ua:
463 Same revision checked out in repo a and ua:
464
464
465 $ hg -R a parents --template "{node|short}\n"
465 $ hg -R a parents --template "{node|short}\n"
466 e8ece76546a6
466 e8ece76546a6
467 $ hg -R ua parents --template "{node|short}\n"
467 $ hg -R ua parents --template "{node|short}\n"
468 e8ece76546a6
468 e8ece76546a6
469
469
470 $ rm -r ua
470 $ rm -r ua
471
471
472
472
473 Testing -r <branch>:
473 Testing -r <branch>:
474
474
475 $ hg clone -r stable a ua
475 $ hg clone -r stable a ua
476 adding changesets
476 adding changesets
477 adding manifests
477 adding manifests
478 adding file changes
478 adding file changes
479 added 14 changesets with 14 changes to 3 files
479 added 14 changesets with 14 changes to 3 files
480 updating to branch stable
480 updating to branch stable
481 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
481 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
482
482
483 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
483 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
484
484
485 $ hg -R ua heads
485 $ hg -R ua heads
486 changeset: 13:0aae7cf88f0d
486 changeset: 13:0aae7cf88f0d
487 branch: stable
487 branch: stable
488 tag: tip
488 tag: tip
489 user: test
489 user: test
490 date: Thu Jan 01 00:00:00 1970 +0000
490 date: Thu Jan 01 00:00:00 1970 +0000
491 summary: another change for branch stable
491 summary: another change for branch stable
492
492
493 changeset: 10:a7949464abda
493 changeset: 10:a7949464abda
494 user: test
494 user: test
495 date: Thu Jan 01 00:00:00 1970 +0000
495 date: Thu Jan 01 00:00:00 1970 +0000
496 summary: test
496 summary: test
497
497
498
498
499 Branch 'stable' is checked out:
499 Branch 'stable' is checked out:
500
500
501 $ hg -R ua parents
501 $ hg -R ua parents
502 changeset: 13:0aae7cf88f0d
502 changeset: 13:0aae7cf88f0d
503 branch: stable
503 branch: stable
504 tag: tip
504 tag: tip
505 user: test
505 user: test
506 date: Thu Jan 01 00:00:00 1970 +0000
506 date: Thu Jan 01 00:00:00 1970 +0000
507 summary: another change for branch stable
507 summary: another change for branch stable
508
508
509
509
510 $ rm -r ua
510 $ rm -r ua
511
511
512
512
513 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
513 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
514 iterable in addbranchrevs()
514 iterable in addbranchrevs()
515
515
516 $ cat <<EOF > simpleclone.py
516 $ cat <<EOF > simpleclone.py
517 > from mercurial import ui, hg
517 > from mercurial import ui, hg
518 > myui = ui.ui.load()
518 > myui = ui.ui.load()
519 > repo = hg.repository(myui, 'a')
519 > repo = hg.repository(myui, 'a')
520 > hg.clone(myui, {}, repo, dest="ua")
520 > hg.clone(myui, {}, repo, dest="ua")
521 > EOF
521 > EOF
522
522
523 $ python simpleclone.py
523 $ python simpleclone.py
524 updating to branch default
524 updating to branch default
525 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
525 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
526
526
527 $ rm -r ua
527 $ rm -r ua
528
528
529 $ cat <<EOF > branchclone.py
529 $ cat <<EOF > branchclone.py
530 > from mercurial import ui, hg, extensions
530 > from mercurial import ui, hg, extensions
531 > myui = ui.ui.load()
531 > myui = ui.ui.load()
532 > extensions.loadall(myui)
532 > extensions.loadall(myui)
533 > repo = hg.repository(myui, 'a')
533 > repo = hg.repository(myui, 'a')
534 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
534 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
535 > EOF
535 > EOF
536
536
537 $ python branchclone.py
537 $ python branchclone.py
538 adding changesets
538 adding changesets
539 adding manifests
539 adding manifests
540 adding file changes
540 adding file changes
541 added 14 changesets with 14 changes to 3 files
541 added 14 changesets with 14 changes to 3 files
542 updating to branch stable
542 updating to branch stable
543 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
543 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
544 $ rm -r ua
544 $ rm -r ua
545
545
546
546
547 Test clone with special '@' bookmark:
547 Test clone with special '@' bookmark:
548 $ cd a
548 $ cd a
549 $ hg bookmark -r a7949464abda @ # branch point of stable from default
549 $ hg bookmark -r a7949464abda @ # branch point of stable from default
550 $ hg clone . ../i
550 $ hg clone . ../i
551 updating to bookmark @
551 updating to bookmark @
552 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
552 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
553 $ hg id -i ../i
553 $ hg id -i ../i
554 a7949464abda
554 a7949464abda
555 $ rm -r ../i
555 $ rm -r ../i
556
556
557 $ hg bookmark -f -r stable @
557 $ hg bookmark -f -r stable @
558 $ hg bookmarks
558 $ hg bookmarks
559 @ 15:0aae7cf88f0d
559 @ 15:0aae7cf88f0d
560 $ hg clone . ../i
560 $ hg clone . ../i
561 updating to bookmark @ on branch stable
561 updating to bookmark @ on branch stable
562 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
562 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
563 $ hg id -i ../i
563 $ hg id -i ../i
564 0aae7cf88f0d
564 0aae7cf88f0d
565 $ cd "$TESTTMP"
565 $ cd "$TESTTMP"
566
566
567
567
568 Testing failures:
568 Testing failures:
569
569
570 $ mkdir fail
570 $ mkdir fail
571 $ cd fail
571 $ cd fail
572
572
573 No local source
573 No local source
574
574
575 $ hg clone a b
575 $ hg clone a b
576 abort: repository a not found!
576 abort: repository a not found!
577 [255]
577 [255]
578
578
579 No remote source
579 No remote source
580
580
581 #if windows
581 #if windows
582 $ hg clone http://$LOCALIP:3121/a b
582 $ hg clone http://$LOCALIP:3121/a b
583 abort: error: * (glob)
583 abort: error: * (glob)
584 [255]
584 [255]
585 #else
585 #else
586 $ hg clone http://$LOCALIP:3121/a b
586 $ hg clone http://$LOCALIP:3121/a b
587 abort: error: *refused* (glob)
587 abort: error: *refused* (glob)
588 [255]
588 [255]
589 #endif
589 #endif
590 $ rm -rf b # work around bug with http clone
590 $ rm -rf b # work around bug with http clone
591
591
592
592
593 #if unix-permissions no-root
593 #if unix-permissions no-root
594
594
595 Inaccessible source
595 Inaccessible source
596
596
597 $ mkdir a
597 $ mkdir a
598 $ chmod 000 a
598 $ chmod 000 a
599 $ hg clone a b
599 $ hg clone a b
600 abort: repository a not found!
600 abort: repository a not found!
601 [255]
601 [255]
602
602
603 Inaccessible destination
603 Inaccessible destination
604
604
605 $ hg init b
605 $ hg init b
606 $ cd b
606 $ cd b
607 $ hg clone . ../a
607 $ hg clone . ../a
608 abort: Permission denied: '../a'
608 abort: Permission denied: '../a'
609 [255]
609 [255]
610 $ cd ..
610 $ cd ..
611 $ chmod 700 a
611 $ chmod 700 a
612 $ rm -r a b
612 $ rm -r a b
613
613
614 #endif
614 #endif
615
615
616
616
617 #if fifo
617 #if fifo
618
618
619 Source of wrong type
619 Source of wrong type
620
620
621 $ mkfifo a
621 $ mkfifo a
622 $ hg clone a b
622 $ hg clone a b
623 abort: repository a not found!
623 abort: repository a not found!
624 [255]
624 [255]
625 $ rm a
625 $ rm a
626
626
627 #endif
627 #endif
628
628
629 Default destination, same directory
629 Default destination, same directory
630
630
631 $ hg init q
631 $ hg init q
632 $ hg clone q
632 $ hg clone q
633 destination directory: q
633 destination directory: q
634 abort: destination 'q' is not empty
634 abort: destination 'q' is not empty
635 [255]
635 [255]
636
636
637 destination directory not empty
637 destination directory not empty
638
638
639 $ mkdir a
639 $ mkdir a
640 $ echo stuff > a/a
640 $ echo stuff > a/a
641 $ hg clone q a
641 $ hg clone q a
642 abort: destination 'a' is not empty
642 abort: destination 'a' is not empty
643 [255]
643 [255]
644
644
645
645
646 #if unix-permissions no-root
646 #if unix-permissions no-root
647
647
648 leave existing directory in place after clone failure
648 leave existing directory in place after clone failure
649
649
650 $ hg init c
650 $ hg init c
651 $ cd c
651 $ cd c
652 $ echo c > c
652 $ echo c > c
653 $ hg commit -A -m test
653 $ hg commit -A -m test
654 adding c
654 adding c
655 $ chmod -rx .hg/store/data
655 $ chmod -rx .hg/store/data
656 $ cd ..
656 $ cd ..
657 $ mkdir d
657 $ mkdir d
658 $ hg clone c d 2> err
658 $ hg clone c d 2> err
659 [255]
659 [255]
660 $ test -d d
660 $ test -d d
661 $ test -d d/.hg
661 $ test -d d/.hg
662 [1]
662 [1]
663
663
664 re-enable perm to allow deletion
664 re-enable perm to allow deletion
665
665
666 $ chmod +rx c/.hg/store/data
666 $ chmod +rx c/.hg/store/data
667
667
668 #endif
668 #endif
669
669
670 $ cd ..
670 $ cd ..
671
671
672 Test clone from the repository in (emulated) revlog format 0 (issue4203):
672 Test clone from the repository in (emulated) revlog format 0 (issue4203):
673
673
674 $ mkdir issue4203
674 $ mkdir issue4203
675 $ mkdir -p src/.hg
675 $ mkdir -p src/.hg
676 $ echo foo > src/foo
676 $ echo foo > src/foo
677 $ hg -R src add src/foo
677 $ hg -R src add src/foo
678 $ hg -R src commit -m '#0'
678 $ hg -R src commit -m '#0'
679 $ hg -R src log -q
679 $ hg -R src log -q
680 0:e1bab28bca43
680 0:e1bab28bca43
681 $ hg clone -U -q src dst
681 $ hg clone -U -q src dst
682 $ hg -R dst log -q
682 $ hg -R dst log -q
683 0:e1bab28bca43
683 0:e1bab28bca43
684
684
685 Create repositories to test auto sharing functionality
685 Create repositories to test auto sharing functionality
686
686
687 $ cat >> $HGRCPATH << EOF
687 $ cat >> $HGRCPATH << EOF
688 > [extensions]
688 > [extensions]
689 > share=
689 > share=
690 > EOF
690 > EOF
691
691
692 $ hg init empty
692 $ hg init empty
693 $ hg init source1a
693 $ hg init source1a
694 $ cd source1a
694 $ cd source1a
695 $ echo initial1 > foo
695 $ echo initial1 > foo
696 $ hg -q commit -A -m initial
696 $ hg -q commit -A -m initial
697 $ echo second > foo
697 $ echo second > foo
698 $ hg commit -m second
698 $ hg commit -m second
699 $ cd ..
699 $ cd ..
700
700
701 $ hg init filteredrev0
701 $ hg init filteredrev0
702 $ cd filteredrev0
702 $ cd filteredrev0
703 $ cat >> .hg/hgrc << EOF
703 $ cat >> .hg/hgrc << EOF
704 > [experimental]
704 > [experimental]
705 > evolution=createmarkers
705 > evolution=createmarkers
706 > EOF
706 > EOF
707 $ echo initial1 > foo
707 $ echo initial1 > foo
708 $ hg -q commit -A -m initial0
708 $ hg -q commit -A -m initial0
709 $ hg -q up -r null
709 $ hg -q up -r null
710 $ echo initial2 > foo
710 $ echo initial2 > foo
711 $ hg -q commit -A -m initial1
711 $ hg -q commit -A -m initial1
712 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
712 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
713 $ cd ..
713 $ cd ..
714
714
715 $ hg -q clone --pull source1a source1b
715 $ hg -q clone --pull source1a source1b
716 $ cd source1a
716 $ cd source1a
717 $ hg bookmark bookA
717 $ hg bookmark bookA
718 $ echo 1a > foo
718 $ echo 1a > foo
719 $ hg commit -m 1a
719 $ hg commit -m 1a
720 $ cd ../source1b
720 $ cd ../source1b
721 $ hg -q up -r 0
721 $ hg -q up -r 0
722 $ echo head1 > foo
722 $ echo head1 > foo
723 $ hg commit -m head1
723 $ hg commit -m head1
724 created new head
724 created new head
725 $ hg bookmark head1
725 $ hg bookmark head1
726 $ hg -q up -r 0
726 $ hg -q up -r 0
727 $ echo head2 > foo
727 $ echo head2 > foo
728 $ hg commit -m head2
728 $ hg commit -m head2
729 created new head
729 created new head
730 $ hg bookmark head2
730 $ hg bookmark head2
731 $ hg -q up -r 0
731 $ hg -q up -r 0
732 $ hg branch branch1
732 $ hg branch branch1
733 marked working directory as branch branch1
733 marked working directory as branch branch1
734 (branches are permanent and global, did you want a bookmark?)
734 (branches are permanent and global, did you want a bookmark?)
735 $ echo branch1 > foo
735 $ echo branch1 > foo
736 $ hg commit -m branch1
736 $ hg commit -m branch1
737 $ hg -q up -r 0
737 $ hg -q up -r 0
738 $ hg branch branch2
738 $ hg branch branch2
739 marked working directory as branch branch2
739 marked working directory as branch branch2
740 $ echo branch2 > foo
740 $ echo branch2 > foo
741 $ hg commit -m branch2
741 $ hg commit -m branch2
742 $ cd ..
742 $ cd ..
743 $ hg init source2
743 $ hg init source2
744 $ cd source2
744 $ cd source2
745 $ echo initial2 > foo
745 $ echo initial2 > foo
746 $ hg -q commit -A -m initial2
746 $ hg -q commit -A -m initial2
747 $ echo second > foo
747 $ echo second > foo
748 $ hg commit -m second
748 $ hg commit -m second
749 $ cd ..
749 $ cd ..
750
750
751 Clone with auto share from an empty repo should not result in share
751 Clone with auto share from an empty repo should not result in share
752
752
753 $ mkdir share
753 $ mkdir share
754 $ hg --config share.pool=share clone empty share-empty
754 $ hg --config share.pool=share clone empty share-empty
755 (not using pooled storage: remote appears to be empty)
755 (not using pooled storage: remote appears to be empty)
756 updating to branch default
756 updating to branch default
757 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
757 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
758 $ ls share
758 $ ls share
759 $ test -d share-empty/.hg/store
759 $ test -d share-empty/.hg/store
760 $ test -f share-empty/.hg/sharedpath
760 $ test -f share-empty/.hg/sharedpath
761 [1]
761 [1]
762
762
763 Clone with auto share from a repo with filtered revision 0 should not result in share
763 Clone with auto share from a repo with filtered revision 0 should not result in share
764
764
765 $ hg --config share.pool=share clone filteredrev0 share-filtered
765 $ hg --config share.pool=share clone filteredrev0 share-filtered
766 (not using pooled storage: unable to resolve identity of remote)
766 (not using pooled storage: unable to resolve identity of remote)
767 requesting all changes
767 requesting all changes
768 adding changesets
768 adding changesets
769 adding manifests
769 adding manifests
770 adding file changes
770 adding file changes
771 added 1 changesets with 1 changes to 1 files
771 added 1 changesets with 1 changes to 1 files
772 updating to branch default
772 updating to branch default
773 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
773 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
774
774
775 Clone from repo with content should result in shared store being created
775 Clone from repo with content should result in shared store being created
776
776
777 $ hg --config share.pool=share clone source1a share-dest1a
777 $ hg --config share.pool=share clone source1a share-dest1a
778 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
778 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
779 requesting all changes
779 requesting all changes
780 adding changesets
780 adding changesets
781 adding manifests
781 adding manifests
782 adding file changes
782 adding file changes
783 added 3 changesets with 3 changes to 1 files
783 added 3 changesets with 3 changes to 1 files
784 searching for changes
784 searching for changes
785 no changes found
785 no changes found
786 adding remote bookmark bookA
786 adding remote bookmark bookA
787 updating working directory
787 updating working directory
788 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
788 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
789
789
790 The shared repo should have been created
790 The shared repo should have been created
791
791
792 $ ls share
792 $ ls share
793 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
793 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
794
794
795 The destination should point to it
795 The destination should point to it
796
796
797 $ cat share-dest1a/.hg/sharedpath; echo
797 $ cat share-dest1a/.hg/sharedpath; echo
798 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
798 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
799
799
800 The destination should have bookmarks
800 The destination should have bookmarks
801
801
802 $ hg -R share-dest1a bookmarks
802 $ hg -R share-dest1a bookmarks
803 bookA 2:e5bfe23c0b47
803 bookA 2:e5bfe23c0b47
804
804
805 The default path should be the remote, not the share
805 The default path should be the remote, not the share
806
806
807 $ hg -R share-dest1a config paths.default
807 $ hg -R share-dest1a config paths.default
808 $TESTTMP/source1a (glob)
808 $TESTTMP/source1a (glob)
809
809
810 Clone with existing share dir should result in pull + share
810 Clone with existing share dir should result in pull + share
811
811
812 $ hg --config share.pool=share clone source1b share-dest1b
812 $ hg --config share.pool=share clone source1b share-dest1b
813 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
813 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
814 searching for changes
814 searching for changes
815 adding changesets
815 adding changesets
816 adding manifests
816 adding manifests
817 adding file changes
817 adding file changes
818 added 4 changesets with 4 changes to 1 files (+4 heads)
818 added 4 changesets with 4 changes to 1 files (+4 heads)
819 adding remote bookmark head1
819 adding remote bookmark head1
820 adding remote bookmark head2
820 adding remote bookmark head2
821 updating working directory
821 updating working directory
822 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
823
823
824 $ ls share
824 $ ls share
825 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
825 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
826
826
827 $ cat share-dest1b/.hg/sharedpath; echo
827 $ cat share-dest1b/.hg/sharedpath; echo
828 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
828 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
829
829
830 We only get bookmarks from the remote, not everything in the share
830 We only get bookmarks from the remote, not everything in the share
831
831
832 $ hg -R share-dest1b bookmarks
832 $ hg -R share-dest1b bookmarks
833 head1 3:4a8dc1ab4c13
833 head1 3:4a8dc1ab4c13
834 head2 4:99f71071f117
834 head2 4:99f71071f117
835
835
836 Default path should be source, not share.
836 Default path should be source, not share.
837
837
838 $ hg -R share-dest1b config paths.default
838 $ hg -R share-dest1b config paths.default
839 $TESTTMP/source1b (glob)
839 $TESTTMP/source1b (glob)
840
840
841 Checked out revision should be head of default branch
841 Checked out revision should be head of default branch
842
842
843 $ hg -R share-dest1b log -r .
843 $ hg -R share-dest1b log -r .
844 changeset: 4:99f71071f117
844 changeset: 4:99f71071f117
845 bookmark: head2
845 bookmark: head2
846 parent: 0:b5f04eac9d8f
846 parent: 0:b5f04eac9d8f
847 user: test
847 user: test
848 date: Thu Jan 01 00:00:00 1970 +0000
848 date: Thu Jan 01 00:00:00 1970 +0000
849 summary: head2
849 summary: head2
850
850
851
851
852 Clone from unrelated repo should result in new share
852 Clone from unrelated repo should result in new share
853
853
854 $ hg --config share.pool=share clone source2 share-dest2
854 $ hg --config share.pool=share clone source2 share-dest2
855 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
855 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
856 requesting all changes
856 requesting all changes
857 adding changesets
857 adding changesets
858 adding manifests
858 adding manifests
859 adding file changes
859 adding file changes
860 added 2 changesets with 2 changes to 1 files
860 added 2 changesets with 2 changes to 1 files
861 searching for changes
861 searching for changes
862 no changes found
862 no changes found
863 updating working directory
863 updating working directory
864 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
864 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
865
865
866 $ ls share
866 $ ls share
867 22aeff664783fd44c6d9b435618173c118c3448e
867 22aeff664783fd44c6d9b435618173c118c3448e
868 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
868 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
869
869
870 remote naming mode works as advertised
870 remote naming mode works as advertised
871
871
872 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
872 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
873 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
873 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
874 requesting all changes
874 requesting all changes
875 adding changesets
875 adding changesets
876 adding manifests
876 adding manifests
877 adding file changes
877 adding file changes
878 added 3 changesets with 3 changes to 1 files
878 added 3 changesets with 3 changes to 1 files
879 searching for changes
879 searching for changes
880 no changes found
880 no changes found
881 adding remote bookmark bookA
881 adding remote bookmark bookA
882 updating working directory
882 updating working directory
883 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
883 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
884
884
885 $ ls shareremote
885 $ ls shareremote
886 195bb1fcdb595c14a6c13e0269129ed78f6debde
886 195bb1fcdb595c14a6c13e0269129ed78f6debde
887
887
888 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
888 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
889 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
889 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
890 requesting all changes
890 requesting all changes
891 adding changesets
891 adding changesets
892 adding manifests
892 adding manifests
893 adding file changes
893 adding file changes
894 added 6 changesets with 6 changes to 1 files (+4 heads)
894 added 6 changesets with 6 changes to 1 files (+4 heads)
895 searching for changes
895 searching for changes
896 no changes found
896 no changes found
897 adding remote bookmark head1
897 adding remote bookmark head1
898 adding remote bookmark head2
898 adding remote bookmark head2
899 updating working directory
899 updating working directory
900 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
900 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
901
901
902 $ ls shareremote
902 $ ls shareremote
903 195bb1fcdb595c14a6c13e0269129ed78f6debde
903 195bb1fcdb595c14a6c13e0269129ed78f6debde
904 c0d4f83847ca2a873741feb7048a45085fd47c46
904 c0d4f83847ca2a873741feb7048a45085fd47c46
905
905
906 request to clone a single revision is respected in sharing mode
906 request to clone a single revision is respected in sharing mode
907
907
908 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
908 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
909 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
909 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
910 adding changesets
910 adding changesets
911 adding manifests
911 adding manifests
912 adding file changes
912 adding file changes
913 added 2 changesets with 2 changes to 1 files
913 added 2 changesets with 2 changes to 1 files
914 no changes found
914 no changes found
915 adding remote bookmark head1
915 adding remote bookmark head1
916 updating working directory
916 updating working directory
917 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
917 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
918
918
919 $ hg -R share-1arev log -G
919 $ hg -R share-1arev log -G
920 @ changeset: 1:4a8dc1ab4c13
920 @ changeset: 1:4a8dc1ab4c13
921 | bookmark: head1
921 | bookmark: head1
922 | tag: tip
922 | tag: tip
923 | user: test
923 | user: test
924 | date: Thu Jan 01 00:00:00 1970 +0000
924 | date: Thu Jan 01 00:00:00 1970 +0000
925 | summary: head1
925 | summary: head1
926 |
926 |
927 o changeset: 0:b5f04eac9d8f
927 o changeset: 0:b5f04eac9d8f
928 user: test
928 user: test
929 date: Thu Jan 01 00:00:00 1970 +0000
929 date: Thu Jan 01 00:00:00 1970 +0000
930 summary: initial
930 summary: initial
931
931
932
932
933 making another clone should only pull down requested rev
933 making another clone should only pull down requested rev
934
934
935 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
935 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
936 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
936 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
937 searching for changes
937 searching for changes
938 adding changesets
938 adding changesets
939 adding manifests
939 adding manifests
940 adding file changes
940 adding file changes
941 added 1 changesets with 1 changes to 1 files (+1 heads)
941 added 1 changesets with 1 changes to 1 files (+1 heads)
942 adding remote bookmark head1
942 adding remote bookmark head1
943 adding remote bookmark head2
943 adding remote bookmark head2
944 updating working directory
944 updating working directory
945 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
945 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
946
946
947 $ hg -R share-1brev log -G
947 $ hg -R share-1brev log -G
948 @ changeset: 2:99f71071f117
948 @ changeset: 2:99f71071f117
949 | bookmark: head2
949 | bookmark: head2
950 | tag: tip
950 | tag: tip
951 | parent: 0:b5f04eac9d8f
951 | parent: 0:b5f04eac9d8f
952 | user: test
952 | user: test
953 | date: Thu Jan 01 00:00:00 1970 +0000
953 | date: Thu Jan 01 00:00:00 1970 +0000
954 | summary: head2
954 | summary: head2
955 |
955 |
956 | o changeset: 1:4a8dc1ab4c13
956 | o changeset: 1:4a8dc1ab4c13
957 |/ bookmark: head1
957 |/ bookmark: head1
958 | user: test
958 | user: test
959 | date: Thu Jan 01 00:00:00 1970 +0000
959 | date: Thu Jan 01 00:00:00 1970 +0000
960 | summary: head1
960 | summary: head1
961 |
961 |
962 o changeset: 0:b5f04eac9d8f
962 o changeset: 0:b5f04eac9d8f
963 user: test
963 user: test
964 date: Thu Jan 01 00:00:00 1970 +0000
964 date: Thu Jan 01 00:00:00 1970 +0000
965 summary: initial
965 summary: initial
966
966
967
967
968 Request to clone a single branch is respected in sharing mode
968 Request to clone a single branch is respected in sharing mode
969
969
970 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
970 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
971 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
971 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
972 adding changesets
972 adding changesets
973 adding manifests
973 adding manifests
974 adding file changes
974 adding file changes
975 added 2 changesets with 2 changes to 1 files
975 added 2 changesets with 2 changes to 1 files
976 no changes found
976 no changes found
977 updating working directory
977 updating working directory
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
979
979
980 $ hg -R share-1bbranch1 log -G
980 $ hg -R share-1bbranch1 log -G
981 o changeset: 1:5f92a6c1a1b1
981 o changeset: 1:5f92a6c1a1b1
982 | branch: branch1
982 | branch: branch1
983 | tag: tip
983 | tag: tip
984 | user: test
984 | user: test
985 | date: Thu Jan 01 00:00:00 1970 +0000
985 | date: Thu Jan 01 00:00:00 1970 +0000
986 | summary: branch1
986 | summary: branch1
987 |
987 |
988 @ changeset: 0:b5f04eac9d8f
988 @ changeset: 0:b5f04eac9d8f
989 user: test
989 user: test
990 date: Thu Jan 01 00:00:00 1970 +0000
990 date: Thu Jan 01 00:00:00 1970 +0000
991 summary: initial
991 summary: initial
992
992
993
993
994 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
994 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
995 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
995 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
996 searching for changes
996 searching for changes
997 adding changesets
997 adding changesets
998 adding manifests
998 adding manifests
999 adding file changes
999 adding file changes
1000 added 1 changesets with 1 changes to 1 files (+1 heads)
1000 added 1 changesets with 1 changes to 1 files (+1 heads)
1001 updating working directory
1001 updating working directory
1002 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1002 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1003
1003
1004 $ hg -R share-1bbranch2 log -G
1004 $ hg -R share-1bbranch2 log -G
1005 o changeset: 2:6bacf4683960
1005 o changeset: 2:6bacf4683960
1006 | branch: branch2
1006 | branch: branch2
1007 | tag: tip
1007 | tag: tip
1008 | parent: 0:b5f04eac9d8f
1008 | parent: 0:b5f04eac9d8f
1009 | user: test
1009 | user: test
1010 | date: Thu Jan 01 00:00:00 1970 +0000
1010 | date: Thu Jan 01 00:00:00 1970 +0000
1011 | summary: branch2
1011 | summary: branch2
1012 |
1012 |
1013 | o changeset: 1:5f92a6c1a1b1
1013 | o changeset: 1:5f92a6c1a1b1
1014 |/ branch: branch1
1014 |/ branch: branch1
1015 | user: test
1015 | user: test
1016 | date: Thu Jan 01 00:00:00 1970 +0000
1016 | date: Thu Jan 01 00:00:00 1970 +0000
1017 | summary: branch1
1017 | summary: branch1
1018 |
1018 |
1019 @ changeset: 0:b5f04eac9d8f
1019 @ changeset: 0:b5f04eac9d8f
1020 user: test
1020 user: test
1021 date: Thu Jan 01 00:00:00 1970 +0000
1021 date: Thu Jan 01 00:00:00 1970 +0000
1022 summary: initial
1022 summary: initial
1023
1023
1024
1024
1025 -U is respected in share clone mode
1025 -U is respected in share clone mode
1026
1026
1027 $ hg --config share.pool=share clone -U source1a share-1anowc
1027 $ hg --config share.pool=share clone -U source1a share-1anowc
1028 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1028 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1029 searching for changes
1029 searching for changes
1030 no changes found
1030 no changes found
1031 adding remote bookmark bookA
1031 adding remote bookmark bookA
1032
1032
1033 $ ls share-1anowc
1033 $ ls share-1anowc
1034
1034
1035 Test that auto sharing doesn't cause failure of "hg clone local remote"
1035 Test that auto sharing doesn't cause failure of "hg clone local remote"
1036
1036
1037 $ cd $TESTTMP
1037 $ cd $TESTTMP
1038 $ hg -R a id -r 0
1038 $ hg -R a id -r 0
1039 acb14030fe0a
1039 acb14030fe0a
1040 $ hg id -R remote -r 0
1040 $ hg id -R remote -r 0
1041 abort: repository remote not found!
1041 abort: repository remote not found!
1042 [255]
1042 [255]
1043 $ hg --config share.pool=share -q clone -e "python \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1043 $ hg --config share.pool=share -q clone -e "python \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1044 $ hg -R remote id -r 0
1044 $ hg -R remote id -r 0
1045 acb14030fe0a
1045 acb14030fe0a
1046
1046
1047 Cloning into pooled storage doesn't race (issue5104)
1047 Cloning into pooled storage doesn't race (issue5104)
1048
1048
1049 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1049 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1050 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1050 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1051 $ wait
1051 $ wait
1052
1052
1053 $ hg -R share-destrace1 log -r tip
1053 $ hg -R share-destrace1 log -r tip
1054 changeset: 2:e5bfe23c0b47
1054 changeset: 2:e5bfe23c0b47
1055 bookmark: bookA
1055 bookmark: bookA
1056 tag: tip
1056 tag: tip
1057 user: test
1057 user: test
1058 date: Thu Jan 01 00:00:00 1970 +0000
1058 date: Thu Jan 01 00:00:00 1970 +0000
1059 summary: 1a
1059 summary: 1a
1060
1060
1061
1061
1062 $ hg -R share-destrace2 log -r tip
1062 $ hg -R share-destrace2 log -r tip
1063 changeset: 2:e5bfe23c0b47
1063 changeset: 2:e5bfe23c0b47
1064 bookmark: bookA
1064 bookmark: bookA
1065 tag: tip
1065 tag: tip
1066 user: test
1066 user: test
1067 date: Thu Jan 01 00:00:00 1970 +0000
1067 date: Thu Jan 01 00:00:00 1970 +0000
1068 summary: 1a
1068 summary: 1a
1069
1069
1070 One repo should be new, the other should be shared from the pool. We
1070 One repo should be new, the other should be shared from the pool. We
1071 don't care which is which, so we just make sure we always print the
1071 don't care which is which, so we just make sure we always print the
1072 one containing "new pooled" first, then one one containing "existing
1072 one containing "new pooled" first, then one one containing "existing
1073 pooled".
1073 pooled".
1074
1074
1075 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1075 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1076 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1076 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1077 requesting all changes
1077 requesting all changes
1078 adding changesets
1078 adding changesets
1079 adding manifests
1079 adding manifests
1080 adding file changes
1080 adding file changes
1081 added 3 changesets with 3 changes to 1 files
1081 added 3 changesets with 3 changes to 1 files
1082 searching for changes
1082 searching for changes
1083 no changes found
1083 no changes found
1084 adding remote bookmark bookA
1084 adding remote bookmark bookA
1085 updating working directory
1085 updating working directory
1086 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1086 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1087
1087
1088 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1088 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1089 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1089 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1090 searching for changes
1090 searching for changes
1091 no changes found
1091 no changes found
1092 adding remote bookmark bookA
1092 adding remote bookmark bookA
1093 updating working directory
1093 updating working directory
1094 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1094 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1095
1096 SEC: check for unsafe ssh url
1097
1098 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1099 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1100 [255]
1101 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1102 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1103 [255]
1104 $ hg clone 'ssh://fakehost|shellcommand/path'
1105 abort: potentially unsafe url: 'ssh://fakehost|shellcommand/path'
1106 [255]
1107 $ hg clone 'ssh://fakehost%7Cshellcommand/path'
1108 abort: potentially unsafe url: 'ssh://fakehost|shellcommand/path'
1109 [255]
1110
1111 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1112 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1113 [255]
1114 We should not have created a file named owned - if it exists, the
1115 attack succeeded.
1116 $ if test -f owned; then echo 'you got owned'; fi
General Comments 0
You need to be logged in to leave comments. Login now