[Bps-public-commit] App-Changeloggr branch, master, updated. 71d3f5480cd3a623e99d6d6b1e85a933ea262fd1

sartak at bestpractical.com sartak at bestpractical.com
Wed Aug 5 11:41:21 EDT 2009


The branch, master has been updated
       via  71d3f5480cd3a623e99d6d6b1e85a933ea262fd1 (commit)
      from  65a8e11bfca07b605de3587998aaee5d1e72162d (commit)

Summary of changes:
 bin/backfill-diffstat |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 bin/backfill-diffstat

- Log -----------------------------------------------------------------
commit 71d3f5480cd3a623e99d6d6b1e85a933ea262fd1
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 11:41:11 2009 -0400

    Add script to backfill the diffstat

diff --git a/bin/backfill-diffstat b/bin/backfill-diffstat
new file mode 100644
index 0000000..2b918c8
--- /dev/null
+++ b/bin/backfill-diffstat
@@ -0,0 +1,34 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Jifty;
+BEGIN { Jifty->new }
+
+$| = 1;
+
+die "usage: $0 'changelog name' 'path to git repository'"
+    if @ARGV != 2;
+
+my ($changelog_name, $path) = @ARGV;
+
+-d $path or die "git repository does not exist or is not a directory";
+-d "$path/.git" or die "directory does not include a .git directory";
+
+my $changelog = App::Changeloggr::Model::Changelog->new(
+    current_user => App::Changeloggr::CurrentUser->superuser,
+);
+my ($ok, $msg) = $changelog->load_by_cols(name => $changelog_name);
+die "Unable to load changelog '$changelog_name': $msg" if !$ok;
+
+my $changes = $changelog->changes;
+while (my $change = $changes->next) {
+    next if $change->message =~ /\d+ files? changed, \d+ insertions?\(\+\), \d+ deletions?\(-\)/;
+    my $id = $change->identifier;
+    my $stat = `git log --format=oneline --stat $id~1..$id`;
+    $stat =~ s/^.*\n//;
+
+    $change->set_diffstat($stat);
+    print ".";
+}
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list