Skip to content

Instantly share code, notes, and snippets.

@ericanderson
Created April 26, 2011 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericanderson/943404 to your computer and use it in GitHub Desktop.
Save ericanderson/943404 to your computer and use it in GitHub Desktop.
proj_id = 10010
search_svc = jira.component_mgr.getSearchService
q = search_svc.parseQuery(jira.user('eanderson'), "project=qa and Customer is not empty").getQuery
res = search_svc.search(jira.user('eanderson'), q, com.atlassian.jira.web.bean.PagerFilter.getUnlimitedFilter())
res.getIssues.each do |issue|
cf = jira.custom_field(issue, "Customer")
issue.getCustomFieldValue(cf).split(",").map{|x| x.strip.gsub(' ', '_')}.each do |label|
jira.label_mgr.addLabel(jira.user('eanderson'), issue.getId, 10480, label, false)
end
end
issue = jira.get_issue('QA-45047') # FIXME: hack for development
cf = jira.custom_field(issue, "Customer")
labels = issue.getCustomFieldValue(cf).split(",").map{|x| x.strip.gusb(' ', '_')}
labels.each do |label|
jira.label_mgr.addLabel(jira.user('eanderson'), issue.getId, 10480, label, false)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment