/[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

Annotation of /trunk/svn-indexer.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (hide annotations)
Thu Dec 7 00:51:39 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1637 byte(s)
default repository moved to config.yml
1 dpavlin 1 #!/usr/bin/perl -w
2    
3     # svn-indexer.pl
4     #
5     # 12/04/06 22:19:20 CET Dobrica Pavlinusic <dpavlin@rot13.org>
6    
7     use strict;
8    
9     use lib 'lib';
10    
11 dpavlin 17
12 dpavlin 1 use SVN::Log;
13     use Data::Dump qw/dump/;
14    
15     use Jifty;
16    
17     BEGIN { Jifty->new };
18    
19 dpavlin 21 my $repository = shift @ARGV || Jifty->config->app('repository');
20    
21 dpavlin 1 my ($start_rev,$end_rev) = (1, 'HEAD');
22    
23     my $system_user = SVNBrowser::CurrentUser->superuser;
24    
25 dpavlin 3 my $rev_col = SVNBrowser::Model::RevisionCollection->new(current_user => $system_user);
26     $rev_col->unlimit;
27     $rev_col->order_by({ column => 'revision', order => 'DES' });
28     my $last_rev = $rev_col->first;
29    
30     if ($last_rev) {
31     $start_rev = $last_rev->revision;
32 dpavlin 17 warn "Index $repository rev $start_rev - $end_rev\n";
33 dpavlin 3 }
34    
35 dpavlin 1 SVN::Log::retrieve({
36 dpavlin 17 repository => $repository,
37 dpavlin 1 start => $start_rev,
38     end => $end_rev,
39     callback => sub {
40     my ($paths,$revision,$author,$date,$message) = @_;
41    
42 dpavlin 17 return if ($last_rev && $revision <= $last_rev->revision);
43 dpavlin 11
44 dpavlin 1 $author ||= 'anonymous';
45    
46     my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);
47     my $id = $r->load_or_create(
48     revision => $revision,
49     author => $author,
50     commit_date => $date,
51     message => $message,
52     );
53     print "$revision -> $id $date $author\n";
54     foreach my $path (keys %$paths) {
55     my $action = $paths->{$path}->{action} || die "no action in ", dump($path);
56    
57     my $branch = '/';
58     ($branch,$path) = ($1,$2) if ($path =~ m!^(/[^/]+)(/.+)$!);
59    
60     my $a = SVNBrowser::Model::Action->new(current_user => $system_user);
61     $a->load_or_create(
62     revision => $revision,
63     type => $action,
64     branch => $branch,
65     rel_path => $path,
66     );
67     print " $action | $branch | $path\n";
68     }
69     }
70     });
71    
72    

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26