forked from qt-creator/qt-creator
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user