Mercurial > hg
changeset 4094:fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 16 Feb 2007 04:54:49 -0200 |
parents | 669f99f78db0 |
children | 6fa7a2d0fc2e |
files | hgext/notify.py tests/test-notify tests/test-notify.out |
diffstat | 3 files changed, 56 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/notify.py Fri Feb 16 04:54:47 2007 -0200 +++ b/hgext/notify.py Fri Feb 16 04:54:49 2007 -0200 @@ -137,11 +137,12 @@ '''try to clean up email addresses.''' addr = templater.email(addr.strip()) - a = addr.find('@localhost') - if a != -1: - addr = addr[:a] - if '@' not in addr: - return addr + '@' + self.domain + if self.domain: + a = addr.find('@localhost') + if a != -1: + addr = addr[:a] + if '@' not in addr: + return addr + '@' + self.domain return addr def subscribers(self):
--- a/tests/test-notify Fri Feb 16 04:54:47 2007 -0200 +++ b/tests/test-notify Fri Feb 16 04:54:49 2007 -0200 @@ -8,18 +8,14 @@ incoming.notify = python:hgext.notify.hook [notify] -config = $HGTMP/.notify.conf sources = pull -domain = test.com -strip = 3 -template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} diffstat = False -[web] -baseurl = http://test/ - [usersubs] foo@bar = * + +[reposubs] +* = baz EOF hg help notify @@ -35,6 +31,24 @@ echo % commit hg --traceback --cwd a commit -Amb -d '1 0' +echo '% pull (minimal config)' +hg --traceback --cwd b pull ../a 2>&1 | 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/' + +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 % 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/' +
--- a/tests/test-notify.out Fri Feb 16 04:54:47 2007 -0200 +++ b/tests/test-notify.out Fri Feb 16 04:54:49 2007 -0200 @@ -6,7 +6,35 @@ % clone 1 files updated, 0 files merged, 0 files removed, 0 files unresolved % commit +% pull (minimal config) +pulling from ../a +searching for changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +Subject: changeset in test-notify/b: b +From: test +X-Hg-Notification: changeset 0647d048b600 +Message-Id: +To: baz, foo@bar + +changeset 0647d048b600 in test-notify/b +details: test-notify/b?cmd=changeset;node=0647d048b600 +description: + b + +diffs (6 lines): + +diff -r cb9a9f314b8b -r 0647d048b600 a +--- a/a Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:01 1970 +0000 +@@ -1,1 +1,2 @@ a + a ++a +(run 'hg update' to get a working copy) % pull +rolling back last transaction pulling from ../a searching for changes adding changesets @@ -17,7 +45,7 @@ From: test@test.com X-Hg-Notification: changeset 0647d048b600 Message-Id: -To: foo@bar +To: baz@test.com, foo@bar changeset 0647d048b600 description: