[Bps-public-commit] r9103 - in SVKUI: trunk/lib/SVKUI/View

clsung at bestpractical.com clsung at bestpractical.com
Thu Sep 20 11:20:09 EDT 2007


Author: clsung
Date: Thu Sep 20 11:20:07 2007
New Revision: 9103

Modified:
   SVKUI/   (props changed)
   SVKUI/trunk/lib/SVKUI/View/browse.pm

Log:
 r9187 at going04:  clsung | 2007-09-20 23:20:03 +0800
 - implement log via parse_log();


Modified: SVKUI/trunk/lib/SVKUI/View/browse.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/View/browse.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/View/browse.pm	Thu Sep 20 11:20:07 2007
@@ -83,39 +83,49 @@
     };
 };
 
-template log => sub {
+template 'log' => sub {
     my $self = shift;
     my $output_raw = get('output_raw');
-    my @lines = split /\n/, $output_raw;
-    my $last_rev = -1;
-    my $line_no = 0;
-    my @styles = ( '#e0e0e0', '#f7f7f7' );
-    my $index_style = 0;
-    table { {class is 'listing' } { id is 'dirlist' } {summary is 'Browse Listing'} 
-	thead { 
-	    row {
-		th { 'Line #' }
-		th { {class is 'chgset' } 'Revision' }
-		th { {class is 'author' } 'Author' }
-		th {}
-	    }
-	}
-	tbody {
-	for my $_line (@lines) {
-	    my ($_rev, $_author, $_time, $_content) = ($_line =~ m/^ *(\d+)\t+\( *(\w+) ([\d-]+)\):\t+(.*)$/);
-	    next unless defined ($_rev);
-	    $index_style = ($index_style + 1) % 2 if ($last_rev != $_rev);
-	    row {
-		cell { $line_no };
-		cell { {class is 'chgset'} $_rev if ($last_rev != $_rev) };
-		cell { {class is 'author', align is 'center'} $_author };
-		cell { {style is "white-space: pre; background: $styles[$index_style];" } $_content }
+    my %fields = parse_log($output_raw);
+    use Data::Dumper;
+    warn Dumper(%fields);
+    my $rev = get('rev');
+    h1 { "Revision $rev"}
+    dl { {id is 'overview'}
+	dt { {class is 'time'} 'Date:' }
+	dd { {class is 'time'} $fields{'time'} }
+	dt { {class is 'author'} 'Author:' }
+	dd { {class is 'author'} $fields{'author'} }
+	dt { {class is 'message'} 'Revision Log:' }
+	dd { {class is 'message'} $fields{'message'} }
+	dt { {class is 'files'} 'Files:' }
+	dd { {class is 'files'} 
+	    ul {
+		foreach my $_file (@{$fields{'files'}}) {
+		    li {
+			div { {class is 'mod'} }
+			$_file
+		    }
+		}
 	    }
-	    $line_no++;
-	    $last_rev = $_rev;
-	} # for
 	};
     };
 };
 
+sub parse_log {
+    my $output_raw = shift;
+    my @lines = split /\n/, $output_raw;
+    my %fields;
+#    r2 (orig r2411):  clsung | 2007-06-21 09:09:40 +0800 
+    foreach my $_line (@lines) {
+	if ($_line =~ m/^ *r\d+(?: \(orig r\d+\))?: *(\w+) \| ([-\d: +]+)/) {
+	    ($fields{'author'}, $fields{'time'}) = ($1,$2);
+	}
+	#($fields{'author'}, $fields{'time'}) = ($_line =~ m/^ *r\d+(?: \(orig r\d+\))?: *(\w+) \| ([-\d: +]+)/);
+    }
+    $fields{'message'} = 'bc';
+    push @{$fields{'files'}},"N/A";
+    return %fields;
+};
+
 1;



More information about the Bps-public-commit mailing list