tests/test-command-template
author Mads Kiilerich <mads@kiilerich.com>
Sat, 03 Oct 2009 18:31:20 +0200
changeset 9536 f04d17912441
parent 9382 829ac0af66a4
child 9961 0aa1a632262b
child 10249 8ebb34b0f6f7
permissions -rwxr-xr-x
cmdutil: templating keywords latesttag and latesttagdistance This can be used for referring to revisions in a reasonable meaningful, stable and monotonically increasing way, suitable for releases or builds directly from a repository. The latest tag is found by searching through untagged ancestors and finding the latest tagged ancestor based on tag date. The distance is found from the length of the longest path to the tagged revision. For example: hg log -l1 --template '{latesttag}+{latesttagdistance}\n' can return 1.3.1+197 This is mostly work by Gilles Moris <gilles.moris@free.fr>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
hg init a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     4
cd a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     5
echo a > a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
hg add a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     7
echo line 1 > b
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     8
echo line 2 >> b
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
     9
hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    10
hg add b
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
echo other 1 > c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
echo other 2 >> c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
echo >> c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    14
echo other 3 >> c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
    15
hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
hg add c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
    17
hg commit -m 'no person' -d '1200000 0' -u 'other@place'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
echo c >> c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
    19
hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
3463
031aac7ec584 Extended templating test for new branches and extra changeset info.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3459
diff changeset
    20
echo foo > .hg/branch
031aac7ec584 Extended templating test for new branches and extra changeset info.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3459
diff changeset
    21
hg commit -m 'new branch' -d '1400000 0' -u 'person'
4353
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4352
diff changeset
    22
hg co -q 3
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4352
diff changeset
    23
echo other 4 >> d
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4352
diff changeset
    24
hg add d
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4352
diff changeset
    25
hg commit -m 'new head' -d '1500000 0' -u 'person'
6723
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6320
diff changeset
    26
hg merge -q foo
4353
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4352
diff changeset
    27
hg commit -m 'merge' -d '1500001 0' -u 'person'
4825
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4353
diff changeset
    28
# second branch starting at nullrev
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4353
diff changeset
    29
hg update null
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4353
diff changeset
    30
echo second > second
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4353
diff changeset
    31
hg add second
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4353
diff changeset
    32
hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
7682
9c8bbae02e9c templater: fix age filter to state the obvious on future timestamps
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6723
diff changeset
    33
echo third > third
9c8bbae02e9c templater: fix age filter to state the obvious on future timestamps
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6723
diff changeset
    34
hg add third
9c8bbae02e9c templater: fix age filter to state the obvious on future timestamps
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6723
diff changeset
    35
hg commit -m third -d "2020-01-01 10:01"
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    36
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    37
# make sure user/global hgrc does not affect tests
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    38
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    39
echo 'logtemplate =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    40
echo 'style =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    41
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    42
echo '# default style is like normal output'
3459
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3193
diff changeset
    43
echo '#  normal'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    44
hg log > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    45
hg log --style default > style.out
9382
829ac0af66a4 test-command-template: Don't diff files with same content
Mads Kiilerich <mads@kiilerich.com>
parents: 8523
diff changeset
    46
cmp log.out style.out || diff -u log.out style.out
3459
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3193
diff changeset
    47
echo '#  verbose'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    48
hg log -v > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
hg log -v --style default > style.out
9382
829ac0af66a4 test-command-template: Don't diff files with same content
Mads Kiilerich <mads@kiilerich.com>
parents: 8523
diff changeset
    50
cmp log.out style.out || diff -u log.out style.out
3459
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3193
diff changeset
    51
echo '#  debug'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    52
hg log --debug > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    53
hg log --debug --style default > style.out
9382
829ac0af66a4 test-command-template: Don't diff files with same content
Mads Kiilerich <mads@kiilerich.com>
parents: 8523
diff changeset
    54
cmp log.out style.out || diff -u log.out style.out
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    55
4351
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    56
echo '# revision with no copies (used to print a traceback)'
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    57
hg tip -v --template '\n'
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    58
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    59
echo '# compact style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    60
hg log --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    61
hg log -v --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    62
hg log --debug --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    63
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    64
echo '# error if style not readable'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    65
touch q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    66
chmod 0 q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    67
hg log --style ./q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    68
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    69
echo '# error if no style'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    70
hg log --style notexist
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    71
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    72
echo '# error if style missing key'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    73
echo 'q = q' > t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    74
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    75
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    76
echo '# error if include fails'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    77
echo 'changeset = q' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    78
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    79
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    80
echo '# include works'
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3463
diff changeset
    81
rm q
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    82
echo '{rev}' > q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    83
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    84
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    85
echo '# ui.style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    86
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
echo 'style = t' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
3193
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
    90
echo '# issue338'
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
    91
hg log --style=changelog > changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
    92
cat changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
    93
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    94
echo "# keys work"
5550
db6633f11d59 cmdutil: make "files" list all files, add "file_mods" for modified files
Patrick Mezard <pmezard@gmail.com>
parents: 4825
diff changeset
    95
for key in author branches date desc file_adds file_dels file_mods \
7879
5c4026a289a4 templater: ability to display diffstat for log-like commands
Alexander Solovyov <piranha at piranha.org.ua>
parents: 7682
diff changeset
    96
        files manifest node parents rev tags diffstat; do
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    97
    for mode in '' --verbose --debug; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    98
        hg log $mode --template "$key$mode: {$key}\n"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    99
    done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   100
done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   101
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   102
echo '# filters work'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   103
hg log --template '{author|domain}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   104
hg log --template '{author|person}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   105
hg log --template '{author|user}\n'
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
   106
hg log --template '{date|age}\n' > /dev/null || exit 1
7682
9c8bbae02e9c templater: fix age filter to state the obvious on future timestamps
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6723
diff changeset
   107
hg log -l1 --template '{date|age}\n' 
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   108
hg log --template '{date|date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   109
hg log --template '{date|isodate}\n'
6320
9a9b02bcbcf4 tests: update test-command-template for the new {isodatesec} filter
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 6174
diff changeset
   110
hg log --template '{date|isodatesec}\n'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   111
hg log --template '{date|rfc822date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   112
hg log --template '{desc|firstline}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   113
hg log --template '{node|short}\n'
6174
434139080ed4 Permit XML entities to be escaped in template output.
Jesse Glick <jesse.glick@sun.com>
parents: 5550
diff changeset
   114
hg log --template '<changeset author="{author|xmlescape}"/>\n'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   115
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   116
echo '# formatnode filter works'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   117
echo '#  quiet'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   118
hg -q log -r 0 --template '{node|formatnode}\n'
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   119
echo '#  normal'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   120
hg log -r 0 --template '{node|formatnode}\n'
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   121
echo '#  verbose'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   122
hg -v log -r 0 --template '{node|formatnode}\n'
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   123
echo '#  debug'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   124
hg --debug log -r 0 --template '{node|formatnode}\n'
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   125
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   126
echo '# error on syntax'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   127
echo 'x = "f' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   128
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   129
9536
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   130
cd ..
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   131
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   132
echo '# latesttag'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   133
hg init latesttag
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   134
cd latesttag
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   135
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   136
echo a > file
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   137
hg ci -Am a -d '0 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   138
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   139
echo b >> file
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   140
hg ci -m b -d '1 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   141
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   142
echo c >> head1
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   143
hg ci -Am h1c -d '2 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   144
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   145
hg update -q 1
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   146
echo d >> head2
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   147
hg ci -Am h2d -d '3 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   148
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   149
echo e >> head2
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   150
hg ci -m h2e -d '4 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   151
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   152
hg merge -q
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   153
hg ci -m merge -d '5 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   154
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   155
echo '# No tag set'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   156
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   157
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   158
echo '# one common tag: longuest path wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   159
hg tag -r 1 -m t1 -d '6 0' t1
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   160
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   161
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   162
echo '# one ancestor tag: more recent wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   163
hg tag -r 2 -m t2 -d '7 0' t2
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   164
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   165
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   166
echo '# two branch tags: more recent wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   167
hg tag -r 3 -m t3 -d '8 0' t3
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   168
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   169
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   170
echo '# merged tag overrides'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   171
hg tag -r 5 -m t5 -d '9 0' t5
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   172
hg tag -r 3 -m at3 -d '10 0' at3
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   173
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   174
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   175
echo '# done'