commit:     199809b60ed580754ebfad7fd77b18ad2369c9a2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 12 12:29:45 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan 12 19:08:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/rbot-gentoo.git/commit/?id=199809b6

!proj: Distinguish between non-existing and empty projects

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=571614

 gentoo-data.rb | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/gentoo-data.rb b/gentoo-data.rb
index 79c3b34..37b606f 100644
--- a/gentoo-data.rb
+++ b/gentoo-data.rb
@@ -208,25 +208,35 @@ class GentooPlugin < Plugin
           break
         end }
 
-      emails = []
       if project
+        emails = []
         for maintainer in project.get_elements("member")
           emails << 
maintainer.get_elements('email')[0].text.chomp('@gentoo.org')
         end
         for subproject in project.get_elements("subproject")
           if subproject.attributes["inherit-members"] == "1"
-            emails += expand_project_recursively(projects,
+            sub_emails = expand_project_recursively(projects,
                 subproject.attributes["ref"])
+            if sub_emails.nil?
+              emails << "<#{subproject.attributes["ref"]}>"
+            else
+              emails += sub_emails
+            end
           end
         end
+        return emails
+      else
+        return nil
       end
-      return emails
     end
     emails = expand_project_recursively(projects, req_project)
-    unless emails.empty?
-      m.reply "(#{req_project}) #{emails.sort.uniq.join(', ')}"
-    else
+
+    if emails.nil?
       m.reply "No such project: #{req_project}"
+    elsif emails.empty?
+      m.reply "(#{req_project}) [no members]"
+    else
+      m.reply "(#{req_project}) #{emails.sort.uniq.join(', ')}"
     end
   end
 

Reply via email to