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

Alex M Vandiver alexmv at bestpractical.com
Mon Mar 30 15:00:42 EDT 2009


The branch, master has been updated
       via  36e5acd702a0b362819190815d2c354de7ac2cb7 (commit)
       via  61a239ebed57ff877c273dd089b453ee516001a3 (commit)
      from  887606bdf829d8e2a9805c4bcc6c12736061779c (commit)

Summary of changes:
 lib/App/Changeloggr/Model/Change.pm           |    3 ++-
 lib/App/Changeloggr/Model/ChangeCollection.pm |   12 +++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 61a239ebed57ff877c273dd089b453ee516001a3
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Mon Mar 30 15:00:10 2009 -0400

    Fix \r\n newline earlier

diff --git a/lib/App/Changeloggr/Model/ChangeCollection.pm b/lib/App/Changeloggr/Model/ChangeCollection.pm
index b24dc1a..5e9f031 100644
--- a/lib/App/Changeloggr/Model/ChangeCollection.pm
+++ b/lib/App/Changeloggr/Model/ChangeCollection.pm
@@ -47,6 +47,7 @@ sub extract_change_data_from_text {
     my $text = shift;
 
     $text =~ s/^\s+//;
+    $text =~ s/\r\n/\n/g;
 
     my $format = $self->identify_format($text);
     die "I'm unable to handle the change text format: " . substr($text, 0, 30) . '...'
@@ -64,13 +65,13 @@ sub extract_change_data_from_git {
     $text =~ s{
         \A
         (
-            ^ commit \  \w+ \r?\n
+            ^ commit \  \w+ \n
             .*?
         )
         (?=
             \Z
             |
-            ^ commit \  \w+ \r?\n
+            ^ commit \  \w+ \n
         )
     }{}xms;
 

commit 36e5acd702a0b362819190815d2c354de7ac2cb7
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Mon Mar 30 15:00:34 2009 -0400

    Make datestamps actually DateTime objects

diff --git a/lib/App/Changeloggr/Model/Change.pm b/lib/App/Changeloggr/Model/Change.pm
index d1dbd11..d906a2b 100644
--- a/lib/App/Changeloggr/Model/Change.pm
+++ b/lib/App/Changeloggr/Model/Change.pm
@@ -21,7 +21,8 @@ use App::Changeloggr::Record schema {
         label is 'Author';
 
     column date =>
-        type is 'text',
+        type is 'timestamp',
+        filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime),
         label is 'Date';
 
     column message =>
diff --git a/lib/App/Changeloggr/Model/ChangeCollection.pm b/lib/App/Changeloggr/Model/ChangeCollection.pm
index 5e9f031..56e4a99 100644
--- a/lib/App/Changeloggr/Model/ChangeCollection.pm
+++ b/lib/App/Changeloggr/Model/ChangeCollection.pm
@@ -3,6 +3,11 @@ use strict;
 use warnings;
 use base 'App::Changeloggr::Collection';
 use Params::Validate qw(validate SCALAR);
+use DateTime::Format::Strptime;
+
+my $gitdate = DateTime::Format::Strptime->new(
+    pattern => '%a %b %d %T %Y %z',
+);
 
 sub create_from_text {
     my $self = shift;
@@ -86,7 +91,7 @@ sub extract_change_data_from_git {
         $fields{author} = $1;
     }
     if ($entry =~ /^(?:Author)?Date:\s*(.*)$/im) {
-        $fields{date} = $1;
+        $fields{date} = $gitdate->parse_datetime($1);
     }
     # We don't have these columns in the database yet
 #    if ($entry =~ /^Commit:\s*(.*)$/im) {

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



More information about the Bps-public-commit mailing list