ADD: added method to fetch an issue
This commit is contained in:
parent
becb533405
commit
bd510ca01a
@ -628,6 +628,47 @@ sub stats
|
||||
return $ret;
|
||||
}
|
||||
|
||||
=method get
|
||||
|
||||
return an issue identified by its id
|
||||
|
||||
@param 1. param = id
|
||||
@return Git::IssueManager::Issue object
|
||||
|
||||
=cut
|
||||
sub get
|
||||
{
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
|
||||
my @statusse = ("open","assigned","inprogress","closed");
|
||||
|
||||
die("IssueManager not initialized") unless $self->ready();
|
||||
my $ref = $self->repository->getReference('refs/heads/issues');
|
||||
my $tag = $ref->find(".tag")->content();
|
||||
my $root = $ref->getTree();
|
||||
|
||||
|
||||
for my $s (@statusse)
|
||||
{
|
||||
for my $stat ($root->find($s))
|
||||
{
|
||||
for my $i ($stat->get())
|
||||
{
|
||||
if (ref($i) eq "Git::LowLevel::Tree")
|
||||
{
|
||||
my $subject = $i->find("subject");
|
||||
my $mytag = $tag . "-" . substr($subject->hash(),0,8);
|
||||
if ($id eq $mytag)
|
||||
{
|
||||
my $issue = $self->parseIssue($i, $tag, $s);
|
||||
return $issue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
die("issue " . $id . " not found\n");
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user