--- a/tests/test-command-template.t Fri Aug 11 01:34:11 2017 -0700
+++ b/tests/test-command-template.t Mon Aug 21 21:35:06 2017 -0700
@@ -2871,95 +2871,189 @@
No tag set:
- $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
- 5: null+5
- 4: null+4
- 3: null+3
- 2: null+3
- 1: null+2
- 0: null+1
-
-One common tag: longest path wins:
+ $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
+ @ 5: null+5
+ |\
+ | o 4: null+4
+ | |
+ | o 3: null+3
+ | |
+ o | 2: null+3
+ |/
+ o 1: null+2
+ |
+ o 0: null+1
+
+
+One common tag: longest path wins for {latesttagdistance}:
$ hg tag -r 1 -m t1 -d '6 0' t1
- $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
- 6: t1+4
- 5: t1+3
- 4: t1+2
- 3: t1+1
- 2: t1+1
- 1: t1+0
- 0: null+1
-
-One ancestor tag: more recent wins:
+ $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
+ @ 6: t1+4
+ |
+ o 5: t1+3
+ |\
+ | o 4: t1+2
+ | |
+ | o 3: t1+1
+ | |
+ o | 2: t1+1
+ |/
+ o 1: t1+0
+ |
+ o 0: null+1
+
+
+One ancestor tag: closest wins:
$ hg tag -r 2 -m t2 -d '7 0' t2
- $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
- 7: t2+3
- 6: t2+2
- 5: t2+1
- 4: t1+2
- 3: t1+1
- 2: t2+0
- 1: t1+0
- 0: null+1
-
-Two branch tags: more recent wins:
+ $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
+ @ 7: t2+3
+ |
+ o 6: t2+2
+ |
+ o 5: t2+1
+ |\
+ | o 4: t1+2
+ | |
+ | o 3: t1+1
+ | |
+ o | 2: t2+0
+ |/
+ o 1: t1+0
+ |
+ o 0: null+1
+
+
+Two branch tags: more recent wins if same number of changes:
$ hg tag -r 3 -m t3 -d '8 0' t3
- $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
- 8: t3+5
- 7: t3+4
- 6: t3+3
- 5: t3+2
- 4: t3+1
- 3: t3+0
- 2: t2+0
- 1: t1+0
- 0: null+1
+ $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
+ @ 8: t3+5
+ |
+ o 7: t3+4
+ |
+ o 6: t3+3
+ |
+ o 5: t3+2
+ |\
+ | o 4: t3+1
+ | |
+ | o 3: t3+0
+ | |
+ o | 2: t2+0
+ |/
+ o 1: t1+0
+ |
+ o 0: null+1
+
+
+Two branch tags: fewest changes wins:
+
+ $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
+ $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+ @ 9: t4+5,6
+ |
+ o 8: t4+4,5
+ |
+ o 7: t4+3,4
+ |
+ o 6: t4+2,3
+ |
+ o 5: t4+1,2
+ |\
+ | o 4: t4+0,0
+ | |
+ | o 3: t3+0,0
+ | |
+ o | 2: t2+0,0
+ |/
+ o 1: t1+0,0
+ |
+ o 0: null+1,1
+
Merged tag overrides:
$ hg tag -r 5 -m t5 -d '9 0' t5
$ hg tag -r 3 -m at3 -d '10 0' at3
- $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
- 10: t5+5
- 9: t5+4
- 8: t5+3
- 7: t5+2
- 6: t5+1
- 5: t5+0
- 4: at3:t3+1
- 3: at3:t3+0
- 2: t2+0
- 1: t1+0
- 0: null+1
-
- $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
- 10: t5+5,5
- 9: t5+4,4
- 8: t5+3,3
- 7: t5+2,2
- 6: t5+1,1
- 5: t5+0,0
- 4: at3+1,1 t3+1,1
- 3: at3+0,0 t3+0,0
- 2: t2+0,0
- 1: t1+0,0
- 0: null+1,1
-
- $ hg log --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
- 10: t3, C: 8, D: 7
- 9: t3, C: 7, D: 6
- 8: t3, C: 6, D: 5
- 7: t3, C: 5, D: 4
- 6: t3, C: 4, D: 3
- 5: t3, C: 3, D: 2
- 4: t3, C: 1, D: 1
- 3: t3, C: 0, D: 0
- 2: t1, C: 1, D: 1
- 1: t1, C: 0, D: 0
- 0: null, C: 1, D: 1
+ $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
+ @ 11: t5+6
+ |
+ o 10: t5+5
+ |
+ o 9: t5+4
+ |
+ o 8: t5+3
+ |
+ o 7: t5+2
+ |
+ o 6: t5+1
+ |
+ o 5: t5+0
+ |\
+ | o 4: t4+0
+ | |
+ | o 3: at3:t3+0
+ | |
+ o | 2: t2+0
+ |/
+ o 1: t1+0
+ |
+ o 0: null+1
+
+
+ $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+ @ 11: t5+6,6
+ |
+ o 10: t5+5,5
+ |
+ o 9: t5+4,4
+ |
+ o 8: t5+3,3
+ |
+ o 7: t5+2,2
+ |
+ o 6: t5+1,1
+ |
+ o 5: t5+0,0
+ |\
+ | o 4: t4+0,0
+ | |
+ | o 3: at3+0,0 t3+0,0
+ | |
+ o | 2: t2+0,0
+ |/
+ o 1: t1+0,0
+ |
+ o 0: null+1,1
+
+
+ $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
+ @ 11: t3, C: 9, D: 8
+ |
+ o 10: t3, C: 8, D: 7
+ |
+ o 9: t3, C: 7, D: 6
+ |
+ o 8: t3, C: 6, D: 5
+ |
+ o 7: t3, C: 5, D: 4
+ |
+ o 6: t3, C: 4, D: 3
+ |
+ o 5: t3, C: 3, D: 2
+ |\
+ | o 4: t3, C: 1, D: 1
+ | |
+ | o 3: t3, C: 0, D: 0
+ | |
+ o | 2: t1, C: 1, D: 1
+ |/
+ o 1: t1, C: 0, D: 0
+ |
+ o 0: null, C: 1, D: 1
+
$ cd ..
@@ -2981,7 +3075,7 @@
> EOF
$ hg -R latesttag tip
- test 10:9b4a630e5f5f
+ test 11:97e5943b523a
Test recursive showlist template (issue1989):
@@ -2994,7 +3088,7 @@
$ hg -R latesttag log -r tip --style=style1989
M|test
- 10,test
+ 11,test
branch: test
Test new-style inline templating:
@@ -3027,6 +3121,7 @@
$ hg log -R latesttag --template '{desc}\n'
at3
t5
+ t4
t3
t2
t1
@@ -3040,6 +3135,7 @@
$ hg log -R latesttag --template '{strip(desc, "te")}\n'
at3
5
+ 4
3
2
1
@@ -3055,6 +3151,7 @@
$ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
date: 70 01 01 10 +0000
date: 70 01 01 09 +0000
+ date: 70 01 01 04 +0000
date: 70 01 01 08 +0000
date: 70 01 01 07 +0000
date: 70 01 01 06 +0000