--- mailer.py Mon Aug 07 14:47:48 2006 +++ ../mailer.py Thu Aug 17 14:38:58 2006 @@ -167,10 +167,11 @@ """Override this method, if the default implementation is not sufficient. Execute CMD, writing the stdout produced to the output representation.""" # By default we choose to incorporate child stderr into the output + os.system(svn.core.argv_to_command_string(cmd)) pipe_ob = Popen4(cmd) buf = pipe_ob.fromchild.read(self._CHUNKSIZE) - while buf: + while len(buf) > 0: self.write(buf) buf = pipe_ob.fromchild.read(self._CHUNKSIZE) @@ -373,15 +374,23 @@ try: + # NamedTemporaryFile on windows does not allow diff to reopen temp files + # http://www.thescripts.com/forum/thread439775.html + if sys.platform == 'win32': + raise ImportError, 'NamedTemporaryFile is useless on win32' + from tempfile import NamedTemporaryFile + class MailerTemporaryFile(NamedTemporaryFile): + pass except ImportError: # NamedTemporaryFile was added in Python 2.3, so we need to emulate it # for older Pythons. - class NamedTemporaryFile: + class MailerTemporaryFile: def __init__(self): self.name = tempfile.mktemp() self.file = open(self.name, 'w+b') def __del__(self): + self.file.close() os.remove(self.name) def write(self, data): self.file.write(data) @@ -424,10 +433,10 @@ self.output.write(propvalue) elif self.action == 'M': self.output.write('Property diff:\n') - tempfile1 = NamedTemporaryFile() + tempfile1 = MailerTemporaryFile() tempfile1.write(sys.stdin.read()) tempfile1.flush() - tempfile2 = NamedTemporaryFile() + tempfile2 = MailerTemporaryFile() tempfile2.write(self.repos.get_rev_prop(self.propname)) tempfile2.flush() self.output.run(self.cfg.get_diff_cmd(group, {