tests/test-keyword
author Christian Ebert <blacktrash@gmx.net>
Thu, 09 Aug 2007 15:54:27 +0200
changeset 223 65a01675a944
parent 218 d7ddb4e378f3
child 224 fd98a9bffcbe
permissions -rwxr-xr-x
Test that pattern does not span more than 1 line
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
218
d7ddb4e378f3 test: use grep -v instead of sed to delete lines
Christian Ebert <blacktrash@gmx.net>
parents: 215
diff changeset
    12
# grep for backwards compatibility
202
e2a2f9ca8271 Make test more adaptive to different Hg versions
Christian Ebert <blacktrash@gmx.net>
parents: 189
diff changeset
    13
hg help keyword \
218
d7ddb4e378f3 test: use grep -v instead of sed to delete lines
Christian Ebert <blacktrash@gmx.net>
parents: 215
diff changeset
    14
| grep -E -v '^list of commands|hg -v help keyword|^$'
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    15
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    16
echo % hg kwdemo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    17
hg --quiet kwdemo --default \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    18
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    19
 -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
    20
 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    21
 -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
    22
210
304f9ac35869 kwdemo fixes and tweaks
Christian Ebert <blacktrash@gmx.net>
parents: 209
diff changeset
    23
hg --quiet kwdemo "Branch = {branches}"
304f9ac35869 kwdemo fixes and tweaks
Christian Ebert <blacktrash@gmx.net>
parents: 209
diff changeset
    24
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    25
hg init Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    26
cd Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    27
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    28
echo % kwshrink should abort in empty/invalid repo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    29
hg kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    30
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    31
echo 'expand $Id$' > a
223
65a01675a944 Test that pattern does not span more than 1 line
Christian Ebert <blacktrash@gmx.net>
parents: 218
diff changeset
    32
echo 'do not process $Id:' >> a
65a01675a944 Test that pattern does not span more than 1 line
Christian Ebert <blacktrash@gmx.net>
parents: 218
diff changeset
    33
echo 'xxx $' >> a
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    34
echo 'ignore $Id$' > b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    35
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    36
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    37
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    38
echo % default keyword expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    39
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    40
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
    41
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    42
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    43
echo % identify
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    44
hg --quiet identify
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    45
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    46
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    47
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    48
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    49
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    50
echo % touch
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    51
touch a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    52
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    53
hg status
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
rm a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    56
echo % update
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    57
hg update
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    58
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    59
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    60
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    61
echo % copy
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    62
hg cp a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    63
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    64
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
    65
echo % cat a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    66
cat a c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    67
echo % touch copied c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    68
touch c
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    69
echo % status
214
b2e63ec251a9 Add forgotten status for touch copy test
Christian Ebert <blacktrash@gmx.net>
parents: 210
diff changeset
    70
hg status
189
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 % rollback
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    73
hg rollback
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    74
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    75
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    76
echo % update -C
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    77
hg update --clean
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    78
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    79
echo % custom keyword expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    80
echo % try with kwdemo
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    81
hg --quiet kwdemo "Xinfo = {author}: {desc}"
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    82
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    83
cat <<EOF >>$HGRCPATH
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    84
[keywordmaps]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    85
Id = {file} {node|short} {date|rfc822date} {author|user}
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    86
Xinfo = {author}: {desc}
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    87
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    88
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    89
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    90
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    91
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    92
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    93
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    94
echo '$Xinfo$' >> a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    95
cat <<EOF >> log
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    96
firstline
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    97
secondline
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    98
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    99
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   100
echo % interrupted commit
218
d7ddb4e378f3 test: use grep -v instead of sed to delete lines
Christian Ebert <blacktrash@gmx.net>
parents: 215
diff changeset
   101
# redirection and grep for backwards compatibility
d7ddb4e378f3 test: use grep -v instead of sed to delete lines
Christian Ebert <blacktrash@gmx.net>
parents: 215
diff changeset
   102
HGEDITOR=false hg commit 2>&1 | grep -F -v 'edit failed:'
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   103
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   104
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   105
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   106
echo % commit
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   107
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
   108
rm log
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   109
echo % status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   110
hg status
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   111
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   112
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   113
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   114
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   115
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   116
215
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   117
echo % remove
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   118
hg remove a
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   119
hg --debug commit -m rma
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   120
echo % status
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   121
hg status
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   122
echo % rollback
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   123
hg rollback
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   124
echo % status
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   125
hg status
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   126
echo % revert a
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   127
hg revert --no-backup --rev tip a
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   128
echo % cat a
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   129
cat a
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   130
ff719fcc10a3 Test remove
Christian Ebert <blacktrash@gmx.net>
parents: 214
diff changeset
   131
echo % clone to test incoming
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   132
cd ..
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   133
hg clone -r0 Test Test-a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   134
cd Test-a
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   135
cat <<EOF >> .hg/hgrc
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   136
[paths]
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   137
default = ../Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   138
EOF
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   139
echo % incoming
209
430837dbe7f4 Adapt to recent changes in Hg (locks handling, dirstate.update gone)
Christian Ebert <blacktrash@gmx.net>
parents: 208
diff changeset
   140
# remove path to temp dir for backwards compatibility
218
d7ddb4e378f3 test: use grep -v instead of sed to delete lines
Christian Ebert <blacktrash@gmx.net>
parents: 215
diff changeset
   141
hg incoming | grep -v '^comparing with'
189
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   142
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   143
echo % switch off expansion
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   144
cd ../Test
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   145
echo % kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   146
hg --debug kwshrink
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   147
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   148
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   149
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   150
hg cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   151
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   152
rm $HGRCPATH
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   153
echo % cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   154
cat a b
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   155
echo % hg cat
247159261ba5 Add backwards compatible test-suite
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   156
hg cat a b