Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: gnustavo/jiratools
base: 1b2e5f2696
...
head fork: gnustavo/jiratools
compare: 45cb7d72c2
  • 5 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 46 additions and 23 deletions.
  1. +45 −22 bin/git-log-jiras.pl
  2. +1 −1  cgi-bin/load-ods.pl
View
67 bin/git-log-jiras.pl
@@ -11,49 +11,71 @@
######################
# Global Configuration
-my $JIRAURL = 'https://jira.example.com';
my $jirakey = qr/\b[A-Z][A-Z]+-\d+\b/;
###################
# Option processing
-my $usage = "$0 [--gitdir=DIR] [--[no]jira] [COMMIT..COMMIT]\n";
+my $usage = "$0 [--jiraurl=URL] [--gitdir=DIR] [--[no]jira] [COMMIT..COMMIT]\n";
+my $JIRAURL = 'https://jira.example.com';
my $GitDir = '.';
my $JIRA = 1;
GetOptions(
- 'gitdir=s' => \$GitDir,
- 'jira!' => \$JIRA,
+ 'jiraurl=s' => \$JIRAURL,
+ 'gitdir=s' => \$GitDir,
+ 'jira!' => \$JIRA,
) or die $usage;
######################
# Grok git commit logs
-my $git = Git->repository(Directory => $GitDir);
+my $git = App::gh::Git->repository(Directory => $GitDir);
my @commits;
+
{
# See 'git help log' to understand the --pretty argument
my ($pipe, $ctx) = $git->command_output_pipe('log', '-z', '--date=iso', '--name-only', @ARGV);
- local $/ = "\x00\x00";
+ local $/ = "\x00";
while (<$pipe>) {
chomp;
- my ($commit, $author, $date, undef, @body) = split /\n/;
- $commit =~ s/^commit\s+// or die "Cannot grok commit line from $_";
- $author =~ s/^Author:\s+// or die "Cannot grok author line from $_";
- $date =~ s/^Date:\s+// or die "Cannot grok date line from $_";
- my $msg;
- while (@body && $body[0] =~ /^ {4}(.*)/) {
- $msg .= "$1\n";
- shift @body;
+ next unless length;
+ if (/^commit /) {
+ # Start of a new commit
+ my %c;
+ if (/^commit\s+([0-9a-f]{40})/) {
+ $c{commit} = $1;
+ } else {
+ die "Cannot grok commit line from: $_";
+ }
+
+ if (/^Author:\s+(.*)/m) {
+ $c{author} = $1;
+ } else {
+ die "Cannot grok author line from: $_";
+ }
+
+ if (/^Date:\s+(.*)/m) {
+ $c{date} = $1;
+ } else {
+ die "Cannot grok date line from: $_";
+ }
+
+ while (/^ {4}(.*)/mgc) {
+ $c{msg} .= "$1\n";
+ }
+
+ if (/\G\n\n(.*)/s) {
+ $c{files} = [$1];
+ } else {
+ $c{files} = [];
+ }
+
+ push @commits, \%c;
+ } else {
+ # Another file affected by the current commit
+ push @{$commits[-1]{files}}, $_;
}
- shift @body; # skip a blank line before the file list
- push @commits, {
- commit => $commit,
- author => $author,
- date => $date,
- msg => $msg,
- files => \@body,
- };
}
$git->command_close_pipe($pipe, $ctx);
}
@@ -104,6 +126,7 @@
warn "WARN: cannot get issue '$key': $@\n";
next;
}
+ no warnings; # avoid warnings for uninitialized keys
say '"', join('","' => @{$issue}{qw/key assignee summary/}), '"';
}
} else {
View
2  cgi-bin/load-ods.pl
@@ -65,7 +65,7 @@
p("Projeto JIRA:", textfield('jiraproj')),
p("Planilha preenchida:", filefield('odsfile')),
p({-style => 'font-size: small'},
- checkbox(-name => 'debug', -checked => 1, -value => '--debug'),
+ checkbox(-name => 'debug', -checked => 0, -value => '--debug'),
"(Marque se quiser gerar logs detalhados de depuração para os administradores.)"),
submit,
end_form,

No commit comments for this range

Something went wrong with that request. Please try again.