FS-7988 FS-7989 add debug mode to fixbug and filebug and add -project to filebug and add -append and -comment to fixbug to append to defualt commit msg
This commit is contained in:
parent
25e8d05492
commit
99d29ba679
|
@ -39,6 +39,7 @@ my $hashtxt = `git log -1 --oneline 2>/dev/null`;
|
||||||
my ($hash) = split(" ", $hashtxt);
|
my ($hash) = split(" ", $hashtxt);
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
|
'project=s' => \$opts{project},
|
||||||
'summary=s' => \$opts{summary},
|
'summary=s' => \$opts{summary},
|
||||||
'desc=s' => \$opts{desc},
|
'desc=s' => \$opts{desc},
|
||||||
'components=s' => \$opts{components},
|
'components=s' => \$opts{components},
|
||||||
|
@ -46,9 +47,12 @@ GetOptions(
|
||||||
'user=s' => \$opts{user},
|
'user=s' => \$opts{user},
|
||||||
'pass=s' => \$opts{pass},
|
'pass=s' => \$opts{pass},
|
||||||
'type=s' => \$opts{type},
|
'type=s' => \$opts{type},
|
||||||
) or die "Usage: $0 -summary <summary> -desc <desc> ....\n";
|
'debug' => \$opts{debug},
|
||||||
|
) or die "Usage: $0 -summary <summary> -desc <desc> [-debug] ....\n";
|
||||||
|
|
||||||
|
|
||||||
|
$opts{project} or $opts{project} = "FS";
|
||||||
|
|
||||||
if ($opts{components}) {
|
if ($opts{components}) {
|
||||||
$opts{components_array} = [map {{name => $_}} split(" ", $opts{components})];
|
$opts{components_array} = [map {{name => $_}} split(" ", $opts{components})];
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,12 +67,18 @@ if (!$opts{user}) {
|
||||||
$opts{user} = getuser();
|
$opts{user} = getuser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$opts{pass}) {
|
if (!$opts{pass} && !$opts{debug}) {
|
||||||
$opts{pass} = getpass();
|
$opts{pass} = getpass();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $jira = JIRA::REST->new('https://freeswitch.org/jira', $opts{user}, $opts{pass}) or die "login incorrect:";
|
my $jira;
|
||||||
my $issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
|
my $issue;
|
||||||
|
|
||||||
|
if (!$opts{debug}) {
|
||||||
|
$jira = JIRA::REST->new('https://freeswitch.org/jira', $opts{user}, $opts{pass}) or die "login incorrect:";
|
||||||
|
$issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
|
||||||
|
}
|
||||||
|
|
||||||
#print $issue->{key};
|
#print $issue->{key};
|
||||||
#exit;
|
#exit;
|
||||||
|
|
||||||
|
@ -96,29 +106,23 @@ if (!$opts{hash}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $input = {
|
||||||
|
fields => {
|
||||||
|
project => { key => $opts{project} },
|
||||||
|
issuetype => { name => $opts{type} },
|
||||||
|
summary => $opts{summary},
|
||||||
|
description => $opts{desc},
|
||||||
|
customfield_10024 => $opts{hash},
|
||||||
|
customfield_10025 => $opts{hash},
|
||||||
|
components => $opts{components_array}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($opts{debug}) {
|
||||||
my $issue = $jira->POST('/issue', undef,
|
print Dumper \%opts;
|
||||||
{
|
print Dumper $input;
|
||||||
fields => {
|
} else {
|
||||||
project => { key => 'FS' },
|
$issue = $jira->POST('/issue', undef, $input) or die "Issue was not created:";
|
||||||
issuetype => { name => $opts{type} },
|
print "Issue Posted: " . $issue->{key};
|
||||||
summary => $opts{summary},
|
}
|
||||||
description => $opts{desc},
|
|
||||||
customfield_10024 => $opts{hash},
|
|
||||||
customfield_10025 => $opts{hash},
|
|
||||||
components => $opts{components_array}
|
|
||||||
},
|
|
||||||
}) or die "Issue was not created:";
|
|
||||||
|
|
||||||
|
|
||||||
print "Issue Posted: " . $issue->{key};
|
|
||||||
|
|
||||||
|
|
||||||
__END__
|
|
||||||
|
|
||||||
my $jira = JIRA::REST->new('https://freeswitch.org/jira', $user, $pass);
|
|
||||||
|
|
||||||
#$issue = $jira->GET("/issue/FS-7985");
|
|
||||||
#print Dumper $issue;
|
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,15 @@ my %opts;
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'bug=s' => \$opts{bug},
|
'bug=s' => \$opts{bug},
|
||||||
'msg=s' => \$opts{msg}
|
'msg=s' => \$opts{msg},
|
||||||
) or die "Usage: $0 -bug <bug-id> [-m [edit|<msg>]] <files>\n";
|
'debug' => \$opts{debug},
|
||||||
|
'append=s' => \$opts{append},
|
||||||
|
'comment=s' => \$opts{comment}
|
||||||
|
) or die "Usage: $0 -bug <bug-id> [-m [edit|<msg>]] [-append <msg>] [-debug] <files>\n";
|
||||||
|
|
||||||
|
|
||||||
$opts{bug} || die "missing bug";;
|
$opts{bug} or $opts{bug} = shift;
|
||||||
|
|
||||||
my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/$opts{bug}/$opts{bug}.xml";
|
my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/$opts{bug}/$opts{bug}.xml";
|
||||||
my $cmd;
|
my $cmd;
|
||||||
my $prog = `which curl` || `which wget`;
|
my $prog = `which curl` || `which wget`;
|
||||||
|
@ -46,18 +50,30 @@ if ($opts{msg} eq "edit") {
|
||||||
my $args = join(" ", @ARGV);
|
my $args = join(" ", @ARGV);
|
||||||
my $gitcmd;
|
my $gitcmd;
|
||||||
|
|
||||||
|
if ($opts{append}) {
|
||||||
|
$opts{append} = " " . $opts{append};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opts{comment}) {
|
||||||
|
$opts{append} .= " #comment " . $opts{comment};
|
||||||
|
}
|
||||||
|
|
||||||
if ($auto) {
|
if ($auto) {
|
||||||
if ($opts{msg}) {
|
if ($opts{msg}) {
|
||||||
$opts{msg} =~ s/%s/$sum/;
|
$opts{msg} =~ s/%s/$sum/;
|
||||||
$opts{msg} =~ s/%b/$opts{bug}/;
|
$opts{msg} =~ s/%b/$opts{bug}/;
|
||||||
$gitcmd = "git commit $args -m \"$opts{msg}\"";
|
$gitcmd = "git commit $args -m \"$opts{msg}$opts{append}\"";
|
||||||
} else {
|
} else {
|
||||||
$gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]\"";
|
$gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]$opts{append}\"";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$gitcmd = "git commit $args -t /tmp/$opts{bug}.tmp";
|
$gitcmd = "git commit $args -t /tmp/$opts{bug}.tmp";
|
||||||
}
|
}
|
||||||
|
|
||||||
system $gitcmd;
|
if ($opts{debug}) {
|
||||||
|
print "CMD: $gitcmd\n";
|
||||||
|
} else {
|
||||||
|
system $gitcmd;
|
||||||
|
}
|
||||||
|
|
||||||
unlink("/tmp/$opts{bug}.tmp");
|
unlink("/tmp/$opts{bug}.tmp");
|
||||||
|
|
Loading…
Reference in New Issue