my ($hash) = split(" ", $hashtxt);
GetOptions(
+ 'project=s' => \$opts{project},
'summary=s' => \$opts{summary},
'desc=s' => \$opts{desc},
'components=s' => \$opts{components},
'user=s' => \$opts{user},
'pass=s' => \$opts{pass},
'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}) {
$opts{components_array} = [map {{name => $_}} split(" ", $opts{components})];
} else {
$opts{user} = getuser();
}
-if (!$opts{pass}) {
+if (!$opts{pass} && !$opts{debug}) {
$opts{pass} = getpass();
}
-my $jira = JIRA::REST->new('https://freeswitch.org/jira', $opts{user}, $opts{pass}) or die "login incorrect:";
-my $issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
+my $jira;
+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};
#exit;
}
}
-
-
-my $issue = $jira->POST('/issue', undef,
- {
- fields => {
- project => { key => 'FS' },
- issuetype => { name => $opts{type} },
- 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;
+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}) {
+ print Dumper \%opts;
+ print Dumper $input;
+} else {
+ $issue = $jira->POST('/issue', undef, $input) or die "Issue was not created:";
+ print "Issue Posted: " . $issue->{key};
+}
GetOptions(
'bug=s' => \$opts{bug},
- 'msg=s' => \$opts{msg}
- ) or die "Usage: $0 -bug <bug-id> [-m [edit|<msg>]] <files>\n";
+ 'msg=s' => \$opts{msg},
+ '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 $cmd;
my $prog = `which curl` || `which wget`;
my $args = join(" ", @ARGV);
my $gitcmd;
+if ($opts{append}) {
+ $opts{append} = " " . $opts{append};
+}
+
+if ($opts{comment}) {
+ $opts{append} .= " #comment " . $opts{comment};
+}
+
if ($auto) {
if ($opts{msg}) {
$opts{msg} =~ s/%s/$sum/;
$opts{msg} =~ s/%b/$opts{bug}/;
- $gitcmd = "git commit $args -m \"$opts{msg}\"";
+ $gitcmd = "git commit $args -m \"$opts{msg}$opts{append}\"";
} else {
- $gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]\"";
+ $gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]$opts{append}\"";
}
} else {
$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");