Skip to content

Commit

Permalink
[backend] fix bug in srcdiff's olinkrev=linkrev handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Feb 8, 2012
1 parent 5ca4b46 commit a635f01
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/backend/bs_srcserver
Expand Up @@ -3886,13 +3886,23 @@ sub sourcediff {
}
$files = handlelinks($rev, $files, \%li);
die("bad link: $files\n") unless ref $files;
$cgi->{'olinkrev'} = $li{'srcmd5'} if $cgi->{'olinkrev'} && $cgi->{'olinkrev'} eq 'linkrev';

# some nasty magic to improve diff usability
if ($l && $cgi->{'linkrev'} && $l->{'project'} eq $oprojid && $l->{'package'} eq $opackid && !$l->{'rev'} && !$cgi->{'orev'}) {
# we're diffing against the link target. As the user specified a baserev, we should use it
# instead of the latest source
$orev = getrev($oprojid, $opackid, $li{'srcmd5'});
$ofiles = lsrev($orev);
}
# olinkrev=linkrev: reuse same linkrev if the link target matches
if ($cgi->{'olinkrev'} && $cgi->{'olinkrev'} eq 'linkrev' && $ofiles->{'_link'}) {
my $ol = repreadxml($orev, '_link', $ofiles->{'_link'}, $BSXML::link, 1);
if ($ol) {
$ol->{'project'} = $orev->{'project'} unless defined $ol->{'project'};
$ol->{'package'} = $orev->{'package'} unless defined $ol->{'package'};
}
$cgi->{'olinkrev'} = $li{'srcmd5'} if $l && $ol && $l->{'project'} eq $ol->{'project'} && $l->{'package'} eq $ol->{'package'};
}
}
if ($ofiles->{'_link'}) {
$orev->{'linkrev'} = $cgi->{'olinkrev'} if $cgi->{'olinkrev'} && $cgi->{'olinkrev'} ne 'linkrev';
Expand Down

0 comments on commit a635f01

Please sign in to comment.