This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 82f119d0 Link to CI revision; detect excess changes; show trigger 
revision
82f119d0 is described below

commit 82f119d0304158d06833c8375c14470ef4da82eb
Author: Sebb <[email protected]>
AuthorDate: Wed Mar 6 17:38:12 2024 +0000

    Link to CI revision; detect excess changes; show trigger revision
---
 tools/pubsub-ci-email.rb | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tools/pubsub-ci-email.rb b/tools/pubsub-ci-email.rb
index 6026f4d2..35a9cd73 100755
--- a/tools/pubsub-ci-email.rb
+++ b/tools/pubsub-ci-email.rb
@@ -108,7 +108,8 @@ 
SOURCE_URL='https://svn.apache.org/repos/private/committers/board/committee-info
 
 # last seen revision of committee-info.txt
 PREVIOUS_REVISION = '/srv/svn/committee-info_last_revision.txt'
-
+# Try to guard against flooding mailing lists
+MAX_COMMITS = 10 # Max commits allowed since previous revision
 TYPES = {
   'Added' => 'added to',
   'Dropped' => 'dropped from'
@@ -128,8 +129,8 @@ def parse_content(content)
   }.to_h
 end
 
-# Compare files. parameters are hashes.
-def do_diff(initialhash, currenthash)
+# Compare files. parameters are hashes {:revision, :author, :date}
+def do_diff(initialhash, currenthash, triggerrev)
   initialrev = initialhash[:revision]
   # initialcommitter = initialhash[:author]
   # initialdate = initialhash[:date] 
@@ -172,12 +173,12 @@ def do_diff(initialhash, currenthash)
        #{commit_msg}
 
     Links for convenience:
-    https://svn.apache.org/repos/private/committers/board/committee-info.txt
+    
https://svn.apache.org/repos/private/committers/board/committee-info.txt?p=#{currentrev}
     https://lists.apache.org/list?#{mail_list}
     https://whimsy.apache.org/roster/committee/#{cttee.name}
 
     This is an automated email generated by Whimsy (#{File.basename(__FILE__)})
-    Revisions compared: #{initialrev} => #{currentrev}
+    Revisions compared: #{initialrev} => #{currentrev}. Trigger: #{triggerrev}
 
     EOD
     mail = Mail.new do
@@ -201,10 +202,12 @@ def handle_change(revision)
     # get list of commmits from initial to current.
     # @return array of entries, each of which is an array of [commitid, 
committer, datestamp]
     out,_ = ASF::SVN.svn_commits!(SOURCE_URL, previous_revision, revision)
-    puts stamp "Number of commits found since then: #{out.size - 1}"
+    commits = out.size - 1
+    puts stamp "Number of commits found since then: #{commits}"
+    raise ArgumentError.new "More than #{MAX_COMMITS} commits detected since 
#{previous_revision} - this looks wrong" if commits > MAX_COMMITS
     # Get pairs of entries and calculate differences
     out.each_cons(2) do |before, after|
-      do_diff(before, after)
+      do_diff(before, after, revision)
       File.write(PREVIOUS_REVISION, after[:revision]) # done that one
     end
   rescue StandardError => e

Reply via email to