Debian Codegraph @

tests/test-tag.t

raw
1 $ cat >> $HGRCPATH << EOF
2 > [experimental]
3 > hook-track-tags=1
4 > [hooks]
5 > txnclose.track-tag=sh ${TESTTMP}/taghook.sh
6 > EOF
7
8 $ cat << EOF > taghook.sh
9 > #!/bin/sh
10 > # escape the "$" otherwise the test runner interpret it when writting the
11 > # file...
12 > if [ -n "\$HG_TAG_MOVED" ]; then
13 > echo 'hook: tag changes detected'
14 > sed 's/^/hook: /' .hg/changes/tags.changes
15 > fi
16 > EOF
17 $ hg init test
18 $ cd test
19
20 $ echo a > a
21 $ hg add a
22 $ hg commit -m "test"
23 $ hg history
24 changeset: 0:acb14030fe0a
25 tag: tip
26 user: test
27 date: Thu Jan 01 00:00:00 1970 +0000
28 summary: test
29
30
31 $ hg tag ' '
32 abort: tag names cannot consist entirely of whitespace
33 [10]
34
35 (this tests also that editor is not invoked, if '--edit' is not
36 specified)
37
38 $ HGEDITOR=cat hg tag "bleah"
39 hook: tag changes detected
40 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
41 $ hg history
42 changeset: 1:d4f0d2909abc
43 tag: tip
44 user: test
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: Added tag bleah for changeset acb14030fe0a
47
48 changeset: 0:acb14030fe0a
49 tag: bleah
50 user: test
51 date: Thu Jan 01 00:00:00 1970 +0000
52 summary: test
53
54
55 $ echo foo >> .hgtags
56 $ hg tag "bleah2"
57 abort: working copy of .hgtags is changed
58 (please commit .hgtags manually)
59 [255]
60
61 $ hg revert .hgtags
62 $ hg tag -r 0 x y z y y z
63 abort: tag names must be unique
64 [10]
65 $ hg tag tap nada dot tip
66 abort: the name 'tip' is reserved
67 [10]
68 $ hg tag .
69 abort: the name '.' is reserved
70 [10]
71 $ hg tag null
72 abort: the name 'null' is reserved
73 [10]
74 $ hg tag "bleah"
75 abort: tag 'bleah' already exists (use -f to force)
76 [10]
77 $ hg tag "blecch" "bleah"
78 abort: tag 'bleah' already exists (use -f to force)
79 [10]
80
81 $ hg tag --remove "blecch"
82 abort: tag 'blecch' does not exist
83 [10]
84 $ hg tag --remove "bleah" "blecch" "blough"
85 abort: tag 'blecch' does not exist
86 [10]
87
88 $ hg tag -r 0 "bleah0"
89 hook: tag changes detected
90 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
91 $ hg tag -l -r 1 "bleah1"
92 $ hg tag gack gawk gorp
93 hook: tag changes detected
94 hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gack
95 hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gawk
96 hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gorp
97 $ hg tag -f gack
98 hook: tag changes detected
99 hook: -M 336fccc858a4eb69609a291105009e484a6b6b8d gack
100 hook: +M 799667b6f2d9b957f73fa644a918c2df22bab58f gack
101 $ hg tag --remove gack gorp
102 hook: tag changes detected
103 hook: -R 799667b6f2d9b957f73fa644a918c2df22bab58f gack
104 hook: -R 336fccc858a4eb69609a291105009e484a6b6b8d gorp
105
106 $ hg tag "bleah "
107 abort: tag 'bleah' already exists (use -f to force)
108 [10]
109 $ hg tag " bleah"
110 abort: tag 'bleah' already exists (use -f to force)
111 [10]
112 $ hg tag " bleah"
113 abort: tag 'bleah' already exists (use -f to force)
114 [10]
115 $ hg tag -r 0 " bleahbleah "
116 hook: tag changes detected
117 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
118 $ hg tag -r 0 " bleah bleah "
119 hook: tag changes detected
120 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
121
122 $ cat .hgtags
123 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
124 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
125 336fccc858a4eb69609a291105009e484a6b6b8d gack
126 336fccc858a4eb69609a291105009e484a6b6b8d gawk
127 336fccc858a4eb69609a291105009e484a6b6b8d gorp
128 336fccc858a4eb69609a291105009e484a6b6b8d gack
129 799667b6f2d9b957f73fa644a918c2df22bab58f gack
130 799667b6f2d9b957f73fa644a918c2df22bab58f gack
131 0000000000000000000000000000000000000000 gack
132 336fccc858a4eb69609a291105009e484a6b6b8d gorp
133 0000000000000000000000000000000000000000 gorp
134 acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
135 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
136
137 $ cat .hg/localtags
138 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
139
140 tagging on a non-head revision
141
142 $ hg update 0
143 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
144 $ hg tag -l localblah
145 $ hg tag "foobar"
146 abort: working directory is not at a branch head (use -f to force)
147 [10]
148 $ hg tag -f "foobar"
149 hook: tag changes detected
150 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
151 $ cat .hgtags
152 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
153 $ cat .hg/localtags
154 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
155 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
156
157 $ hg tag -l 'xx
158 > newline'
159 abort: '\n' cannot be used in a name
160 [10]
161 $ hg tag -l 'xx:xx'
162 abort: ':' cannot be used in a name
163 [10]
164
165 cloning local tags
166
167 $ cd ..
168 $ hg -R test log -r0:5
169 changeset: 0:acb14030fe0a
170 tag: bleah
171 tag: bleah bleah
172 tag: bleah0
173 tag: bleahbleah
174 tag: foobar
175 tag: localblah
176 user: test
177 date: Thu Jan 01 00:00:00 1970 +0000
178 summary: test
179
180 changeset: 1:d4f0d2909abc
181 tag: bleah1
182 user: test
183 date: Thu Jan 01 00:00:00 1970 +0000
184 summary: Added tag bleah for changeset acb14030fe0a
185
186 changeset: 2:336fccc858a4
187 tag: gawk
188 user: test
189 date: Thu Jan 01 00:00:00 1970 +0000
190 summary: Added tag bleah0 for changeset acb14030fe0a
191
192 changeset: 3:799667b6f2d9
193 user: test
194 date: Thu Jan 01 00:00:00 1970 +0000
195 summary: Added tag gack, gawk, gorp for changeset 336fccc858a4
196
197 changeset: 4:154eeb7c0138
198 user: test
199 date: Thu Jan 01 00:00:00 1970 +0000
200 summary: Added tag gack for changeset 799667b6f2d9
201
202 changeset: 5:b4bb47aaff09
203 user: test
204 date: Thu Jan 01 00:00:00 1970 +0000
205 summary: Removed tag gack, gorp
206
207 $ hg clone -q -rbleah1 test test1
208 hook: tag changes detected
209 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
210 $ hg -R test1 parents --style=compact
211 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test
212 Added tag bleah for changeset acb14030fe0a
213
214 $ hg clone -q -r5 test#bleah1 test2
215 hook: tag changes detected
216 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
217 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
218 hook: +A 336fccc858a4eb69609a291105009e484a6b6b8d gawk
219 $ hg -R test2 parents --style=compact
220 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test
221 Removed tag gack, gorp
222
223 $ hg clone -q -U test#bleah1 test3
224 hook: tag changes detected
225 hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
226 $ hg -R test3 parents --style=compact
227
228 $ cd test
229
230 Issue601: hg tag doesn't do the right thing if .hgtags or localtags
231 doesn't end with EOL
232
233 $ "$PYTHON" << EOF
234 > f = open('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
235 > f = open('.hg/localtags', 'w'); f.write(last); f.close()
236 > EOF
237 $ cat .hg/localtags; echo
238 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
239 $ hg tag -l localnewline
240 $ cat .hg/localtags; echo
241 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
242 c2899151f4e76890c602a2597a650a72666681bf localnewline
243
244
245 $ "$PYTHON" << EOF
246 > f = open('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
247 > f = open('.hgtags', 'w'); f.write(last); f.close()
248 > EOF
249 $ hg ci -m'broken manual edit of .hgtags'
250 $ cat .hgtags; echo
251 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
252 $ hg tag newline
253 hook: tag changes detected
254 hook: +A a0eea09de1eeec777b46f2085260a373b2fbc293 newline
255 $ cat .hgtags; echo
256 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
257 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
258
259
260 tag and branch using same name
261
262 $ hg branch tag-and-branch-same-name
263 marked working directory as branch tag-and-branch-same-name
264 (branches are permanent and global, did you want a bookmark?)
265 $ hg ci -m"discouraged"
266 $ hg tag tag-and-branch-same-name
267 warning: tag tag-and-branch-same-name conflicts with existing branch name
268 hook: tag changes detected
269 hook: +A fc93d2ea1cd78e91216c6cfbbf26747c10ce11ae tag-and-branch-same-name
270
271 test custom commit messages
272
273 $ cat > editor.sh << '__EOF__'
274 > echo "==== before editing"
275 > cat "$1"
276 > echo "===="
277 > echo "custom tag message" > "$1"
278 > echo "second line" >> "$1"
279 > __EOF__
280
281 at first, test saving last-message.txt
282
283 (test that editor is not invoked before transaction starting)
284
285 $ cat > .hg/hgrc << '__EOF__'
286 > [hooks]
287 > # this failure occurs before editor invocation
288 > pretag.test-saving-lastmessage = false
289 > __EOF__
290 $ rm -f .hg/last-message.txt
291 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
292 abort: pretag.test-saving-lastmessage hook exited with status 1
293 [40]
294 $ test -f .hg/last-message.txt
295 [1]
296
297 (test that editor is invoked and commit message is saved into
298 "last-message.txt")
299
300 $ cat >> .hg/hgrc << '__EOF__'
301 > [hooks]
302 > pretag.test-saving-lastmessage =
303 > # this failure occurs after editor invocation
304 > pretxncommit.unexpectedabort = false
305 > __EOF__
306
307 (this tests also that editor is invoked, if '--edit' is specified,
308 regardless of '--message')
309
310 $ rm -f .hg/last-message.txt
311 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar"
312 ==== before editing
313 foo bar
314
315
316 HG: Enter commit message. Lines beginning with 'HG:' are removed.
317 HG: Leave message empty to abort commit.
318 HG: --
319 HG: user: test
320 HG: branch 'tag-and-branch-same-name'
321 HG: changed .hgtags
322 ====
323 transaction abort!
324 rollback completed
325 note: commit message saved in .hg/last-message.txt
326 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
327 abort: pretxncommit.unexpectedabort hook exited with status 1
328 [40]
329 $ cat .hg/last-message.txt
330 custom tag message
331 second line
332
333 $ cat >> .hg/hgrc << '__EOF__'
334 > [hooks]
335 > pretxncommit.unexpectedabort =
336 > __EOF__
337 $ hg status .hgtags
338 M .hgtags
339 $ hg revert --no-backup -q .hgtags
340
341 then, test custom commit message itself
342
343 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
344 ==== before editing
345 Added tag custom-tag for changeset 75a534207be6
346
347
348 HG: Enter commit message. Lines beginning with 'HG:' are removed.
349 HG: Leave message empty to abort commit.
350 HG: --
351 HG: user: test
352 HG: branch 'tag-and-branch-same-name'
353 HG: changed .hgtags
354 ====
355 hook: tag changes detected
356 hook: +A 75a534207be6b03576e0c7a4fa5708d045f1c876 custom-tag
357 $ hg log -l1 --template "{desc}\n"
358 custom tag message
359 second line
360
361
362 local tag with .hgtags modified
363
364 $ hg tag hgtags-modified
365 hook: tag changes detected
366 hook: +A 0f26aaea6f74c3ed6c4aad8844403c9ba128d23a hgtags-modified
367 $ hg rollback
368 repository tip rolled back to revision 13 (undo commit)
369 working directory now based on revision 13
370 $ hg st
371 M .hgtags
372 ? .hgtags.orig
373 ? editor.sh
374 $ hg tag --local baz
375 $ hg revert --no-backup .hgtags
376
377
378 tagging when at named-branch-head that's not a topo-head
379
380 $ hg up default
381 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 $ hg merge -t internal:local
383 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
384 (branch merge, don't forget to commit)
385 $ hg ci -m 'merge named branch'
386 hook: tag changes detected
387 hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
388 hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
389 hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
390 hook: -R acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
391 hook: -R 336fccc858a4eb69609a291105009e484a6b6b8d gawk
392 $ hg up 13
393 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 $ hg tag new-topo-head
395 hook: tag changes detected
396 hook: +A 0f26aaea6f74c3ed6c4aad8844403c9ba128d23a new-topo-head
397
398 tagging on null rev
399
400 $ hg up null
401 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
402 $ hg tag nullrev
403 abort: working directory is not at a branch head (use -f to force)
404 [10]
405
406 $ hg init empty
407 $ hg tag -R empty nullrev
408 abort: cannot tag null revision
409 [10]
410
411 $ hg tag -R empty -r 00000000000 -f nulltag
412 abort: cannot tag null revision
413 [10]
414
415 $ hg tag -R empty -r "wdir()" -f wdirtag
416 abort: cannot tag working directory
417 [10]
418
419 issue5539: pruned tags do not appear in .hgtags
420
421 $ cat >> $HGRCPATH << EOF
422 > [experimental]
423 > evolution.exchange = True
424 > evolution.createmarkers=True
425 > EOF
426 $ hg up e4d483960b9b --quiet
427 $ echo aaa >>a
428 $ hg ci -maaa
429 $ hg log -r . -T "{node}\n"
430 743b3afd5aa69f130c246806e48ad2e699f490d2
431 $ hg tag issue5539
432 hook: tag changes detected
433 hook: +A 743b3afd5aa69f130c246806e48ad2e699f490d2 issue5539
434 $ cat .hgtags
435 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
436 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
437 743b3afd5aa69f130c246806e48ad2e699f490d2 issue5539
438 $ hg log -r . -T "{node}\n"
439 abeb261f0508ecebcd345ce21e7a25112df417aa
440 (mimic 'hg prune' command by obsoleting current changeset and then moving to its parent)
441 $ hg debugobsolete abeb261f0508ecebcd345ce21e7a25112df417aa --record-parents
442 1 new obsolescence markers
443 obsoleted 1 changesets
444 $ hg up ".^" --quiet
445 $ cat .hgtags
446 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
447 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
448 $ echo bbb >>a
449 $ hg ci -mbbb
450 $ hg log -r . -T "{node}\n"
451 089dd20da58cae34165c37b064539c6ac0c6a0dd
452 $ hg tag issue5539
453 hook: tag changes detected
454 hook: +A 089dd20da58cae34165c37b064539c6ac0c6a0dd issue5539
455 $ hg id
456 0accf560a709 tip
457 $ cat .hgtags
458 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
459 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
460 089dd20da58cae34165c37b064539c6ac0c6a0dd issue5539
461 $ hg tags
462 tip 19:0accf560a709
463 issue5539 18:089dd20da58c
464 new-topo-head 13:0f26aaea6f74
465 baz 13:0f26aaea6f74
466 custom-tag 12:75a534207be6
467 tag-and-branch-same-name 11:fc93d2ea1cd7
468 newline 9:a0eea09de1ee
469 localnewline 8:c2899151f4e7
470 localblah 0:acb14030fe0a
471 foobar 0:acb14030fe0a
472
473 $ cd ..
474
475 tagging on an uncommitted merge (issue2542)
476
477 $ hg init repo-tag-uncommitted-merge
478 $ cd repo-tag-uncommitted-merge
479 $ echo c1 > f1
480 $ hg ci -Am0
481 adding f1
482 $ echo c2 > f2
483 $ hg ci -Am1
484 adding f2
485 $ hg co -q 0
486 $ hg branch b1
487 marked working directory as branch b1
488 (branches are permanent and global, did you want a bookmark?)
489 $ hg ci -m2
490 $ hg up default
491 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
492 $ hg merge b1
493 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
494 (branch merge, don't forget to commit)
495
496 $ hg tag t1
497 abort: uncommitted merge
498 [20]
499 $ hg status
500 $ hg tag --rev 1 t2
501 abort: uncommitted merge
502 [20]
503 $ hg tag --rev 1 --local t3
504 $ hg tags -v
505 tip 2:2a156e8887cc
506 t3 1:c3adabd1a5f4 local
507
508 $ cd ..
509
510 commit hook on tag used to be run without write lock - issue3344
511
512 $ hg init repo-tag
513 $ touch repo-tag/test
514 $ hg -R repo-tag commit -A -m "test"
515 adding test
516 $ hg init repo-tag-target
517 $ cat > "$TESTTMP/issue3344.sh" <<EOF
518 > hg push "$TESTTMP/repo-tag-target"
519 > EOF
520 $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag
521 hook: tag changes detected
522 hook: +A be090ea6625635128e90f7d89df8beeb2bcc1653 tag
523 pushing to $TESTTMP/repo-tag-target
524 searching for changes
525 adding changesets
526 adding manifests
527 adding file changes
528 added 2 changesets with 2 changes to 2 files
529 hook: tag changes detected
530 hook: +A be090ea6625635128e90f7d89df8beeb2bcc1653 tag
531
532 automatically merge resolvable tag conflicts (i.e. tags that differ in rank)
533 create two clones with some different tags as well as some common tags
534 check that we can merge tags that differ in rank
535
536 $ hg init repo-automatic-tag-merge
537 $ cd repo-automatic-tag-merge
538 $ echo c0 > f0
539 $ hg ci -A -m0
540 adding f0
541 $ hg tag tbase
542 hook: tag changes detected
543 hook: +A 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
544 $ hg up -qr '.^'
545 $ hg log -r 'wdir()' -T "{latesttagdistance}\n"
546 1
547 $ hg up -q
548 $ hg log -r 'wdir()' -T "{latesttagdistance}\n"
549 2
550 $ cd ..
551 $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone
552 updating to branch default
553 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
554 $ cd repo-automatic-tag-merge-clone
555 $ echo c1 > f1
556 $ hg ci -A -m1
557 adding f1
558 $ hg tag t1 t2 t3
559 hook: tag changes detected
560 hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
561 hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
562 hook: +A 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
563 $ hg tag --remove t2
564 hook: tag changes detected
565 hook: -R 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
566 $ hg tag t5
567 hook: tag changes detected
568 hook: +A 875517b4806a848f942811a315a5bce30804ae85 t5
569 $ echo c2 > f2
570 $ hg ci -A -m2
571 adding f2
572 $ hg tag -f t3
573 hook: tag changes detected
574 hook: -M 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
575 hook: +M 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
576
577 $ cd ../repo-automatic-tag-merge
578 $ echo c3 > f3
579 $ hg ci -A -m3
580 adding f3
581 $ hg tag -f t4 t5 t6
582 hook: tag changes detected
583 hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t4
584 hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
585 hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
586
587 $ hg up -q '.^'
588 $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n"
589 1 changes since t4:t5:t6
590 $ hg log -r '.' -T "{changessincelatesttag} changes since {latesttag}\n"
591 0 changes since t4:t5:t6
592 $ echo c5 > f3
593 $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n"
594 1 changes since t4:t5:t6
595 $ hg up -qC
596
597 $ hg tag --remove t5
598 hook: tag changes detected
599 hook: -R 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
600 $ echo c4 > f4
601 $ hg log -r '.' -T "{changessincelatesttag} changes since {latesttag}\n"
602 2 changes since t4:t6
603 $ hg log -r '.' -T "{latesttag % '{latesttag}\n'}"
604 t4
605 t6
606 $ hg log -r '.' -T "{latesttag('t4') % 'T: {tag}, C: {changes}, D: {distance}\n'}"
607 T: t4, C: 2, D: 2
608 $ hg log -r '.' -T "{latesttag('re:\d') % 'T: {tag}, C: {changes}, D: {distance}\n'}"
609 T: t4, C: 2, D: 2
610 T: t6, C: 2, D: 2
611 $ hg log -r . -T '{join(latesttag(), "*")}\n'
612 t4*t6
613 $ hg ci -A -m4
614 adding f4
615 $ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n"
616 4 changes since t4:t6
617 $ hg tag t2
618 hook: tag changes detected
619 hook: +A 929bca7b18d067cbf3844c3896319a940059d748 t2
620 $ hg tag -f t6
621 hook: tag changes detected
622 hook: -M 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
623 hook: +M 09af2ce14077a94effef208b49a718f4836d4338 t6
624
625 $ cd ../repo-automatic-tag-merge-clone
626 $ hg pull
627 pulling from $TESTTMP/repo-automatic-tag-merge
628 searching for changes
629 adding changesets
630 adding manifests
631 adding file changes
632 added 6 changesets with 6 changes to 3 files (+1 heads)
633 new changesets 9aa4e1292a27:b325cc5b642c
634 hook: tag changes detected
635 hook: +A 929bca7b18d067cbf3844c3896319a940059d748 t2
636 hook: +A 9aa4e1292a27a248f8d07339bed9931d54907be7 t4
637 hook: -R 875517b4806a848f942811a315a5bce30804ae85 t5
638 hook: +A 09af2ce14077a94effef208b49a718f4836d4338 t6
639 (run 'hg heads' to see heads, 'hg merge' to merge)
640 $ hg merge --tool internal:tagmerge
641 merging .hgtags
642 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
643 (branch merge, don't forget to commit)
644 $ hg status
645 M .hgtags
646 M f3
647 M f4
648 $ hg resolve -l
649 R .hgtags
650 $ cat .hgtags
651 9aa4e1292a27a248f8d07339bed9931d54907be7 t4
652 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
653 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
654 09af2ce14077a94effef208b49a718f4836d4338 t6
655 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
656 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
657 929bca7b18d067cbf3844c3896319a940059d748 t2
658 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
659 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
660 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
661 0000000000000000000000000000000000000000 t2
662 875517b4806a848f942811a315a5bce30804ae85 t5
663 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
664 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
665 0000000000000000000000000000000000000000 t5
666 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
667 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
668
669 check that the merge tried to minimize the diff with the first merge parent
670
671 $ hg diff --git -r 'p1()' .hgtags
672 diff --git a/.hgtags b/.hgtags
673 --- a/.hgtags
674 +++ b/.hgtags
675 @@ -1,9 +1,17 @@
676 +9aa4e1292a27a248f8d07339bed9931d54907be7 t4
677 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
678 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
679 +09af2ce14077a94effef208b49a718f4836d4338 t6
680 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
681 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
682 +929bca7b18d067cbf3844c3896319a940059d748 t2
683 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
684 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
685 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
686 0000000000000000000000000000000000000000 t2
687 875517b4806a848f942811a315a5bce30804ae85 t5
688 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
689 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
690 +0000000000000000000000000000000000000000 t5
691 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
692 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
693
694 detect merge tag conflicts
695
696 $ hg update -C -r tip
697 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
698 $ hg tag t7
699 hook: tag changes detected
700 hook: +A b325cc5b642c5b465bdbe8c09627cb372de3d47d t7
701 $ hg update -C -r 'first(sort(head()))'
702 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
703 $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags
704 $ hg commit -m "manually add conflicting t7 tag"
705 hook: tag changes detected
706 hook: -R 929bca7b18d067cbf3844c3896319a940059d748 t2
707 hook: +A 875517b4806a848f942811a315a5bce30804ae85 t5
708 hook: -M b325cc5b642c5b465bdbe8c09627cb372de3d47d t7
709 hook: +M ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
710 $ hg merge --tool internal:tagmerge
711 merging .hgtags
712 automatic .hgtags merge failed
713 the following 1 tags are in conflict: t7
714 automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice)
715 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
716 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
717 [1]
718 $ hg resolve -l
719 U .hgtags
720 $ cat .hgtags
721 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
722 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
723 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
724 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
725 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
726 0000000000000000000000000000000000000000 t2
727 875517b4806a848f942811a315a5bce30804ae85 t5
728 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
729 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
730 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
731
732 $ cd ..
733
734 handle the loss of tags
735
736 $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags
737 updating to branch default
738 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
739 $ cd repo-merge-lost-tags
740 $ echo c5 > f5
741 $ hg ci -A -m5
742 adding f5
743 $ hg tag -f t7
744 hook: tag changes detected
745 hook: -M ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
746 hook: +M fd3a9e394ce3afb354a496323bf68ac1755a30de t7
747 $ hg update -r 'p1(t7)'
748 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
749 $ printf '' > .hgtags
750 $ hg commit -m 'delete all tags'
751 created new head
752 $ hg log -r 'max(t7::)'
753 changeset: 17:ffe462b50880
754 user: test
755 date: Thu Jan 01 00:00:00 1970 +0000
756 summary: Added tag t7 for changeset fd3a9e394ce3
757
758 $ hg update -r 'max(t7::)'
759 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
760 $ hg merge -r tip --tool internal:tagmerge
761 merging .hgtags
762 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
763 (branch merge, don't forget to commit)
764 $ hg resolve -l
765 R .hgtags
766 $ cat .hgtags
767 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
768 0000000000000000000000000000000000000000 tbase
769 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
770 0000000000000000000000000000000000000000 t1
771 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
772 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
773 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
774 0000000000000000000000000000000000000000 t2
775 875517b4806a848f942811a315a5bce30804ae85 t5
776 0000000000000000000000000000000000000000 t5
777 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
778 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
779 0000000000000000000000000000000000000000 t3
780 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
781 0000000000000000000000000000000000000000 t7
782 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
783 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
784
785 also check that we minimize the diff with the 1st merge parent
786
787 $ hg diff --git -r 'p1()' .hgtags
788 diff --git a/.hgtags b/.hgtags
789 --- a/.hgtags
790 +++ b/.hgtags
791 @@ -1,12 +1,17 @@
792 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
793 +0000000000000000000000000000000000000000 tbase
794 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
795 +0000000000000000000000000000000000000000 t1
796 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
797 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
798 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
799 0000000000000000000000000000000000000000 t2
800 875517b4806a848f942811a315a5bce30804ae85 t5
801 +0000000000000000000000000000000000000000 t5
802 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
803 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
804 +0000000000000000000000000000000000000000 t3
805 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
806 +0000000000000000000000000000000000000000 t7
807 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
808 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
809