tests/test-keyword
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 14 Feb 2008 18:08:16 -0200
changeset 6108 5086576a2152
parent 6061 de08788511d7
child 6116 e27f39865d7e
permissions -rwxr-xr-x
revert: only call dirstate.normal when we know the file is clean
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     1
#!/bin/sh
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     2
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     3
cat <<EOF >> $HGRCPATH
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     4
[extensions]
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     5
hgext.keyword =
5894
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
     6
hgext.mq =
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     7
[keyword]
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     8
* =
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     9
b = ignore
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    10
[hooks]
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    11
commit=
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    12
commit.test=cp a hooktest
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    13
EOF
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    14
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    15
echo % help
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    16
hg help keyword
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    17
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    18
echo % hg kwdemo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    19
hg --quiet kwdemo --default \
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    20
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    21
 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    22
 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    23
 -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!'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    24
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    25
hg --quiet kwdemo "Branch = {branches}"
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    26
6051
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    27
hg init Test-bndl
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    28
cd Test-bndl
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    29
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    30
echo % kwshrink should exit silently in empty/invalid repo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    31
hg kwshrink
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    32
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    33
# Symlinks cannot be created on Windows. The bundle was made with:
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    34
#
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    35
# hg init t
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    36
# cd t
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    37
# echo a > a
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    38
# ln -s a sym
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    39
# hg add sym
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    40
# hg ci -m addsym -u mercurial
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    41
# hg bundle --base null ../test-keyword.hg
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    42
#
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    43
hg pull -u "$TESTDIR/test-keyword.hg" \
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    44
    | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    45
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    46
echo 'expand $Id$' > a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    47
echo 'do not process $Id:' >> a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    48
echo 'xxx $' >> a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    49
echo 'ignore $Id$' > b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    50
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    51
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    52
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    53
echo % addremove
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    54
hg addremove
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    55
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    56
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    57
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    58
echo % default keyword expansion including commit hook
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    59
echo % interrupted commit should not change state or run commit hook
5855
a6ccb957fd07 Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5839
diff changeset
    60
hg --debug commit
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    61
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    62
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    63
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    64
echo % commit
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    65
hg --debug commit -mabsym -d '0 0' -u 'User Name <user@example.com>'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    66
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    67
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    68
echo % identify
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    69
hg --quiet identify
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    70
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
    71
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    72
echo % hg cat
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    73
hg cat sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    74
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    75
echo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    76
echo % diff a hooktest
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    77
diff a hooktest
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    78
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    79
echo % removing commit hook from config
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    80
sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    81
mv $HGRCPATH.nohook $HGRCPATH
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    82
rm hooktest
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    83
6051
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    84
echo % bundle
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    85
hg bundle --base null ../kw.hg
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    86
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    87
cd ..
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    88
hg init Test
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    89
cd Test
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    90
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    91
echo % pull from bundle
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    92
hg pull -u ../kw.hg
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
    93
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    94
echo % touch
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    95
touch a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    96
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    97
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    98
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    99
rm sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   100
echo % update
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   101
hg update
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   102
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   103
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   104
5856
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   105
echo % check whether expansion is filewise
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   106
echo '$Id$' > c
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   107
echo 'tests for different changenodes' >> c
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   108
echo % commit c
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   109
hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   110
echo % force expansion
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   111
hg -v kwexpand
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   112
echo % compare changenodes in a c
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   113
cat a c
5894
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   114
6051
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
   115
echo % qinit -c
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
   116
hg qinit -c
5894
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   117
echo % qimport
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   118
hg qimport -r tip -n mqtest.diff
6051
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
   119
echo % qcommit
1038b1458d7a keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents: 5894
diff changeset
   120
hg qcommit -mqtest
5894
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   121
echo % keywords should not be expanded in patch
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   122
cat .hg/patches/mqtest.diff
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   123
echo % qpop
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   124
hg qpop
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   125
echo % qgoto - should imply qpush
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   126
hg qgoto mqtest.diff
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   127
echo % cat
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   128
cat c
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   129
echo % qpop and move on
e181665c1c79 keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents: 5856
diff changeset
   130
hg qpop
5856
85888efbdfff keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents: 5855
diff changeset
   131
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   132
echo % copy
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   133
hg cp a c
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   134
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   135
echo % kwfiles added
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   136
hg kwfiles
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   137
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   138
echo % commit
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   139
hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   140
echo % cat a c
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   141
cat a c
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   142
echo % touch copied c after 1 second
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   143
sleep 1
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   144
touch c
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   145
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   146
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   147
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   148
echo % kwfiles
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   149
hg kwfiles
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   150
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   151
echo % diff --rev
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   152
hg diff --rev 1 | grep -v 'b/c'
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   153
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   154
echo % rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   155
hg rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   156
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   157
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   158
echo % update -C
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   159
hg update --clean
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   160
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   161
echo % custom keyword expansion
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   162
echo % try with kwdemo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   163
hg --quiet kwdemo "Xinfo = {author}: {desc}"
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   164
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   165
cat <<EOF >>$HGRCPATH
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   166
[keywordmaps]
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   167
Id = {file} {node|short} {date|rfc822date} {author|user}
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   168
Xinfo = {author}: {desc}
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   169
EOF
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   170
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   171
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   172
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   173
echo % hg cat
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   174
hg cat sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   175
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   176
echo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   177
echo '$Xinfo$' >> a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   178
cat <<EOF >> log
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   179
firstline
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   180
secondline
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   181
EOF
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   182
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   183
echo % interrupted commit should not change state
5855
a6ccb957fd07 Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5839
diff changeset
   184
hg commit
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   185
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   186
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   187
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   188
echo % commit
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   189
hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   190
rm log
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   191
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   192
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   193
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   194
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   195
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   196
echo % hg cat
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   197
hg cat sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   198
echo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   199
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   200
echo % remove
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   201
hg remove a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   202
hg --debug commit -m rma
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   203
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   204
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   205
echo % rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   206
hg rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   207
echo % status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   208
hg status
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   209
echo % revert a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   210
hg revert --no-backup --rev tip a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   211
echo % cat a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   212
cat a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   213
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   214
echo % clone to test incoming
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   215
cd ..
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   216
hg clone -r1 Test Test-a
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   217
cd Test-a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   218
cat <<EOF >> .hg/hgrc
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   219
[paths]
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   220
default = ../Test
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   221
EOF
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   222
echo % incoming
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   223
# remove path to temp dir
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   224
hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   225
5839
59fba5caa94b Don't use the -i option with sed
Will Maier <willmaier@ml1.net>
parents: 5816
diff changeset
   226
sed -e 's/Id.*/& rejecttest/' a > a.new
59fba5caa94b Don't use the -i option with sed
Will Maier <willmaier@ml1.net>
parents: 5816
diff changeset
   227
mv a.new a
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   228
echo % commit rejecttest
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   229
hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   230
echo % export
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   231
hg export -o ../rejecttest.diff tip
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   232
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   233
cd ../Test
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   234
echo % import
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   235
hg import ../rejecttest.diff
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   236
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   237
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   238
echo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   239
echo % rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   240
hg rollback
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   241
echo % clean update
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   242
hg update --clean
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   243
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   244
echo % kwexpand/kwshrink on selected files
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   245
mkdir x
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   246
echo % copy a x/a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   247
hg copy a x/a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   248
echo % kwexpand a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   249
hg --verbose kwexpand a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   250
echo % kwexpand x/a should abort
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   251
hg --verbose kwexpand x/a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   252
cd x
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   253
hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   254
echo % cat a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   255
cat a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   256
echo % kwshrink a inside directory x
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   257
hg --verbose kwshrink a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   258
echo % cat a
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   259
cat a
5855
a6ccb957fd07 Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5839
diff changeset
   260
cd ..
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   261
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   262
echo % kwexpand nonexistent
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   263
hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   264
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   265
echo % switch off expansion
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   266
echo % kwshrink with unknown file u
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   267
cp a u
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   268
hg --verbose kwshrink
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   269
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   270
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   271
echo % hg cat
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   272
hg cat sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   273
echo
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   274
rm $HGRCPATH
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   275
echo % cat
6061
de08788511d7 test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 6051
diff changeset
   276
cat a b
5816
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   277
echo % hg cat
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   278
hg cat sym a b
3bd22fd3b750 keyword: add test
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
   279
echo