Commit 0df2e299 authored by Nikolai Krasheninnikov's avatar Nikolai Krasheninnikov Committed by Méven Car

Fixes svn plugin issuing "mkfifo" on Windows.

Summary:
BUG: 319546
Non-blocking portable solution without any shell use.

Reviewers: #dolphin, elvisangelaccio, meven, ngraham

Reviewed By: #dolphin, elvisangelaccio, meven

Subscribers: anthonyfieroni

Differential Revision: https://phabricator.kde.org/D26259
parent 40adb358
......@@ -307,10 +307,42 @@ void FileViewSvnPlugin::showLocalChanges()
Q_ASSERT(!m_contextDir.isEmpty());
Q_ASSERT(m_contextItems.isEmpty());
const QString command = QLatin1String("mkfifo /tmp/fifo; svn diff ") +
KShell::quoteArg(m_contextDir) +
QLatin1String(" > /tmp/fifo & kompare /tmp/fifo; rm /tmp/fifo");
KRun::runCommand(command, 0);
// This temporary file will be deleted on Dolphin close. We make an assumption:
// when the file gets deleted kompare has already loaded it and no longer needs it.
const QString tmpFileNameTemplate = QString("%1/%2.XXXXXX").arg(QDir::tempPath(), QDir(m_contextDir).dirName());
QTemporaryFile *file = new QTemporaryFile(tmpFileNameTemplate, this);
if (!file->open()) {
emit errorMessage(i18nc("@info:status", "Could not show local SVN changes."));
return;
}
QProcess process;
process.setStandardOutputFile(file->fileName());
process.start(
QLatin1String("svn"),
QStringList {
QLatin1String("diff"),
QLatin1String("--git"),
m_contextDir
}
);
if (!process.waitForFinished() || process.exitCode() != 0) {
emit errorMessage(i18nc("@info:status", "Could not show local SVN changes: svn diff failed."));
file->deleteLater();
return;
}
const bool started = QProcess::startDetached(
QLatin1String("kompare"),
QStringList {
file->fileName()
}
);
if (!started) {
emit errorMessage(i18nc("@info:status", "Could not show local SVN changes: could not start kompare."));
file->deleteLater();
}
}
void FileViewSvnPlugin::commitFiles()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment