view tests/test-mq @ 2901:05f357b70cb0

Tune a bit the extdiff toplevel comments/samples. * Capitalize the first letter of all sentences * Add an example for GNU diff(1) 'context diff' mode. * Explain the requirement for separate cmd.xxx and opts.xxx options in .hgrc, which hopefully will guard against users trying to add: [extdiff] # Add a new Mercurial command called `cdiff', which calls # GNU diff(1) in 'context diff' mode. cmd.cdiff = diff -Nprc5 which fails for recent crew builds with: $ hg cdiff . making snapshot of 1 files from rev 07dc4a569f4e making snapshot of 1 files from working dir diff -Nprc5: not found The correct way to do this is by separating the cmd.cdiff and opts.cdiff parts like this: [extdiff] # Add a new Mercurial command called `cdiff', which calls # GNU diff(1) in 'context diff' mode. cmd.cdiff = diff opts.cdiff = -Nprc5 so add it as a new example and explicitly describe it in the extdiff comments.
author Giorgos Keramidas <keramida@ceid.upatras.gr>
date Tue, 15 Aug 2006 18:14:58 +0300
parents 307439d6fede
children 2f190e998eb3
line wrap: on
line source

#!/bin/sh

HGRCPATH=$HGTMP/.hgrc; export HGRCPATH
echo "[extensions]" >> $HGTMP/.hgrc
echo "mq=" >> $HGTMP/.hgrc

echo % help
hg help mq

hg init a
cd a
echo a > a
hg ci -Ama

hg clone . ../k

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

cd a

echo % qnew -m

hg qnew -m 'foo bar' test.patch
cat .hg/patches/test.patch

echo % qrefresh

echo a >> a
hg qrefresh
sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
    -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch

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

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

echo % commit should fail
hg commit

echo % push should fail
hg push ../../k

echo % qunapplied
hg qunapplied

echo % push should succeed
hg qpop -a
hg push ../../k

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/*