tests: add test for notify extension as changegroup hook
authorDennis Schoen <ds@1d10t.de>
Thu, 18 Sep 2008 13:55:58 +0200
changeset 7043 b714aac1f7b3
parent 7042 0ada66dcc259
child 7044 e51c0f41f271
tests: add test for notify extension as changegroup hook
tests/test-notify-changegroup
tests/test-notify-changegroup.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-notify-changegroup	Thu Sep 18 13:55:58 2008 +0200
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+cat <<EOF >> $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:/'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-notify-changegroup.out	Thu Sep 18 13:55:58 2008 +0200
@@ -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