[cvsspam-devel] patch for incorrect handling of Binary adds (SVN)

Renaud Bruyeron bruyeron at fullsix.com
Wed Aug 9 18:43:15 UTC 2006


Hi there,

The following patch against 
http://svn.badgers-in-foil.co.uk/cvsspam/branches/svn_support
 corrects an issue in svnspam when the revision contains new binary files.

best regards,

 - Renaud

Index: svn_post_commit_hook.rb
===================================================================
--- svn_post_commit_hook.rb     (revision 249)
+++ svn_post_commit_hook.rb     (working copy)
@@ -195,7 +195,24 @@

 def read_added_diff(out, lines, path)
   lines.assert_next(/^=+$/)
-  m = lines.assert_next(/^---.*\(rev (\d+)\)$/)
+  lines.assert_next
+  if lines.current =~ /\(Binary files differ\)/
+    process_added_binary_diff(out, lines, path)
+  else
+    process_added_text_diff(out, lines, path)
+  end
+end
+
+def process_added_binary_diff(out, lines, path)
+  next_rev= $revision
+  out.puts "#V NONE,#{next_rev}"
+  out.puts "#A #{$shortrepo}/#{path}"
+  out.puts "#U diff x x"
+  out.puts "#U Binary file x added"
+end
+
+def process_added_text_diff(out, lines, path)
+  m = lines.assert_current(/^---.*\(rev (\d+)\)$/)
   prev_rev = m[1].to_i
   diff1 = lines.current
   m = lines.assert_next(/^\+\+\+.*\(rev (\d+)\)$/)




More information about the cvsspam-devel mailing list