tests/test-keyword
author Christian Ebert <blacktrash@gmx.net>
Wed, 18 Jul 2007 21:29:32 +0200
branchkwmap-templates
changeset 189 247159261ba5
child 202 e2a2f9ca8271
permissions -rwxr-xr-x
Add backwards compatible test-suite Without symlink testing, as older Hg versions don't handle them.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     1
#!/bin/sh
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     2
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     3
cat <<EOF >> $HGRCPATH
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     4
[extensions]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     5
hgext.keyword =
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     6
[keyword]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     7
* =
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     8
b = ignore
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     9
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    10
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    11
echo % help
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    12
hg help keyword
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    13
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    14
echo % hg kwdemo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    15
hg --quiet kwdemo --default \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    16
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    17
 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    18
 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    19
 -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    20
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    21
hg init Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    22
cd Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    23
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    24
echo % kwshrink should abort in empty/invalid repo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    25
hg kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    26
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    27
echo 'expand $Id$' > a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    28
echo 'ignore $Id$' > b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    29
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    30
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    31
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    32
echo % default keyword expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    33
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    34
hg --debug commit -A -mab -d '0 0' -u 'User Name <user@example.com>'
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    35
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    36
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    37
echo % identify
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    38
hg --quiet identify
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    39
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    40
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    41
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    42
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    43
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    44
echo % touch
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    45
touch a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    46
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    47
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    48
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    49
rm a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    50
echo % update
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    51
hg update
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    52
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    53
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    54
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    55
echo % copy
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    56
hg cp a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    57
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    58
hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    59
echo % cat a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    60
cat a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    61
echo % touch copied c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    62
touch c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    63
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    64
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    65
echo % rollback
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    66
hg rollback
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    67
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    68
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    69
echo % update -C
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    70
hg update --clean
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    71
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    72
echo % custom keyword expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    73
echo % try with kwdemo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    74
hg --quiet kwdemo "Xinfo = {author}: {desc}"
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    75
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    76
cat <<EOF >>$HGRCPATH
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    77
[keywordmaps]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    78
Id = {file} {node|short} {date|rfc822date} {author|user}
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    79
Xinfo = {author}: {desc}
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    80
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    81
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    82
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    83
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    84
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    85
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    86
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    87
echo '$Xinfo$' >> a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    88
cat <<EOF >> log
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    89
firstline
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    90
secondline
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    91
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    92
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    93
echo % interrupted commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    94
HGEDITOR=false hg commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    95
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    96
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    97
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    98
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    99
hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   100
rm log
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   101
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   102
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   103
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   104
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   105
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   106
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   107
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   108
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   109
cd ..
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   110
hg clone -r0 Test Test-a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   111
cd Test-a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   112
cat <<EOF >> .hg/hgrc
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   113
[paths]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   114
default = ../Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   115
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   116
echo % incoming
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   117
# remove path to temp dir
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   118
hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   119
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   120
echo % switch off expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   121
cd ../Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   122
echo % kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   123
hg --debug kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   124
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   125
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   126
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   127
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   128
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   129
rm $HGRCPATH
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   130
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   131
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   132
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   133
hg cat a b