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

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 30 14:46:48 EDT 2009


The branch, master has been updated
       via  aa477cd4e880c382b07338ae1ac4536d610ae7dd (commit)
      from  0974e5e5d788db8a3e0cbf09c113fa35fd80a6d7 (commit)

Summary of changes:
 lib/App/Changeloggr/InputFormat/Subversion.pm |   56 ++++++++++++++----------
 1 files changed, 33 insertions(+), 23 deletions(-)

- Log -----------------------------------------------------------------
commit aa477cd4e880c382b07338ae1ac4536d610ae7dd
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Jul 30 14:45:23 2009 -0400

    Add svn log entries in reverse

diff --git a/lib/App/Changeloggr/InputFormat/Subversion.pm b/lib/App/Changeloggr/InputFormat/Subversion.pm
index 4d2bac3..00b87e9 100644
--- a/lib/App/Changeloggr/InputFormat/Subversion.pm
+++ b/lib/App/Changeloggr/InputFormat/Subversion.pm
@@ -18,29 +18,39 @@ sub matches {
 sub next_match {
     my $self = shift;
 
-    $self->{text} =~ s{
-        \A
-        (
-            ^ -{72} \r? \n
-            (r.*?) \s+ \|
-            \s+ (.*?) \s+ \|
-            \s+ (\d{4}-\d{2}-\d{2} \s+ \d{2}:\d{2}:\d{2}\s+\S+) \s+ \(.*?\) \s+ \|
-            \s+ \d+ \s+ lines? \r? \n \r? \n
-            ( .*? )
-        )
-        (?=
-            ^ -{72} \r? \n
-        )
-    }{}xms or return;
-
-    my %fields;
-    $fields{raw} = $1;
-    $fields{identifier} = $2;
-    $fields{author} = $3;
-    $fields{date} = $fields{commit_date} = DATE_PARSER->parse_datetime($4);
-    $fields{message} = $self->strip_detritus($5);
-
-    return \%fields;
+    unless ($self->{log_entries}) {
+        while (1) {
+            $self->{text} =~ s{
+                \A
+                (
+                    ^ -{72} \r? \n
+                    (r.*?) \s+ \|
+                    \s+ (.*?) \s+ \|
+                    \s+ (\d{4}-\d{2}-\d{2} \s+ \d{2}:\d{2}:\d{2}\s+\S+) \s+ \(.*?\) \s+ \|
+                    \s+ \d+ \s+ lines? \r? \n \r? \n
+                    ( .*? )
+                )
+                (?=
+                    ^ -{72} \r? \n
+                )
+            }{}xms or last;
+
+            my $date = DATE_PARSER->parse_datetime($4);
+
+            push @{ $self->{log_entries} }, {
+                raw         => $1,
+                identifier  => $2,
+                author      => $3,
+                date        => $date,
+                commit_date => $date,
+                message     => $self->strip_detritus($5),
+            };
+        }
+
+        @{ $self->{log_entries} } = reverse @{ $self->{log_entries} };
+    }
+
+    return shift @{ $self->{log_entries} };
 }
 
 =begin svn-sample

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



More information about the Bps-public-commit mailing list