test-mq
391 lines
| 6.3 KiB
| text/plain
|
TextLexer
/ tests / test-mq
|
r2729 | #!/bin/sh | ||
|
r2990 | echo "[extensions]" >> $HGRCPATH | ||
echo "mq=" >> $HGRCPATH | ||||
|
r2729 | |||
echo % help | ||||
hg help mq | ||||
hg init a | ||||
cd a | ||||
echo a > a | ||||
|
r2848 | hg ci -Ama | ||
hg clone . ../k | ||||
|
r2729 | mkdir b | ||
echo z > b/z | ||||
hg ci -Ama | ||||
echo % qinit | ||||
hg qinit | ||||
cd .. | ||||
hg init b | ||||
echo % -R qinit | ||||
hg -R b qinit | ||||
hg init c | ||||
echo % qinit -c | ||||
hg --cwd c qinit -c | ||||
hg -R c/.hg/patches st | ||||
echo % qnew implies add | ||||
hg -R c qnew test.patch | ||||
hg -R c/.hg/patches st | ||||
|
r4071 | echo '% qinit; qinit -c' | ||
hg init d | ||||
cd d | ||||
hg qinit | ||||
hg qinit -c | ||||
# qinit -c should create both files if they don't exist | ||||
echo ' .hgignore:' | ||||
cat .hg/patches/.hgignore | ||||
echo ' series:' | ||||
cat .hg/patches/series | ||||
hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/' | ||||
cd .. | ||||
echo '% qinit; <stuff>; qinit -c' | ||||
hg init e | ||||
cd e | ||||
hg qnew A | ||||
echo foo > foo | ||||
hg add foo | ||||
hg qrefresh | ||||
hg qnew B | ||||
echo >> foo | ||||
hg qrefresh | ||||
echo status >> .hg/patches/.hgignore | ||||
echo bleh >> .hg/patches/.hgignore | ||||
hg qinit -c | ||||
hg -R .hg/patches status | ||||
# qinit -c shouldn't touch these files if they already exist | ||||
echo ' .hgignore:' | ||||
cat .hg/patches/.hgignore | ||||
echo ' series:' | ||||
cat .hg/patches/series | ||||
cd .. | ||||
|
r2729 | cd a | ||
echo % qnew -m | ||||
hg qnew -m 'foo bar' test.patch | ||||
cat .hg/patches/test.patch | ||||
echo % qrefresh | ||||
echo a >> a | ||||
hg qrefresh | ||||
|
r2843 | sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \ | ||
|
r2729 | -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch | ||||
|
r4173 | echo % empty qrefresh | ||
hg qrefresh -X a | ||||
echo 'revision:' | ||||
hg diff -r -2 -r -1 | ||||
echo 'patch:' | ||||
cat .hg/patches/test.patch | ||||
echo 'working dir diff:' | ||||
hg diff --nodates -q | ||||
# restore things | ||||
hg qrefresh | ||||
|
r2729 | echo % qpop | ||
hg qpop | ||||
echo % qpush | ||||
hg qpush | ||||
cd .. | ||||
echo % pop/push outside repo | ||||
hg -R a qpop | ||||
hg -R a qpush | ||||
cd a | ||||
hg qnew test2.patch | ||||
echo % qrefresh in subdir | ||||
cd b | ||||
echo a > a | ||||
hg add a | ||||
hg qrefresh | ||||
echo % pop/push -a in subdir | ||||
hg qpop -a | ||||
hg --traceback qpush -a | ||||
echo % qseries | ||||
hg qseries | ||||
|
r3681 | hg qpop | ||
hg qseries -vs | ||||
hg qpush | ||||
|
r2729 | |||
echo % qapplied | ||||
hg qapplied | ||||
echo % qtop | ||||
hg qtop | ||||
echo % qprev | ||||
hg qprev | ||||
echo % qnext | ||||
hg qnext | ||||
echo % pop, qnext, qprev, qapplied | ||||
hg qpop | ||||
hg qnext | ||||
hg qprev | ||||
hg qapplied | ||||
|
r2846 | echo % commit should fail | ||
hg commit | ||||
|
r2848 | echo % push should fail | ||
hg push ../../k | ||||
|
r2729 | echo % qunapplied | ||
hg qunapplied | ||||
|
r3081 | echo % qpush/qpop with index | ||
hg qnew test1b.patch | ||||
echo 1b > 1b | ||||
hg add 1b | ||||
hg qrefresh | ||||
hg qpush 2 | ||||
hg qpop 0 | ||||
hg qpush test.patch+1 | ||||
hg qpush test.patch+2 | ||||
hg qpop test2.patch-1 | ||||
hg qpop test2.patch-2 | ||||
hg qpush test1b.patch+1 | ||||
|
r2848 | echo % push should succeed | ||
hg qpop -a | ||||
hg push ../../k | ||||
|
r4101 | echo % qpush/qpop error codes | ||
errorcode() | ||||
{ | ||||
hg "$@" && echo " $@ succeeds" || echo " $@ fails" | ||||
} | ||||
# we want to start with some patches applied | ||||
hg qpush -a | ||||
echo " % pops all patches and succeeds" | ||||
errorcode qpop -a | ||||
echo " % does nothing and succeeds" | ||||
errorcode qpop -a | ||||
echo " % fails - nothing else to pop" | ||||
errorcode qpop | ||||
echo " % pushes a patch and succeeds" | ||||
errorcode qpush | ||||
echo " % pops a patch and succeeds" | ||||
errorcode qpop | ||||
echo " % pushes up to test1b.patch and succeeds" | ||||
errorcode qpush test1b.patch | ||||
echo " % does nothing and succeeds" | ||||
errorcode qpush test1b.patch | ||||
echo " % does nothing and succeeds" | ||||
errorcode qpop test1b.patch | ||||
echo " % fails - can't push to this patch" | ||||
errorcode qpush test.patch | ||||
echo " % fails - can't pop to this patch" | ||||
errorcode qpop test2.patch | ||||
echo " % pops up to test.patch and succeeds" | ||||
errorcode qpop test.patch | ||||
echo " % pushes all patches and succeeds" | ||||
errorcode qpush -a | ||||
echo " % does nothing and succeeds" | ||||
errorcode qpush -a | ||||
echo " % fails - nothing else to push" | ||||
errorcode qpush | ||||
echo " % does nothing and succeeds" | ||||
errorcode qpush test2.patch | ||||
|
r2729 | echo % strip | ||
cd ../../b | ||||
echo x>x | ||||
hg ci -Ama | ||||
hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' | ||||
hg unbundle .hg/strip-backup/* | ||||
|
r2934 | |||
|
r3027 | echo '% cd b; hg qrefresh' | ||
hg init refresh | ||||
cd refresh | ||||
echo a > a | ||||
hg ci -Ama -d'0 0' | ||||
hg qnew -mfoo foo | ||||
echo a >> a | ||||
hg qrefresh | ||||
mkdir b | ||||
cd b | ||||
echo f > f | ||||
hg add f | ||||
hg qrefresh | ||||
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo | ||||
echo % hg qrefresh . | ||||
hg qrefresh . | ||||
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo | ||||
hg status | ||||
|
r3334 | echo % qpush failure | ||
cd .. | ||||
hg qrefresh | ||||
hg qnew -mbar bar | ||||
echo foo > foo | ||||
|
r3464 | echo bar > bar | ||
hg add foo bar | ||||
|
r3334 | hg qrefresh | ||
hg qpop -a | ||||
echo bar > foo | ||||
hg qpush -a | ||||
|
r3464 | hg st | ||
|
r3334 | |||
|
r2990 | cat >>$HGRCPATH <<EOF | ||
|
r2934 | [diff] | ||
git = True | ||||
EOF | ||||
cd .. | ||||
hg init git | ||||
cd git | ||||
hg qinit | ||||
hg qnew -m'new file' new | ||||
echo foo > new | ||||
chmod +x new | ||||
hg add new | ||||
hg qrefresh | ||||
|
r2935 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new | ||||
|
r2934 | |||
hg qnew -m'copy file' copy | ||||
hg cp new copy | ||||
hg qrefresh | ||||
|
r2935 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy | ||||
|
r2934 | |||
hg qpop | ||||
hg qpush | ||||
hg qdiff | ||||
|
r3697 | cat >>$HGRCPATH <<EOF | ||
[diff] | ||||
git = False | ||||
EOF | ||||
hg qdiff --git | ||||
|
r3699 | |||
cd .. | ||||
hg init slow | ||||
cd slow | ||||
hg qinit | ||||
echo foo > foo | ||||
hg add foo | ||||
hg ci -m 'add foo' | ||||
hg qnew bar | ||||
echo bar > bar | ||||
hg add bar | ||||
hg mv foo baz | ||||
hg qrefresh --git | ||||
hg up -C 0 | ||||
echo >> foo | ||||
hg ci -m 'change foo' | ||||
hg up -C 1 | ||||
hg qrefresh --git 2>&1 | grep -v 'saving bundle' | ||||
cat .hg/patches/bar | ||||
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . | ||||
|
r3700 | hg qrefresh --git | ||
cat .hg/patches/bar | ||||
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . | ||||
|
r3699 | |||
echo | ||||
hg up -C 1 | ||||
echo >> foo | ||||
hg ci -m 'change foo again' | ||||
hg up -C 2 | ||||
hg mv bar quux | ||||
hg mv baz bleh | ||||
hg qrefresh --git 2>&1 | grep -v 'saving bundle' | ||||
cat .hg/patches/bar | ||||
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . | ||||
|
r3700 | hg mv quux fred | ||
hg mv bleh barney | ||||
hg qrefresh --git | ||||
cat .hg/patches/bar | ||||
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . | ||||
|
r4065 | |||
echo '% strip again' | ||||
cd .. | ||||
hg init strip | ||||
cd strip | ||||
touch foo | ||||
hg add foo | ||||
hg ci -m 'add foo' -d '0 0' | ||||
echo >> foo | ||||
hg ci -m 'change foo 1' -d '0 0' | ||||
hg up -C 0 | ||||
echo 1 >> foo | ||||
hg ci -m 'change foo 2' -d '0 0' | ||||
HGMERGE=true hg merge | ||||
hg ci -m merge -d '0 0' | ||||
hg log | ||||
hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' | ||||
hg log | ||||
|
r4090 | cd .. | ||
|
r4065 | |||
|
r4090 | echo '% qclone' | ||
qlog() | ||||
{ | ||||
echo 'main repo:' | ||||
hg log --template ' rev {rev}: {desc}\n' | ||||
echo 'patch repo:' | ||||
hg -R .hg/patches log --template ' rev {rev}: {desc}\n' | ||||
} | ||||
hg init qclonesource | ||||
cd qclonesource | ||||
echo foo > foo | ||||
hg add foo | ||||
hg ci -m 'add foo' | ||||
hg qinit -c | ||||
hg qnew patch1 | ||||
echo bar >> foo | ||||
hg qrefresh -m 'change foo' | ||||
hg qci -m checkpoint | ||||
qlog | ||||
cd .. | ||||
# repo with patches applied | ||||
hg qclone qclonesource qclonedest | ||||
cd qclonedest | ||||
qlog | ||||
cd .. | ||||
# repo with patches unapplied | ||||
cd qclonesource | ||||
hg qpop -a | ||||
qlog | ||||
cd .. | ||||
hg qclone qclonesource qclonedest2 | ||||
cd qclonedest2 | ||||
qlog | ||||
cd .. | ||||