view tests/test-notify @ 6375:cdc458b12f0f

update: better logic and messages for updates - complain about attempts to merge with ancestor - when updating, differentiate between - crossing named branches with no local changes (jump) - crossing named branches with local changes (complain) - nonlinear update on the same named branch, no changes (complain some more) - nonlinear update on the same named branch, changes (different complaining)
author Matt Mackall <mpm@selenic.com>
date Mon, 24 Mar 2008 10:01:05 -0500
parents 25e74cd3f023
children 31837416ef4d
line wrap: on
line source

#!/bin/sh

cat <<EOF >> $HGRCPATH
[extensions]
notify=

[hooks]
incoming.notify = python:hgext.notify.hook

[notify]
sources = pull
diffstat = False

[usersubs]
foo@bar = *

[reposubs]
* = baz
EOF

hg help notify
hg init a
echo a > a/a
echo % commit
hg --traceback --cwd a commit -Ama -d '0 0'

echo % clone
hg --traceback clone a b

echo a >> a/a
echo % commit
hg --traceback --cwd a commit -Amb -d '1 0'

# on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
cat <<EOF >> $HGRCPATH
[notify]
maxsubject = 200
EOF

# the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
# of the very long subject line
echo '% pull (minimal config)'
hg --traceback --cwd b pull ../a 2>&1 |
  python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' |
  sed -e 's/\(Message-Id:\).*/\1/' \
  -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \
  -e 's/^details: .*test-notify/details: test-notify/' \
  -e 's/^Date:.*/Date:/'

cat <<EOF >> $HGRCPATH
[notify]
config = $HGTMP/.notify.conf
domain = test.com
strip = 3
template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}

[web]
baseurl = http://test/
EOF

echo % fail for config file is missing
hg --cwd b rollback
hg --cwd b pull ../a 2>&1 | grep 'unable to open.*\.notify\.conf' > /dev/null && echo pull failed

touch "$HGTMP/.notify.conf"

echo % pull
hg --cwd b rollback
hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
  -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
  -e 's/^Date:.*/Date:/'