[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH] Python mailer hook script for Windows

From: Prucha, Brett A <Brett.Prucha.BAH_at_scrb.navy.mil>
Date: 2004-12-14 20:14:12 CET

>Please resend as a unified-context diff ("diff -u"). Contextless diffs are
unusable without specification of the *exact* version on which they are
based, and also make it far harder to review the patch in email.
>
Ok, here is the diff -u version. I do not have a SVN checkout of the code. The mailer_orig.py is based off of the 1.1.1 release source code located in the downloaded zip file at subversion-1.1.1\tools\hook-scripts\mailer\mailer.py. Hope that helps.

=========================================================================
--- mailer_orig.py Mon Aug 09 17:32:32 2004
+++ mailer.py Tue Dec 14 10:41:49 2004
@@ -20,6 +20,7 @@
 import ConfigParser
 import time
 import popen2
+import StringIO
 import cStringIO
 import smtplib
 import re
@@ -69,6 +70,9 @@
       subject = prefix + ' ' + self.subject
     else:
       subject = self.subject
+ if len(subject) > 200:
+ tmp = StringIO.StringIO(subject)
+ subject = tmp.read(197) + "..."
     hdrs = 'From: %s\n' \
            'To: %s\n' \
            'Subject: %s\n' \
@@ -94,11 +98,16 @@
   def run(self, cmd):
     # we're holding everything in memory, so we may as well read the
     # entire diff into memory and stash that into the buffer
- pipe_ob = popen2.Popen3(cmd)
- self.write(pipe_ob.fromchild.read())
-
- # wait on the child so we don't end up with a billion zombies
- pipe_ob.wait()
+ tmp = ""
+ for i in cmd:
+ if len(tmp) > 0:
+ tmp = tmp + " "
+ if re.search("[ ,\t]", i) == None:
+ tmp = tmp + i
+ else:
+ tmp = tmp + "\"" + i + "\""
+ ps = os.popen2(tmp)
+ self.write(ps[1].read())
 
   def finish(self):
     server = smtplib.SMTP(self.cfg.general.smtp_hostname)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 14 20:20:18 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.