tests/test-command-template
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed, 18 Aug 2010 23:37:26 +0200
changeset 11968 66521d25c2a6
parent 11656 83eb6b1465bf
permissions -rwxr-xr-x
mq/qqueue: update bash completion
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
10059
9dd4e2859482 test-command-template: test 'file_copies' keyword
Patrick Mezard <pmezard@gmail.com>
parents: 9961
diff changeset
    35
hg mv second fourth
7682
9c8bbae02e9c templater: fix age filter to state the obvious on future timestamps
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6723
diff changeset
    36
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
    37
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    38
# 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
    39
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    40
echo 'logtemplate =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    41
echo 'style =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    42
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    43
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
    44
echo '#  normal'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    45
hg log > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    46
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
    47
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
    48
echo '#  verbose'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
hg log -v > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    50
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
    51
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
    52
echo '#  debug'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    53
hg log --debug > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    54
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
    55
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
    56
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
    57
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
    58
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
    59
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    60
echo '# compact style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    61
hg log --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    62
hg log -v --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    63
hg log --debug --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    64
10160
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    65
# Test xml styles
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    66
echo '# xml style works (--style xml)'
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    67
hg log --style xml
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    68
echo '# xml style works (-v --style xml)'
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    69
hg log -v --style xml
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    70
echo '# xml style works (--debug --style xml)'
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    71
hg log --debug --style xml
48653dea23dd Bugfix and test for hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents: 10061
diff changeset
    72
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    73
echo '# error if style not readable'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    74
touch q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    75
chmod 0 q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    76
hg log --style ./q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    77
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    78
echo '# error if no style'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    79
hg log --style notexist
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    80
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    81
echo '# error if style missing key'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    82
echo 'q = q' > t
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 '# error if include fails'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    86
echo 'changeset = q' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
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
    90
rm q
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    91
echo '{rev}' > q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    92
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    93
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    94
echo '# ui.style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    95
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    96
echo 'style = t' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    97
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    98
3193
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
    99
echo '# issue338'
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
   100
hg log --style=changelog > changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
   101
cat changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
   102
11465
ace5bd98bee3 heads: fix templating of headers again (issue2130)
Simon Howkins <simonh@symbian.org>
parents: 10260
diff changeset
   103
echo '# issue 2130'
ace5bd98bee3 heads: fix templating of headers again (issue2130)
Simon Howkins <simonh@symbian.org>
parents: 10260
diff changeset
   104
hg heads --style changelog
ace5bd98bee3 heads: fix templating of headers again (issue2130)
Simon Howkins <simonh@symbian.org>
parents: 10260
diff changeset
   105
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   106
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
   107
for key in author branches date desc file_adds file_dels file_mods \
10061
9e2ab10728a2 Make {file_copies} usable as a --template key
Patrick Mezard <pmezard@gmail.com>
parents: 10060
diff changeset
   108
        file_copies file_copies_switch files \
10060
f780b1098efc templatekw: change {file_copies} behaviour, add {file_copies_switch}
Patrick Mezard <pmezard@gmail.com>
parents: 10059
diff changeset
   109
        manifest node parents rev tags diffstat extras; do
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   110
    for mode in '' --verbose --debug; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   111
        hg log $mode --template "$key$mode: {$key}\n"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   112
    done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   113
done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   114
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   115
echo '# filters work'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   116
hg log --template '{author|domain}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   117
hg log --template '{author|person}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   118
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
   119
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
   120
hg log -l1 --template '{date|age}\n' 
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   121
hg log --template '{date|date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   122
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
   123
hg log --template '{date|isodatesec}\n'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   124
hg log --template '{date|rfc822date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   125
hg log --template '{desc|firstline}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   126
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
   127
hg log --template '<changeset author="{author|xmlescape}"/>\n'
11656
83eb6b1465bf test-command-template: test 'children' template keyword
Jason Harris <jason@jasonfharris.com>
parents: 11465
diff changeset
   128
hg log --template '{rev}: {children}\n'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   129
4352
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   130
echo '# formatnode filter works'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4351
diff changeset
   131
echo '#  quiet'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   132
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
   133
echo '#  normal'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   134
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
   135
echo '#  verbose'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   136
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
   137
echo '#  debug'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8012
diff changeset
   138
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
   139
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   140
echo '# error on syntax'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   141
echo 'x = "f' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   142
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   143
9536
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   144
cd ..
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   145
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   146
echo '# latesttag'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   147
hg init latesttag
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   148
cd latesttag
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   149
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   150
echo a > file
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   151
hg ci -Am a -d '0 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   152
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   153
echo b >> file
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   154
hg ci -m b -d '1 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   155
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   156
echo c >> head1
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   157
hg ci -Am h1c -d '2 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   158
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   159
hg update -q 1
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   160
echo d >> head2
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   161
hg ci -Am h2d -d '3 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   162
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   163
echo e >> head2
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   164
hg ci -m h2e -d '4 0'
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
hg merge -q
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   167
hg ci -m merge -d '5 0'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   168
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   169
echo '# No tag set'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   170
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   171
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   172
echo '# one common tag: longuest path wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   173
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
   174
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   175
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   176
echo '# one ancestor tag: more recent wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   177
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
   178
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   179
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   180
echo '# two branch tags: more recent wins'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   181
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
   182
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   183
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   184
echo '# merged tag overrides'
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   185
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
   186
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
   187
hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
10249
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   188
cd ..
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   189
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   190
echo '# style path expansion (issue1948)'
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   191
mkdir -p home/styles
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   192
cat > home/styles/teststyle <<EOF
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   193
changeset = 'test {rev}:{node|short}\n'
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   194
EOF
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   195
HOME=`pwd`/home; export HOME
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   196
cat > latesttag/.hg/hgrc <<EOF
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   197
[ui]
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   198
style = ~/styles/teststyle
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   199
EOF
8ebb34b0f6f7 cmdutil: expand style paths (issue1948)
Patrick Mezard <pmezard@gmail.com>
parents: 9536
diff changeset
   200
hg -R latesttag tip
9536
f04d17912441 cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents: 9382
diff changeset
   201
10260
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   202
echo '# test recursive showlist template (issue1989)'
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   203
cat > style1989 <<EOF
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   204
changeset = '{file_mods}{manifest}{extras}'
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   205
file_mod  = 'M|{author|person}\n'
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   206
manifest = '{rev},{author}\n'
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   207
extra = '{key}: {author}\n'
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   208
EOF
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   209
hg -R latesttag log -r tip --style=style1989
fe699ca08a45 templatekw: fix extras, manifest and showlist args (issue1989)
Patrick Mezard <pmezard@gmail.com>
parents: 10250
diff changeset
   210
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   211
echo '# done'