/[Frey]/trunk/lib/Frey/SVN.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/SVN.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 803 by dpavlin, Tue Dec 9 20:31:31 2008 UTC revision 804 by dpavlin, Wed Dec 10 22:49:31 2008 UTC
# Line 25  has limit => ( Line 25  has limit => (
25          default => 50,          default => 50,
26  );  );
27    
28  sub as_markup {  sub iterator {
29          my ($self) = @_;          my ($self,$coderef) = @_;
30            
         # extract svk revision: r113@athlon (orig r999): dpavlin | 2005-09-01 20:38:07 +0200  
         my $svk_rev_re = '\s+(r\d+@\w+(\s+\(orig\s+r\d+\))*:\s+\w+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s+\+\d+)\s*';  
   
         sub encode {  
                 my $foo = shift;  
                 $foo =~ s/$svk_rev_re//gsm;  
                 $foo =~ s/</&lt;/g;  
                 $foo =~ s/>/&gt;/g;  
                 $foo =~ s/"/&quot;/g;  
                 $foo =~ s/([\n\r][\n\r]+)/<\/p>$1<p>/gis;  
                 $foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis;  
                 $foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis;  
                 $foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis;           # svk  
                 return $foo;  
         }  
   
31          sub sh_regex($$) {          sub sh_regex($$) {
32                  my ($cmd,$regex) = @_;                  my ($cmd,$regex) = @_;
33                  open(my $sh, $cmd . ' |') || die "sh_regex failed on $cmd: $!";                  open(my $sh, $cmd . ' |') || die "sh_regex failed on $cmd: $!";
# Line 105  sub as_markup { Line 89  sub as_markup {
89    
90          my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]);          my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]);
91    
92            foreach my $e (@{$xml->{'logentry'}}) {
93                    warn "# e = ",$self->dump( $e );
94                    $coderef->($e);
95            }
96    }
97    
98    sub as_markup {
99            my ($self) = @_;
100    
101            # extract svk revision: r113@athlon (orig r999): dpavlin | 2005-09-01 20:38:07 +0200
102            our $svk_rev_re = '\s+(r\d+@\w+(\s+\(orig\s+r\d+\))*:\s+\w+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s+\+\d+)\s*';
103    
104            sub encode {
105                    my $foo = shift;
106                    $foo =~ s/$svk_rev_re//gsm;
107                    $foo =~ s/</&lt;/g;
108                    $foo =~ s/>/&gt;/g;
109                    $foo =~ s/"/&quot;/g;
110                    $foo =~ s/([\n\r][\n\r]+)/<\/p>$1<p>/gis;
111                    $foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis;
112                    $foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis;
113                    $foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis;           # svk
114                    return $foo;
115            }
116    
117          our $html = '';          our $html = '';
118          sub html {          sub html {
119                  $html .= join("\n", @_);                  $html .= join("\n", @_);
120          }          }
121    
122          foreach my $e (@{$xml->{'logentry'}}) {          $self->iterator( sub {
123                    my $e = shift;
124    
125                  my $rev = $e->{'revision'};                  my $rev = $e->{'revision'};
126                  my $date = $e->{'date'};                  my $date = $e->{'date'};
127    
# Line 135  sub as_markup { Line 146  sub as_markup {
146    
147                  html '<blockquote><p><tt style="color:#808080">',join(", ",@files),':</tt> ',encode($e->{'msg'}),'</p></blockquote>';                  html '<blockquote><p><tt style="color:#808080">',join(", ",@files),':</tt> ',encode($e->{'msg'}),'</p></blockquote>';
148    
149          }          });
150    
151          return $html;          return $html;
152  }  }

Legend:
Removed from v.803  
changed lines
  Added in v.804

  ViewVC Help
Powered by ViewVC 1.1.26