view tests/test-mq-git @ 11330:713ae78bb583

provide pre- and post- hooks with parsed command line arguments. python hooks are passed two new keyword arguments: - opts: a dict of options; unsepcified options are set to their default - pats: a list of arguments shell hooks receive two new variables containing string representations of the above data: - $HG_OPTS - $HG_PATS for example, the opts and pats for 'hg -f v1.1' would be: {'force': True, 'message': '', 'rev': '', 'user': '', 'date': '', 'local': None, 'remove': None, 'mq': None} ['v1.1']
author Chad Dombrova <chadrik@gmail.com>
date Thu, 10 Jun 2010 09:32:19 -0700
parents 8cb81d75730c
children
line wrap: on
line source

#!/bin/sh

# Test the plumbing of mq.git option
# Automatic upgrade itself is tested elsewhere.

echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
echo "[diff]" >> $HGRCPATH
echo "nodates=1" >> $HGRCPATH

hg init repo-auto
cd repo-auto
echo '% git=auto: regular patch creation'
echo a > a
hg add a
hg qnew -d '0 0' -f adda
cat .hg/patches/adda
echo '% git=auto: git patch creation with copy'
hg cp a b
hg qnew -d '0 0' -f copy
cat .hg/patches/copy
echo '% git=auto: git patch when using --git'
echo regular > regular
hg add regular
hg qnew -d '0 0' --git -f git
cat .hg/patches/git
echo '% git=auto: regular patch after qrefresh without --git'
hg qrefresh -d '0 0'
cat .hg/patches/git
cd ..

hg init repo-keep
cd repo-keep
echo '[mq]' > .hg/hgrc
echo 'git = KEEP' >> .hg/hgrc
echo '% git=keep: git patch with --git'
echo a > a
hg add a
hg qnew -d '0 0' -f --git git
cat .hg/patches/git
echo '% git=keep: git patch after qrefresh without --git'
echo a >> a
hg qrefresh -d '0 0'
cat .hg/patches/git
cd ..

hg init repo-yes
cd repo-yes
echo '[mq]' > .hg/hgrc
echo 'git = yes' >> .hg/hgrc
echo '% git=yes: git patch'
echo a > a
hg add a
hg qnew -d '0 0' -f git
cat .hg/patches/git
echo '% git=yes: git patch after qrefresh'
echo a >> a
hg qrefresh -d '0 0'
cat .hg/patches/git
cd ..

hg init repo-no
cd repo-no
echo '[diff]' > .hg/hgrc
echo 'git = True' >> .hg/hgrc
echo '[mq]' > .hg/hgrc
echo 'git = False' >> .hg/hgrc
echo '% git=no: regular patch with copy'
echo a > a
hg add a
hg qnew -d '0 0' -f adda
hg cp a b
hg qnew -d '0 0' -f regular
cat .hg/patches/regular
echo '% git=no: regular patch after qrefresh with copy'
hg cp a c
hg qrefresh -d '0 0'
cat .hg/patches/regular
cd ..