scripts/aoo-annotate.pl |   86 ++++++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 32 deletions(-)

New commits:
commit 3052ccd593da43973343f2e9b834b4d56228677a
Author: Michael Meeks <michael.me...@suse.com>
Date:   Wed Feb 27 12:17:05 2013 +0000

    prettier printing etc.

diff --git a/scripts/aoo-annotate.pl b/scripts/aoo-annotate.pl
index c55d72b..781bd26 100755
--- a/scripts/aoo-annotate.pl
+++ b/scripts/aoo-annotate.pl
@@ -1,23 +1,6 @@
 #!/usr/bin/perl -w
 
-# use strict;
-
-sub read_git_notes($)
-{
-    my $git_dir = shift;
-    my %has_note;
-    my $outputh;
-
-    print STDERR "read legacy tags from notes\n";
-    open ($outputh, "cd $git_dir ; git notes list |") || die "can't read git 
notes";
-    while (<$outputh>) {
-       /\s*(\S+)\s+(\S+)$/ || die "badly formatted '\$ git notes list' output";
-       $has_note{$2} = 1;
-    }
-    close ($outputh);
-
-    return \%has_note;
-}
+use strict;
 
 sub clean_note($)
 {
@@ -33,7 +16,7 @@ sub read_log($)
     my @revisions;
     my $outputh;
 
-    print STDERR "read revisions:\n";
+#    print STDERR "read revisions:\n";
     open ($outputh, "cd $git_dir ; git --no-pager log 
--pretty='%H,%cn,%ce,%cd,>>%s<<>>%N<<' aoo/approx-3.4.0..origin/aoo/trunk|") || 
die "can't get git log: $!";
     while (<$outputh>) {
        my $line = $_;
@@ -74,6 +57,8 @@ sub dump_breakdown($)
     my $rev_count = scalar (@{$revs});
     my $annotated = 0;
     my %frequency;
+    my $contiguous = 0;
+    my $in_start_run = 1;
     for my $rev (@{$revs}) {
        if($rev->{note} ne "") {
            my $stem = $rev->{note};
@@ -82,34 +67,71 @@ sub dump_breakdown($)
            $frequency{$stem} = 0 if (!defined $frequency{$stem});
            $frequency{$stem}++;
            $annotated++;
+           $contiguous++ if ($in_start_run);
+       } else {
+           $in_start_run = 0;
        }
     }
 
     print STDERR "$annotated annotations of $rev_count commits\n";
+    print STDERR "with an initial block of $contiguous annotation\n";
     for my $stem (sort { $frequency{$b} <=> $frequency{$a} } keys %frequency) {
        print STDERR "$frequency{$stem}\t$stem\n";
     }
 }
 
-my $git_dir = shift @ARGV;
+sub usage()
+{
+    print STDERR "Usage: aoo-annotate.pl [args] [/path/to/git]\n";
+    print STDERR "annotate AOO commits as to their status\n";
+    print STDERR "\n";
+    print STDERR "  -a, --all    list all commits regardless of status\n";
+    print STDERR "  -n, --notes  list just commits with notes\n";
+    print STDERR "  -h, --help   show this\n";
+    print STDERR "  -s, --stats  show stats on merging\n";
+}
+
+my $git_dir;
+my $stats = 0;
+my $all = 0;
+my $notes = 0;
+
+for my $arg (@ARGV) {
+    if ($arg eq '--help' || $arg eq '-h') {
+       usage();
+       exit;
+    } elsif ($arg eq '--stats' || $arg eq '-s') {
+       $stats = 1;
+    } elsif ($arg eq '--all' || $arg eq '-a') {
+       $all = 1;
+    } elsif ($arg eq '--notes' || $arg eq '-n') {
+       $notes = 1;
+    } elsif (!defined $git_dir) {
+       $git_dir = $arg;
+    } else {
+       usage ();
+       die "unknown argument: $arg";
+    }
+}
 
 if (!defined $git_dir) {
     $git_dir = `pwd`;
 }
 
-my $has_note = read_git_notes($git_dir);
 my $revs = read_log($git_dir);
 
-
-
-print STDERR "\n";
-print STDERR "Commits:\n";
-for my $rev (@{$revs}) {
-
-    my $note = $rev->{note};
-    chomp ($note);
-    print "$rev->{hash}\t$rev->{note}\n";
+if (!$stats) {
+    print STDERR "Commits:\n";
+    for my $rev (@{$revs}) {
+       my $note = $rev->{note};
+       chomp ($note);
+       my $has_note = ($note ne "");
+       my $printit = $all || ($has_note && $notes) || (!$has_note && !$notes);
+       print "$rev->{hash}\t$rev->{note}\n" if ($printit);
+    }
 }
 
-print STDERR "\n";
-dump_breakdown ($revs);
+if ($stats == 1) {
+    print STDERR "\n";
+    dump_breakdown ($revs);
+}
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to