Commits

Anonymous committed 4617203

Noaw takes the diff as a string rather than performing the diff itself

Comments (0)

Files changed (1)

lib/Padre/Plugin/HG/DiffView.pm

           };
 
 
-sub showList
+sub showDiff
 {
-	my ($class, $hg, $file) = @_;
+	my ($class, $hg, $diffString) = @_;
 	
 		my $self = $class->SUPER::new(
 		undef,
 	$self->SetIcon(Padre::Wx::Icon::PADRE);
 	my $sizer = Wx::BoxSizer->new(Wx::wxVERTICAL);
 	my $sizer2 = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
-	my   $diff_box = Wx::TextCtrl->new($self, -1, ,'',Wx::wxDefaultPosition,
+	$self->{diff_box} = Wx::TextCtrl->new($self, -1, ,'',Wx::wxDefaultPosition,
 	Wx::wxDefaultSize,Wx::wxTE_READONLY|Wx::wxTE_MULTILINE, Wx::wxDefaultValidator, 'diffBox');
     
         #insert the HG data
         chdir ($self->{hg}->{project_path});
-        my @hgdata = `hg diff -g $file`;
+        my @hgdata = split(/\n/, $diffString);
         #my @filestatus =  $self->{hg}->_get_hg_files(@hgdata);
-        my $diffString = join("\n",@hgdata);
-        $self->{diff_box} = $diff_box;
+     
 	$self->_populate_list( \@hgdata);
 
 	
               sub{$self->Close(); return} 
              );
 
-    $sizer->Add($diff_box, 1, Wx::wxEXPAND, 10);
+    $sizer->Add($self->{diff_box}, 1, Wx::wxEXPAND, 10);
     $sizer2->Add($ok_button, 0, Wx::wxALL, 10);
     $sizer->Add($sizer2, 0, Wx::wxEXPAND, 10);
     $self->SetSizer($sizer);
 	{
 		$self->{diff_box}->SetDefaultStyle(Wx::TextAttr->new(Wx::Colour->new('black')));
 	}
-	$self->{diff_box}->AppendText($line);
+	$self->{diff_box}->AppendText($line."\n");
 
  }