##// END OF EJS Templates
mq: qpush --move, reorder patch series and apply only the patch...
mq: qpush --move, reorder patch series and apply only the patch This makes it less necessary to edit .hg/patches/series manually.

File last commit:

r11064:590b1d6e default
r11064:590b1d6e default
Show More
test-mq
618 lines | 11.1 KiB | text/plain | TextLexer
Vadim Gelfer
mq: add basic tests
r2729 #!/bin/sh
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo()
{
if [ -f .hg/store/undo ]; then
echo ".hg/store/undo still exists after $1"
fi
}
Thomas Arendsen Hein
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc...
r2990 echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
Vadim Gelfer
mq: add basic tests
r2729
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo "[mq]" >> $HGRCPATH
echo "plain=true" >> $HGRCPATH
Vadim Gelfer
mq: add basic tests
r2729 echo % help
hg help mq
hg init a
cd a
echo a > a
Vadim Gelfer
mq: do not allow to push from repo with patches applied
r2848 hg ci -Ama
hg clone . ../k
Vadim Gelfer
mq: add basic tests
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
Alexis S. L. Carvalho
mq: qinit -c creates a repo even after a regular qinit
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
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo qnew
Alexis S. L. Carvalho
mq: qinit -c creates a repo even after a regular qinit
r4071 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 ..
Cédric Duval
mq: fix init with nonexistent or non-local repository
r10691 echo '% init --mq without repo'
mkdir f
cd f
hg init --mq
cd ..
Cédric Duval
mq: test for init --mq with a destination argument
r10710 echo '% init --mq with repo path'
hg init g
hg init --mq g
test -d g/.hg/patches/.hg && echo "ok" || echo "failed"
Cédric Duval
mq: fix init with nonexistent or non-local repository
r10691 echo '% init --mq with nonexistent directory'
hg init --mq nonexistentdir
echo '% init --mq with bundle (non "local")'
hg -R a bundle --all a.bundle >/dev/null
hg init --mq a.bundle
Vadim Gelfer
mq: add basic tests
r2729 cd a
hg qnew -m 'foo bar' test.patch
echo % qrefresh
echo a >> a
hg qrefresh
Danek Duvall
Fix some tests for portability.
r2843 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
Vadim Gelfer
mq: add basic tests
r2729 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
Alexis S. L. Carvalho
fix qrefresh'ing an empty 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
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo qrefresh
Alexis S. L. Carvalho
fix qrefresh'ing an empty patch...
r4173
Vadim Gelfer
mq: add basic tests
r2729 echo % qpop
hg qpop
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo qpop
Vadim Gelfer
mq: add basic tests
r2729
Greg Ward
tags: implement persistent tag caching (issue548)....
r9151 echo % qpush with dump of tag cache
Vadim Gelfer
mq: add basic tests
r2729
Greg Ward
tags: implement persistent tag caching (issue548)....
r9151 # Dump the tag cache to ensure that it has exactly one head after qpush.
rm -f .hg/tags.cache
hg tags > /dev/null
echo ".hg/tags.cache (pre qpush):"
sed 's/ [0-9a-f]*//' .hg/tags.cache
Vadim Gelfer
mq: add basic tests
r2729 hg qpush
Greg Ward
tags: implement persistent tag caching (issue548)....
r9151 hg tags > /dev/null
echo ".hg/tags.cache (post qpush):"
sed 's/ [0-9a-f]*//' .hg/tags.cache
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo qpush
Vadim Gelfer
mq: add basic tests
r2729
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
Dan Villiom Podlaski Christiansen
qseries: don't truncate the patch name (issue1912)...
r9874 # setting columns & interactive tests truncating (issue1912)
Vadim Gelfer
mq: add basic tests
r2729 echo % qseries
Dan Villiom Podlaski Christiansen
qseries: don't truncate the patch name (issue1912)...
r9874 COLUMNS=4 hg qseries --config ui.interactive=true
COLUMNS=20 hg qseries --config ui.interactive=true -vs
Alexis S. L. Carvalho
fix qseries -v when there are unapplied patches
r3681 hg qpop
hg qseries -vs
hg qpush
Vadim Gelfer
mq: add basic tests
r2729
echo % qapplied
hg qapplied
Matt Mackall
Backed out premature qprev/qnext removal
r9439 echo % qtop
hg qtop
Dirkjan Ochtman
mq: add options to qapplied/qunapplied to act like qprev/qnext
r9364 echo % prev
hg qapp -1
Vadim Gelfer
mq: add basic tests
r2729
Dirkjan Ochtman
mq: add options to qapplied/qunapplied to act like qprev/qnext
r9364 echo % next
hg qunapp -1
Vadim Gelfer
mq: add basic tests
r2729 hg qpop
Vadim Gelfer
mq: test commit in repo with patches applied
r2846 echo % commit should fail
hg commit
Vadim Gelfer
mq: do not allow to push from repo with patches applied
r2848 echo % push should fail
hg push ../../k
Brendan Cully
Prevent import over an applied patch (closes issue795)
r7142 echo % import should fail
hg st .
echo foo >> ../a
hg diff > ../../import.diff
hg revert --no-backup ../a
hg import ../../import.diff
hg st
Brendan Cully
Allow import --no-commit over an applied MQ patch....
r9867 echo % import --no-commit should succeed
hg import --no-commit ../../import.diff
hg st
hg revert --no-backup ../a
Brendan Cully
Prevent import over an applied patch (closes issue795)
r7142
Vadim Gelfer
mq: add basic tests
r2729 echo % qunapplied
hg qunapplied
Thomas Arendsen Hein
Added tests for qpush/qpop with index.
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
Mads Kiilerich
mq: qpush --move, reorder patch series and apply only the patch...
r11064 echo % qpush --move
hg qpop -a
hg qpush --move test2.patch # move to front
hg qpush --move test1b.patch
hg qpush --move test.patch # noop move
hg qseries -v
hg qpop -a
hg qpush --move test.patch # cleaning up
hg qpush --move test1b.patch
hg qpush --move bogus # nonexistent patch
hg qpush --move test.patch # already applied
hg qpush
Dirkjan Ochtman
mq: add options to qapplied/qunapplied to act like qprev/qnext
r9364 echo % pop, qapplied, qunapplied
hg qseries -v
echo % qapplied -1 test.patch
hg qapplied -1 test.patch
echo % qapplied -1 test1b.patch
hg qapplied -1 test1b.patch
echo % qapplied -1 test2.patch
hg qapplied -1 test2.patch
echo % qapplied -1
hg qapplied -1
echo % qapplied
hg qapplied
echo % qapplied test1b.patch
hg qapplied test1b.patch
echo % qunapplied -1
hg qunapplied -1
echo % qunapplied
hg qunapplied
echo % popping
hg qpop
echo % qunapplied -1
hg qunapplied -1
echo % qunapplied
hg qunapplied
echo % qunapplied test2.patch
hg qunapplied test2.patch
echo % qunapplied -1 test2.patch
hg qunapplied -1 test2.patch
echo % popping -a
hg qpop -a
echo % qapplied
hg qapplied
echo % qapplied -1
hg qapplied -1
hg qpush
Vadim Gelfer
mq: do not allow to push from repo with patches applied
r2848 echo % push should succeed
hg qpop -a
hg push ../../k
Alexis S. L. Carvalho
add some tests for qpush/qpop error codes
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
Vadim Gelfer
mq: add basic tests
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/*
Brendan Cully
Teach mq about git patches
r2934
Dirkjan Ochtman
mq: add --force option to strip
r6472 echo % strip with local changes, should complain
hg up
echo y>y
hg add y
hg strip tip | sed 's/\(saving bundle to \).*/\1/'
echo % --force strip with local changes
hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
Brendan Cully
Call patch.diff directly instead of printdiff - this also saves an...
r3027 echo '% cd b; hg qrefresh'
hg init refresh
cd refresh
echo a > a
Martin Geisler
tests: removed redundant "-d '0 0'" from test scripts...
r8167 hg ci -Ama
Brendan Cully
Call patch.diff directly instead of printdiff - this also saves an...
r3027 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
Brendan Cully
Test case for bdiff on buffer objects
r3334 echo % qpush failure
cd ..
hg qrefresh
hg qnew -mbar bar
echo foo > foo
Brendan Cully
mq: test case for issue399
r3464 echo bar > bar
hg add foo bar
Brendan Cully
Test case for bdiff on buffer objects
r3334 hg qrefresh
hg qpop -a
echo bar > foo
hg qpush -a
Brendan Cully
mq: test case for issue399
r3464 hg st
Brendan Cully
Test case for bdiff on buffer objects
r3334
Brendan Cully
mq: add qparent tag (first parent of qbase)
r4219 echo % mq tags
hg log --template '{rev} {tags}\n' -r qparent:qtip
Alexis S. L. Carvalho
mqrepo: don't abort if the status file has an unknown node
r5979 echo % bad node in status
hg qpop
hg strip -qn tip
hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
Dirkjan Ochtman
mq: allow qpop if popped revisions are not working dir parents
r7621 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
Alexis S. L. Carvalho
mqrepo: don't abort if the status file has an unknown node
r5979
Thomas Arendsen Hein
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc...
r2990 cat >>$HGRCPATH <<EOF
Brendan Cully
Teach mq about git patches
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
Brendan Cully
sed portability fixes
r2935 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
Brendan Cully
Teach mq about git patches
r2934
hg qnew -m'copy file' copy
hg cp new copy
hg qrefresh
Brendan Cully
sed portability fixes
r2935 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
Brendan Cully
Teach mq about git patches
r2934
hg qpop
hg qpush
hg qdiff
Alexis S. L. Carvalho
add --git option to qdiff
r3697 cat >>$HGRCPATH <<EOF
[diff]
git = False
EOF
hg qdiff --git
Patrick Mezard
test-mq: better tests delimitation
r10149 cd ..
Alexis S. L. Carvalho
qrefresh: fix handling of added files (including copies) in the slow path
r3699
Patrick Mezard
test-mq: better tests delimitation
r10149 echo % test file addition in slow path
Alexis S. L. Carvalho
qrefresh: fix handling of added files (including copies) in the slow path
r3699 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
Patrick Mezard
Make {file_copies} usable as a --template key...
r10061 hg log -v --template '{rev} {file_copies}\n' -r .
Alexis S. L. Carvalho
qrefresh: fix handling of copies in the fast path
r3700 hg qrefresh --git
cat .hg/patches/bar
Patrick Mezard
Make {file_copies} usable as a --template key...
r10061 hg log -v --template '{rev} {file_copies}\n' -r .
Bryan O'Sullivan
mq: autodetect an existing git patch during qrefresh (issue 491)
r4890 hg qrefresh
grep 'diff --git' .hg/patches/bar
Alexis S. L. Carvalho
qrefresh: fix handling of added files (including copies) in the slow path
r3699
Patrick Mezard
test-mq: better tests delimitation
r10149 echo % test file move chains in the slow path
Alexis S. L. Carvalho
qrefresh: fix handling of added files (including copies) in the slow path
r3699 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
Patrick Mezard
Make {file_copies} usable as a --template key...
r10061 hg log -v --template '{rev} {file_copies}\n' -r .
Alexis S. L. Carvalho
qrefresh: fix handling of copies in the fast path
r3700 hg mv quux fred
hg mv bleh barney
hg qrefresh --git
cat .hg/patches/bar
Patrick Mezard
Make {file_copies} usable as a --template key...
r10061 hg log -v --template '{rev} {file_copies}\n' -r .
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065
Brendan Cully
mq: fix regression in 6fd953d5faea...
r5294 echo % refresh omitting an added file
hg qnew baz
echo newfile > newfile
hg add newfile
hg qrefresh
hg st -A newfile
hg qrefresh -X newfile
hg st -A newfile
hg revert newfile
rm newfile
hg qpop
hg qdel baz
Patrick Mezard
Test qnew --git
r5026 echo % create a git patch
echo a > alexander
hg add alexander
hg qnew -f --git addalexander
Thomas Arendsen Hein
Fix bashism and remove useless use of cat.
r5027 grep diff .hg/patches/addalexander
Patrick Mezard
Test qnew --git
r5026
echo % create a git binary patch
cat > writebin.py <<EOF
import sys
path = sys.argv[1]
open(path, 'wb').write('BIN\x00ARY')
EOF
python writebin.py bucephalus
python "$TESTDIR/md5sum.py" bucephalus
hg add bucephalus
hg qnew -f --git addbucephalus
Thomas Arendsen Hein
Fix bashism and remove useless use of cat.
r5027 grep diff .hg/patches/addbucephalus
Patrick Mezard
Test qnew --git
r5026
echo % check binary patches can be popped and pushed
hg qpop
Thomas Arendsen Hein
Fix bashism and remove useless use of cat.
r5027 test -f bucephalus && echo % bucephalus should not be there
Patrick Mezard
Test qnew --git
r5026 hg qpush
test -f bucephalus || echo % bucephalus should be there
python "$TESTDIR/md5sum.py" bucephalus
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 echo '% strip again'
cd ..
hg init strip
cd strip
touch foo
hg add foo
Martin Geisler
tests: removed redundant "-d '0 0'" from test scripts...
r8167 hg ci -m 'add foo'
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 echo >> foo
Martin Geisler
tests: removed redundant "-d '0 0'" from test scripts...
r8167 hg ci -m 'change foo 1'
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 hg up -C 0
echo 1 >> foo
Martin Geisler
tests: removed redundant "-d '0 0'" from test scripts...
r8167 hg ci -m 'change foo 2'
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 HGMERGE=true hg merge
Martin Geisler
tests: removed redundant "-d '0 0'" from test scripts...
r8167 hg ci -m merge
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 hg log
hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
Alexis S. L. Carvalho
mq: really remove undo after a qpush (and after a strip)...
r5527 checkundo strip
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065 hg log
Alexis S. L. Carvalho
qclone: don't call reposetup manually
r4090 cd ..
Alexis S. L. Carvalho
fix strip'ping the second parent of a merge
r4065
Alexis S. L. Carvalho
qclone: don't call reposetup manually
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'
Brendan Cully
mq: improve qclone error handling when patch directory is not a repository.
r4862 hg qinit
Alexis S. L. Carvalho
qclone: don't call reposetup manually
r4090 hg qnew patch1
echo bar >> foo
hg qrefresh -m 'change foo'
Brendan Cully
mq: improve qclone error handling when patch directory is not a repository.
r4862 cd ..
# repo with unversioned patch dir
hg qclone qclonesource failure
cd qclonesource
hg qinit -c
Alexis S. L. Carvalho
qclone: don't call reposetup manually
r4090 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 ..
Patrick Mezard
patch: check filename is /dev/null for creation or deletion (issue 1033)...
r6280 echo % 'test applying on an empty file (issue 1033)'
hg init empty
cd empty
touch a
hg ci -Am addempty
echo a > a
hg qnew -f -e changea
hg qpop
hg qpush
cd ..
Dirkjan Ochtman
mq: don't commit local changes on pushing empty patch (issue1087)
r6554
echo % test qpush with --force, issue1087
hg init forcepush
cd forcepush
echo hello > hello.txt
echo bye > bye.txt
hg ci -Ama
hg qnew -d '0 0' empty
hg qpop
echo world >> hello.txt
echo % qpush should fail, local changes
hg qpush
echo % apply force, should not discard changes with empty patch
Mads Kiilerich
tests: fix reported patch tool name in test-mq...
r7042 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
Dirkjan Ochtman
mq: don't commit local changes on pushing empty patch (issue1087)
r6554 hg diff --config diff.nodates=True
hg qdiff --config diff.nodates=True
hg log -l1 -p
hg qref -d '0 0'
hg qpop
echo universe >> hello.txt
echo universe >> bye.txt
echo % qpush should fail, local changes
hg qpush
echo % apply force, should discard changes in hello, but not bye
hg qpush -f
hg st
hg diff --config diff.nodates=True
hg qdiff --config diff.nodates=True
Dirkjan Ochtman
mq: allow qpop if popped revisions are not working dir parents
r7621
echo % test popping revisions not in working dir ancestry
hg qseries -v
hg up qparent
hg qpop
Nicolas Dumazet
mq: qpop: remove added files before re-adding removed files...
r10048
cd ..
hg init deletion-order
cd deletion-order
touch a
hg ci -Aqm0
hg qnew rename-dir
hg rm a
hg qrefresh
mkdir a b
touch a/a b/b
hg add -q a b
hg qrefresh
echo % test popping must remove files added in subdirectories first
hg qpop
cd ..