ADD: method to delete an issue from the issue list

This commit is contained in:
Dominik Meyer 2018-09-11 20:18:53 +02:00
parent 221512e419
commit 5a3e0dcfcc
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -285,16 +285,43 @@ sub list
return @issues;
}
=method delete
delete an issue from the issue list
=cut
sub delete
{
my $self = shift;
my $id = shift;
my @statusse = ("open","closed","assigned","inprogress");
die("IssueManager not initialized") unless $self->ready();
my $ref = $self->repository->getReference('refs/heads/issues');
my $root = $ref->getTree();
my $ref = $self->repository->getReference('refs/heads/issues');
my $tag = $ref->find(".tag")->content();
my $root = $ref->getTree();
for my $s (@statusse)
{
for my $status ($root->find("open"))
{
for my $i ($status->get())
{
if (ref($i) eq "Git::LowLevel::Tree")
{
my $mytag = $tag . "-" . substr($i->hash(),0,8);
if ($id eq $mytag)
{
$status->del($i);
$ref->commit("removed issue " . $i->mypath);
return;
}
}
}
}
}
die("issue " . $id . " not found\n");
}
1;