/[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 11 - (hide annotations)
Tue Dec 5 23:14:16 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1571 byte(s)
don't import again last imported revision
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 dpavlin 11 return if ($revision <= $last_rev->revision);
40    
41 dpavlin 1 $author ||= 'anonymous';
42    
43     my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);
44     my $id = $r->load_or_create(
45     revision => $revision,
46     author => $author,
47     commit_date => $date,
48     message => $message,
49     );
50     print "$revision -> $id $date $author\n";
51     foreach my $path (keys %$paths) {
52     my $action = $paths->{$path}->{action} || die "no action in ", dump($path);
53    
54     my $branch = '/';
55     ($branch,$path) = ($1,$2) if ($path =~ m!^(/[^/]+)(/.+)$!);
56    
57     my $a = SVNBrowser::Model::Action->new(current_user => $system_user);
58     $a->load_or_create(
59     revision => $revision,
60     type => $action,
61     branch => $branch,
62     rel_path => $path,
63     );
64     print " $action | $branch | $path\n";
65     }
66     }
67     });
68    
69    

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26