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

sartak at bestpractical.com sartak at bestpractical.com
Wed May 27 15:41:47 EDT 2009


The branch, master has been updated
       via  a6fda5d50e2b99d2877866203b6284beeefba67b (commit)
      from  c5ff49d7df626bb5444bfb84941d6a6dd8307aa9 (commit)

Summary of changes:
 lib/App/Changeloggr/InputFormat.pm     |   20 ++++++++++++++++++++
 lib/App/Changeloggr/InputFormat/Git.pm |    9 +--------
 2 files changed, 21 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit a6fda5d50e2b99d2877866203b6284beeefba67b
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed May 27 15:41:32 2009 -0400

    Move detritus-stripping from Git to the superclass

diff --git a/lib/App/Changeloggr/InputFormat.pm b/lib/App/Changeloggr/InputFormat.pm
index 7115443..5fc1c19 100644
--- a/lib/App/Changeloggr/InputFormat.pm
+++ b/lib/App/Changeloggr/InputFormat.pm
@@ -41,4 +41,24 @@ sub take_offline {
     return length($self->{text}) > 4 * 1024; # 4k of text or more
 }
 
+sub strip_detritus {
+    my $self = shift;
+    my $msg  = shift;
+
+    # git-svn metadata
+    $msg =~ s/^git-svn-id: .*$//m;
+
+    # strip potentially-nested svk headers
+    # this intentionally does not match any line in the message, since
+    # that could lose merge information
+    while ($msg =~ s/^\s*r\d+\@\S+:\s*\S+\s*\|\s*.*\n//) {
+        $msg =~ s/^ //g;
+    }
+
+    # Remove extra newlines at the end of the message
+    $msg =~ s/\s+\z//;
+
+    return $msg;
+}
+
 1;
diff --git a/lib/App/Changeloggr/InputFormat/Git.pm b/lib/App/Changeloggr/InputFormat/Git.pm
index 06f6fd8..ae1f3a6 100644
--- a/lib/App/Changeloggr/InputFormat/Git.pm
+++ b/lib/App/Changeloggr/InputFormat/Git.pm
@@ -66,14 +66,7 @@ sub next_match {
         $fields{diffstat} =~ s/\s+\z//;
     }
 
-    # git-svn detritus
-    $fields{message} =~ s/^git-svn-id: .*$//m;
-
-    # svn/svk header
-    $fields{message} =~ s/^\s*r\d+\@\S+:\s*\S+\s*\|\s*.*\n//;
-
-    # Remove extra newlines at the end of the message
-    $fields{message} =~ s/\s+\z//;
+    $fields{message} = $self->strip_detritus($fields{message});
 
     return \%fields;
 }

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



More information about the Bps-public-commit mailing list