Changeset 7479


Ignore:
Timestamp:
08/23/09 03:53:16 (2 years ago)
Author:
waxhead
Message:

Added "Blame" to the SVN plugin.

Cleaned up some more code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Padre-Plugin-SVN-waxhead/lib/Padre/Plugin/SVN.pm

    r7478 r7479  
    110110            'Project' => sub { $self->svn_commit_project }, 
    111111        ], 
     112        'Blame' => [ 
     113            'File'  => sub { $self->svn_blame }, 
     114        ], 
    112115        'Status...' => [ 
    113116            'File'    => sub { $self->svn_status_of_file }, 
     
    165168        return; 
    166169    } 
     170} 
     171 
     172sub svn_blame { 
     173    my( $self ) = @_; 
     174    my $filename = _get_current_filename(); 
     175    if ($filename) { 
     176        my $main = Padre::Current->main; 
     177        $self->{_busyCursor} = Wx::BusyCursor->new(); 
     178        my $file = svn_file($filename); 
     179        $file->blame(); 
     180        $self->{_busyCursor} = undef; 
     181        my $blame = join( "\n", @{$file->stdout} ); 
     182        require Padre::Plugin::SVN::Wx::SVNDialog; 
     183        my $dialog = Padre::Plugin::SVN::Wx::SVNDialog->new($main, $filename, $blame, 'Blame'); 
     184        $dialog->Show(1); 
     185        return 1; 
     186    } 
     187     
     188    return; 
     189     
    167190} 
    168191 
     
    293316        my $file = svn_file($filename); 
    294317        my $diff = $file->diff; 
    295         #$main->on_new(); 
    296         #my $doc = Padre::Document->new(); 
    297318        my $diff_str = join( "\n", @{$file->stdout} ); 
    298319        $main->new_document_from_string($diff_str); 
    299         #$main->on_new(); 
    300         # get the last id created - assume new is created at the end 
    301         #my @ids = $main->pageids; 
    302         #my @docs = $main->documents; 
    303         #print "pageids: " . join( ",", @ids ) . "\n"; 
    304         #print "docs: " . join( ",", @docs ) . "\n"; 
    305         #print "last element is: " . $ids[-1] . "\n"; 
    306         #my $doc = $docs[$ids[-1]]; 
    307         #$doc->text_set($diff_str); 
    308320        return 1; 
    309321    } 
     
    354366         
    355367        #$message = "\"" .  $message . "\""; 
    356         print "This is the commit message: $message"; 
     368        # print "This is the commit message: $message"; 
    357369         
    358370        # here's how: 
     
    375387        $self->{_busyCursor} = undef; 
    376388    } 
    377  
    378     # show that the file was committed 
    379389     
    380390    return; 
Note: See TracChangeset for help on using the changeset viewer.