ADD: added method to fetch an issue

This commit is contained in:
Dominik Meyer 2018-09-15 22:04:12 +02:00
parent becb533405
commit bd510ca01a
No known key found for this signature in database
GPG Key ID: B4C312B600606B64
1 changed files with 41 additions and 0 deletions

View File

@ -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;