/[simile]/svn/index.cgi
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 /svn/index.cgi

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

revision 18 by dpavlin, Fri Oct 17 10:09:15 2008 UTC revision 30 by dpavlin, Mon Oct 20 19:41:49 2008 UTC
# Line 12  use CGI; Line 12  use CGI;
12    
13  my $debug = $ENV{'DEBUG'} || 0;  my $debug = $ENV{'DEBUG'} || 0;
14    
15  my $max_items = 500;  my $limit = 1000;
16    
17  my $repository_dir = '/srv/svn';  my $repository_dir = '/srv/svn';
18  my $svnweb = 'https://svn-strix.carnet.hr/private/svnweb/index.cgi/%s/revision?rev=%d';  my $svnweb = 'https://svn-strix.carnet.hr/private/svnweb/index.cgi/%s/revision?rev=%d';
 my $strip_branch = s!^/(branches/)?[^/]+/!/!;  
19    
20  # my local config for development  # my local config for development
21  $repository_dir = '/home/dpavlin/private/svn';  $repository_dir = '/home/dpavlin/private/svn';
22  $svnweb = 'http://localhost/svnweb/index.cgi/%s/revision?rev=%d';  $svnweb = 'http://localhost/svnweb/index.cgi/%s/revision?rev=%d';
23  $strip_branch = s!!!;  # my local svk mirrors
24    $repository_dir = '/home/dpavlin/.svk';
25    $svnweb = 'http://localhost/svnweb/svk/index.cgi/%s/revision?rev=%d';
26    
27  # for older JSON  # for older JSON
28  #sub encode_json { objToJson( @_ ) }  #sub encode_json { objToJson( @_ ) }
29    
30  sub path_strip {  sub path_strip {
31          my $path = shift;          my $path = shift;
32          $path =~ $strip_branch;  #       $path =~ $strip_branch;
33          return $path;          return $path;
34  }  }
35    
# Line 38  closedir($dir); Line 39  closedir($dir);
39    
40  our $q = CGI->new;  our $q = CGI->new;
41  my $repository = $q->param('repository');  my $repository = $q->param('repository');
42  $repository = (grep { m/^\Q$repository\E$/ } @repositories )[0];  $repository = (grep { m/^\Q$repository\E$/ } @repositories )[0] if $repository;
43    
44    warn "q = ",dump( $q );
45    warn "# limit: ", $q->param('limit');
46    
47  sub select_repository {  sub select_repository {
48          $q->start_form( -name => 'current_repository', -id => 'current_repository', -method => 'post' ),          my $onChange = qq{document.getElementById('current_repository').submit();};
49          "Select repository: ",          return (
50          $q->popup_menu( -name => 'repository', -values => [ @repositories ], -onChange => qq{document.getElementById('current_repository').submit();} ),                  $q->start_form( -name => 'current_repository', -id => 'current_repository', -method => 'post' ),
51          $q->submit,                  "From repository ",
52          $q->end_form;                  $q->popup_menu( -name => 'repository', -values => [ @repositories ], -onChange => $onChange ),
53                    " show ",
54                    $q->popup_menu( -name => 'limit', -values => [ qw/100 500 1000 5000 10000/ ], -onChange => $onChange ),
55                    " revisions with ",
56                    $q->checkbox(-name=>'path', -checked=>1, -value=>'ON', -label=>'path modifications', -onChange => $onChange ),
57                    $q->submit,
58                    $q->end_form
59            );
60  }  }
61    
62  if ( ! $repository ) {  if ( ! $repository ) {
# Line 60  if ( ! $repository ) { Line 71  if ( ! $repository ) {
71    
72             <link rel="exhibit/data"             <link rel="exhibit/data"
73      type="application/json"      type="application/json"
74      href="?repository=$repository&json=1" />      href="|, $q->url( -query => 1 ), qq|&json=1" />
75    
76  <!--  <!--
77  <script  <script
# Line 91  if ( ! $repository ) { Line 102  if ( ! $repository ) {
102                    
103              <div ex:role="facet" ex:expression=".author" ex:facetLabel="Author"              <div ex:role="facet" ex:expression=".author" ex:facetLabel="Author"
104                  ex:sortMode="count"></div>                  ex:sortMode="count"></div>
105        |, $q->param('path') ?
106    qq|
107              <div ex:role="facet" ex:expression=".action" ex:facetLabel="Action"              <div ex:role="facet" ex:expression=".action" ex:facetLabel="Action"
108                  ex:sortMode="count" ex:scroll="false"></div>                  ex:sortMode="count" ex:scroll="false"></div>
109                    | : '',
110    qq|
111              <div ex:role="facet" ex:expression=".revision" ex:facetClass="NumericRange"              <div ex:role="facet" ex:expression=".revision" ex:facetClass="NumericRange"
112                  ex:interval="10" ex:scroll="true"></div>                  ex:interval="20" ex:scroll="true"></div>
113                    |, $q->param('path') ?
114    qq|
115              <div ex:role="facet" ex:expression=".path" ex:facetLabel="Path by Count"              <div ex:role="facet" ex:expression=".path" ex:facetLabel="Path by Count"
116                  ex:sortMode="count"></div>                  ex:sortMode="count"></div>
117                    | : '',
118    qq|
119          </td>          </td>
120          <td>          <td>
121                    
# Line 115  if ( ! $repository ) { Line 130  if ( ! $repository ) {
130                  ex:colorKey=".author"                  ex:colorKey=".author"
131                  ex:topBandUnit="week" ex:topBandPixelsPerUnit="200"                  ex:topBandUnit="week" ex:topBandPixelsPerUnit="200"
132                  ex:bottomBandUnit="month" ex:bottomBandPixelsPerUnit="25"                  ex:bottomBandUnit="month" ex:bottomBandPixelsPerUnit="25"
133                  ex:timelineHeight="650" />                  ex:timelineHeight="550" />
134                            
135              <div ex:role="view" ex:viewClass="Tabular"              <div ex:role="view" ex:viewClass="Tabular"
136                  ex:columns=".revision, .author, .date, .path, .action, .copyfrom-path, .copyfrom-rev, .msg"                  ex:columns=".revision, .author, .date, .PATH, .action, .copyfrom-path, .copyfrom-rev, .msg"
137                  />                  />
138          </td>          </td>
139    
# Line 145  my $json = { Line 160  my $json = {
160    
161  my $log;  my $log;
162  {  {
163          open( my $log_fh, '-|', "svn log --xml --stop-on-copy -v file://$repository_dir/$repository" ) || die "can't read svn log: $!";          my $cmd = "svn log --xml --stop-on-copy -v --limit " . ( $q->param('limit') || $limit ) . " file://$repository_dir/$repository";
164            warn "cmd: $cmd\n";
165            open( my $log_fh, '-|', $cmd) || die "can't read svn log: $!";
166          local $/ = undef;          local $/ = undef;
167          $log = <$log_fh>;          $log = <$log_fh>;
168          close( $log_fh );          close( $log_fh );
# Line 176  foreach my $e (@{$xml->{'logentry'}}) { Line 193  foreach my $e (@{$xml->{'logentry'}}) {
193    
194                  push @{ $json->{items} }, $item;                  push @{ $json->{items} }, $item;
195    
196                  $max_items--;                  last if ! $q->param('path');
                 # we skip all other items in commits with more than 10 files as they are too chatty  
                 last if $#{ $e->{'paths'}->{'path'} } > 10;  
 #               last; # FIXME record just single item for each commit!  
                 # we also break out when $max_items is reached to keep browser (somewhat) alive  
                 last if ! $max_items;  
197          }          }
198    
         last if ! $max_items;  
199  }  }
200    
201  print qq|Content-type: application/json\n\r\n\r|, encode_json( $json );  print qq|Content-type: application/json\n\r\n\r|, encode_json( $json );

Legend:
Removed from v.18  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26