aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-01-12 13:29:45 +0100
committerMichał Górny <mgorny@gentoo.org>2016-01-12 20:08:53 +0100
commit199809b60ed580754ebfad7fd77b18ad2369c9a2 (patch)
tree560a5327194f706ad7c27291b63cf6f335633e4a
parentAdd !proj to obtain project members from projects.xml (diff)
downloadrbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.tar.gz
rbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.tar.bz2
rbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.zip
!proj: Distinguish between non-existing and empty projects
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=571614
-rw-r--r--gentoo-data.rb22
1 files 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