# HG changeset patch # User Dennis Schoen # Date 2008-09-18 11:55:58 # Node ID b714aac1f7b39ce79122c57fac2c2e8e20b3ec22 # Parent 0ada66dcc25963a1f13f7b4fd51dacb479ed4a96 tests: add test for notify extension as changegroup hook diff --git a/tests/test-notify-changegroup b/tests/test-notify-changegroup new file mode 100755 --- /dev/null +++ b/tests/test-notify-changegroup @@ -0,0 +1,43 @@ +#!/bin/sh + +cat <> $HGRCPATH +[extensions] +notify= + +[hooks] +changegroup.notify = python:hgext.notify.hook + +[notify] +sources = push +diffstat = False +maxsubject = 200 + +[usersubs] +foo@bar = * + +[reposubs] +* = baz +EOF + +hg init a + +echo % clone +hg --traceback clone a b + +echo a > b/a +echo % commit +hg --traceback --cwd b commit -Ama + +echo a >> b/a +echo % commit +hg --traceback --cwd b commit -Amb + +echo % push +hg --traceback --cwd b push ../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/^Subject: .*test-notify/Subject: test-notify/' \ + -e 's/^details: .*test-notify/details: test-notify/' \ + -e 's/^Date:.*/Date:/' + diff --git a/tests/test-notify-changegroup.out b/tests/test-notify-changegroup.out new file mode 100644 --- /dev/null +++ b/tests/test-notify-changegroup.out @@ -0,0 +1,36 @@ +% clone +updating working directory +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +% commit +adding a +% commit +% push +pushing to ../a +searching for changes +adding changesets +adding manifests +adding file changes +added 2 changesets with 2 changes to 1 files +Date: +Subject: test-notify-changegroup/a: 2 new changesets +From: test +X-Hg-Notification: changeset cb9a9f314b8b +Message-Id: +To: baz, foo@bar + +changeset cb9a9f314b8b in test-notify-changegroup/a +details: test-notify-changegroup/a?cmd=changeset;node=cb9a9f314b8b +summary: a + +changeset ba677d0156c1 in test-notify-changegroup/a +details: test-notify-changegroup/a?cmd=changeset;node=ba677d0156c1 +summary: b + +diffs (6 lines): + +diff -r 000000000000 -r ba677d0156c1 a +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:00 1970 +0000 +@@ -0,0 +1,2 @@ ++a ++a