]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add fixbug.pl to tree
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 17 Aug 2015 21:31:09 +0000 (16:31 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 17 Aug 2015 21:31:09 +0000 (16:31 -0500)
support-d/utils/fixbug.pl [new file with mode: 0755]

diff --git a/support-d/utils/fixbug.pl b/support-d/utils/fixbug.pl
new file mode 100755 (executable)
index 0000000..6e5f80d
--- /dev/null
@@ -0,0 +1,49 @@
+
+use XML::Simple;
+use Data::Dumper;
+
+
+
+my $bug = shift || die "missing bug";;
+my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/${bug}/${bug}.xml";
+my $cmd;
+my $prog = `which curl` || `which wget`;
+my $auto = 1;
+
+chomp $prog;
+
+$prog || die "missing url fetch program, install curl or wget";
+
+if ($prog =~ /wget/) {
+  $cmd = "$prog -O -";
+} else {
+  $cmd = $prog;
+}
+
+my $xml = `$cmd $url 2>/dev/null`;
+
+my $xs= new XML::Simple;
+my $r = $xs->XMLin($xml);
+
+my $sum = $r->{channel}->{item}->{summary};
+
+if ($ARGV[0] eq "edit") {
+  shift;
+  $auto = 0;
+  open T, ">/tmp/$bug.tmp";
+  print T "#resolve [$sum]\n\n";
+  close T;
+}
+
+my $args = join(" ", @ARGV);
+my $gitcmd;
+
+if ($auto) {
+  $gitcmd = "git commit $args -m \"#resolve [$sum]\"";
+} else {
+  $gitcmd = "git commit $args -t /tmp/$bug.tmp";
+}
+
+system $gitcmd;
+
+unlink("/tmp/$bug.tmp");