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

Contents of /trunk/svn-indexer.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (show annotations)
Thu Dec 7 00:51:39 2006 UTC (17 years, 4 months ago) by dpavlin
File MIME type: text/plain
File size: 1637 byte(s)
default repository moved to config.yml
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
12 use SVN::Log;
13 use Data::Dump qw/dump/;
14
15 use Jifty;
16
17 BEGIN { Jifty->new };
18
19 my $repository = shift @ARGV || Jifty->config->app('repository');
20
21 my ($start_rev,$end_rev) = (1, 'HEAD');
22
23 my $system_user = SVNBrowser::CurrentUser->superuser;
24
25 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 warn "Index $repository rev $start_rev - $end_rev\n";
33 }
34
35 SVN::Log::retrieve({
36 repository => $repository,
37 start => $start_rev,
38 end => $end_rev,
39 callback => sub {
40 my ($paths,$revision,$author,$date,$message) = @_;
41
42 return if ($last_rev && $revision <= $last_rev->revision);
43
44 $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