tests/test-command-template
author Thomas Arendsen Hein <thomas@intevation.de>
Thu, 18 May 2006 21:01:38 +0200
changeset 2308 cb520d961d6a
parent 1939 d59fc0d4558f
child 3193 a6d0cd63068c
permissions -rwxr-xr-x
Use platform path for renaming file in util.atomictempfile.rename()
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'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    21
# 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
    22
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
echo 'logtemplate =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    24
echo 'style =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    25
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    26
echo '# default style is like normal output'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    27
hg log > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
hg log --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
    29
diff log.out style.out
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    30
hg log -v > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    31
hg log -v --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
    32
diff log.out style.out
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    33
hg log --debug > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    34
hg log --debug --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
    35
diff log.out style.out
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
echo '# compact style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    38
hg log --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    39
hg log -v --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    40
hg log --debug --style compact
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 '# error if style not readable'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    43
touch q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    44
chmod 0 q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    45
hg log --style ./q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    46
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    47
echo '# error if no style'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    48
hg log --style notexist
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    50
echo '# error if style missing key'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    51
echo 'q = q' > t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    52
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    53
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    54
echo '# error if include fails'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    55
echo 'changeset = q' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    56
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    57
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    58
echo '# include works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    59
rm -f q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    60
echo '{rev}' > q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    61
hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    62
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    63
echo '# ui.style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    64
echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    65
echo 'style = t' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    66
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    67
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    68
echo "# keys work"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    69
for key in author branches date desc file_adds file_dels files \
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    70
        manifest node parents rev tags; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    71
    for mode in '' --verbose --debug; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    72
        hg log $mode --template "$key$mode: {$key}\n"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    73
    done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    74
done
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 '# filters work'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    77
hg log --template '{author|domain}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    78
hg log --template '{author|person}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    79
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
    80
hg log --template '{date|age}\n' > /dev/null || exit 1
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    81
hg log --template '{date|date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    82
hg log --template '{date|isodate}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    83
hg log --template '{date|rfc822date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    84
hg log --template '{desc|firstline}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    85
hg log --template '{node|short}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    86
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
echo '# error on syntax'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
echo 'x = "f' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    90
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    91
echo '# done'