Author: gstein
Date: Sat Dec 16 23:29:33 2023
New Revision: 1914729

URL: http://svn.apache.org/viewvc?rev=1914729&view=rev
Log:
Fix PropChange.generate

* tools/hook-scripts/mailer/mailer.py
  (OutputBase.run): remove, because below was the only usage.
  (PropChange.generate):
    use generate_diff() to render propchange diff instead of
    OutputBase.run()

Patch by: Yasuhito FUTATSUKI <[email protected]>

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1914729&r1=1914728&r2=1914729&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Sat Dec 16 23:29:33 
2023
@@ -211,22 +211,6 @@ class OutputBase:
     representation."""
     raise NotImplementedError
 
-  def run(self, cmd):
-    """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
-    pipe_ob = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                               stderr=subprocess.STDOUT,
-                               close_fds=sys.platform != "win32")
-
-    buf = pipe_ob.stdout.read(self._CHUNKSIZE)
-    while buf:
-      self.write_binary(buf)
-      buf = pipe_ob.stdout.read(self._CHUNKSIZE)
-
-    # wait on the child so we don't end up with a billion zombies
-    pipe_ob.wait()
-
 
 class MailedOutput(OutputBase):
 
@@ -598,12 +582,13 @@ class PropChange(Messenger):
           tempfile2 = tempfile.NamedTemporaryFile()
           tempfile2.write(self.repos.get_rev_prop(self.propname, scratch_pool))
           tempfile2.flush()
-          output.run(self.cfg.get_diff_cmd(group, {
-            'label_from' : 'old property value',
-            'label_to' : 'new property value',
-            'from' : tempfile1.name,
-            'to' : tempfile2.name,
-            }))
+          for diffs in generate_diff(self.cfg.get_diff_cmd(group, {
+              'label_from' : 'old property value',
+              'label_to' : 'new property value',
+              'from' : tempfile1.name,
+              'to' : tempfile2.name,
+              })):
+              writer.write(to_str(diffs.raw))
         output.finish()
       except MessageSendFailure:
         ret = 1


Reply via email to