Fix reloading of patch files

(cherry picked from commit 37ddb4e9eb)
Change-Id: I06c41eb802b0a3318da3ddfa72bd3575c02867fa
Task-number: QTCREATORBUG-13241
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
jkobus
2014-10-23 16:47:20 +02:00
committed by Eike Ziller
parent 4889239479
commit 2e364c1506
3 changed files with 32 additions and 38 deletions

View File

@@ -278,29 +278,10 @@ bool DiffEditor::open(QString *errorString,
{
Q_UNUSED(realFileName)
if (!m_controller)
if (!m_document)
return false;
QString patch;
if (m_document->read(fileName, &patch, errorString) != Utils::TextFileFormat::ReadSuccess)
return false;
bool ok = false;
QList<FileData> fileDataList
= DiffUtils::readPatch(patch,
m_controller->isIgnoreWhitespace(),
&ok);
if (!ok) {
*errorString = tr("Could not parse patch file \"%1\". "
"The content is not of unified diff format.")
.arg(fileName);
return false;
}
const QFileInfo fi(fileName);
m_document->setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
m_controller->setDiffFiles(fileDataList, fi.absolutePath());
return true;
return m_document->open(errorString, fileName);
}
Core::IDocument *DiffEditor::document()