/[SVNBrowser]/trunk/svn-indexer.pl
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/svn-indexer.pl

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

revision 3 by dpavlin, Tue Dec 5 10:33:49 2006 UTC revision 26 by dpavlin, Sun Dec 10 00:01:33 2006 UTC
# Line 8  use strict; Line 8  use strict;
8    
9  use lib 'lib';  use lib 'lib';
10    
11    
12  use SVN::Log;  use SVN::Log;
13  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
14    
# Line 15  use Jifty; Line 16  use Jifty;
16    
17  BEGIN { Jifty->new };  BEGIN { Jifty->new };
18    
19    my $repository = shift @ARGV || Jifty->config->app('repository');
20    
21  my ($start_rev,$end_rev) = (1, 'HEAD');  my ($start_rev,$end_rev) = (1, 'HEAD');
22    
23  my $system_user = SVNBrowser::CurrentUser->superuser;  my $system_user = SVNBrowser::CurrentUser->superuser;
# Line 24  $rev_col->unlimit; Line 27  $rev_col->unlimit;
27  $rev_col->order_by({ column => 'revision', order => 'DES' });  $rev_col->order_by({ column => 'revision', order => 'DES' });
28  my $last_rev = $rev_col->first;  my $last_rev = $rev_col->first;
29    
30    my $branch_regex = Jifty->config->app('branch_regex');
31    
32  if ($last_rev) {  if ($last_rev) {
33          $start_rev = $last_rev->revision;          $start_rev = $last_rev->revision;
34          warn "Update from revision $start_rev to $end_rev\n";          warn "Index $repository rev $start_rev - $end_rev [branch regex: $branch_regex]\n";
35  }  }
36    
37  SVN::Log::retrieve({  SVN::Log::retrieve({
38          repository => "svn://svn.pliva.hr/strix",          repository => $repository,
39          start => $start_rev,          start => $start_rev,
40          end => $end_rev,          end => $end_rev,
41          callback => sub {          callback => sub {
42                  my ($paths,$revision,$author,$date,$message) = @_;                  my ($paths,$revision,$author,$date,$message) = @_;
43    
44                    return if ($last_rev && $revision <= $last_rev->revision);
45    
46                  $author ||= 'anonymous';                  $author ||= 'anonymous';
47    
48                  my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);                  my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);
# Line 50  SVN::Log::retrieve({ Line 57  SVN::Log::retrieve({
57                          my $action = $paths->{$path}->{action} || die "no action in ", dump($path);                          my $action = $paths->{$path}->{action} || die "no action in ", dump($path);
58    
59                          my $branch = '/';                          my $branch = '/';
60                          ($branch,$path) = ($1,$2) if ($path =~ m!^(/[^/]+)(/.+)$!);                          ($branch,$path) = ($1,$2) if ($path =~ m/$branch_regex/);
61    
62                            my $b = SVNBrowser::Model::Branch->new(current_user => $system_user);
63                            $b->load_or_create(
64                                    path => $branch,
65                            );
66                            
67                            my $rb = SVNBrowser::Model::RevisionBranch->new(current_user => $system_user);
68                            $rb->load_or_create(
69                                    revision => $r,
70                                    branch => $b,
71                            );
72    
73                          my $a = SVNBrowser::Model::Action->new(current_user => $system_user);                          my $a = SVNBrowser::Model::Action->new(current_user => $system_user);
74                          $a->load_or_create(                          $a->load_or_create(
# Line 59  SVN::Log::retrieve({ Line 77  SVN::Log::retrieve({
77                                  branch => $branch,                                  branch => $branch,
78                                  rel_path => $path,                                  rel_path => $path,
79                          );                          );
80    
81                          print " $action | $branch | $path\n";                          print " $action | $branch | $path\n";
82                  }                  }
83          }          }

Legend:
Removed from v.3  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26