Commit bad8a15f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Introduce long timeout.

parent 79191a76
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
enum { p4Timeout = 20000 }; enum { p4Timeout = 20000 };
enum { longTimeoutFactor = 4 };
static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{ {
...@@ -866,9 +867,9 @@ static inline QString msgNotStarted(const QString &cmd) ...@@ -866,9 +867,9 @@ static inline QString msgNotStarted(const QString &cmd)
return PerforcePlugin::tr("Could not start perforce '%1'. Please check your settings in the preferences.").arg(cmd); return PerforcePlugin::tr("Could not start perforce '%1'. Please check your settings in the preferences.").arg(cmd);
} }
static inline QString msgTimeout() static inline QString msgTimeout(int timeOut)
{ {
return PerforcePlugin::tr("Perforce did not respond within timeout limit (%1 ms).").arg(p4Timeout ); return PerforcePlugin::tr("Perforce did not respond within timeout limit (%1 ms).").arg(timeOut );
} }
static inline QString msgCrash() static inline QString msgCrash()
...@@ -893,7 +894,8 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir, ...@@ -893,7 +894,8 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance(); VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance();
// Run, connect stderr to the output window // Run, connect stderr to the output window
Utils::SynchronousProcess process; Utils::SynchronousProcess process;
process.setTimeout(p4Timeout); const int timeOut = (flags & LongTimeOut) ? longTimeoutFactor * p4Timeout : p4Timeout;
process.setTimeout(timeOut);
process.setStdOutCodec(outputCodec); process.setStdOutCodec(outputCodec);
if (flags & OverrideDiffEnvironment) if (flags & OverrideDiffEnvironment)
process.setProcessEnvironment(overrideDiffEnvironmentVariable()); process.setProcessEnvironment(overrideDiffEnvironmentVariable());
...@@ -980,10 +982,11 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD ...@@ -980,10 +982,11 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
process.closeWriteChannel(); process.closeWriteChannel();
} }
if (!process.waitForFinished(p4Timeout)) { const int timeOut = (flags & LongTimeOut) ? longTimeoutFactor * p4Timeout : p4Timeout;
if (!process.waitForFinished(timeOut)) {
PerforceChecker::ensureProcessStopped(process); PerforceChecker::ensureProcessStopped(process);
response.error = true; response.error = true;
response.message = msgTimeout(); response.message = msgTimeout(timeOut);
return response; return response;
} }
if (process.exitStatus() != QProcess::NormalExit) { if (process.exitStatus() != QProcess::NormalExit) {
...@@ -1199,7 +1202,7 @@ bool PerforcePlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *subm ...@@ -1199,7 +1202,7 @@ bool PerforcePlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *subm
QStringList submitArgs; QStringList submitArgs;
submitArgs << QLatin1String("submit") << QLatin1String("-i"); submitArgs << QLatin1String("submit") << QLatin1String("-i");
const PerforceResponse submitResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), submitArgs, const PerforceResponse submitResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), submitArgs,
RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow|ShowBusyCursor, LongTimeOut|RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow|ShowBusyCursor,
QStringList(), changeDescription); QStringList(), changeDescription);
if (submitResponse.error) { if (submitResponse.error) {
VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("p4 submit failed: %1").arg(submitResponse.message)); VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("p4 submit failed: %1").arg(submitResponse.message));
......
...@@ -146,7 +146,8 @@ private: ...@@ -146,7 +146,8 @@ private:
// Run completely synchronously, no signals emitted // Run completely synchronously, no signals emitted
RunFullySynchronous = 0x20, RunFullySynchronous = 0x20,
IgnoreExitCode = 0x40, IgnoreExitCode = 0x40,
ShowBusyCursor = 0x80 ShowBusyCursor = 0x80,
LongTimeOut = 0x100
}; };
// args are passed as command line arguments // args are passed as command line arguments
......
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