whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-217 - fix icla caching
Date Wed, 24 Oct 2018 21:29:12 GMT
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 93bc2d3  WHIMSY-217 - fix icla caching
93bc2d3 is described below

commit 93bc2d38b34a5397f96888caf66309fc870f0e5a
Author: Sebb <sebb@apache.org>
AuthorDate: Wed Oct 24 22:29:02 2018 +0100

    WHIMSY-217 - fix icla caching
---
 lib/whimsy/asf/icla.rb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index 14212ff..92d592e 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -44,6 +44,7 @@ module ASF
         @@id_index = nil
         @@email_index = nil
         @@name_index = nil
+        @@icla_index = nil # cache of all iclas as an array
         @@svn_change = nil
 
         @@availids = nil
@@ -123,13 +124,10 @@ module ASF
     # iterate over all of the ICLAs
     def self.each(&block)
       refresh
-      if @@id_index and not @@id_index.empty?
-        @@id_index.values.each(&block)
-      elsif @@email_index and not @@email_index.empty?
-        @@email_index.values.each(&block)
-      elsif @@name_index and not @@name_index.empty?
-        @@name_index.values.each(&block)
+      if @@icla_index and not @@icla_index.empty?
+        @@icla_index.each(&block)
       elsif SOURCE and File.exist?(SOURCE)
+        @@icla_index = []
         File.read(SOURCE).scan(/^([-\w]+):(.*?):(.*?):(.*?):(.*)/).each do |list|
           icla = ICLA.new()
           icla.id = list[0]
@@ -143,6 +141,7 @@ module ASF
             icla.claRef = match[1] || match[2]
           end
           block.call(icla)
+          @@icla_index << icla
         end
       end
     end


Mime
View raw message