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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (hide annotations)
Sun Dec 10 14:06:33 2006 UTC (17 years, 4 months ago) by dpavlin
File MIME type: text/plain
File size: 2000 byte(s)
make branch for Action::Filter refactoring
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 dpavlin 26 my $branch_regex = Jifty->config->app('branch_regex');
31    
32 dpavlin 3 if ($last_rev) {
33     $start_rev = $last_rev->revision;
34 dpavlin 26 warn "Index $repository rev $start_rev - $end_rev [branch regex: $branch_regex]\n";
35 dpavlin 3 }
36    
37 dpavlin 1 SVN::Log::retrieve({
38 dpavlin 17 repository => $repository,
39 dpavlin 1 start => $start_rev,
40     end => $end_rev,
41     callback => sub {
42     my ($paths,$revision,$author,$date,$message) = @_;
43    
44 dpavlin 17 return if ($last_rev && $revision <= $last_rev->revision);
45 dpavlin 11
46 dpavlin 1 $author ||= 'anonymous';
47    
48     my $r = SVNBrowser::Model::Revision->new(current_user => $system_user);
49     my $id = $r->load_or_create(
50     revision => $revision,
51     author => $author,
52     commit_date => $date,
53     message => $message,
54     );
55     print "$revision -> $id $date $author\n";
56     foreach my $path (keys %$paths) {
57     my $action = $paths->{$path}->{action} || die "no action in ", dump($path);
58    
59     my $branch = '/';
60 dpavlin 26 ($branch,$path) = ($1,$2) if ($path =~ m/$branch_regex/);
61 dpavlin 1
62 dpavlin 26 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 dpavlin 1 my $a = SVNBrowser::Model::Action->new(current_user => $system_user);
74     $a->load_or_create(
75     revision => $revision,
76     type => $action,
77     branch => $branch,
78     rel_path => $path,
79     );
80 dpavlin 26
81 dpavlin 1 print " $action | $branch | $path\n";
82     }
83     }
84     });
85    
86    

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26