forked from qt-creator/qt-creator
Git: Avoid QProcess::waitForReadyRead in MergeTool
It's unreliable on Windows with Qt 5.7. Change-Id: I0703ae825e9db80ac8063d9f6962863a68591ed6 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
c64b3f9882
commit
ff963bc184
@@ -70,18 +70,9 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MergeTool::FileState MergeTool::waitAndReadStatus(QString &extraInfo)
|
MergeTool::FileState MergeTool::parseStatus(const QByteArray &line, QString &extraInfo)
|
||||||
{
|
{
|
||||||
QByteArray state;
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
if (m_process->canReadLine()) {
|
|
||||||
const QByteArray line = m_process->readLine();
|
|
||||||
VcsOutputWindow::append(QString::fromLocal8Bit(line));
|
|
||||||
QByteArray state = line.trimmed();
|
QByteArray state = line.trimmed();
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_process->waitForReadyRead(500);
|
|
||||||
}
|
|
||||||
// " {local}: modified file"
|
// " {local}: modified file"
|
||||||
// " {remote}: deleted"
|
// " {remote}: deleted"
|
||||||
if (!state.isEmpty()) {
|
if (!state.isEmpty()) {
|
||||||
@@ -218,8 +209,10 @@ void MergeTool::readData()
|
|||||||
m_mergeType = mergeType(line.left(index));
|
m_mergeType = mergeType(line.left(index));
|
||||||
int quote = line.indexOf('\'');
|
int quote = line.indexOf('\'');
|
||||||
m_fileName = QString::fromLocal8Bit(line.mid(quote + 1, line.lastIndexOf('\'') - quote - 1));
|
m_fileName = QString::fromLocal8Bit(line.mid(quote + 1, line.lastIndexOf('\'') - quote - 1));
|
||||||
m_localState = waitAndReadStatus(m_localInfo);
|
} else if (line.startsWith(" {local}")) {
|
||||||
m_remoteState = waitAndReadStatus(m_remoteInfo);
|
m_localState = parseStatus(line, m_localInfo);
|
||||||
|
} else if (line.startsWith(" {remote}")) {
|
||||||
|
m_remoteState = parseStatus(line, m_remoteInfo);
|
||||||
chooseAction();
|
chooseAction();
|
||||||
} else if (line.startsWith("Was the merge successful")) {
|
} else if (line.startsWith("Was the merge successful")) {
|
||||||
prompt(tr("Unchanged File"), tr("Was the merge successful?"));
|
prompt(tr("Unchanged File"), tr("Was the merge successful?"));
|
||||||
|
@@ -69,7 +69,7 @@ private:
|
|||||||
void done();
|
void done();
|
||||||
void write(const QByteArray &bytes);
|
void write(const QByteArray &bytes);
|
||||||
|
|
||||||
FileState waitAndReadStatus(QString &extraInfo);
|
FileState parseStatus(const QByteArray &line, QString &extraInfo);
|
||||||
QString mergeTypeName();
|
QString mergeTypeName();
|
||||||
QString stateName(FileState state, const QString &extraInfo);
|
QString stateName(FileState state, const QString &extraInfo);
|
||||||
void chooseAction();
|
void chooseAction();
|
||||||
|
Reference in New Issue
Block a user