whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit b08cbd2: Correctly handle SVN updates
Date Sun, 17 Jan 2016 23:48:14 GMT
Commit b08cbd26f56efa1e39e31bdbfdf91131388c7bc4:
    Correctly handle SVN updates
    Also provide more information if there are 5 or less children with
    the parent's status.


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/status/monitor.rb                                        | ++++ 
www/status/monitors/svn.rb                                   | +++++++ --
------------------------------------------------------------
20 changes: 17 additions, 3 deletions.
------------------------------------------------------------


diff --git a/www/status/monitor.rb b/www/status/monitor.rb
index 3f60025..f58fb21 100644
--- a/www/status/monitor.rb
+++ b/www/status/monitor.rb
@@ -130,6 +130,10 @@ def normalize(status)
         if group.length != 1
           # indicate the number of item with that status
           status['title'] = "#{group.length} #{ISSUE_TYPE[status['level']]}"
+
+          if group.length <= 4
+            status['title'] += ': ' + group.map(&:first).join(', ')
+          end
         else
           # indicate the item with the problem
           key, value = group.first
diff --git a/www/status/monitors/svn.rb b/www/status/monitors/svn.rb
index 9fcf16b..c39a805 100644
--- a/www/status/monitors/svn.rb
+++ b/www/status/monitors/svn.rb
@@ -13,13 +13,14 @@ def Monitor.svn(previous_status)
   # extract status for each repository
   updates.each do |update|
     level = 'success'
-    data = update[/^At revision \d+\.$/]
+    title = nil
+    data = revision = update[/^(Updated to|At) revision \d+\.$/]
 
     lines = update.split("\n")
     repository = lines.shift
 
     lines.reject! {|line| line == "Updating '.':"}
-    lines.reject! {|line| line =~ /^At revision \d+\.$/}
+    lines.reject! {|line| line =~ /^(Updated to|At) revision \d+\.$/}
 
     unless lines.empty?
       level = 'info'
@@ -28,12 +29,21 @@ def Monitor.svn(previous_status)
 
     lines.reject! {|line| line =~ /^[ADU]    /}
 
-    unless lines.empty?
+    if lines.empty?
+      if data.length == 1
+        title = "1 file updated"
+      else
+        title = "#{data.length} files updated"
+      end
+
+      data << revision if data.instance_of? Array
+    else
       level = 'danger'
       data = lines.dup
     end
 
     status[repository] = {level: level, data: data}
+    status[repository][:title] = title if title
   end
 
   {data: status}

Mime
View raw message