enhanced subversion model to to retry with a pegged url when calling svn_cat() for diffing

This commit is contained in:
hyung-hwan 2015-02-05 08:20:45 +00:00
parent 9474738217
commit eb142f5bb7

View File

@ -646,11 +646,21 @@ class SubversionModel extends Model
$old_text = @svn_cat ($info2[0]['url'], $info2[0]['revision']); $old_text = @svn_cat ($info2[0]['url'], $info2[0]['revision']);
if ($old_text === FALSE) if ($old_text === FALSE)
{ {
// if the old URL can't give the contents, $pegged_url = $info2[0]['url'] . '@' . $info2[0]['revision'];
// try it with the latest url and the old revision number $old_text = @svn_cat ($pegged_url, $info2[0]['revision']);
$old_text = @svn_cat ($info1[0]['url'], $info2[0]['revision']); if ($old_text === FALSE)
{
// if the old URL can't give the contents,
// try it with the latest url and the old revision number
$old_text = @svn_cat ($info1[0]['url'], $info2[0]['revision']);
}
} }
$new_text = @svn_cat ($info1[0]['url'], $info1[0]['revision']); $new_text = @svn_cat ($info1[0]['url'], $info1[0]['revision']);
if ($new_text == FALSE)
{
$pegged_url = $info1[0]['url'] . '@' . $info1[0]['revision'];
$new_text = @svn_cat ($pegged_url, $info1[0]['revision']);
}
$fileinfo['content'] = $this->_get_diff ($diff, $old_text, $new_text, TRUE, FALSE); $fileinfo['content'] = $this->_get_diff ($diff, $old_text, $new_text, TRUE, FALSE);
} }
else else