##// END OF EJS Templates
tests: add per-line output conditionals for Windows
Matt Harbison -
r31830:d34316ae default
parent child Browse files
Show More
@@ -1,1094 +1,1094 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
34 checkisexec (execbit !)
35 checklink
35 checklink (symlink !)
36 checklink-target
36 checklink-target (symlink !)
37 checknoexec
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
52 checkisexec (execbit !)
53 checklink
53 checklink (symlink !)
54 checklink-target
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
@@ -1,621 +1,621 b''
1 $ fileset() {
1 $ fileset() {
2 > hg debugfileset "$@"
2 > hg debugfileset "$@"
3 > }
3 > }
4
4
5 $ hg init repo
5 $ hg init repo
6 $ cd repo
6 $ cd repo
7 $ echo a > a1
7 $ echo a > a1
8 $ echo a > a2
8 $ echo a > a2
9 $ echo b > b1
9 $ echo b > b1
10 $ echo b > b2
10 $ echo b > b2
11 $ hg ci -Am addfiles
11 $ hg ci -Am addfiles
12 adding a1
12 adding a1
13 adding a2
13 adding a2
14 adding b1
14 adding b1
15 adding b2
15 adding b2
16
16
17 Test operators and basic patterns
17 Test operators and basic patterns
18
18
19 $ fileset -v a1
19 $ fileset -v a1
20 ('symbol', 'a1')
20 ('symbol', 'a1')
21 a1
21 a1
22 $ fileset -v 'a*'
22 $ fileset -v 'a*'
23 ('symbol', 'a*')
23 ('symbol', 'a*')
24 a1
24 a1
25 a2
25 a2
26 $ fileset -v '"re:a\d"'
26 $ fileset -v '"re:a\d"'
27 ('string', 're:a\\d')
27 ('string', 're:a\\d')
28 a1
28 a1
29 a2
29 a2
30 $ fileset -v 'a1 or a2'
30 $ fileset -v 'a1 or a2'
31 (or
31 (or
32 ('symbol', 'a1')
32 ('symbol', 'a1')
33 ('symbol', 'a2'))
33 ('symbol', 'a2'))
34 a1
34 a1
35 a2
35 a2
36 $ fileset 'a1 | a2'
36 $ fileset 'a1 | a2'
37 a1
37 a1
38 a2
38 a2
39 $ fileset 'a* and "*1"'
39 $ fileset 'a* and "*1"'
40 a1
40 a1
41 $ fileset 'a* & "*1"'
41 $ fileset 'a* & "*1"'
42 a1
42 a1
43 $ fileset 'not (r"a*")'
43 $ fileset 'not (r"a*")'
44 b1
44 b1
45 b2
45 b2
46 $ fileset '! ("a*")'
46 $ fileset '! ("a*")'
47 b1
47 b1
48 b2
48 b2
49 $ fileset 'a* - a1'
49 $ fileset 'a* - a1'
50 a2
50 a2
51 $ fileset 'a_b'
51 $ fileset 'a_b'
52 $ fileset '"\xy"'
52 $ fileset '"\xy"'
53 hg: parse error: invalid \x escape
53 hg: parse error: invalid \x escape
54 [255]
54 [255]
55
55
56 Test files status
56 Test files status
57
57
58 $ rm a1
58 $ rm a1
59 $ hg rm a2
59 $ hg rm a2
60 $ echo b >> b2
60 $ echo b >> b2
61 $ hg cp b1 c1
61 $ hg cp b1 c1
62 $ echo c > c2
62 $ echo c > c2
63 $ echo c > c3
63 $ echo c > c3
64 $ cat > .hgignore <<EOF
64 $ cat > .hgignore <<EOF
65 > \.hgignore
65 > \.hgignore
66 > 2$
66 > 2$
67 > EOF
67 > EOF
68 $ fileset 'modified()'
68 $ fileset 'modified()'
69 b2
69 b2
70 $ fileset 'added()'
70 $ fileset 'added()'
71 c1
71 c1
72 $ fileset 'removed()'
72 $ fileset 'removed()'
73 a2
73 a2
74 $ fileset 'deleted()'
74 $ fileset 'deleted()'
75 a1
75 a1
76 $ fileset 'missing()'
76 $ fileset 'missing()'
77 a1
77 a1
78 $ fileset 'unknown()'
78 $ fileset 'unknown()'
79 c3
79 c3
80 $ fileset 'ignored()'
80 $ fileset 'ignored()'
81 .hgignore
81 .hgignore
82 c2
82 c2
83 $ fileset 'hgignore()'
83 $ fileset 'hgignore()'
84 a2
84 a2
85 b2
85 b2
86 $ fileset 'clean()'
86 $ fileset 'clean()'
87 b1
87 b1
88 $ fileset 'copied()'
88 $ fileset 'copied()'
89 c1
89 c1
90
90
91 Test files status in different revisions
91 Test files status in different revisions
92
92
93 $ hg status -m
93 $ hg status -m
94 M b2
94 M b2
95 $ fileset -r0 'revs("wdir()", modified())' --traceback
95 $ fileset -r0 'revs("wdir()", modified())' --traceback
96 b2
96 b2
97 $ hg status -a
97 $ hg status -a
98 A c1
98 A c1
99 $ fileset -r0 'revs("wdir()", added())'
99 $ fileset -r0 'revs("wdir()", added())'
100 c1
100 c1
101 $ hg status --change 0 -a
101 $ hg status --change 0 -a
102 A a1
102 A a1
103 A a2
103 A a2
104 A b1
104 A b1
105 A b2
105 A b2
106 $ hg status -mru
106 $ hg status -mru
107 M b2
107 M b2
108 R a2
108 R a2
109 ? c3
109 ? c3
110 $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())'
110 $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())'
111 b2
111 b2
112 a2
112 a2
113 $ fileset -r0 'added() or revs("wdir()", added())'
113 $ fileset -r0 'added() or revs("wdir()", added())'
114 a1
114 a1
115 a2
115 a2
116 b1
116 b1
117 b2
117 b2
118 c1
118 c1
119
119
120 Test files properties
120 Test files properties
121
121
122 >>> file('bin', 'wb').write('\0a')
122 >>> file('bin', 'wb').write('\0a')
123 $ fileset 'binary()'
123 $ fileset 'binary()'
124 $ fileset 'binary() and unknown()'
124 $ fileset 'binary() and unknown()'
125 bin
125 bin
126 $ echo '^bin$' >> .hgignore
126 $ echo '^bin$' >> .hgignore
127 $ fileset 'binary() and ignored()'
127 $ fileset 'binary() and ignored()'
128 bin
128 bin
129 $ hg add bin
129 $ hg add bin
130 $ fileset 'binary()'
130 $ fileset 'binary()'
131 bin
131 bin
132
132
133 $ fileset 'grep("b{1}")'
133 $ fileset 'grep("b{1}")'
134 b2
134 b2
135 c1
135 c1
136 b1
136 b1
137 $ fileset 'grep("missingparens(")'
137 $ fileset 'grep("missingparens(")'
138 hg: parse error: invalid match pattern: unbalanced parenthesis
138 hg: parse error: invalid match pattern: unbalanced parenthesis
139 [255]
139 [255]
140
140
141 #if execbit
141 #if execbit
142 $ chmod +x b2
142 $ chmod +x b2
143 $ fileset 'exec()'
143 $ fileset 'exec()'
144 b2
144 b2
145 #endif
145 #endif
146
146
147 #if symlink
147 #if symlink
148 $ ln -s b2 b2link
148 $ ln -s b2 b2link
149 $ fileset 'symlink() and unknown()'
149 $ fileset 'symlink() and unknown()'
150 b2link
150 b2link
151 $ hg add b2link
151 $ hg add b2link
152 #endif
152 #endif
153
153
154 #if no-windows
154 #if no-windows
155 $ echo foo > con.xml
155 $ echo foo > con.xml
156 $ fileset 'not portable()'
156 $ fileset 'not portable()'
157 con.xml
157 con.xml
158 $ hg --config ui.portablefilenames=ignore add con.xml
158 $ hg --config ui.portablefilenames=ignore add con.xml
159 #endif
159 #endif
160
160
161 >>> file('1k', 'wb').write(' '*1024)
161 >>> file('1k', 'wb').write(' '*1024)
162 >>> file('2k', 'wb').write(' '*2048)
162 >>> file('2k', 'wb').write(' '*2048)
163 $ hg add 1k 2k
163 $ hg add 1k 2k
164 $ fileset 'size("bar")'
164 $ fileset 'size("bar")'
165 hg: parse error: couldn't parse size: bar
165 hg: parse error: couldn't parse size: bar
166 [255]
166 [255]
167 $ fileset '(1k, 2k)'
167 $ fileset '(1k, 2k)'
168 hg: parse error: can't use a list in this context
168 hg: parse error: can't use a list in this context
169 (see hg help "filesets.x or y")
169 (see hg help "filesets.x or y")
170 [255]
170 [255]
171 $ fileset 'size(1k)'
171 $ fileset 'size(1k)'
172 1k
172 1k
173 $ fileset '(1k or 2k) and size("< 2k")'
173 $ fileset '(1k or 2k) and size("< 2k")'
174 1k
174 1k
175 $ fileset '(1k or 2k) and size("<=2k")'
175 $ fileset '(1k or 2k) and size("<=2k")'
176 1k
176 1k
177 2k
177 2k
178 $ fileset '(1k or 2k) and size("> 1k")'
178 $ fileset '(1k or 2k) and size("> 1k")'
179 2k
179 2k
180 $ fileset '(1k or 2k) and size(">=1K")'
180 $ fileset '(1k or 2k) and size(">=1K")'
181 1k
181 1k
182 2k
182 2k
183 $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
183 $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
184 1k
184 1k
185 $ fileset 'size("1M")'
185 $ fileset 'size("1M")'
186 $ fileset 'size("1 GB")'
186 $ fileset 'size("1 GB")'
187
187
188 Test merge states
188 Test merge states
189
189
190 $ hg ci -m manychanges
190 $ hg ci -m manychanges
191 $ hg up -C 0
191 $ hg up -C 0
192 * files updated, 0 files merged, * files removed, 0 files unresolved (glob)
192 * files updated, 0 files merged, * files removed, 0 files unresolved (glob)
193 $ echo c >> b2
193 $ echo c >> b2
194 $ hg ci -m diverging b2
194 $ hg ci -m diverging b2
195 created new head
195 created new head
196 $ fileset 'resolved()'
196 $ fileset 'resolved()'
197 $ fileset 'unresolved()'
197 $ fileset 'unresolved()'
198 $ hg merge
198 $ hg merge
199 merging b2
199 merging b2
200 warning: conflicts while merging b2! (edit, then use 'hg resolve --mark')
200 warning: conflicts while merging b2! (edit, then use 'hg resolve --mark')
201 * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob)
201 * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob)
202 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
202 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
203 [1]
203 [1]
204 $ fileset 'resolved()'
204 $ fileset 'resolved()'
205 $ fileset 'unresolved()'
205 $ fileset 'unresolved()'
206 b2
206 b2
207 $ echo e > b2
207 $ echo e > b2
208 $ hg resolve -m b2
208 $ hg resolve -m b2
209 (no more unresolved files)
209 (no more unresolved files)
210 $ fileset 'resolved()'
210 $ fileset 'resolved()'
211 b2
211 b2
212 $ fileset 'unresolved()'
212 $ fileset 'unresolved()'
213 $ hg ci -m merge
213 $ hg ci -m merge
214
214
215 Test subrepo predicate
215 Test subrepo predicate
216
216
217 $ hg init sub
217 $ hg init sub
218 $ echo a > sub/suba
218 $ echo a > sub/suba
219 $ hg -R sub add sub/suba
219 $ hg -R sub add sub/suba
220 $ hg -R sub ci -m sub
220 $ hg -R sub ci -m sub
221 $ echo 'sub = sub' > .hgsub
221 $ echo 'sub = sub' > .hgsub
222 $ hg init sub2
222 $ hg init sub2
223 $ echo b > sub2/b
223 $ echo b > sub2/b
224 $ hg -R sub2 ci -Am sub2
224 $ hg -R sub2 ci -Am sub2
225 adding b
225 adding b
226 $ echo 'sub2 = sub2' >> .hgsub
226 $ echo 'sub2 = sub2' >> .hgsub
227 $ fileset 'subrepo()'
227 $ fileset 'subrepo()'
228 $ hg add .hgsub
228 $ hg add .hgsub
229 $ fileset 'subrepo()'
229 $ fileset 'subrepo()'
230 sub
230 sub
231 sub2
231 sub2
232 $ fileset 'subrepo("sub")'
232 $ fileset 'subrepo("sub")'
233 sub
233 sub
234 $ fileset 'subrepo("glob:*")'
234 $ fileset 'subrepo("glob:*")'
235 sub
235 sub
236 sub2
236 sub2
237 $ hg ci -m subrepo
237 $ hg ci -m subrepo
238
238
239 Test that .hgsubstate is updated as appropriate during a conversion. The
239 Test that .hgsubstate is updated as appropriate during a conversion. The
240 saverev property is enough to alter the hashes of the subrepo.
240 saverev property is enough to alter the hashes of the subrepo.
241
241
242 $ hg init ../converted
242 $ hg init ../converted
243 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
243 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
244 > sub ../converted/sub
244 > sub ../converted/sub
245 initializing destination ../converted/sub repository
245 initializing destination ../converted/sub repository
246 scanning source...
246 scanning source...
247 sorting...
247 sorting...
248 converting...
248 converting...
249 0 sub
249 0 sub
250 $ hg clone -U sub2 ../converted/sub2
250 $ hg clone -U sub2 ../converted/sub2
251 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
251 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
252 > . ../converted
252 > . ../converted
253 scanning source...
253 scanning source...
254 sorting...
254 sorting...
255 converting...
255 converting...
256 4 addfiles
256 4 addfiles
257 3 manychanges
257 3 manychanges
258 2 diverging
258 2 diverging
259 1 merge
259 1 merge
260 0 subrepo
260 0 subrepo
261 no ".hgsubstate" updates will be made for "sub2"
261 no ".hgsubstate" updates will be made for "sub2"
262 $ hg up -q -R ../converted -r tip
262 $ hg up -q -R ../converted -r tip
263 $ hg --cwd ../converted cat sub/suba sub2/b -r tip
263 $ hg --cwd ../converted cat sub/suba sub2/b -r tip
264 a
264 a
265 b
265 b
266 $ oldnode=`hg log -r tip -T "{node}\n"`
266 $ oldnode=`hg log -r tip -T "{node}\n"`
267 $ newnode=`hg log -R ../converted -r tip -T "{node}\n"`
267 $ newnode=`hg log -R ../converted -r tip -T "{node}\n"`
268 $ [ "$oldnode" != "$newnode" ] || echo "nothing changed"
268 $ [ "$oldnode" != "$newnode" ] || echo "nothing changed"
269
269
270 Test with a revision
270 Test with a revision
271
271
272 $ hg log -G --template '{rev} {desc}\n'
272 $ hg log -G --template '{rev} {desc}\n'
273 @ 4 subrepo
273 @ 4 subrepo
274 |
274 |
275 o 3 merge
275 o 3 merge
276 |\
276 |\
277 | o 2 diverging
277 | o 2 diverging
278 | |
278 | |
279 o | 1 manychanges
279 o | 1 manychanges
280 |/
280 |/
281 o 0 addfiles
281 o 0 addfiles
282
282
283 $ echo unknown > unknown
283 $ echo unknown > unknown
284 $ fileset -r1 'modified()'
284 $ fileset -r1 'modified()'
285 b2
285 b2
286 $ fileset -r1 'added() and c1'
286 $ fileset -r1 'added() and c1'
287 c1
287 c1
288 $ fileset -r1 'removed()'
288 $ fileset -r1 'removed()'
289 a2
289 a2
290 $ fileset -r1 'deleted()'
290 $ fileset -r1 'deleted()'
291 $ fileset -r1 'unknown()'
291 $ fileset -r1 'unknown()'
292 $ fileset -r1 'ignored()'
292 $ fileset -r1 'ignored()'
293 $ fileset -r1 'hgignore()'
293 $ fileset -r1 'hgignore()'
294 b2
294 b2
295 bin
295 bin
296 $ fileset -r1 'binary()'
296 $ fileset -r1 'binary()'
297 bin
297 bin
298 $ fileset -r1 'size(1k)'
298 $ fileset -r1 'size(1k)'
299 1k
299 1k
300 $ fileset -r3 'resolved()'
300 $ fileset -r3 'resolved()'
301 $ fileset -r3 'unresolved()'
301 $ fileset -r3 'unresolved()'
302
302
303 #if execbit
303 #if execbit
304 $ fileset -r1 'exec()'
304 $ fileset -r1 'exec()'
305 b2
305 b2
306 #endif
306 #endif
307
307
308 #if symlink
308 #if symlink
309 $ fileset -r1 'symlink()'
309 $ fileset -r1 'symlink()'
310 b2link
310 b2link
311 #endif
311 #endif
312
312
313 #if no-windows
313 #if no-windows
314 $ fileset -r1 'not portable()'
314 $ fileset -r1 'not portable()'
315 con.xml
315 con.xml
316 $ hg forget 'con.xml'
316 $ hg forget 'con.xml'
317 #endif
317 #endif
318
318
319 $ fileset -r4 'subrepo("re:su.*")'
319 $ fileset -r4 'subrepo("re:su.*")'
320 sub
320 sub
321 sub2
321 sub2
322 $ fileset -r4 'subrepo("sub")'
322 $ fileset -r4 'subrepo("sub")'
323 sub
323 sub
324 $ fileset -r4 'b2 or c1'
324 $ fileset -r4 'b2 or c1'
325 b2
325 b2
326 c1
326 c1
327
327
328 >>> open('dos', 'wb').write("dos\r\n")
328 >>> open('dos', 'wb').write("dos\r\n")
329 >>> open('mixed', 'wb').write("dos\r\nunix\n")
329 >>> open('mixed', 'wb').write("dos\r\nunix\n")
330 >>> open('mac', 'wb').write("mac\r")
330 >>> open('mac', 'wb').write("mac\r")
331 $ hg add dos mixed mac
331 $ hg add dos mixed mac
332
332
333 (remove a1, to examine safety of 'eol' on removed files)
333 (remove a1, to examine safety of 'eol' on removed files)
334 $ rm a1
334 $ rm a1
335
335
336 $ fileset 'eol(dos)'
336 $ fileset 'eol(dos)'
337 dos
337 dos
338 mixed
338 mixed
339 $ fileset 'eol(unix)'
339 $ fileset 'eol(unix)'
340 mixed
340 mixed
341 .hgsub
341 .hgsub
342 .hgsubstate
342 .hgsubstate
343 b1
343 b1
344 b2
344 b2
345 c1
345 c1
346 $ fileset 'eol(mac)'
346 $ fileset 'eol(mac)'
347 mac
347 mac
348
348
349 Test safety of 'encoding' on removed files
349 Test safety of 'encoding' on removed files
350
350
351 #if symlink
351 #if symlink
352 $ fileset 'encoding("ascii")'
352 $ fileset 'encoding("ascii")'
353 dos
353 dos
354 mac
354 mac
355 mixed
355 mixed
356 .hgsub
356 .hgsub
357 .hgsubstate
357 .hgsubstate
358 1k
358 1k
359 2k
359 2k
360 b1
360 b1
361 b2
361 b2
362 b2link
362 b2link
363 bin
363 bin
364 c1
364 c1
365 #else
365 #else
366 $ fileset 'encoding("ascii")'
366 $ fileset 'encoding("ascii")'
367 dos
367 dos
368 mac
368 mac
369 mixed
369 mixed
370 .hgsub
370 .hgsub
371 .hgsubstate
371 .hgsubstate
372 1k
372 1k
373 2k
373 2k
374 b1
374 b1
375 b2
375 b2
376 bin
376 bin
377 c1
377 c1
378 #endif
378 #endif
379
379
380 Test detection of unintentional 'matchctx.existing()' invocation
380 Test detection of unintentional 'matchctx.existing()' invocation
381
381
382 $ cat > $TESTTMP/existingcaller.py <<EOF
382 $ cat > $TESTTMP/existingcaller.py <<EOF
383 > from mercurial import registrar
383 > from mercurial import registrar
384 >
384 >
385 > filesetpredicate = registrar.filesetpredicate()
385 > filesetpredicate = registrar.filesetpredicate()
386 > @filesetpredicate('existingcaller()', callexisting=False)
386 > @filesetpredicate('existingcaller()', callexisting=False)
387 > def existingcaller(mctx, x):
387 > def existingcaller(mctx, x):
388 > # this 'mctx.existing()' invocation is unintentional
388 > # this 'mctx.existing()' invocation is unintentional
389 > return [f for f in mctx.existing()]
389 > return [f for f in mctx.existing()]
390 > EOF
390 > EOF
391
391
392 $ cat >> .hg/hgrc <<EOF
392 $ cat >> .hg/hgrc <<EOF
393 > [extensions]
393 > [extensions]
394 > existingcaller = $TESTTMP/existingcaller.py
394 > existingcaller = $TESTTMP/existingcaller.py
395 > EOF
395 > EOF
396
396
397 $ fileset 'existingcaller()' 2>&1 | tail -1
397 $ fileset 'existingcaller()' 2>&1 | tail -1
398 AssertionError: unexpected existing() invocation
398 AssertionError: unexpected existing() invocation
399
399
400 Test 'revs(...)'
400 Test 'revs(...)'
401 ================
401 ================
402
402
403 small reminder of the repository state
403 small reminder of the repository state
404
404
405 $ hg log -G
405 $ hg log -G
406 @ changeset: 4:160936123545
406 @ changeset: 4:160936123545
407 | tag: tip
407 | tag: tip
408 | user: test
408 | user: test
409 | date: Thu Jan 01 00:00:00 1970 +0000
409 | date: Thu Jan 01 00:00:00 1970 +0000
410 | summary: subrepo
410 | summary: subrepo
411 |
411 |
412 o changeset: 3:9d594e11b8c9
412 o changeset: 3:9d594e11b8c9
413 |\ parent: 2:55b05bdebf36
413 |\ parent: 2:55b05bdebf36
414 | | parent: 1:830839835f98
414 | | parent: 1:830839835f98
415 | | user: test
415 | | user: test
416 | | date: Thu Jan 01 00:00:00 1970 +0000
416 | | date: Thu Jan 01 00:00:00 1970 +0000
417 | | summary: merge
417 | | summary: merge
418 | |
418 | |
419 | o changeset: 2:55b05bdebf36
419 | o changeset: 2:55b05bdebf36
420 | | parent: 0:8a9576c51c1f
420 | | parent: 0:8a9576c51c1f
421 | | user: test
421 | | user: test
422 | | date: Thu Jan 01 00:00:00 1970 +0000
422 | | date: Thu Jan 01 00:00:00 1970 +0000
423 | | summary: diverging
423 | | summary: diverging
424 | |
424 | |
425 o | changeset: 1:830839835f98
425 o | changeset: 1:830839835f98
426 |/ user: test
426 |/ user: test
427 | date: Thu Jan 01 00:00:00 1970 +0000
427 | date: Thu Jan 01 00:00:00 1970 +0000
428 | summary: manychanges
428 | summary: manychanges
429 |
429 |
430 o changeset: 0:8a9576c51c1f
430 o changeset: 0:8a9576c51c1f
431 user: test
431 user: test
432 date: Thu Jan 01 00:00:00 1970 +0000
432 date: Thu Jan 01 00:00:00 1970 +0000
433 summary: addfiles
433 summary: addfiles
434
434
435 $ hg status --change 0
435 $ hg status --change 0
436 A a1
436 A a1
437 A a2
437 A a2
438 A b1
438 A b1
439 A b2
439 A b2
440 $ hg status --change 1
440 $ hg status --change 1
441 M b2
441 M b2
442 A 1k
442 A 1k
443 A 2k
443 A 2k
444 A b2link
444 A b2link (no-windows !)
445 A bin
445 A bin
446 A c1
446 A c1
447 A con.xml
447 A con.xml (no-windows !)
448 R a2
448 R a2
449 $ hg status --change 2
449 $ hg status --change 2
450 M b2
450 M b2
451 $ hg status --change 3
451 $ hg status --change 3
452 M b2
452 M b2
453 A 1k
453 A 1k
454 A 2k
454 A 2k
455 A b2link
455 A b2link (no-windows !)
456 A bin
456 A bin
457 A c1
457 A c1
458 A con.xml
458 A con.xml (no-windows !)
459 R a2
459 R a2
460 $ hg status --change 4
460 $ hg status --change 4
461 A .hgsub
461 A .hgsub
462 A .hgsubstate
462 A .hgsubstate
463 $ hg status
463 $ hg status
464 A dos
464 A dos
465 A mac
465 A mac
466 A mixed
466 A mixed
467 R con.xml
467 R con.xml (no-windows !)
468 ! a1
468 ! a1
469 ? b2.orig
469 ? b2.orig
470 ? c3
470 ? c3
471 ? unknown
471 ? unknown
472
472
473 Test files at -r0 should be filtered by files at wdir
473 Test files at -r0 should be filtered by files at wdir
474 -----------------------------------------------------
474 -----------------------------------------------------
475
475
476 $ fileset -r0 '* and revs("wdir()", *)'
476 $ fileset -r0 '* and revs("wdir()", *)'
477 a1
477 a1
478 b1
478 b1
479 b2
479 b2
480
480
481 Test that "revs()" work at all
481 Test that "revs()" work at all
482 ------------------------------
482 ------------------------------
483
483
484 $ fileset "revs('2', modified())"
484 $ fileset "revs('2', modified())"
485 b2
485 b2
486
486
487 Test that "revs()" work for file missing in the working copy/current context
487 Test that "revs()" work for file missing in the working copy/current context
488 ----------------------------------------------------------------------------
488 ----------------------------------------------------------------------------
489
489
490 (a2 not in working copy)
490 (a2 not in working copy)
491
491
492 $ fileset "revs('0', added())"
492 $ fileset "revs('0', added())"
493 a1
493 a1
494 a2
494 a2
495 b1
495 b1
496 b2
496 b2
497
497
498 (none of the file exist in "0")
498 (none of the file exist in "0")
499
499
500 $ fileset -r 0 "revs('4', added())"
500 $ fileset -r 0 "revs('4', added())"
501 .hgsub
501 .hgsub
502 .hgsubstate
502 .hgsubstate
503
503
504 Call with empty revset
504 Call with empty revset
505 --------------------------
505 --------------------------
506
506
507 $ fileset "revs('2-2', modified())"
507 $ fileset "revs('2-2', modified())"
508
508
509 Call with revset matching multiple revs
509 Call with revset matching multiple revs
510 ---------------------------------------
510 ---------------------------------------
511
511
512 $ fileset "revs('0+4', added())"
512 $ fileset "revs('0+4', added())"
513 a1
513 a1
514 a2
514 a2
515 b1
515 b1
516 b2
516 b2
517 .hgsub
517 .hgsub
518 .hgsubstate
518 .hgsubstate
519
519
520 overlapping set
520 overlapping set
521
521
522 $ fileset "revs('1+2', modified())"
522 $ fileset "revs('1+2', modified())"
523 b2
523 b2
524
524
525 test 'status(...)'
525 test 'status(...)'
526 =================
526 =================
527
527
528 Simple case
528 Simple case
529 -----------
529 -----------
530
530
531 $ fileset "status(3, 4, added())"
531 $ fileset "status(3, 4, added())"
532 .hgsub
532 .hgsub
533 .hgsubstate
533 .hgsubstate
534
534
535 use rev to restrict matched file
535 use rev to restrict matched file
536 -----------------------------------------
536 -----------------------------------------
537
537
538 $ hg status --removed --rev 0 --rev 1
538 $ hg status --removed --rev 0 --rev 1
539 R a2
539 R a2
540 $ fileset "status(0, 1, removed())"
540 $ fileset "status(0, 1, removed())"
541 a2
541 a2
542 $ fileset "* and status(0, 1, removed())"
542 $ fileset "* and status(0, 1, removed())"
543 $ fileset -r 4 "status(0, 1, removed())"
543 $ fileset -r 4 "status(0, 1, removed())"
544 a2
544 a2
545 $ fileset -r 4 "* and status(0, 1, removed())"
545 $ fileset -r 4 "* and status(0, 1, removed())"
546 $ fileset "revs('4', * and status(0, 1, removed()))"
546 $ fileset "revs('4', * and status(0, 1, removed()))"
547 $ fileset "revs('0', * and status(0, 1, removed()))"
547 $ fileset "revs('0', * and status(0, 1, removed()))"
548 a2
548 a2
549
549
550 check wdir()
550 check wdir()
551 ------------
551 ------------
552
552
553 $ hg status --removed --rev 4
553 $ hg status --removed --rev 4
554 R con.xml
554 R con.xml (no-windows !)
555 $ fileset "status(4, 'wdir()', removed())"
555 $ fileset "status(4, 'wdir()', removed())"
556 con.xml
556 con.xml (no-windows !)
557
557
558 $ hg status --removed --rev 2
558 $ hg status --removed --rev 2
559 R a2
559 R a2
560 $ fileset "status('2', 'wdir()', removed())"
560 $ fileset "status('2', 'wdir()', removed())"
561 a2
561 a2
562
562
563 test backward status
563 test backward status
564 --------------------
564 --------------------
565
565
566 $ hg status --removed --rev 0 --rev 4
566 $ hg status --removed --rev 0 --rev 4
567 R a2
567 R a2
568 $ hg status --added --rev 4 --rev 0
568 $ hg status --added --rev 4 --rev 0
569 A a2
569 A a2
570 $ fileset "status(4, 0, added())"
570 $ fileset "status(4, 0, added())"
571 a2
571 a2
572
572
573 test cross branch status
573 test cross branch status
574 ------------------------
574 ------------------------
575
575
576 $ hg status --added --rev 1 --rev 2
576 $ hg status --added --rev 1 --rev 2
577 A a2
577 A a2
578 $ fileset "status(1, 2, added())"
578 $ fileset "status(1, 2, added())"
579 a2
579 a2
580
580
581 test with multi revs revset
581 test with multi revs revset
582 ---------------------------
582 ---------------------------
583 $ hg status --added --rev 0:1 --rev 3:4
583 $ hg status --added --rev 0:1 --rev 3:4
584 A .hgsub
584 A .hgsub
585 A .hgsubstate
585 A .hgsubstate
586 A 1k
586 A 1k
587 A 2k
587 A 2k
588 A b2link
588 A b2link (no-windows !)
589 A bin
589 A bin
590 A c1
590 A c1
591 A con.xml
591 A con.xml (no-windows !)
592 $ fileset "status('0:1', '3:4', added())"
592 $ fileset "status('0:1', '3:4', added())"
593 .hgsub
593 .hgsub
594 .hgsubstate
594 .hgsubstate
595 1k
595 1k
596 2k
596 2k
597 b2link
597 b2link (no-windows !)
598 bin
598 bin
599 c1
599 c1
600 con.xml
600 con.xml (no-windows !)
601
601
602 tests with empty value
602 tests with empty value
603 ----------------------
603 ----------------------
604
604
605 Fully empty revset
605 Fully empty revset
606
606
607 $ fileset "status('', '4', added())"
607 $ fileset "status('', '4', added())"
608 hg: parse error: first argument to status must be a revision
608 hg: parse error: first argument to status must be a revision
609 [255]
609 [255]
610 $ fileset "status('2', '', added())"
610 $ fileset "status('2', '', added())"
611 hg: parse error: second argument to status must be a revision
611 hg: parse error: second argument to status must be a revision
612 [255]
612 [255]
613
613
614 Empty revset will error at the revset layer
614 Empty revset will error at the revset layer
615
615
616 $ fileset "status(' ', '4', added())"
616 $ fileset "status(' ', '4', added())"
617 hg: parse error at 1: not a prefix: end
617 hg: parse error at 1: not a prefix: end
618 [255]
618 [255]
619 $ fileset "status('2', ' ', added())"
619 $ fileset "status('2', ' ', added())"
620 hg: parse error at 1: not a prefix: end
620 hg: parse error at 1: not a prefix: end
621 [255]
621 [255]
@@ -1,383 +1,383 b''
1 #require hardlink
1 #require hardlink
2
2
3 $ cat > nlinks.py <<EOF
3 $ cat > nlinks.py <<EOF
4 > import sys
4 > import sys
5 > from mercurial import util
5 > from mercurial import util
6 > for f in sorted(sys.stdin.readlines()):
6 > for f in sorted(sys.stdin.readlines()):
7 > f = f[:-1]
7 > f = f[:-1]
8 > print util.nlinks(f), f
8 > print util.nlinks(f), f
9 > EOF
9 > EOF
10
10
11 $ nlinksdir()
11 $ nlinksdir()
12 > {
12 > {
13 > find $1 -type f | python $TESTTMP/nlinks.py
13 > find $1 -type f | python $TESTTMP/nlinks.py
14 > }
14 > }
15
15
16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
17
17
18 $ cat > linkcp.py <<EOF
18 $ cat > linkcp.py <<EOF
19 > from mercurial import util
19 > from mercurial import util
20 > import sys
20 > import sys
21 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
21 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
22 > EOF
22 > EOF
23
23
24 $ linkcp()
24 $ linkcp()
25 > {
25 > {
26 > python $TESTTMP/linkcp.py $1 $2
26 > python $TESTTMP/linkcp.py $1 $2
27 > }
27 > }
28
28
29 Prepare repo r1:
29 Prepare repo r1:
30
30
31 $ hg init r1
31 $ hg init r1
32 $ cd r1
32 $ cd r1
33
33
34 $ echo c1 > f1
34 $ echo c1 > f1
35 $ hg add f1
35 $ hg add f1
36 $ hg ci -m0
36 $ hg ci -m0
37
37
38 $ mkdir d1
38 $ mkdir d1
39 $ cd d1
39 $ cd d1
40 $ echo c2 > f2
40 $ echo c2 > f2
41 $ hg add f2
41 $ hg add f2
42 $ hg ci -m1
42 $ hg ci -m1
43 $ cd ../..
43 $ cd ../..
44
44
45 $ nlinksdir r1/.hg/store
45 $ nlinksdir r1/.hg/store
46 1 r1/.hg/store/00changelog.i
46 1 r1/.hg/store/00changelog.i
47 1 r1/.hg/store/00manifest.i
47 1 r1/.hg/store/00manifest.i
48 1 r1/.hg/store/data/d1/f2.i
48 1 r1/.hg/store/data/d1/f2.i
49 1 r1/.hg/store/data/f1.i
49 1 r1/.hg/store/data/f1.i
50 1 r1/.hg/store/fncache
50 1 r1/.hg/store/fncache
51 1 r1/.hg/store/phaseroots
51 1 r1/.hg/store/phaseroots
52 1 r1/.hg/store/undo
52 1 r1/.hg/store/undo
53 1 r1/.hg/store/undo.backup.fncache
53 1 r1/.hg/store/undo.backup.fncache
54 1 r1/.hg/store/undo.backupfiles
54 1 r1/.hg/store/undo.backupfiles
55 1 r1/.hg/store/undo.phaseroots
55 1 r1/.hg/store/undo.phaseroots
56
56
57
57
58 Create hardlinked clone r2:
58 Create hardlinked clone r2:
59
59
60 $ hg clone -U --debug r1 r2 --config progress.debug=true
60 $ hg clone -U --debug r1 r2 --config progress.debug=true
61 linking: 1
61 linking: 1
62 linking: 2
62 linking: 2
63 linking: 3
63 linking: 3
64 linking: 4
64 linking: 4
65 linking: 5
65 linking: 5
66 linking: 6
66 linking: 6
67 linking: 7
67 linking: 7
68 linked 7 files
68 linked 7 files
69
69
70 Create non-hardlinked clone r3:
70 Create non-hardlinked clone r3:
71
71
72 $ hg clone --pull r1 r3
72 $ hg clone --pull r1 r3
73 requesting all changes
73 requesting all changes
74 adding changesets
74 adding changesets
75 adding manifests
75 adding manifests
76 adding file changes
76 adding file changes
77 added 2 changesets with 2 changes to 2 files
77 added 2 changesets with 2 changes to 2 files
78 updating to branch default
78 updating to branch default
79 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
80
80
81
81
82 Repos r1 and r2 should now contain hardlinked files:
82 Repos r1 and r2 should now contain hardlinked files:
83
83
84 $ nlinksdir r1/.hg/store
84 $ nlinksdir r1/.hg/store
85 2 r1/.hg/store/00changelog.i
85 2 r1/.hg/store/00changelog.i
86 2 r1/.hg/store/00manifest.i
86 2 r1/.hg/store/00manifest.i
87 2 r1/.hg/store/data/d1/f2.i
87 2 r1/.hg/store/data/d1/f2.i
88 2 r1/.hg/store/data/f1.i
88 2 r1/.hg/store/data/f1.i
89 2 r1/.hg/store/fncache
89 2 r1/.hg/store/fncache
90 1 r1/.hg/store/phaseroots
90 1 r1/.hg/store/phaseroots
91 1 r1/.hg/store/undo
91 1 r1/.hg/store/undo
92 1 r1/.hg/store/undo.backup.fncache
92 1 r1/.hg/store/undo.backup.fncache
93 1 r1/.hg/store/undo.backupfiles
93 1 r1/.hg/store/undo.backupfiles
94 1 r1/.hg/store/undo.phaseroots
94 1 r1/.hg/store/undo.phaseroots
95
95
96 $ nlinksdir r2/.hg/store
96 $ nlinksdir r2/.hg/store
97 2 r2/.hg/store/00changelog.i
97 2 r2/.hg/store/00changelog.i
98 2 r2/.hg/store/00manifest.i
98 2 r2/.hg/store/00manifest.i
99 2 r2/.hg/store/data/d1/f2.i
99 2 r2/.hg/store/data/d1/f2.i
100 2 r2/.hg/store/data/f1.i
100 2 r2/.hg/store/data/f1.i
101 2 r2/.hg/store/fncache
101 2 r2/.hg/store/fncache
102
102
103 Repo r3 should not be hardlinked:
103 Repo r3 should not be hardlinked:
104
104
105 $ nlinksdir r3/.hg/store
105 $ nlinksdir r3/.hg/store
106 1 r3/.hg/store/00changelog.i
106 1 r3/.hg/store/00changelog.i
107 1 r3/.hg/store/00manifest.i
107 1 r3/.hg/store/00manifest.i
108 1 r3/.hg/store/data/d1/f2.i
108 1 r3/.hg/store/data/d1/f2.i
109 1 r3/.hg/store/data/f1.i
109 1 r3/.hg/store/data/f1.i
110 1 r3/.hg/store/fncache
110 1 r3/.hg/store/fncache
111 1 r3/.hg/store/phaseroots
111 1 r3/.hg/store/phaseroots
112 1 r3/.hg/store/undo
112 1 r3/.hg/store/undo
113 1 r3/.hg/store/undo.backupfiles
113 1 r3/.hg/store/undo.backupfiles
114 1 r3/.hg/store/undo.phaseroots
114 1 r3/.hg/store/undo.phaseroots
115
115
116
116
117 Create a non-inlined filelog in r3:
117 Create a non-inlined filelog in r3:
118
118
119 $ cd r3/d1
119 $ cd r3/d1
120 >>> f = open('data1', 'wb')
120 >>> f = open('data1', 'wb')
121 >>> for x in range(10000):
121 >>> for x in range(10000):
122 ... f.write("%s\n" % str(x))
122 ... f.write("%s\n" % str(x))
123 >>> f.close()
123 >>> f.close()
124 $ for j in 0 1 2 3 4 5 6 7 8 9; do
124 $ for j in 0 1 2 3 4 5 6 7 8 9; do
125 > cat data1 >> f2
125 > cat data1 >> f2
126 > hg commit -m$j
126 > hg commit -m$j
127 > done
127 > done
128 $ cd ../..
128 $ cd ../..
129
129
130 $ nlinksdir r3/.hg/store
130 $ nlinksdir r3/.hg/store
131 1 r3/.hg/store/00changelog.i
131 1 r3/.hg/store/00changelog.i
132 1 r3/.hg/store/00manifest.i
132 1 r3/.hg/store/00manifest.i
133 1 r3/.hg/store/data/d1/f2.d
133 1 r3/.hg/store/data/d1/f2.d
134 1 r3/.hg/store/data/d1/f2.i
134 1 r3/.hg/store/data/d1/f2.i
135 1 r3/.hg/store/data/f1.i
135 1 r3/.hg/store/data/f1.i
136 1 r3/.hg/store/fncache
136 1 r3/.hg/store/fncache
137 1 r3/.hg/store/phaseroots
137 1 r3/.hg/store/phaseroots
138 1 r3/.hg/store/undo
138 1 r3/.hg/store/undo
139 1 r3/.hg/store/undo.backup.fncache
139 1 r3/.hg/store/undo.backup.fncache
140 1 r3/.hg/store/undo.backup.phaseroots
140 1 r3/.hg/store/undo.backup.phaseroots
141 1 r3/.hg/store/undo.backupfiles
141 1 r3/.hg/store/undo.backupfiles
142 1 r3/.hg/store/undo.phaseroots
142 1 r3/.hg/store/undo.phaseroots
143
143
144 Push to repo r1 should break up most hardlinks in r2:
144 Push to repo r1 should break up most hardlinks in r2:
145
145
146 $ hg -R r2 verify
146 $ hg -R r2 verify
147 checking changesets
147 checking changesets
148 checking manifests
148 checking manifests
149 crosschecking files in changesets and manifests
149 crosschecking files in changesets and manifests
150 checking files
150 checking files
151 2 files, 2 changesets, 2 total revisions
151 2 files, 2 changesets, 2 total revisions
152
152
153 $ cd r3
153 $ cd r3
154 $ hg push
154 $ hg push
155 pushing to $TESTTMP/r1 (glob)
155 pushing to $TESTTMP/r1 (glob)
156 searching for changes
156 searching for changes
157 adding changesets
157 adding changesets
158 adding manifests
158 adding manifests
159 adding file changes
159 adding file changes
160 added 10 changesets with 10 changes to 1 files
160 added 10 changesets with 10 changes to 1 files
161
161
162 $ cd ..
162 $ cd ..
163
163
164 $ nlinksdir r2/.hg/store
164 $ nlinksdir r2/.hg/store
165 1 r2/.hg/store/00changelog.i
165 1 r2/.hg/store/00changelog.i
166 1 r2/.hg/store/00manifest.i
166 1 r2/.hg/store/00manifest.i
167 1 r2/.hg/store/data/d1/f2.i
167 1 r2/.hg/store/data/d1/f2.i
168 2 r2/.hg/store/data/f1.i
168 2 r2/.hg/store/data/f1.i
169 [12] r2/\.hg/store/fncache (re)
169 [12] r2/\.hg/store/fncache (re)
170
170
171 $ hg -R r2 verify
171 $ hg -R r2 verify
172 checking changesets
172 checking changesets
173 checking manifests
173 checking manifests
174 crosschecking files in changesets and manifests
174 crosschecking files in changesets and manifests
175 checking files
175 checking files
176 2 files, 2 changesets, 2 total revisions
176 2 files, 2 changesets, 2 total revisions
177
177
178
178
179 $ cd r1
179 $ cd r1
180 $ hg up
180 $ hg up
181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
182
182
183 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
183 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
184
184
185 $ echo c1c1 >> f1
185 $ echo c1c1 >> f1
186 $ hg ci -m00
186 $ hg ci -m00
187 $ cd ..
187 $ cd ..
188
188
189 $ nlinksdir r2/.hg/store
189 $ nlinksdir r2/.hg/store
190 1 r2/.hg/store/00changelog.i
190 1 r2/.hg/store/00changelog.i
191 1 r2/.hg/store/00manifest.i
191 1 r2/.hg/store/00manifest.i
192 1 r2/.hg/store/data/d1/f2.i
192 1 r2/.hg/store/data/d1/f2.i
193 1 r2/.hg/store/data/f1.i
193 1 r2/.hg/store/data/f1.i
194 [12] r2/\.hg/store/fncache (re)
194 [12] r2/\.hg/store/fncache (re)
195
195
196
196
197 $ cd r3
197 $ cd r3
198 $ hg tip --template '{rev}:{node|short}\n'
198 $ hg tip --template '{rev}:{node|short}\n'
199 11:a6451b6bc41f
199 11:a6451b6bc41f
200 $ echo bla > f1
200 $ echo bla > f1
201 $ hg ci -m1
201 $ hg ci -m1
202 $ cd ..
202 $ cd ..
203
203
204 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
204 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
205
205
206 $ linkcp r3 r4
206 $ linkcp r3 r4
207
207
208 r4 has hardlinks in the working dir (not just inside .hg):
208 r4 has hardlinks in the working dir (not just inside .hg):
209
209
210 $ nlinksdir r4
210 $ nlinksdir r4
211 2 r4/.hg/00changelog.i
211 2 r4/.hg/00changelog.i
212 2 r4/.hg/branch
212 2 r4/.hg/branch
213 2 r4/.hg/cache/branch2-served
213 2 r4/.hg/cache/branch2-served
214 2 r4/.hg/cache/checkisexec
214 2 r4/.hg/cache/checkisexec (execbit !)
215 3 r4/.hg/cache/checklink (?)
215 3 r4/.hg/cache/checklink (?)
216 ? r4/.hg/cache/checklink-target (glob)
216 ? r4/.hg/cache/checklink-target (glob) (symlink !)
217 2 r4/.hg/cache/checknoexec
217 2 r4/.hg/cache/checknoexec (execbit !)
218 2 r4/.hg/cache/rbc-names-v1
218 2 r4/.hg/cache/rbc-names-v1
219 2 r4/.hg/cache/rbc-revs-v1
219 2 r4/.hg/cache/rbc-revs-v1
220 2 r4/.hg/dirstate
220 2 r4/.hg/dirstate
221 2 r4/.hg/hgrc
221 2 r4/.hg/hgrc
222 2 r4/.hg/last-message.txt
222 2 r4/.hg/last-message.txt
223 2 r4/.hg/requires
223 2 r4/.hg/requires
224 2 r4/.hg/store/00changelog.i
224 2 r4/.hg/store/00changelog.i
225 2 r4/.hg/store/00manifest.i
225 2 r4/.hg/store/00manifest.i
226 2 r4/.hg/store/data/d1/f2.d
226 2 r4/.hg/store/data/d1/f2.d
227 2 r4/.hg/store/data/d1/f2.i
227 2 r4/.hg/store/data/d1/f2.i
228 2 r4/.hg/store/data/f1.i
228 2 r4/.hg/store/data/f1.i
229 2 r4/.hg/store/fncache
229 2 r4/.hg/store/fncache
230 2 r4/.hg/store/phaseroots
230 2 r4/.hg/store/phaseroots
231 2 r4/.hg/store/undo
231 2 r4/.hg/store/undo
232 2 r4/.hg/store/undo.backup.fncache
232 2 r4/.hg/store/undo.backup.fncache
233 2 r4/.hg/store/undo.backup.phaseroots
233 2 r4/.hg/store/undo.backup.phaseroots
234 2 r4/.hg/store/undo.backupfiles
234 2 r4/.hg/store/undo.backupfiles
235 2 r4/.hg/store/undo.phaseroots
235 2 r4/.hg/store/undo.phaseroots
236 [24] r4/\.hg/undo\.backup\.dirstate (re)
236 [24] r4/\.hg/undo\.backup\.dirstate (re)
237 2 r4/.hg/undo.bookmarks
237 2 r4/.hg/undo.bookmarks
238 2 r4/.hg/undo.branch
238 2 r4/.hg/undo.branch
239 2 r4/.hg/undo.desc
239 2 r4/.hg/undo.desc
240 [24] r4/\.hg/undo\.dirstate (re)
240 [24] r4/\.hg/undo\.dirstate (re)
241 2 r4/d1/data1
241 2 r4/d1/data1
242 2 r4/d1/f2
242 2 r4/d1/f2
243 2 r4/f1
243 2 r4/f1
244
244
245 Update back to revision 11 in r4 should break hardlink of file f1:
245 Update back to revision 11 in r4 should break hardlink of file f1:
246
246
247 $ hg -R r4 up 11
247 $ hg -R r4 up 11
248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249
249
250 $ nlinksdir r4
250 $ nlinksdir r4
251 2 r4/.hg/00changelog.i
251 2 r4/.hg/00changelog.i
252 1 r4/.hg/branch
252 1 r4/.hg/branch
253 2 r4/.hg/cache/branch2-served
253 2 r4/.hg/cache/branch2-served
254 2 r4/.hg/cache/checkisexec
254 2 r4/.hg/cache/checkisexec (execbit !)
255 2 r4/.hg/cache/checklink-target
255 2 r4/.hg/cache/checklink-target (symlink !)
256 2 r4/.hg/cache/checknoexec
256 2 r4/.hg/cache/checknoexec (execbit !)
257 2 r4/.hg/cache/rbc-names-v1
257 2 r4/.hg/cache/rbc-names-v1
258 2 r4/.hg/cache/rbc-revs-v1
258 2 r4/.hg/cache/rbc-revs-v1
259 1 r4/.hg/dirstate
259 1 r4/.hg/dirstate
260 2 r4/.hg/hgrc
260 2 r4/.hg/hgrc
261 2 r4/.hg/last-message.txt
261 2 r4/.hg/last-message.txt
262 2 r4/.hg/requires
262 2 r4/.hg/requires
263 2 r4/.hg/store/00changelog.i
263 2 r4/.hg/store/00changelog.i
264 2 r4/.hg/store/00manifest.i
264 2 r4/.hg/store/00manifest.i
265 2 r4/.hg/store/data/d1/f2.d
265 2 r4/.hg/store/data/d1/f2.d
266 2 r4/.hg/store/data/d1/f2.i
266 2 r4/.hg/store/data/d1/f2.i
267 2 r4/.hg/store/data/f1.i
267 2 r4/.hg/store/data/f1.i
268 2 r4/.hg/store/fncache
268 2 r4/.hg/store/fncache
269 2 r4/.hg/store/phaseroots
269 2 r4/.hg/store/phaseroots
270 2 r4/.hg/store/undo
270 2 r4/.hg/store/undo
271 2 r4/.hg/store/undo.backup.fncache
271 2 r4/.hg/store/undo.backup.fncache
272 2 r4/.hg/store/undo.backup.phaseroots
272 2 r4/.hg/store/undo.backup.phaseroots
273 2 r4/.hg/store/undo.backupfiles
273 2 r4/.hg/store/undo.backupfiles
274 2 r4/.hg/store/undo.phaseroots
274 2 r4/.hg/store/undo.phaseroots
275 [24] r4/\.hg/undo\.backup\.dirstate (re)
275 [24] r4/\.hg/undo\.backup\.dirstate (re)
276 2 r4/.hg/undo.bookmarks
276 2 r4/.hg/undo.bookmarks
277 2 r4/.hg/undo.branch
277 2 r4/.hg/undo.branch
278 2 r4/.hg/undo.desc
278 2 r4/.hg/undo.desc
279 [24] r4/\.hg/undo\.dirstate (re)
279 [24] r4/\.hg/undo\.dirstate (re)
280 2 r4/d1/data1
280 2 r4/d1/data1
281 2 r4/d1/f2
281 2 r4/d1/f2
282 1 r4/f1
282 1 r4/f1
283
283
284
284
285 Test hardlinking outside hg:
285 Test hardlinking outside hg:
286
286
287 $ mkdir x
287 $ mkdir x
288 $ echo foo > x/a
288 $ echo foo > x/a
289
289
290 $ linkcp x y
290 $ linkcp x y
291 $ echo bar >> y/a
291 $ echo bar >> y/a
292
292
293 No diff if hardlink:
293 No diff if hardlink:
294
294
295 $ diff x/a y/a
295 $ diff x/a y/a
296
296
297 Test mq hardlinking:
297 Test mq hardlinking:
298
298
299 $ echo "[extensions]" >> $HGRCPATH
299 $ echo "[extensions]" >> $HGRCPATH
300 $ echo "mq=" >> $HGRCPATH
300 $ echo "mq=" >> $HGRCPATH
301
301
302 $ hg init a
302 $ hg init a
303 $ cd a
303 $ cd a
304
304
305 $ hg qimport -n foo - << EOF
305 $ hg qimport -n foo - << EOF
306 > # HG changeset patch
306 > # HG changeset patch
307 > # Date 1 0
307 > # Date 1 0
308 > diff -r 2588a8b53d66 a
308 > diff -r 2588a8b53d66 a
309 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
309 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
310 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
310 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
311 > @@ -0,0 +1,1 @@
311 > @@ -0,0 +1,1 @@
312 > +a
312 > +a
313 > EOF
313 > EOF
314 adding foo to series file
314 adding foo to series file
315
315
316 $ hg qpush
316 $ hg qpush
317 applying foo
317 applying foo
318 now at: foo
318 now at: foo
319
319
320 $ cd ..
320 $ cd ..
321 $ linkcp a b
321 $ linkcp a b
322 $ cd b
322 $ cd b
323
323
324 $ hg qimport -n bar - << EOF
324 $ hg qimport -n bar - << EOF
325 > # HG changeset patch
325 > # HG changeset patch
326 > # Date 2 0
326 > # Date 2 0
327 > diff -r 2588a8b53d66 a
327 > diff -r 2588a8b53d66 a
328 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
328 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
329 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
329 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
330 > @@ -0,0 +1,1 @@
330 > @@ -0,0 +1,1 @@
331 > +b
331 > +b
332 > EOF
332 > EOF
333 adding bar to series file
333 adding bar to series file
334
334
335 $ hg qpush
335 $ hg qpush
336 applying bar
336 applying bar
337 now at: bar
337 now at: bar
338
338
339 $ cat .hg/patches/status
339 $ cat .hg/patches/status
340 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
340 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
341 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
341 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
342
342
343 $ cat .hg/patches/series
343 $ cat .hg/patches/series
344 foo
344 foo
345 bar
345 bar
346
346
347 $ cat ../a/.hg/patches/status
347 $ cat ../a/.hg/patches/status
348 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
348 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
349
349
350 $ cat ../a/.hg/patches/series
350 $ cat ../a/.hg/patches/series
351 foo
351 foo
352
352
353 Test tags hardlinking:
353 Test tags hardlinking:
354
354
355 $ hg qdel -r qbase:qtip
355 $ hg qdel -r qbase:qtip
356 patch foo finalized without changeset message
356 patch foo finalized without changeset message
357 patch bar finalized without changeset message
357 patch bar finalized without changeset message
358
358
359 $ hg tag -l lfoo
359 $ hg tag -l lfoo
360 $ hg tag foo
360 $ hg tag foo
361
361
362 $ cd ..
362 $ cd ..
363 $ linkcp b c
363 $ linkcp b c
364 $ cd c
364 $ cd c
365
365
366 $ hg tag -l -r 0 lbar
366 $ hg tag -l -r 0 lbar
367 $ hg tag -r 0 bar
367 $ hg tag -r 0 bar
368
368
369 $ cat .hgtags
369 $ cat .hgtags
370 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
370 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
371 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
371 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
372
372
373 $ cat .hg/localtags
373 $ cat .hg/localtags
374 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
374 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
375 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
375 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
376
376
377 $ cat ../b/.hgtags
377 $ cat ../b/.hgtags
378 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
378 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
379
379
380 $ cat ../b/.hg/localtags
380 $ cat ../b/.hg/localtags
381 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
381 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
382
382
383 $ cd ..
383 $ cd ..
@@ -1,718 +1,718 b''
1 setup
1 setup
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > blackbox=
5 > blackbox=
6 > mock=$TESTDIR/mockblackbox.py
6 > mock=$TESTDIR/mockblackbox.py
7 > EOF
7 > EOF
8
8
9 Helper functions:
9 Helper functions:
10
10
11 $ cacheexists() {
11 $ cacheexists() {
12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
13 > }
13 > }
14
14
15 $ fnodescacheexists() {
15 $ fnodescacheexists() {
16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
17 > }
17 > }
18
18
19 $ dumptags() {
19 $ dumptags() {
20 > rev=$1
20 > rev=$1
21 > echo "rev $rev: .hgtags:"
21 > echo "rev $rev: .hgtags:"
22 > hg cat -r$rev .hgtags
22 > hg cat -r$rev .hgtags
23 > }
23 > }
24
24
25 # XXX need to test that the tag cache works when we strip an old head
25 # XXX need to test that the tag cache works when we strip an old head
26 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
26 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
27 # same, but stuff has changed behind tip.
27 # same, but stuff has changed behind tip.
28
28
29 Setup:
29 Setup:
30
30
31 $ hg init t
31 $ hg init t
32 $ cd t
32 $ cd t
33 $ cacheexists
33 $ cacheexists
34 no tag cache
34 no tag cache
35 $ fnodescacheexists
35 $ fnodescacheexists
36 no fnodes cache
36 no fnodes cache
37 $ hg id
37 $ hg id
38 000000000000 tip
38 000000000000 tip
39 $ cacheexists
39 $ cacheexists
40 no tag cache
40 no tag cache
41 $ fnodescacheexists
41 $ fnodescacheexists
42 no fnodes cache
42 no fnodes cache
43 $ echo a > a
43 $ echo a > a
44 $ hg add a
44 $ hg add a
45 $ hg commit -m "test"
45 $ hg commit -m "test"
46 $ hg co
46 $ hg co
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 $ hg identify
48 $ hg identify
49 acb14030fe0a tip
49 acb14030fe0a tip
50 $ hg identify -r 'wdir()'
50 $ hg identify -r 'wdir()'
51 acb14030fe0a tip
51 acb14030fe0a tip
52 $ cacheexists
52 $ cacheexists
53 tag cache exists
53 tag cache exists
54 No fnodes cache because .hgtags file doesn't exist
54 No fnodes cache because .hgtags file doesn't exist
55 (this is an implementation detail)
55 (this is an implementation detail)
56 $ fnodescacheexists
56 $ fnodescacheexists
57 no fnodes cache
57 no fnodes cache
58
58
59 Try corrupting the cache
59 Try corrupting the cache
60
60
61 $ printf 'a b' > .hg/cache/tags2-visible
61 $ printf 'a b' > .hg/cache/tags2-visible
62 $ hg identify
62 $ hg identify
63 acb14030fe0a tip
63 acb14030fe0a tip
64 $ cacheexists
64 $ cacheexists
65 tag cache exists
65 tag cache exists
66 $ fnodescacheexists
66 $ fnodescacheexists
67 no fnodes cache
67 no fnodes cache
68 $ hg identify
68 $ hg identify
69 acb14030fe0a tip
69 acb14030fe0a tip
70
70
71 Create local tag with long name:
71 Create local tag with long name:
72
72
73 $ T=`hg identify --debug --id`
73 $ T=`hg identify --debug --id`
74 $ hg tag -l "This is a local tag with a really long name!"
74 $ hg tag -l "This is a local tag with a really long name!"
75 $ hg tags
75 $ hg tags
76 tip 0:acb14030fe0a
76 tip 0:acb14030fe0a
77 This is a local tag with a really long name! 0:acb14030fe0a
77 This is a local tag with a really long name! 0:acb14030fe0a
78 $ rm .hg/localtags
78 $ rm .hg/localtags
79
79
80 Create a tag behind hg's back:
80 Create a tag behind hg's back:
81
81
82 $ echo "$T first" > .hgtags
82 $ echo "$T first" > .hgtags
83 $ cat .hgtags
83 $ cat .hgtags
84 acb14030fe0a21b60322c440ad2d20cf7685a376 first
84 acb14030fe0a21b60322c440ad2d20cf7685a376 first
85 $ hg add .hgtags
85 $ hg add .hgtags
86 $ hg commit -m "add tags"
86 $ hg commit -m "add tags"
87 $ hg tags
87 $ hg tags
88 tip 1:b9154636be93
88 tip 1:b9154636be93
89 first 0:acb14030fe0a
89 first 0:acb14030fe0a
90 $ hg identify
90 $ hg identify
91 b9154636be93 tip
91 b9154636be93 tip
92
92
93 We should have a fnodes cache now that we have a real tag
93 We should have a fnodes cache now that we have a real tag
94 The cache should have an empty entry for rev 0 and a valid entry for rev 1.
94 The cache should have an empty entry for rev 0 and a valid entry for rev 1.
95
95
96
96
97 $ fnodescacheexists
97 $ fnodescacheexists
98 fnodes cache exists
98 fnodes cache exists
99 $ f --size --hexdump .hg/cache/hgtagsfnodes1
99 $ f --size --hexdump .hg/cache/hgtagsfnodes1
100 .hg/cache/hgtagsfnodes1: size=48
100 .hg/cache/hgtagsfnodes1: size=48
101 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
101 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
102 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
102 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
103 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
103 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
104
104
105 Repeat with cold tag cache:
105 Repeat with cold tag cache:
106
106
107 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
107 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
108 $ hg identify
108 $ hg identify
109 b9154636be93 tip
109 b9154636be93 tip
110
110
111 $ fnodescacheexists
111 $ fnodescacheexists
112 fnodes cache exists
112 fnodes cache exists
113 $ f --size --hexdump .hg/cache/hgtagsfnodes1
113 $ f --size --hexdump .hg/cache/hgtagsfnodes1
114 .hg/cache/hgtagsfnodes1: size=48
114 .hg/cache/hgtagsfnodes1: size=48
115 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
115 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
116 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
116 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
117 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
117 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
118
118
119 And again, but now unable to write tag cache or lock file:
119 And again, but now unable to write tag cache or lock file:
120
120
121 #if unix-permissions
121 #if unix-permissions
122 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
122 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
123 $ chmod 555 .hg/cache
123 $ chmod 555 .hg/cache
124 $ hg identify
124 $ hg identify
125 b9154636be93 tip
125 b9154636be93 tip
126 $ chmod 755 .hg/cache
126 $ chmod 755 .hg/cache
127
127
128 $ chmod 555 .hg
128 $ chmod 555 .hg
129 $ hg identify
129 $ hg identify
130 b9154636be93 tip
130 b9154636be93 tip
131 $ chmod 755 .hg
131 $ chmod 755 .hg
132 #endif
132 #endif
133
133
134 Tag cache debug info written to blackbox log
134 Tag cache debug info written to blackbox log
135
135
136 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
136 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
137 $ hg identify
137 $ hg identify
138 b9154636be93 tip
138 b9154636be93 tip
139 $ hg blackbox -l 6
139 $ hg blackbox -l 6
140 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
140 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
141 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing 48 bytes to cache/hgtagsfnodes1
141 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing 48 bytes to cache/hgtagsfnodes1
142 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
142 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
143 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
143 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
144 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
144 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
145 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
145 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
146
146
147 Failure to acquire lock results in no write
147 Failure to acquire lock results in no write
148
148
149 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
149 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
150 $ echo 'foo:1' > .hg/wlock
150 $ echo 'foo:1' > .hg/wlock
151 $ hg identify
151 $ hg identify
152 b9154636be93 tip
152 b9154636be93 tip
153 $ hg blackbox -l 6
153 $ hg blackbox -l 6
154 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
154 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
155 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired
155 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired
156 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
156 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
157 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
157 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
158 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
158 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
159 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
159 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
160
160
161 $ fnodescacheexists
161 $ fnodescacheexists
162 no fnodes cache
162 no fnodes cache
163
163
164 $ rm .hg/wlock
164 $ rm .hg/wlock
165
165
166 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
166 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
167 $ hg identify
167 $ hg identify
168 b9154636be93 tip
168 b9154636be93 tip
169
169
170 Create a branch:
170 Create a branch:
171
171
172 $ echo bb > a
172 $ echo bb > a
173 $ hg status
173 $ hg status
174 M a
174 M a
175 $ hg identify
175 $ hg identify
176 b9154636be93+ tip
176 b9154636be93+ tip
177 $ hg co first
177 $ hg co first
178 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
178 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
179 $ hg id
179 $ hg id
180 acb14030fe0a+ first
180 acb14030fe0a+ first
181 $ hg id -r 'wdir()'
181 $ hg id -r 'wdir()'
182 acb14030fe0a+ first
182 acb14030fe0a+ first
183 $ hg -v id
183 $ hg -v id
184 acb14030fe0a+ first
184 acb14030fe0a+ first
185 $ hg status
185 $ hg status
186 M a
186 M a
187 $ echo 1 > b
187 $ echo 1 > b
188 $ hg add b
188 $ hg add b
189 $ hg commit -m "branch"
189 $ hg commit -m "branch"
190 created new head
190 created new head
191
191
192 Creating a new commit shouldn't append the .hgtags fnodes cache until
192 Creating a new commit shouldn't append the .hgtags fnodes cache until
193 tags info is accessed
193 tags info is accessed
194
194
195 $ f --size --hexdump .hg/cache/hgtagsfnodes1
195 $ f --size --hexdump .hg/cache/hgtagsfnodes1
196 .hg/cache/hgtagsfnodes1: size=48
196 .hg/cache/hgtagsfnodes1: size=48
197 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
197 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
198 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
198 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
199 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
199 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
200
200
201 $ hg id
201 $ hg id
202 c8edf04160c7 tip
202 c8edf04160c7 tip
203
203
204 First 4 bytes of record 3 are changeset fragment
204 First 4 bytes of record 3 are changeset fragment
205
205
206 $ f --size --hexdump .hg/cache/hgtagsfnodes1
206 $ f --size --hexdump .hg/cache/hgtagsfnodes1
207 .hg/cache/hgtagsfnodes1: size=72
207 .hg/cache/hgtagsfnodes1: size=72
208 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
208 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
209 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
209 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
210 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
210 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
211 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............|
211 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............|
212 0040: 00 00 00 00 00 00 00 00 |........|
212 0040: 00 00 00 00 00 00 00 00 |........|
213
213
214 Merge the two heads:
214 Merge the two heads:
215
215
216 $ hg merge 1
216 $ hg merge 1
217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 (branch merge, don't forget to commit)
218 (branch merge, don't forget to commit)
219 $ hg blackbox -l3
219 $ hg blackbox -l3
220 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28 (5000)> merge 1
220 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28 (5000)> merge 1
221 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> merge 1 exited 0 after * seconds (glob)
221 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> merge 1 exited 0 after * seconds (glob)
222 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l3
222 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l3
223 $ hg id
223 $ hg id
224 c8edf04160c7+b9154636be93+ tip
224 c8edf04160c7+b9154636be93+ tip
225 $ hg status
225 $ hg status
226 M .hgtags
226 M .hgtags
227 $ hg commit -m "merge"
227 $ hg commit -m "merge"
228
228
229 Create a fake head, make sure tag not visible afterwards:
229 Create a fake head, make sure tag not visible afterwards:
230
230
231 $ cp .hgtags tags
231 $ cp .hgtags tags
232 $ hg tag last
232 $ hg tag last
233 $ hg rm .hgtags
233 $ hg rm .hgtags
234 $ hg commit -m "remove"
234 $ hg commit -m "remove"
235
235
236 $ mv tags .hgtags
236 $ mv tags .hgtags
237 $ hg add .hgtags
237 $ hg add .hgtags
238 $ hg commit -m "readd"
238 $ hg commit -m "readd"
239 $
239 $
240 $ hg tags
240 $ hg tags
241 tip 6:35ff301afafe
241 tip 6:35ff301afafe
242 first 0:acb14030fe0a
242 first 0:acb14030fe0a
243
243
244 Add invalid tags:
244 Add invalid tags:
245
245
246 $ echo "spam" >> .hgtags
246 $ echo "spam" >> .hgtags
247 $ echo >> .hgtags
247 $ echo >> .hgtags
248 $ echo "foo bar" >> .hgtags
248 $ echo "foo bar" >> .hgtags
249 $ echo "a5a5 invalid" >> .hg/localtags
249 $ echo "a5a5 invalid" >> .hg/localtags
250 $ cat .hgtags
250 $ cat .hgtags
251 acb14030fe0a21b60322c440ad2d20cf7685a376 first
251 acb14030fe0a21b60322c440ad2d20cf7685a376 first
252 spam
252 spam
253
253
254 foo bar
254 foo bar
255 $ hg commit -m "tags"
255 $ hg commit -m "tags"
256
256
257 Report tag parse error on other head:
257 Report tag parse error on other head:
258
258
259 $ hg up 3
259 $ hg up 3
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ echo 'x y' >> .hgtags
261 $ echo 'x y' >> .hgtags
262 $ hg commit -m "head"
262 $ hg commit -m "head"
263 created new head
263 created new head
264
264
265 $ hg tags --debug
265 $ hg tags --debug
266 .hgtags@75d9f02dfe28, line 2: cannot parse entry
266 .hgtags@75d9f02dfe28, line 2: cannot parse entry
267 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
267 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
268 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
268 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
269 tip 8:c4be69a18c11e8bc3a5fdbb576017c25f7d84663
269 tip 8:c4be69a18c11e8bc3a5fdbb576017c25f7d84663
270 first 0:acb14030fe0a21b60322c440ad2d20cf7685a376
270 first 0:acb14030fe0a21b60322c440ad2d20cf7685a376
271 $ hg tip
271 $ hg tip
272 changeset: 8:c4be69a18c11
272 changeset: 8:c4be69a18c11
273 tag: tip
273 tag: tip
274 parent: 3:ac5e980c4dc0
274 parent: 3:ac5e980c4dc0
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: head
277 summary: head
278
278
279
279
280 Test tag precedence rules:
280 Test tag precedence rules:
281
281
282 $ cd ..
282 $ cd ..
283 $ hg init t2
283 $ hg init t2
284 $ cd t2
284 $ cd t2
285 $ echo foo > foo
285 $ echo foo > foo
286 $ hg add foo
286 $ hg add foo
287 $ hg ci -m 'add foo' # rev 0
287 $ hg ci -m 'add foo' # rev 0
288 $ hg tag bar # rev 1
288 $ hg tag bar # rev 1
289 $ echo >> foo
289 $ echo >> foo
290 $ hg ci -m 'change foo 1' # rev 2
290 $ hg ci -m 'change foo 1' # rev 2
291 $ hg up -C 1
291 $ hg up -C 1
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 $ hg tag -r 1 -f bar # rev 3
293 $ hg tag -r 1 -f bar # rev 3
294 $ hg up -C 1
294 $ hg up -C 1
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ echo >> foo
296 $ echo >> foo
297 $ hg ci -m 'change foo 2' # rev 4
297 $ hg ci -m 'change foo 2' # rev 4
298 created new head
298 created new head
299 $ hg tags
299 $ hg tags
300 tip 4:0c192d7d5e6b
300 tip 4:0c192d7d5e6b
301 bar 1:78391a272241
301 bar 1:78391a272241
302
302
303 Repeat in case of cache effects:
303 Repeat in case of cache effects:
304
304
305 $ hg tags
305 $ hg tags
306 tip 4:0c192d7d5e6b
306 tip 4:0c192d7d5e6b
307 bar 1:78391a272241
307 bar 1:78391a272241
308
308
309 Detailed dump of tag info:
309 Detailed dump of tag info:
310
310
311 $ hg heads -q # expect 4, 3, 2
311 $ hg heads -q # expect 4, 3, 2
312 4:0c192d7d5e6b
312 4:0c192d7d5e6b
313 3:6fa450212aeb
313 3:6fa450212aeb
314 2:7a94127795a3
314 2:7a94127795a3
315 $ dumptags 2
315 $ dumptags 2
316 rev 2: .hgtags:
316 rev 2: .hgtags:
317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
318 $ dumptags 3
318 $ dumptags 3
319 rev 3: .hgtags:
319 rev 3: .hgtags:
320 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
320 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
321 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
321 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
322 78391a272241d70354aa14c874552cad6b51bb42 bar
322 78391a272241d70354aa14c874552cad6b51bb42 bar
323 $ dumptags 4
323 $ dumptags 4
324 rev 4: .hgtags:
324 rev 4: .hgtags:
325 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
325 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
326
326
327 Dump cache:
327 Dump cache:
328
328
329 $ cat .hg/cache/tags2-visible
329 $ cat .hg/cache/tags2-visible
330 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
330 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
331 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
331 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
332 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
332 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
333 78391a272241d70354aa14c874552cad6b51bb42 bar
333 78391a272241d70354aa14c874552cad6b51bb42 bar
334
334
335 $ f --size --hexdump .hg/cache/hgtagsfnodes1
335 $ f --size --hexdump .hg/cache/hgtagsfnodes1
336 .hg/cache/hgtagsfnodes1: size=120
336 .hg/cache/hgtagsfnodes1: size=120
337 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
337 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
338 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
338 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
339 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
339 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
340 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
340 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
341 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
341 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
342 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
342 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
343 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
343 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
344 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=|
344 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=|
345
345
346 Corrupt the .hgtags fnodes cache
346 Corrupt the .hgtags fnodes cache
347 Extra junk data at the end should get overwritten on next cache update
347 Extra junk data at the end should get overwritten on next cache update
348
348
349 $ echo extra >> .hg/cache/hgtagsfnodes1
349 $ echo extra >> .hg/cache/hgtagsfnodes1
350 $ echo dummy1 > foo
350 $ echo dummy1 > foo
351 $ hg commit -m throwaway1
351 $ hg commit -m throwaway1
352
352
353 $ hg tags
353 $ hg tags
354 tip 5:8dbfe60eff30
354 tip 5:8dbfe60eff30
355 bar 1:78391a272241
355 bar 1:78391a272241
356
356
357 $ hg blackbox -l 6
357 $ hg blackbox -l 6
358 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags
358 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags
359 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing 24 bytes to cache/hgtagsfnodes1
359 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing 24 bytes to cache/hgtagsfnodes1
360 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> 2/3 cache hits/lookups in * seconds (glob)
360 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> 2/3 cache hits/lookups in * seconds (glob)
361 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing .hg/cache/tags2-visible with 1 tags
361 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing .hg/cache/tags2-visible with 1 tags
362 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags exited 0 after * seconds (glob)
362 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags exited 0 after * seconds (glob)
363 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> blackbox -l 6
363 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> blackbox -l 6
364
364
365 #if unix-permissions no-root
365 #if unix-permissions no-root
366 Errors writing to .hgtags fnodes cache are silently ignored
366 Errors writing to .hgtags fnodes cache are silently ignored
367
367
368 $ echo dummy2 > foo
368 $ echo dummy2 > foo
369 $ hg commit -m throwaway2
369 $ hg commit -m throwaway2
370
370
371 $ chmod a-w .hg/cache/hgtagsfnodes1
371 $ chmod a-w .hg/cache/hgtagsfnodes1
372 $ rm -f .hg/cache/tags2-visible
372 $ rm -f .hg/cache/tags2-visible
373
373
374 $ hg tags
374 $ hg tags
375 tip 6:b968051b5cf3
375 tip 6:b968051b5cf3
376 bar 1:78391a272241
376 bar 1:78391a272241
377
377
378 $ hg blackbox -l 6
378 $ hg blackbox -l 6
379 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
379 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
380 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1'
380 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1'
381 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
381 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
382 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
382 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
383 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
383 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
384 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
384 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
385
385
386 $ chmod a+w .hg/cache/hgtagsfnodes1
386 $ chmod a+w .hg/cache/hgtagsfnodes1
387
387
388 $ rm -f .hg/cache/tags2-visible
388 $ rm -f .hg/cache/tags2-visible
389 $ hg tags
389 $ hg tags
390 tip 6:b968051b5cf3
390 tip 6:b968051b5cf3
391 bar 1:78391a272241
391 bar 1:78391a272241
392
392
393 $ hg blackbox -l 6
393 $ hg blackbox -l 6
394 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
394 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
395 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
395 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
396 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
396 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
397 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
397 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
398 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
398 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
399 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
399 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
400
400
401 $ f --size .hg/cache/hgtagsfnodes1
401 $ f --size .hg/cache/hgtagsfnodes1
402 .hg/cache/hgtagsfnodes1: size=168
402 .hg/cache/hgtagsfnodes1: size=168
403
403
404 $ hg -q --config extensions.strip= strip -r 6 --no-backup
404 $ hg -q --config extensions.strip= strip -r 6 --no-backup
405 #endif
405 #endif
406
406
407 Stripping doesn't truncate the tags cache until new data is available
407 Stripping doesn't truncate the tags cache until new data is available
408
408
409 $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible
409 $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible
410 $ hg tags
410 $ hg tags
411 tip 5:8dbfe60eff30
411 tip 5:8dbfe60eff30
412 bar 1:78391a272241
412 bar 1:78391a272241
413
413
414 $ f --size .hg/cache/hgtagsfnodes1
414 $ f --size .hg/cache/hgtagsfnodes1
415 .hg/cache/hgtagsfnodes1: size=144
415 .hg/cache/hgtagsfnodes1: size=144
416
416
417 $ hg -q --config extensions.strip= strip -r 5 --no-backup
417 $ hg -q --config extensions.strip= strip -r 5 --no-backup
418 $ hg tags
418 $ hg tags
419 tip 4:0c192d7d5e6b
419 tip 4:0c192d7d5e6b
420 bar 1:78391a272241
420 bar 1:78391a272241
421
421
422 $ hg blackbox -l 5
422 $ hg blackbox -l 5
423 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing 24 bytes to cache/hgtagsfnodes1
423 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing 24 bytes to cache/hgtagsfnodes1
424 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> 2/3 cache hits/lookups in * seconds (glob)
424 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> 2/3 cache hits/lookups in * seconds (glob)
425 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing .hg/cache/tags2-visible with 1 tags
425 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing .hg/cache/tags2-visible with 1 tags
426 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> tags exited 0 after * seconds (glob)
426 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> tags exited 0 after * seconds (glob)
427 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> blackbox -l 5
427 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> blackbox -l 5
428
428
429 $ f --size .hg/cache/hgtagsfnodes1
429 $ f --size .hg/cache/hgtagsfnodes1
430 .hg/cache/hgtagsfnodes1: size=120
430 .hg/cache/hgtagsfnodes1: size=120
431
431
432 $ echo dummy > foo
432 $ echo dummy > foo
433 $ hg commit -m throwaway3
433 $ hg commit -m throwaway3
434
434
435 $ hg tags
435 $ hg tags
436 tip 5:035f65efb448
436 tip 5:035f65efb448
437 bar 1:78391a272241
437 bar 1:78391a272241
438
438
439 $ hg blackbox -l 6
439 $ hg blackbox -l 6
440 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags
440 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags
441 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing 24 bytes to cache/hgtagsfnodes1
441 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing 24 bytes to cache/hgtagsfnodes1
442 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> 2/3 cache hits/lookups in * seconds (glob)
442 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> 2/3 cache hits/lookups in * seconds (glob)
443 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing .hg/cache/tags2-visible with 1 tags
443 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing .hg/cache/tags2-visible with 1 tags
444 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags exited 0 after * seconds (glob)
444 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags exited 0 after * seconds (glob)
445 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> blackbox -l 6
445 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> blackbox -l 6
446 $ f --size .hg/cache/hgtagsfnodes1
446 $ f --size .hg/cache/hgtagsfnodes1
447 .hg/cache/hgtagsfnodes1: size=144
447 .hg/cache/hgtagsfnodes1: size=144
448
448
449 $ hg -q --config extensions.strip= strip -r 5 --no-backup
449 $ hg -q --config extensions.strip= strip -r 5 --no-backup
450
450
451 Test tag removal:
451 Test tag removal:
452
452
453 $ hg tag --remove bar # rev 5
453 $ hg tag --remove bar # rev 5
454 $ hg tip -vp
454 $ hg tip -vp
455 changeset: 5:5f6e8655b1c7
455 changeset: 5:5f6e8655b1c7
456 tag: tip
456 tag: tip
457 user: test
457 user: test
458 date: Thu Jan 01 00:00:00 1970 +0000
458 date: Thu Jan 01 00:00:00 1970 +0000
459 files: .hgtags
459 files: .hgtags
460 description:
460 description:
461 Removed tag bar
461 Removed tag bar
462
462
463
463
464 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
464 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
465 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
465 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
466 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
466 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
467 @@ -1,1 +1,3 @@
467 @@ -1,1 +1,3 @@
468 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
468 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
469 +78391a272241d70354aa14c874552cad6b51bb42 bar
469 +78391a272241d70354aa14c874552cad6b51bb42 bar
470 +0000000000000000000000000000000000000000 bar
470 +0000000000000000000000000000000000000000 bar
471
471
472 $ hg tags
472 $ hg tags
473 tip 5:5f6e8655b1c7
473 tip 5:5f6e8655b1c7
474 $ hg tags # again, try to expose cache bugs
474 $ hg tags # again, try to expose cache bugs
475 tip 5:5f6e8655b1c7
475 tip 5:5f6e8655b1c7
476
476
477 Remove nonexistent tag:
477 Remove nonexistent tag:
478
478
479 $ hg tag --remove foobar
479 $ hg tag --remove foobar
480 abort: tag 'foobar' does not exist
480 abort: tag 'foobar' does not exist
481 [255]
481 [255]
482 $ hg tip
482 $ hg tip
483 changeset: 5:5f6e8655b1c7
483 changeset: 5:5f6e8655b1c7
484 tag: tip
484 tag: tip
485 user: test
485 user: test
486 date: Thu Jan 01 00:00:00 1970 +0000
486 date: Thu Jan 01 00:00:00 1970 +0000
487 summary: Removed tag bar
487 summary: Removed tag bar
488
488
489
489
490 Undo a tag with rollback:
490 Undo a tag with rollback:
491
491
492 $ hg rollback # destroy rev 5 (restore bar)
492 $ hg rollback # destroy rev 5 (restore bar)
493 repository tip rolled back to revision 4 (undo commit)
493 repository tip rolled back to revision 4 (undo commit)
494 working directory now based on revision 4
494 working directory now based on revision 4
495 $ hg tags
495 $ hg tags
496 tip 4:0c192d7d5e6b
496 tip 4:0c192d7d5e6b
497 bar 1:78391a272241
497 bar 1:78391a272241
498 $ hg tags
498 $ hg tags
499 tip 4:0c192d7d5e6b
499 tip 4:0c192d7d5e6b
500 bar 1:78391a272241
500 bar 1:78391a272241
501
501
502 Test tag rank:
502 Test tag rank:
503
503
504 $ cd ..
504 $ cd ..
505 $ hg init t3
505 $ hg init t3
506 $ cd t3
506 $ cd t3
507 $ echo foo > foo
507 $ echo foo > foo
508 $ hg add foo
508 $ hg add foo
509 $ hg ci -m 'add foo' # rev 0
509 $ hg ci -m 'add foo' # rev 0
510 $ hg tag -f bar # rev 1 bar -> 0
510 $ hg tag -f bar # rev 1 bar -> 0
511 $ hg tag -f bar # rev 2 bar -> 1
511 $ hg tag -f bar # rev 2 bar -> 1
512 $ hg tag -fr 0 bar # rev 3 bar -> 0
512 $ hg tag -fr 0 bar # rev 3 bar -> 0
513 $ hg tag -fr 1 bar # rev 4 bar -> 1
513 $ hg tag -fr 1 bar # rev 4 bar -> 1
514 $ hg tag -fr 0 bar # rev 5 bar -> 0
514 $ hg tag -fr 0 bar # rev 5 bar -> 0
515 $ hg tags
515 $ hg tags
516 tip 5:85f05169d91d
516 tip 5:85f05169d91d
517 bar 0:bbd179dfa0a7
517 bar 0:bbd179dfa0a7
518 $ hg co 3
518 $ hg co 3
519 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
519 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 $ echo barbar > foo
520 $ echo barbar > foo
521 $ hg ci -m 'change foo' # rev 6
521 $ hg ci -m 'change foo' # rev 6
522 created new head
522 created new head
523 $ hg tags
523 $ hg tags
524 tip 6:735c3ca72986
524 tip 6:735c3ca72986
525 bar 0:bbd179dfa0a7
525 bar 0:bbd179dfa0a7
526
526
527 Don't allow moving tag without -f:
527 Don't allow moving tag without -f:
528
528
529 $ hg tag -r 3 bar
529 $ hg tag -r 3 bar
530 abort: tag 'bar' already exists (use -f to force)
530 abort: tag 'bar' already exists (use -f to force)
531 [255]
531 [255]
532 $ hg tags
532 $ hg tags
533 tip 6:735c3ca72986
533 tip 6:735c3ca72986
534 bar 0:bbd179dfa0a7
534 bar 0:bbd179dfa0a7
535
535
536 Strip 1: expose an old head:
536 Strip 1: expose an old head:
537
537
538 $ hg --config extensions.mq= strip 5
538 $ hg --config extensions.mq= strip 5
539 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
539 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
540 $ hg tags # partly stale cache
540 $ hg tags # partly stale cache
541 tip 5:735c3ca72986
541 tip 5:735c3ca72986
542 bar 1:78391a272241
542 bar 1:78391a272241
543 $ hg tags # up-to-date cache
543 $ hg tags # up-to-date cache
544 tip 5:735c3ca72986
544 tip 5:735c3ca72986
545 bar 1:78391a272241
545 bar 1:78391a272241
546
546
547 Strip 2: destroy whole branch, no old head exposed
547 Strip 2: destroy whole branch, no old head exposed
548
548
549 $ hg --config extensions.mq= strip 4
549 $ hg --config extensions.mq= strip 4
550 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
550 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
551 $ hg tags # partly stale
551 $ hg tags # partly stale
552 tip 4:735c3ca72986
552 tip 4:735c3ca72986
553 bar 0:bbd179dfa0a7
553 bar 0:bbd179dfa0a7
554 $ rm -f .hg/cache/tags2-visible
554 $ rm -f .hg/cache/tags2-visible
555 $ hg tags # cold cache
555 $ hg tags # cold cache
556 tip 4:735c3ca72986
556 tip 4:735c3ca72986
557 bar 0:bbd179dfa0a7
557 bar 0:bbd179dfa0a7
558
558
559 Test tag rank with 3 heads:
559 Test tag rank with 3 heads:
560
560
561 $ cd ..
561 $ cd ..
562 $ hg init t4
562 $ hg init t4
563 $ cd t4
563 $ cd t4
564 $ echo foo > foo
564 $ echo foo > foo
565 $ hg add
565 $ hg add
566 adding foo
566 adding foo
567 $ hg ci -m 'add foo' # rev 0
567 $ hg ci -m 'add foo' # rev 0
568 $ hg tag bar # rev 1 bar -> 0
568 $ hg tag bar # rev 1 bar -> 0
569 $ hg tag -f bar # rev 2 bar -> 1
569 $ hg tag -f bar # rev 2 bar -> 1
570 $ hg up -qC 0
570 $ hg up -qC 0
571 $ hg tag -fr 2 bar # rev 3 bar -> 2
571 $ hg tag -fr 2 bar # rev 3 bar -> 2
572 $ hg tags
572 $ hg tags
573 tip 3:197c21bbbf2c
573 tip 3:197c21bbbf2c
574 bar 2:6fa450212aeb
574 bar 2:6fa450212aeb
575 $ hg up -qC 0
575 $ hg up -qC 0
576 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
576 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
577
577
578 Bar should still point to rev 2:
578 Bar should still point to rev 2:
579
579
580 $ hg tags
580 $ hg tags
581 tip 4:3b4b14ed0202
581 tip 4:3b4b14ed0202
582 bar 2:6fa450212aeb
582 bar 2:6fa450212aeb
583
583
584 Test that removing global/local tags does not get confused when trying
584 Test that removing global/local tags does not get confused when trying
585 to remove a tag of type X which actually only exists as a type Y:
585 to remove a tag of type X which actually only exists as a type Y:
586
586
587 $ cd ..
587 $ cd ..
588 $ hg init t5
588 $ hg init t5
589 $ cd t5
589 $ cd t5
590 $ echo foo > foo
590 $ echo foo > foo
591 $ hg add
591 $ hg add
592 adding foo
592 adding foo
593 $ hg ci -m 'add foo' # rev 0
593 $ hg ci -m 'add foo' # rev 0
594
594
595 $ hg tag -r 0 -l localtag
595 $ hg tag -r 0 -l localtag
596 $ hg tag --remove localtag
596 $ hg tag --remove localtag
597 abort: tag 'localtag' is not a global tag
597 abort: tag 'localtag' is not a global tag
598 [255]
598 [255]
599 $
599 $
600 $ hg tag -r 0 globaltag
600 $ hg tag -r 0 globaltag
601 $ hg tag --remove -l globaltag
601 $ hg tag --remove -l globaltag
602 abort: tag 'globaltag' is not a local tag
602 abort: tag 'globaltag' is not a local tag
603 [255]
603 [255]
604 $ hg tags -v
604 $ hg tags -v
605 tip 1:a0b6fe111088
605 tip 1:a0b6fe111088
606 localtag 0:bbd179dfa0a7 local
606 localtag 0:bbd179dfa0a7 local
607 globaltag 0:bbd179dfa0a7
607 globaltag 0:bbd179dfa0a7
608
608
609 Test for issue3911
609 Test for issue3911
610
610
611 $ hg tag -r 0 -l localtag2
611 $ hg tag -r 0 -l localtag2
612 $ hg tag -l --remove localtag2
612 $ hg tag -l --remove localtag2
613 $ hg tags -v
613 $ hg tags -v
614 tip 1:a0b6fe111088
614 tip 1:a0b6fe111088
615 localtag 0:bbd179dfa0a7 local
615 localtag 0:bbd179dfa0a7 local
616 globaltag 0:bbd179dfa0a7
616 globaltag 0:bbd179dfa0a7
617
617
618 $ hg tag -r 1 -f localtag
618 $ hg tag -r 1 -f localtag
619 $ hg tags -v
619 $ hg tags -v
620 tip 2:5c70a037bb37
620 tip 2:5c70a037bb37
621 localtag 1:a0b6fe111088
621 localtag 1:a0b6fe111088
622 globaltag 0:bbd179dfa0a7
622 globaltag 0:bbd179dfa0a7
623
623
624 $ hg tags -v
624 $ hg tags -v
625 tip 2:5c70a037bb37
625 tip 2:5c70a037bb37
626 localtag 1:a0b6fe111088
626 localtag 1:a0b6fe111088
627 globaltag 0:bbd179dfa0a7
627 globaltag 0:bbd179dfa0a7
628
628
629 $ hg tag -r 1 localtag2
629 $ hg tag -r 1 localtag2
630 $ hg tags -v
630 $ hg tags -v
631 tip 3:bbfb8cd42be2
631 tip 3:bbfb8cd42be2
632 localtag2 1:a0b6fe111088
632 localtag2 1:a0b6fe111088
633 localtag 1:a0b6fe111088
633 localtag 1:a0b6fe111088
634 globaltag 0:bbd179dfa0a7
634 globaltag 0:bbd179dfa0a7
635
635
636 $ hg tags -v
636 $ hg tags -v
637 tip 3:bbfb8cd42be2
637 tip 3:bbfb8cd42be2
638 localtag2 1:a0b6fe111088
638 localtag2 1:a0b6fe111088
639 localtag 1:a0b6fe111088
639 localtag 1:a0b6fe111088
640 globaltag 0:bbd179dfa0a7
640 globaltag 0:bbd179dfa0a7
641
641
642 $ cd ..
642 $ cd ..
643
643
644 Create a repository with tags data to test .hgtags fnodes transfer
644 Create a repository with tags data to test .hgtags fnodes transfer
645
645
646 $ hg init tagsserver
646 $ hg init tagsserver
647 $ cd tagsserver
647 $ cd tagsserver
648 $ touch foo
648 $ touch foo
649 $ hg -q commit -A -m initial
649 $ hg -q commit -A -m initial
650 $ hg tag -m 'tag 0.1' 0.1
650 $ hg tag -m 'tag 0.1' 0.1
651 $ echo second > foo
651 $ echo second > foo
652 $ hg commit -m second
652 $ hg commit -m second
653 $ hg tag -m 'tag 0.2' 0.2
653 $ hg tag -m 'tag 0.2' 0.2
654 $ hg tags
654 $ hg tags
655 tip 3:40f0358cb314
655 tip 3:40f0358cb314
656 0.2 2:f63cc8fe54e4
656 0.2 2:f63cc8fe54e4
657 0.1 0:96ee1d7354c4
657 0.1 0:96ee1d7354c4
658 $ cd ..
658 $ cd ..
659
659
660 Cloning should pull down hgtags fnodes mappings and write the cache file
660 Cloning should pull down hgtags fnodes mappings and write the cache file
661
661
662 $ hg clone --pull tagsserver tagsclient
662 $ hg clone --pull tagsserver tagsclient
663 requesting all changes
663 requesting all changes
664 adding changesets
664 adding changesets
665 adding manifests
665 adding manifests
666 adding file changes
666 adding file changes
667 added 4 changesets with 4 changes to 2 files
667 added 4 changesets with 4 changes to 2 files
668 updating to branch default
668 updating to branch default
669 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
669 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
670
670
671 Missing tags2* files means the cache wasn't written through the normal mechanism.
671 Missing tags2* files means the cache wasn't written through the normal mechanism.
672
672
673 $ ls tagsclient/.hg/cache
673 $ ls tagsclient/.hg/cache
674 branch2-served
674 branch2-served
675 checkisexec
675 checkisexec (execbit !)
676 checklink
676 checklink (symlink !)
677 checklink-target
677 checklink-target (symlink !)
678 hgtagsfnodes1
678 hgtagsfnodes1
679 rbc-names-v1
679 rbc-names-v1
680 rbc-revs-v1
680 rbc-revs-v1
681
681
682 Cache should contain the head only, even though other nodes have tags data
682 Cache should contain the head only, even though other nodes have tags data
683
683
684 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
684 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
685 tagsclient/.hg/cache/hgtagsfnodes1: size=96
685 tagsclient/.hg/cache/hgtagsfnodes1: size=96
686 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
686 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
687 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
687 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
688 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
688 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
689 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
689 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
690 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
690 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
691 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
691 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
692
692
693 Running hg tags should produce tags2* file and not change cache
693 Running hg tags should produce tags2* file and not change cache
694
694
695 $ hg -R tagsclient tags
695 $ hg -R tagsclient tags
696 tip 3:40f0358cb314
696 tip 3:40f0358cb314
697 0.2 2:f63cc8fe54e4
697 0.2 2:f63cc8fe54e4
698 0.1 0:96ee1d7354c4
698 0.1 0:96ee1d7354c4
699
699
700 $ ls tagsclient/.hg/cache
700 $ ls tagsclient/.hg/cache
701 branch2-served
701 branch2-served
702 checkisexec
702 checkisexec (execbit !)
703 checklink
703 checklink (symlink !)
704 checklink-target
704 checklink-target (symlink !)
705 hgtagsfnodes1
705 hgtagsfnodes1
706 rbc-names-v1
706 rbc-names-v1
707 rbc-revs-v1
707 rbc-revs-v1
708 tags2-visible
708 tags2-visible
709
709
710 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
710 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
711 tagsclient/.hg/cache/hgtagsfnodes1: size=96
711 tagsclient/.hg/cache/hgtagsfnodes1: size=96
712 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
712 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
713 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
713 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
714 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
714 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
715 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
715 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
716 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
716 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
717 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
717 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
718
718
General Comments 0
You need to be logged in to leave comments. Login now