test-keyword
396 lines
| 7.2 KiB
| text/plain
|
TextLexer
/ tests / test-keyword
Christian Ebert
|
r5816 | #!/bin/sh | ||
cat <<EOF >> $HGRCPATH | ||||
[extensions] | ||||
Christian Ebert
|
r10125 | keyword = | ||
mq = | ||||
notify = | ||||
Christian Ebert
|
r11046 | record = | ||
Christian Ebert
|
r10125 | transplant = | ||
Christian Ebert
|
r11046 | [ui] | ||
interactive = true | ||||
Christian Ebert
|
r9462 | EOF | ||
# demo before [keyword] files are set up | ||||
# would succeed without uisetup otherwise | ||||
echo % hg kwdemo | ||||
hg --quiet kwdemo \ | ||||
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \ | ||||
-e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \ | ||||
-e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \ | ||||
-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!' | ||||
hg --quiet kwdemo "Branch = {branches}" | ||||
cat <<EOF >> $HGRCPATH | ||||
Christian Ebert
|
r5816 | [keyword] | ||
Christian Ebert
|
r11044 | ** = | ||
Christian Ebert
|
r5816 | b = ignore | ||
[hooks] | ||||
commit= | ||||
commit.test=cp a hooktest | ||||
EOF | ||||
Christian Ebert
|
r6051 | hg init Test-bndl | ||
cd Test-bndl | ||||
Christian Ebert
|
r5816 | |||
echo % kwshrink should exit silently in empty/invalid repo | ||||
hg kwshrink | ||||
Patrick Mezard
|
r6061 | # Symlinks cannot be created on Windows. The bundle was made with: | ||
# | ||||
# hg init t | ||||
# cd t | ||||
# echo a > a | ||||
# ln -s a sym | ||||
# hg add sym | ||||
# hg ci -m addsym -u mercurial | ||||
# hg bundle --base null ../test-keyword.hg | ||||
# | ||||
hg pull -u "$TESTDIR/test-keyword.hg" \ | ||||
| sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/' | ||||
Christian Ebert
|
r5816 | echo 'expand $Id$' > a | ||
echo 'do not process $Id:' >> a | ||||
echo 'xxx $' >> a | ||||
echo 'ignore $Id$' > b | ||||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | |||
Christian Ebert
|
r9493 | echo % no kwfiles | ||
hg kwfiles | ||||
echo % untracked candidates | ||||
hg -v kwfiles --unknown | ||||
Christian Ebert
|
r5816 | echo % addremove | ||
hg addremove | ||||
echo % status | ||||
hg status | ||||
echo % default keyword expansion including commit hook | ||||
echo % interrupted commit should not change state or run commit hook | ||||
Thomas Arendsen Hein
|
r5855 | hg --debug commit | ||
Christian Ebert
|
r5816 | echo % status | ||
hg status | ||||
echo % commit | ||||
Martin Geisler
|
r8167 | hg --debug commit -mabsym -u 'User Name <user@example.com>' | ||
Christian Ebert
|
r5816 | echo % status | ||
hg status | ||||
echo % identify | ||||
Alexis S. L. Carvalho
|
r6157 | hg debugrebuildstate | ||
Christian Ebert
|
r5816 | hg --quiet identify | ||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo % hg cat | ||
hg cat sym a b | ||||
echo | ||||
echo % diff a hooktest | ||||
diff a hooktest | ||||
echo % removing commit hook from config | ||||
Mads Kiilerich
|
r10775 | sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook | ||
mv "$HGRCPATH".nohook "$HGRCPATH" | ||||
Christian Ebert
|
r5816 | rm hooktest | ||
Christian Ebert
|
r6051 | echo % bundle | ||
hg bundle --base null ../kw.hg | ||||
cd .. | ||||
hg init Test | ||||
cd Test | ||||
Christian Ebert
|
r6116 | echo % notify on pull to check whether keywords stay as is in email | ||
echo % ie. if patch.diff wrapper acts as it should | ||||
cat <<EOF >> $HGRCPATH | ||||
[hooks] | ||||
incoming.notify = python:hgext.notify.hook | ||||
[notify] | ||||
sources = pull | ||||
diffstat = False | ||||
[reposubs] | ||||
* = Test | ||||
EOF | ||||
Christian Ebert
|
r6051 | echo % pull from bundle | ||
Christian Ebert
|
r7116 | hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d' | ||
Christian Ebert
|
r6116 | |||
echo % remove notify config | ||||
Mads Kiilerich
|
r10775 | sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify | ||
mv "$HGRCPATH".nonotify "$HGRCPATH" | ||||
Christian Ebert
|
r6051 | |||
Christian Ebert
|
r5816 | echo % touch | ||
touch a b | ||||
echo % status | ||||
hg status | ||||
rm sym a b | ||||
echo % update | ||||
Matt Mackall
|
r8742 | hg update -C | ||
Christian Ebert
|
r5816 | echo % cat | ||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | |||
Christian Ebert
|
r5856 | echo % check whether expansion is filewise | ||
echo '$Id$' > c | ||||
echo 'tests for different changenodes' >> c | ||||
echo % commit c | ||||
hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>' | ||||
echo % force expansion | ||||
hg -v kwexpand | ||||
echo % compare changenodes in a c | ||||
cat a c | ||||
Christian Ebert
|
r5894 | |||
Christian Ebert
|
r11046 | echo % record | ||
Christian Ebert
|
r11065 | python -c \ | ||
'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);' | ||||
Christian Ebert
|
r11046 | hg record -d '1 10' -m rectest<<EOF | ||
y | ||||
y | ||||
n | ||||
EOF | ||||
echo | ||||
hg identify | ||||
hg status | ||||
echo % cat modified file | ||||
cat a | ||||
hg diff | grep -v 'b/a' | ||||
hg rollback | ||||
hg update -C | ||||
Christian Ebert
|
r10931 | echo % init --mq | ||
hg init --mq | ||||
Christian Ebert
|
r5894 | echo % qimport | ||
hg qimport -r tip -n mqtest.diff | ||||
Christian Ebert
|
r10931 | echo % commit --mq | ||
hg commit --mq -m mqtest | ||||
Christian Ebert
|
r5894 | echo % keywords should not be expanded in patch | ||
cat .hg/patches/mqtest.diff | ||||
echo % qpop | ||||
hg qpop | ||||
echo % qgoto - should imply qpush | ||||
hg qgoto mqtest.diff | ||||
echo % cat | ||||
cat c | ||||
Christian Ebert
|
r11044 | echo % hg cat | ||
hg cat c | ||||
echo % keyword should not be expanded in filelog | ||||
hg --config 'extensions.keyword=!' cat c | ||||
Christian Ebert
|
r5894 | echo % qpop and move on | ||
hg qpop | ||||
Christian Ebert
|
r5856 | |||
Christian Ebert
|
r5816 | echo % copy | ||
hg cp a c | ||||
echo % kwfiles added | ||||
hg kwfiles | ||||
echo % commit | ||||
hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>' | ||||
echo % cat a c | ||||
cat a c | ||||
Matt Mackall
|
r6328 | echo % touch copied c | ||
Christian Ebert
|
r5816 | touch c | ||
echo % status | ||||
hg status | ||||
echo % kwfiles | ||||
hg kwfiles | ||||
Christian Ebert
|
r9493 | echo % ignored files | ||
hg -v kwfiles --ignore | ||||
echo % all files | ||||
hg kwfiles --all | ||||
Christian Ebert
|
r5816 | |||
echo % diff --rev | ||||
Patrick Mezard
|
r6061 | hg diff --rev 1 | grep -v 'b/c' | ||
Christian Ebert
|
r5816 | |||
echo % rollback | ||||
hg rollback | ||||
echo % status | ||||
hg status | ||||
echo % update -C | ||||
hg update --clean | ||||
echo % custom keyword expansion | ||||
echo % try with kwdemo | ||||
hg --quiet kwdemo "Xinfo = {author}: {desc}" | ||||
cat <<EOF >>$HGRCPATH | ||||
[keywordmaps] | ||||
Id = {file} {node|short} {date|rfc822date} {author|user} | ||||
Xinfo = {author}: {desc} | ||||
EOF | ||||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo % hg cat | ||
hg cat sym a b | ||||
echo | ||||
echo '$Xinfo$' >> a | ||||
cat <<EOF >> log | ||||
firstline | ||||
secondline | ||||
EOF | ||||
echo % interrupted commit should not change state | ||||
Thomas Arendsen Hein
|
r5855 | hg commit | ||
Christian Ebert
|
r5816 | echo % status | ||
hg status | ||||
echo % commit | ||||
hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>' | ||||
rm log | ||||
echo % status | ||||
hg status | ||||
Christian Ebert
|
r6867 | echo % verify | ||
hg verify | ||||
Christian Ebert
|
r5816 | |||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo % hg cat | ||
hg cat sym a b | ||||
echo | ||||
Christian Ebert
|
r6667 | echo % annotate | ||
hg annotate a | ||||
Christian Ebert
|
r5816 | |||
echo % remove | ||||
Alexis S. L. Carvalho
|
r6157 | hg debugrebuildstate | ||
Christian Ebert
|
r5816 | hg remove a | ||
hg --debug commit -m rma | ||||
echo % status | ||||
hg status | ||||
echo % rollback | ||||
hg rollback | ||||
echo % status | ||||
hg status | ||||
echo % revert a | ||||
hg revert --no-backup --rev tip a | ||||
echo % cat a | ||||
cat a | ||||
echo % clone to test incoming | ||||
cd .. | ||||
Patrick Mezard
|
r6061 | hg clone -r1 Test Test-a | ||
Christian Ebert
|
r5816 | cd Test-a | ||
cat <<EOF >> .hg/hgrc | ||||
[paths] | ||||
default = ../Test | ||||
EOF | ||||
echo % incoming | ||||
# remove path to temp dir | ||||
hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/' | ||||
Will Maier
|
r5839 | sed -e 's/Id.*/& rejecttest/' a > a.new | ||
mv a.new a | ||||
Christian Ebert
|
r5816 | echo % commit rejecttest | ||
hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>' | ||||
echo % export | ||||
hg export -o ../rejecttest.diff tip | ||||
cd ../Test | ||||
echo % import | ||||
hg import ../rejecttest.diff | ||||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo | ||
echo % rollback | ||||
hg rollback | ||||
echo % clean update | ||||
hg update --clean | ||||
echo % kwexpand/kwshrink on selected files | ||||
mkdir x | ||||
echo % copy a x/a | ||||
hg copy a x/a | ||||
echo % kwexpand a | ||||
hg --verbose kwexpand a | ||||
echo % kwexpand x/a should abort | ||||
hg --verbose kwexpand x/a | ||||
cd x | ||||
hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>' | ||||
echo % cat a | ||||
cat a | ||||
echo % kwshrink a inside directory x | ||||
hg --verbose kwshrink a | ||||
echo % cat a | ||||
cat a | ||||
Thomas Arendsen Hein
|
r5855 | cd .. | ||
Christian Ebert
|
r5816 | |||
echo % kwexpand nonexistent | ||||
Patrick Mezard
|
r6061 | hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/' | ||
Christian Ebert
|
r5816 | |||
Christian Ebert
|
r6927 | echo % hg serve | ||
hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | ||||
cat hg.pid >> $DAEMON_PIDS | ||||
echo % expansion | ||||
echo % hgweb file | ||||
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw') | ||||
echo % no expansion | ||||
echo % hgweb annotate | ||||
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw') | ||||
echo % hgweb changeset | ||||
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw') | ||||
echo % hgweb filediff | ||||
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw') | ||||
echo % errors encountered | ||||
cat errors.log | ||||
Christian Ebert
|
r6933 | echo % merge/resolve | ||
echo '$Id$' > m | ||||
hg add m | ||||
hg commit -m 4kw | ||||
echo foo >> m | ||||
hg commit -m 5foo | ||||
echo % simplemerge | ||||
hg update 4 | ||||
echo foo >> m | ||||
hg commit -m 6foo | ||||
hg merge | ||||
hg commit -m simplemerge | ||||
cat m | ||||
echo % conflict | ||||
hg update 4 | ||||
echo bar >> m | ||||
hg commit -m 8bar | ||||
hg merge | ||||
echo % keyword stays outside conflict zone | ||||
cat m | ||||
echo % resolve to local | ||||
Matt Mackall
|
r7527 | HGMERGE=internal:local hg resolve -a | ||
Christian Ebert
|
r6933 | hg commit -m localresolve | ||
cat m | ||||
Christian Ebert
|
r10117 | echo % test restricted mode with transplant -b | ||
hg update 6 | ||||
hg branch foo | ||||
mv a a.bak | ||||
echo foobranch > a | ||||
cat a.bak >> a | ||||
rm a.bak | ||||
hg commit -m 9foobranch | ||||
hg update default | ||||
hg -y transplant -b foo tip | ||||
echo % no expansion in changeset | ||||
hg tip -p | ||||
echo % expansion in file | ||||
head -n 2 a | ||||
hg -q rollback | ||||
hg -q update -C | ||||
Christian Ebert
|
r5816 | echo % switch off expansion | ||
echo % kwshrink with unknown file u | ||||
cp a u | ||||
hg --verbose kwshrink | ||||
echo % cat | ||||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo % hg cat | ||
hg cat sym a b | ||||
echo | ||||
Mads Kiilerich
|
r10775 | rm "$HGRCPATH" | ||
Christian Ebert
|
r5816 | echo % cat | ||
Patrick Mezard
|
r6061 | cat a b | ||
Christian Ebert
|
r5816 | echo % hg cat | ||
hg cat sym a b | ||||
echo | ||||