/[SVNBrowser]/branches/filter-action/lib/SVNBrowser/Action/Filter.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/filter-action/lib/SVNBrowser/Action/Filter.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 28 by dpavlin, Sun Dec 10 14:06:33 2006 UTC revision 29 by dpavlin, Sun Dec 10 17:21:02 2006 UTC
# Line 86  sub sticky_on_success { 1; } Line 86  sub sticky_on_success { 1; }
86  sub take_action {  sub take_action {
87      my $self = shift;      my $self = shift;
88            
89          my $author = $self->argument_value('author');          my $revisions = SVNBrowser::Model::RevisionCollection->new();
90            $revisions->unlimit();
91    
92            if ( my $author = $self->argument_value('author') ) {
93                    $revisions->limit( column => 'author', value => $author, entry_aggregator => 'AND' );
94            }
95    
96            if ( my $from_date = $self->argument_value('from_date') ) {
97                    $revisions->limit( column => 'commit_date', operator => '>=', value => $from_date, entry_aggregator => 'AND' );
98            }
99    
100            if ( my $to_date = $self->argument_value('to_date') ) {
101                    $revisions->limit( column => 'commit_date', operator => '>=', value => $to_date, entry_aggregator => 'AND' );
102            }
103    
104            if ( my $search = $self->argument_value('search') ) {
105                    $revisions->limit( column => 'message', operator => 'LIKE', value => '%' . $search . '%' );
106            }
107    
108            if ( my $branch = $self->argument_value('branch') ) {
109                    my $b = SVNBrowser::Model::Branch->new();
110                    $b->load_by_cols( path => $branch );
111    
112                    my $rev_branches = $revisions->join(
113                            alias1 => 'main', column1 => 'revision',
114                            table2 => 'revision_branches', column2 => 'revision'
115                    );
116                    $revisions->limit( alias => $rev_branches, column => 'branch', value => $b->id );
117            }
118    
119            $revisions->order_by({ column => 'commit_date', order => 'desc' });
120            $revisions->set_page_info(
121                    current_page => $self->argument_value('page'),
122                    per_page => $self->argument_value('per_page'),
123            );
124    
125            warn "take_action SQL: ", $revisions->build_select_query;
126    
127            $revisions->goto_first_item;
128    
129          my $msg = '';          my $msg = '';
130          $msg .= "Showing only commits for $author" if ($author);          if (my $nr = $revisions->pager->total_entries) {
131          $msg .= ( $msg ? ' and file actions' : 'Showing file actions for each commit' ) if ( $self->argument_value('show_actions') );                          $msg .= "Found $nr revisions";
132      $self->result->message($msg) if ($msg);          } else {
133                            $msg .= "No revisions found";
134            }
135    
136        $self->result->message($msg);
137    
138            $self->result->content( revisions => $revisions );
139            
140            use Data::Dump qw/dump/;
141            warn "take_action revisions = ",dump($revisions);
142    
143      return 1;      return 1;
144  }  }
145    

Legend:
Removed from v.28  
changed lines
  Added in v.29

  ViewVC Help
Powered by ViewVC 1.1.26