aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-14 15:23:12 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-14 15:23:12 +0000
commite3cf553b01a691084755d08dc53aa168a618746d (patch)
tree97cc33b817b165f3d4ec53bb9b1f99560a1e898c
parentbb67d5caecd77211489acd8957665ff240902311 (diff)
downloadrpmdrake-e3cf553b01a691084755d08dc53aa168a618746d.tar
rpmdrake-e3cf553b01a691084755d08dc53aa168a618746d.tar.gz
rpmdrake-e3cf553b01a691084755d08dc53aa168a618746d.tar.bz2
rpmdrake-e3cf553b01a691084755d08dc53aa168a618746d.tar.xz
rpmdrake-e3cf553b01a691084755d08dc53aa168a618746d.zip
Don't view diffs for rpmnew files when files were not modified (bug 13112)
-rwxr-xr-xrpmdrake8
1 files changed, 5 insertions, 3 deletions
diff --git a/rpmdrake b/rpmdrake
index 3eef7952..c2a5ee3f 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -1339,13 +1339,15 @@ sub dialog_rpmnew {
my @inspect_wsize = ($typical_width*2.5, 500);
my $inspect = sub {
my ($file) = @_;
- my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1, transient => $w->{rwindow});
- my $save_wsize = sub { @inspect_wsize = $d->{rwindow}->get_size };
my ($rpmnew, $rpmsave) = ("$file.rpmnew", "$file.rpmsave");
my $rpmfile = 'rpmnew';
-r $rpmnew or $rpmfile = 'rpmsave';
-r $rpmnew && -r $rpmsave && (stat $rpmsave)[9] > (stat $rpmnew)[9] and $rpmfile = 'rpmsave';
$rpmfile eq 'rpmsave' and $rpmnew = $rpmsave;
+ my @diff = `/usr/bin/diff -u '$file' '$rpmnew'`;
+ return if !@diff;
+ my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1, transient => $w->{rwindow});
+ my $save_wsize = sub { @inspect_wsize = $d->{rwindow}->get_size };
my %texts;
gtkadd($d->{window},
gtkpack_(Gtk2::VBox->new(0, 5),
@@ -1373,7 +1375,7 @@ sub dialog_rpmnew {
gtktext_insert($texts{$_}, [ [ $contents{$_}, { 'font' => 'monospace' } ] ]) foreach keys %contents;
my @regexps = ([ '^(--- )|(\+\+\+ )', 'blue' ], [ '^@@ ', 'darkcyan' ], [ '^-', 'red3' ], [ '^\+', 'green3' ]);
my $line2col = sub { $_[0] =~ /$_->[0]/ and return $_->[1] foreach @regexps; 'black' };
- gtktext_insert($texts{diff}, [ map { [ $_, { 'font' => 'monospace', 'foreground' => $line2col->($_) } ] } `diff -u $file $rpmnew` ]);
+ gtktext_insert($texts{diff}, [ map { [ $_, { 'font' => 'monospace', 'foreground' => $line2col->($_) } ] } @diff ]);
$d->{rwindow}->set_default_size(@inspect_wsize);
$d->main;
};