Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add component,resolution,status,priority -> label mapping

  • Loading branch information...
commit d79779ccd71e5b87876b36239bd754c6e76af7e1 1 parent e093d89
@danielbeardsley danielbeardsley authored
Showing with 19 additions and 2 deletions.
  1. +19 −2 ticket.php
View
21 ticket.php
@@ -24,7 +24,8 @@ public function toIssueJson() {
'title' => $this->attr['summary'],
'body' => $this->translateDescription(),
'assignee' => GitUsers::fromTrac($this->attr['owner']) ?: $this->attr['owner'],
- 'milestone' => Milestones::gitId($this->attr['milestone'])
+ 'milestone' => Milestones::gitId($this->attr['milestone']),
+ 'labels' => $this->getLabels()
);
return $json;
@@ -39,6 +40,22 @@ public function saveToGithub() {
private function translateDescription() {
// more on this later
- return $this->attr['description'];
+ $desc = $this->attr['description'];
+ $desc = str_replace("\r\n", "\n", $desc);
+ return $dec;
+ }
+
+ private function getLabels() {
+ $labels = array();
+ if ($comp = $this->attr['component'])
+ $labels[] = "C-{$comp}";
+ if ($resolution = $this->attr['resolution'])
+ $labels[] = "R-{$resolution}";
+ if (($status = $this->attr['status']) && $status != 'closed' && $status != 'assigned')
+ $labels[] = $status;
+ if ($priority = $this->attr['priority'])
+ $labels[] = "P-{$priority}";
+
+ return $labels;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.