/[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 3 - (hide annotations)
Tue Dec 5 10:33:49 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1522 byte(s)
continue import after last imported version
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     use SVN::Log;
12     use Data::Dump qw/dump/;
13    
14     use Jifty;
15    
16     BEGIN { Jifty->new };
17    
18     my ($start_rev,$end_rev) = (1, 'HEAD');
19    
20     my $system_user = SVNBrowser::CurrentUser->superuser;
21    
22 dpavlin 3 my $rev_col = SVNBrowser::Model::RevisionCollection->new(current_user => $system_user);
23     $rev_col->unlimit;
24     $rev_col->order_by({ column => 'revision', order => 'DES' });
25     my $last_rev = $rev_col->first;
26    
27     if ($last_rev) {
28     $start_rev = $last_rev->revision;
29     warn "Update from revision $start_rev to $end_rev\n";
30     }
31    
32 dpavlin 1 SVN::Log::retrieve({
33     repository => "svn://svn.pliva.hr/strix",
34     start => $start_rev,
35     end => $end_rev,
36     callback => sub {
37     my ($paths,$revision,$author,$date,$message) = @_;
38    
39     $author ||= 'anonymous';
40    
41     my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);
42     my $id = $r->load_or_create(
43     revision => $revision,
44     author => $author,
45     commit_date => $date,
46     message => $message,
47     );
48     print "$revision -> $id $date $author\n";
49     foreach my $path (keys %$paths) {
50     my $action = $paths->{$path}->{action} || die "no action in ", dump($path);
51    
52     my $branch = '/';
53     ($branch,$path) = ($1,$2) if ($path =~ m!^(/[^/]+)(/.+)$!);
54    
55     my $a = SVNBrowser::Model::Action->new(current_user => $system_user);
56     $a->load_or_create(
57     revision => $revision,
58     type => $action,
59     branch => $branch,
60     rel_path => $path,
61     );
62     print " $action | $branch | $path\n";
63     }
64     }
65     });
66    
67    

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26