diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index c20d63fa02221d7b3083344ed7e429ae19782cec..534241c76620679e02817a238f6f4a9af0b8bbdb 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -232,7 +232,7 @@ QStringList ClearCasePlugin::getVobList() const QStringList args(QLatin1String("lsvob")); args << QLatin1String("-s"); const ClearCaseResponse response = - runCleartool(currentState().topLevel(), args, m_settings.timeOutMS(), SilentRun); + runCleartool(currentState().topLevel(), args, m_settings.timeOutS, SilentRun); return response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts); } @@ -356,7 +356,7 @@ QString ClearCasePlugin::ccManagesDirectory(const QString &directory) const { QStringList args(QLatin1String("pwv")); const ClearCaseResponse response = - runCleartool(directory, args, m_settings.timeOutMS(), SilentRun); + runCleartool(directory, args, m_settings.timeOutS, SilentRun); if (response.error) return QString(); @@ -404,7 +404,7 @@ QString ClearCasePlugin::ccViewRoot(const QString &directory) const QStringList args(QLatin1String("pwv")); args << QLatin1String("-root"); const ClearCaseResponse response = - runCleartool(directory, args, m_settings.timeOutMS(), SilentRun); + runCleartool(directory, args, m_settings.timeOutS, SilentRun); QString root = response.stdOut.trimmed(); @@ -706,7 +706,7 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const QStringList args(QLatin1String("describe")); args << QLatin1String("-fmt") << QLatin1String("%En@@%PSn") << version; const ClearCaseResponse response = - runCleartool(currentState().topLevel(), args, m_settings.timeOutMS(), SilentRun); + runCleartool(currentState().topLevel(), args, m_settings.timeOutS, SilentRun); if (response.error || response.stdOut.endsWith(QLatin1Char('@'))) // <name-unknown>@@ return QString(); else @@ -722,7 +722,7 @@ QStringList ClearCasePlugin::ccGetActiveVobs() const const QString theViewRoot = viewRoot(); const ClearCaseResponse response = - runCleartool(theViewRoot, args, m_settings.timeOutMS(), SilentRun); + runCleartool(theViewRoot, args, m_settings.timeOutS, SilentRun); if (response.error) return res; @@ -774,7 +774,7 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr args << QLatin1String("-fmt") << QLatin1String("%[activity]p"); args << file; const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), SilentRun); + runCleartool(workingDir, args, m_settings.timeOutS, SilentRun); return response.stdOut; } @@ -911,7 +911,7 @@ void ClearCasePlugin::undoCheckOutCurrent() args << fileName; const ClearCaseResponse diffResponse = - runCleartool(state.currentFileTopLevel(), args, m_settings.timeOutMS(), 0); + runCleartool(state.currentFileTopLevel(), args, m_settings.timeOutS, 0); bool different = diffResponse.error; // return value is 1 if there is any difference bool keep = false; @@ -940,7 +940,7 @@ bool ClearCasePlugin::vcsUndoCheckOut(const QString &workingDir, const QString & args << QDir::toNativeSeparators(fileName); const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); if (!response.error) { @@ -973,7 +973,7 @@ bool ClearCasePlugin::vcsUndoHijack(const QString &workingDir, const QString &fi args << QDir::toNativeSeparators(fileName); const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); if (!response.error && !m_settings.disableIndexer) { const QString absPath = workingDir + QLatin1Char('/') + fileName; @@ -1080,7 +1080,7 @@ QStringList ClearCasePlugin::ccGetActivityVersions(const QString &workingDir, co QStringList args(QLatin1String("lsactivity")); args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity; const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), SilentRun); + runCleartool(workingDir, args, m_settings.timeOutS, SilentRun); if (response.error) return QStringList(); QStringList versions = response.stdOut.split(QLatin1String(", ")); @@ -1306,8 +1306,7 @@ void ClearCasePlugin::history(const QString &workingDir, args.append(QDir::toNativeSeparators(file)); const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), - 0, codec); + runCleartool(workingDir, args, m_settings.timeOutS, 0, codec); if (response.error) return; @@ -1367,7 +1366,7 @@ void ClearCasePlugin::ccUpdate(const QString &workingDir, const QStringList &rel if (!relativePaths.isEmpty()) args.append(relativePaths); const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); + runCleartool(workingDir, args, m_settings.longTimeOutS(), ShowStdOutInLogWindow); if (!response.error) clearCaseControl()->emitRepositoryChanged(workingDir); } @@ -1408,7 +1407,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file args.append(QDir::toNativeSeparators(id)); const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), 0, codec); + runCleartool(workingDir, args, m_settings.timeOutS, 0, codec); if (response.error) return; @@ -1458,7 +1457,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr) args.push_back(id); QTextCodec *codec = VcsBaseEditor::getCodec(source); const ClearCaseResponse response = - runCleartool(topLevel, args, m_settings.timeOutMS(), 0, codec); + runCleartool(topLevel, args, m_settings.timeOutS, 0, codec); description = response.stdOut; if (m_settings.extDiffAvailable) description += diffExternal(id); @@ -1486,13 +1485,13 @@ void ClearCasePlugin::checkInSelected() QString ClearCasePlugin::runCleartoolSync(const QString &workingDir, const QStringList &arguments) const { - return runCleartool(workingDir, arguments, m_settings.timeOutMS(), SilentRun).stdOut; + return runCleartool(workingDir, arguments, m_settings.timeOutS, SilentRun).stdOut; } ClearCaseResponse ClearCasePlugin::runCleartool(const QString &workingDir, const QStringList &arguments, - int timeOut, + int timeOutS, unsigned flags, QTextCodec *outputCodec) const { @@ -1506,12 +1505,12 @@ ClearCasePlugin::runCleartool(const QString &workingDir, const SynchronousProcessResponse sp_resp = VcsBasePlugin::runVcs(workingDir, FileName::fromUserInput(executable), - arguments, timeOut, + arguments, timeOutS, flags, outputCodec); response.error = sp_resp.result != SynchronousProcessResponse::Finished; if (response.error) - response.message = sp_resp.exitMessage(executable, timeOut); + response.message = sp_resp.exitMessage(executable, timeOutS); response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; return response; @@ -1629,7 +1628,7 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName } args << file; ClearCaseResponse response = - runCleartool(topLevel, args, m_settings.timeOutMS(), ShowStdOutInLogWindow | + runCleartool(topLevel, args, m_settings.timeOutS, ShowStdOutInLogWindow | SuppressStdErrInLogWindow | FullySynchronously); if (response.error) { if (response.stdErr.contains(QLatin1String("Versions other than the selected version"))) { @@ -1639,7 +1638,7 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName ccUpdate(workingDir, QStringList() << file); else args.removeOne(QLatin1String("-query")); - response = runCleartool(topLevel, args, m_settings.timeOutMS(), + response = runCleartool(topLevel, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); } } else { @@ -1675,7 +1674,7 @@ bool ClearCasePlugin::vcsSetActivity(const QString &workingDir, const QString &t QStringList args; args << QLatin1String("setactivity") << activity; const ClearCaseResponse actResponse = - runCleartool(workingDir, args, m_settings.timeOutMS(), ShowStdOutInLogWindow); + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow); if (actResponse.error) { QMessageBox::warning(ICore::dialogParent(), title, tr("Set current activity failed: %1").arg(actResponse.message), QMessageBox::Ok); @@ -1719,7 +1718,7 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList & blockers.append(fcb); } const ClearCaseResponse response = - runCleartool(m_checkInView, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); + runCleartool(m_checkInView, args, m_settings.longTimeOutS(), ShowStdOutInLogWindow); QRegExp checkedIn(QLatin1String("Checked in \\\"([^\"]*)\\\"")); bool anySucceeded = false; int offset = checkedIn.indexIn(response.stdOut); @@ -1785,7 +1784,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title, QStringList args; args << QLatin1String("checkout") << commentArg << dirName; const ClearCaseResponse coResponse = - runCleartool(workingDir, args, m_settings.timeOutMS(), + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); if (coResponse.error) { if (coResponse.stdErr.contains(QLatin1String("already checked out"))) @@ -1800,7 +1799,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title, if (!file2.isEmpty()) args << QDir::toNativeSeparators(file2); const ClearCaseResponse opResponse = - runCleartool(workingDir, args, m_settings.timeOutMS(), + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); if (opResponse.error) { // on failure - undo checkout for the directory @@ -1814,7 +1813,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title, args.clear(); args << QLatin1String("checkin") << commentArg << dirName; const ClearCaseResponse ciResponse = - runCleartool(workingDir, args, m_settings.timeOutMS(), + runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow | FullySynchronously); return !ciResponse.error; } @@ -1963,7 +1962,7 @@ bool ClearCasePlugin::newActivity() } const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.timeOutMS(), 0); + runCleartool(workingDir, args, m_settings.timeOutS, 0); if (!response.error) refreshActivities(); @@ -2103,7 +2102,7 @@ QString ClearCasePlugin::getFile(const QString &nativeFile, const QString &prefi QStringList args(QLatin1String("get")); args << QLatin1String("-to") << tempFile << nativeFile; const ClearCaseResponse response = - runCleartool(m_topLevel, args, m_settings.timeOutMS(), SilentRun); + runCleartool(m_topLevel, args, m_settings.timeOutS, SilentRun); if (response.error) return QString(); QFile::setPermissions(tempFile, QFile::ReadOwner | QFile::ReadUser | @@ -2146,8 +2145,7 @@ QString ClearCasePlugin::diffExternal(QString file1, QString file2, bool keep) } else { args << file2; } - const QString diffResponse = - runExtDiff(m_topLevel, args, m_settings.timeOutMS(), codec); + const QString diffResponse = runExtDiff(m_topLevel, args, m_settings.timeOutS, codec); if (!keep && !tempFile1.isEmpty()) { QFile::remove(tempFile1); QFileInfo(tempFile1).dir().rmpath(QLatin1String(".")); @@ -2179,10 +2177,8 @@ void ClearCasePlugin::diffGraphical(const QString &file1, const QString &file2) QProcess::startDetached(m_settings.ccBinaryPath, args, m_topLevel); } -QString ClearCasePlugin::runExtDiff(const QString &workingDir, - const QStringList &arguments, - int timeOut, - QTextCodec *outputCodec) +QString ClearCasePlugin::runExtDiff(const QString &workingDir, const QStringList &arguments, + int timeOutS, QTextCodec *outputCodec) { const QString executable(QLatin1String("diff")); QStringList args(m_settings.diffArgs.split(QLatin1Char(' '), QString::SkipEmptyParts)); @@ -2191,7 +2187,7 @@ QString ClearCasePlugin::runExtDiff(const QString &workingDir, QProcess process; process.setWorkingDirectory(workingDir); process.start(executable, args); - if (!process.waitForFinished(timeOut)) + if (!process.waitForFinished(timeOutS * 1000)) return QString(); QByteArray ba = process.readAll(); return outputCodec ? outputCodec->toUnicode(ba) : diff --git a/src/plugins/clearcase/clearcaseplugin.h b/src/plugins/clearcase/clearcaseplugin.h index 16ba8ce87dda6fa995f7f616bd13018b4e1210d6..d8846b100bf89bdac17f25840a54b92f25c435c1 100644 --- a/src/plugins/clearcase/clearcaseplugin.h +++ b/src/plugins/clearcase/clearcaseplugin.h @@ -235,9 +235,8 @@ private: int editorType, const QString &source, QTextCodec *codec) const; QString runCleartoolSync(const QString &workingDir, const QStringList &arguments) const; - ClearCaseResponse runCleartool(const QString &workingDir, - const QStringList &arguments, int timeOut, - unsigned flags, QTextCodec *outputCodec = 0) const; + ClearCaseResponse runCleartool(const QString &workingDir, const QStringList &arguments, + int timeOutS, unsigned flags, QTextCodec *outputCodec = 0) const; static void sync(QFutureInterface<void> &future, QStringList files); void history(const QString &workingDir, @@ -255,8 +254,8 @@ private: QString diffExternal(QString file1, QString file2 = QString(), bool keep = false); QString getFile(const QString &nativeFile, const QString &prefix); static void rmdir(const QString &path); - QString runExtDiff(const QString &workingDir, const QStringList &arguments, - int timeOut, QTextCodec *outputCodec = 0); + QString runExtDiff(const QString &workingDir, const QStringList &arguments, int timeOutS, + QTextCodec *outputCodec = 0); static QString getDriveLetterOfPath(const QString &directory); FileStatus::Status getFileStatus(const QString &fileName) const; diff --git a/src/plugins/clearcase/clearcasesettings.cpp b/src/plugins/clearcase/clearcasesettings.cpp index abfdcf84c96391a072b116d646d65a45dc6fc295..f02c354d33499d232b27c40cd7d812436309471a 100644 --- a/src/plugins/clearcase/clearcasesettings.cpp +++ b/src/plugins/clearcase/clearcasesettings.cpp @@ -63,17 +63,16 @@ using namespace ClearCase::Internal; ClearCaseSettings::ClearCaseSettings() : ccCommand(defaultCommand()), - historyCount(defaultHistoryCount), - timeOutS(defaultTimeOutS), diffType(GraphicalDiff), diffArgs(QLatin1String(defaultDiffArgs)), autoAssignActivityName(true), autoCheckOut(true), promptToCheckIn(false), disableIndexer(false), - extDiffAvailable(false) -{ -} + extDiffAvailable(false), + historyCount(defaultHistoryCount), + timeOutS(defaultTimeOutS) +{ } void ClearCaseSettings::fromSettings(QSettings *settings) { diff --git a/src/plugins/clearcase/clearcasesettings.h b/src/plugins/clearcase/clearcasesettings.h index 95cca0956ca51e751f85a94c6075da71eb4755fe..f8892985d5ef56286e73d4f43a3b27d4dbd121a2 100644 --- a/src/plugins/clearcase/clearcasesettings.h +++ b/src/plugins/clearcase/clearcasesettings.h @@ -56,24 +56,23 @@ public: void fromSettings(QSettings *); void toSettings(QSettings *) const; - inline int timeOutMS() const { return timeOutS * 1000; } - inline int longTimeOutMS() const { return timeOutS * 10000; } + inline int longTimeOutS() const { return timeOutS * 10; } bool equals(const ClearCaseSettings &s) const; QString ccCommand; QString ccBinaryPath; - int historyCount; - int timeOutS; DiffType diffType; QString diffArgs; + QString indexOnlyVOBs; + QHash<QString, int> totalFiles; bool autoAssignActivityName; bool autoCheckOut; bool promptToCheckIn; bool disableIndexer; - QString indexOnlyVOBs; bool extDiffAvailable; - QHash<QString, int> totalFiles; + int historyCount; + int timeOutS; }; inline bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2) diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 3fbc418f1bef3cf03dd7d1300643326a3a14add4..d9b61771a8a38e0a13b31eb78fb750429b42e1fe 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -620,7 +620,7 @@ void CvsPlugin::revertAll() QStringList args; args << QLatin1String("update") << QLatin1String("-C") << state.topLevel(); const CvsResponse revertResponse = - runCvs(state.topLevel(), args, client()->vcsTimeout(), + runCvs(state.topLevel(), args, client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); if (revertResponse.result == CvsResponse::Ok) cvsVersionControl()->emitRepositoryChanged(state.topLevel()); @@ -636,7 +636,7 @@ void CvsPlugin::revertCurrentFile() QStringList args; args << QLatin1String("diff") << state.relativeCurrentFile(); const CvsResponse diffResponse = - runCvs(state.currentFileTopLevel(), args, client()->vcsTimeout(), 0); + runCvs(state.currentFileTopLevel(), args, client()->vcsTimeoutS(), 0); switch (diffResponse.result) { case CvsResponse::Ok: return; // Not modified, diff exit code 0 @@ -658,7 +658,7 @@ void CvsPlugin::revertCurrentFile() args.clear(); args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile(); const CvsResponse revertResponse = - runCvs(state.currentFileTopLevel(), args, client()->vcsTimeout(), + runCvs(state.currentFileTopLevel(), args, client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); if (revertResponse.result == CvsResponse::Ok) cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile())); @@ -720,7 +720,7 @@ void CvsPlugin::startCommit(const QString &workingDir, const QString &file) // where we are, so, have stdout/stderr channels merged. QStringList args = QStringList(QLatin1String("status")); const CvsResponse response = - runCvs(workingDir, args, client()->vcsTimeout(), MergeOutputChannels); + runCvs(workingDir, args, client()->vcsTimeoutS(), MergeOutputChannels); if (response.result != CvsResponse::Ok) return; // Get list of added/modified/deleted files and purge out undesired ones @@ -768,7 +768,7 @@ bool CvsPlugin::commit(const QString &messageFile, args << QLatin1String("-F") << messageFile; args.append(fileList); const CvsResponse response = - runCvs(m_commitRepository, args, 10 * client()->vcsTimeout(), + runCvs(m_commitRepository, args, 10 * client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); return response.result == CvsResponse::Ok ; } @@ -806,7 +806,7 @@ void CvsPlugin::filelog(const QString &workingDir, args << QLatin1String("log"); args.append(file); const CvsResponse response = - runCvs(workingDir, args, client()->vcsTimeout(), + runCvs(workingDir, args, client()->vcsTimeoutS(), SshPasswordPrompt, codec); if (response.result != CvsResponse::Ok) return; @@ -847,7 +847,7 @@ bool CvsPlugin::update(const QString &topLevel, const QString &file) if (!file.isEmpty()) args.append(file); const CvsResponse response = - runCvs(topLevel, args, 10 * client()->vcsTimeout(), + runCvs(topLevel, args, 10 * client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); const bool ok = response.result == CvsResponse::Ok; if (ok) @@ -894,7 +894,7 @@ bool CvsPlugin::edit(const QString &topLevel, const QStringList &files) QStringList args(QLatin1String("edit")); args.append(files); const CvsResponse response = - runCvs(topLevel, args, client()->vcsTimeout(), + runCvs(topLevel, args, client()->vcsTimeoutS(), ShowStdOutInLogWindow|SshPasswordPrompt); return response.result == CvsResponse::Ok; } @@ -906,7 +906,7 @@ bool CvsPlugin::diffCheckModified(const QString &topLevel, const QStringList &fi QStringList args(QLatin1String("-q")); args << QLatin1String("diff"); args.append(files); - const CvsResponse response = runCvs(topLevel, args, client()->vcsTimeout(), 0); + const CvsResponse response = runCvs(topLevel, args, client()->vcsTimeoutS(), 0); if (response.result == CvsResponse::OtherError) return false; *modified = response.result == CvsResponse::NonNullExitCode; @@ -934,7 +934,7 @@ bool CvsPlugin::unedit(const QString &topLevel, const QStringList &files) args.append(QLatin1String("-y")); args.append(files); const CvsResponse response = - runCvs(topLevel, args, client()->vcsTimeout(), + runCvs(topLevel, args, client()->vcsTimeoutS(), ShowStdOutInLogWindow|SshPasswordPrompt); return response.result == CvsResponse::Ok; } @@ -953,7 +953,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file, args << QLatin1String("-r") << revision; args << file; const CvsResponse response = - runCvs(workingDir, args, client()->vcsTimeout(), + runCvs(workingDir, args, client()->vcsTimeoutS(), SshPasswordPrompt, codec); if (response.result != CvsResponse::Ok) return; @@ -982,7 +982,7 @@ bool CvsPlugin::status(const QString &topLevel, const QString &file, const QStri if (!file.isEmpty()) args.append(file); const CvsResponse response = - runCvs(topLevel, args, client()->vcsTimeout(), 0); + runCvs(topLevel, args, client()->vcsTimeoutS(), 0); const bool ok = response.result == CvsResponse::Ok; if (ok) showOutputInEditor(title, response.stdOut, OtherContent, topLevel, 0); @@ -1065,7 +1065,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const QStringList args; args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file; const CvsResponse logResponse = - runCvs(toplevel, args, client()->vcsTimeout(), SshPasswordPrompt); + runCvs(toplevel, args, client()->vcsTimeoutS(), SshPasswordPrompt); if (logResponse.result != CvsResponse::Ok) { *errorMessage = logResponse.message; return false; @@ -1087,7 +1087,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS); const CvsResponse repoLogResponse = - runCvs(toplevel, args, 10 * client()->vcsTimeout(), SshPasswordPrompt); + runCvs(toplevel, args, 10 * client()->vcsTimeoutS(), SshPasswordPrompt); if (repoLogResponse.result != CvsResponse::Ok) { *errorMessage = repoLogResponse.message; return false; @@ -1124,7 +1124,7 @@ bool CvsPlugin::describe(const QString &repositoryPath, QStringList args(QLatin1String("log")); args << (QLatin1String("-r") + it->revisions.front().revision) << it->file; const CvsResponse logResponse = - runCvs(repositoryPath, args, client()->vcsTimeout(), SshPasswordPrompt); + runCvs(repositoryPath, args, client()->vcsTimeoutS(), SshPasswordPrompt); if (logResponse.result != CvsResponse::Ok) { *errorMessage = logResponse.message; return false; @@ -1141,7 +1141,7 @@ bool CvsPlugin::describe(const QString &repositoryPath, << QLatin1String("-r") << previousRev << QLatin1String("-r") << it->revisions.front().revision << it->file; const CvsResponse diffResponse = - runCvs(repositoryPath, args, client()->vcsTimeout(), 0, codec); + runCvs(repositoryPath, args, client()->vcsTimeoutS(), 0, codec); switch (diffResponse.result) { case CvsResponse::Ok: case CvsResponse::NonNullExitCode: // Diff exit code != 0 @@ -1185,7 +1185,7 @@ void CvsPlugin::submitCurrentLog() // the working directory (see above). CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, const QStringList &arguments, - int timeOut, + int timeOutS, unsigned flags, QTextCodec *outputCodec) const { @@ -1199,7 +1199,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, // Run, connect stderr to the output window const SynchronousProcessResponse sp_resp = runVcs(workingDirectory, executable, client()->settings().addOptions(arguments), - timeOut, flags, outputCodec); + timeOutS, flags, outputCodec); response.result = CvsResponse::OtherError; response.stdErr = sp_resp.stdErr; @@ -1218,7 +1218,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, } if (response.result != CvsResponse::Ok) - response.message = sp_resp.exitMessage(executable.toString(), timeOut); + response.message = sp_resp.exitMessage(executable.toString(), timeOutS); return response; } @@ -1261,7 +1261,7 @@ bool CvsPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName) QStringList args; args << QLatin1String("add") << rawFileName; const CvsResponse response = - runCvs(workingDir, args, client()->vcsTimeout(), + runCvs(workingDir, args, client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); return response.result == CvsResponse::Ok; } @@ -1271,7 +1271,7 @@ bool CvsPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName) QStringList args; args << QLatin1String("remove") << QLatin1String("-f") << rawFileName; const CvsResponse response = - runCvs(workingDir, args, client()->vcsTimeout(), + runCvs(workingDir, args, client()->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); return response.result == CvsResponse::Ok; } @@ -1317,7 +1317,7 @@ bool CvsPlugin::managesFile(const QString &workingDirectory, const QString &file QStringList args; args << QLatin1String("status") << fileName; const CvsResponse response = - runCvs(workingDirectory, args, client()->vcsTimeout(), SshPasswordPrompt); + runCvs(workingDirectory, args, client()->vcsTimeoutS(), SshPasswordPrompt); if (response.result != CvsResponse::Ok) return false; return !response.stdOut.contains(QLatin1String("Status: Unknown")); diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index e23be425b6927e4d4f04de9044861279dc3fcd36..47458336725a6c0e74c08a9bd3306714c1994698 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -142,7 +142,7 @@ private: CvsResponse runCvs(const QString &workingDirectory, const QStringList &arguments, - int timeOut, + int timeOutS, unsigned flags, QTextCodec *outputCodec = 0) const; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index d0c84b081ee9380b4a14192ff826a1259ef1c433..329995df64cdc5fafac50d97265c48a5891624d7 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -157,7 +157,7 @@ void BaseController::runCommand(const QList<QStringList> &args, QTextCodec *code foreach (const QStringList &arg, args) { QTC_ASSERT(!arg.isEmpty(), continue); - m_command->addJob(arg, gitClient()->vcsTimeout()); + m_command->addJob(arg, gitClient()->vcsTimeoutS()); } m_command->execute(); @@ -1998,7 +1998,7 @@ SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirec unsigned flags, QTextCodec *outputCodec) const { - return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), gitArguments, vcsTimeout() * 1000, + return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), gitArguments, vcsTimeoutS(), flags, outputCodec, processEnvironment()); } @@ -2010,8 +2010,7 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory, { VcsCommand command(vcsBinary(), workingDirectory, processEnvironment()); command.addFlags(flags); - return command.runFullySynchronous(gitArguments, vcsTimeout() * 1000, - outputText, errorText); + return command.runFullySynchronous(gitArguments, vcsTimeoutS(), outputText, errorText); } void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt) diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index 7ca29f347f64a12dd33b0b742451928810639f0c..82ed3dc9951693e1c40fee7357c9f9e196ef3e2b 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -159,7 +159,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString & QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QLatin1String("LANGUAGE"), QLatin1String("C")); const SynchronousProcessResponse resp = VcsBasePlugin::runVcs( - workingDir, vcsBinary(), args, vcsTimeout() * 1000, flags, 0, env); + workingDir, vcsBinary(), args, vcsTimeoutS(), flags, 0, env); const bool ok = resp.result == SynchronousProcessResponse::Finished; parsePullOutput(resp.stdOut.trimmed()); diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp index db1b2be053c0f68eefc639b797b3c6a89ca89470..fa284ec7ee12f1424d5bec5afc90d19e01337173 100644 --- a/src/plugins/subversion/subversionclient.cpp +++ b/src/plugins/subversion/subversionclient.cpp @@ -222,7 +222,7 @@ QString DiffController::getDescription() const args << QString::number(m_changeNumber); const SubversionResponse logResponse = SubversionPlugin::instance()->runSvn(m_workingDirectory, args, - m_client->vcsTimeout() * 1000, + m_client->vcsTimeoutS(), VcsBasePlugin::SshPasswordPrompt); if (logResponse.error) @@ -252,7 +252,7 @@ void DiffController::postCollectTextualDiffOutput() args << m_filesList; } - command->addJob(args, m_client->vcsTimeout()); + command->addJob(args, m_client->vcsTimeoutS()); command->execute(); } diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 51480d5f280e336342718c3501d341043811aeac..a6851242100eca3d11c8fc4d98f8ee337a424dc8 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -585,7 +585,7 @@ void SubversionPlugin::revertAll() args << SubversionClient::addAuthenticationOptions(client()->settings()); args << QLatin1String("--recursive") << state.topLevel(); const SubversionResponse revertResponse - = runSvn(state.topLevel(), args, m_client->vcsTimeout() * 1000, + = runSvn(state.topLevel(), args, m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); if (revertResponse.error) QMessageBox::warning(ICore::dialogParent(), title, @@ -604,7 +604,7 @@ void SubversionPlugin::revertCurrentFile() args.push_back(state.relativeCurrentFile()); const SubversionResponse diffResponse - = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeout() * 1000, 0); + = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0); if (diffResponse.error) return; @@ -625,7 +625,7 @@ void SubversionPlugin::revertCurrentFile() args << state.relativeCurrentFile(); const SubversionResponse revertResponse - = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeout() * 1000, + = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); if (!revertResponse.error) @@ -688,7 +688,7 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList args += files; const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeout() * 1000, 0); + = runSvn(workingDir, args, m_client->vcsTimeoutS(), 0); if (response.error) return; @@ -768,8 +768,7 @@ void SubversionPlugin::svnStatus(const QString &workingDir, const QString &relat if (!relativePath.isEmpty()) args.append(relativePath); VcsOutputWindow::setRepository(workingDir); - runSvn(workingDir, args, m_client->vcsTimeout() * 1000, - ShowStdOutInLogWindow|ShowSuccessMessage); + runSvn(workingDir, args, m_client->vcsTimeoutS(), ShowStdOutInLogWindow|ShowSuccessMessage); VcsOutputWindow::clearRepository(); } @@ -795,7 +794,7 @@ void SubversionPlugin::svnUpdate(const QString &workingDir, const QString &relat if (!relativePath.isEmpty()) args.append(relativePath); const SubversionResponse response - = runSvn(workingDir, args, 10 * m_client->vcsTimeout() * 1000, + = runSvn(workingDir, args, 10 * m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); if (!response.error) subVersionControl()->emitRepositoryChanged(workingDir); @@ -834,7 +833,7 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil args.append(QDir::toNativeSeparators(file)); const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeout() * 1000, + = runSvn(workingDir, args, m_client->vcsTimeoutS(), SshPasswordPrompt|ForceCLocale, codec); if (response.error) return; @@ -915,8 +914,9 @@ void SubversionPlugin::submitCurrentLog() } SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, - const QStringList &arguments, int timeOut, - unsigned flags, QTextCodec *outputCodec) const + const QStringList &arguments, + int timeOutS, unsigned flags, + QTextCodec *outputCodec) const { const FileName executable = client()->vcsBinary(); SubversionResponse response; @@ -927,12 +927,12 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, } const SynchronousProcessResponse sp_resp = - VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOut, + VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOutS, flags, outputCodec); response.error = sp_resp.result != SynchronousProcessResponse::Finished; if (response.error) - response.message = sp_resp.exitMessage(executable.toString(), timeOut); + response.message = sp_resp.exitMessage(executable.toString(), timeOutS * 1000); response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; return response; @@ -998,7 +998,7 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN << SubversionClient::addAuthenticationOptions(client()->settings()) << QLatin1String("--parents") << file; const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeout() * 1000, + = runSvn(workingDir, args, m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); return !response.error; } @@ -1013,7 +1013,7 @@ bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFi << QLatin1String("--force") << file; const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeout() * 1000, + = runSvn(workingDir, args, m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow); return !response.error; } @@ -1024,7 +1024,7 @@ bool SubversionPlugin::vcsMove(const QString &workingDir, const QString &from, c args << SubversionClient::addAuthenticationOptions(client()->settings()); args << QDir::toNativeSeparators(from) << QDir::toNativeSeparators(to); const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeout() * 1000, + = runSvn(workingDir, args, m_client->vcsTimeoutS(), SshPasswordPrompt|ShowStdOutInLogWindow|FullySynchronously); return !response.error; } @@ -1052,7 +1052,7 @@ bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &u args << QLatin1String(tempUrl.toEncoded()) << directory; const SubversionResponse response - = runSvn(directory, args, 10 * m_client->vcsTimeout() * 1000, + = runSvn(directory, args, 10 * m_client->vcsTimeoutS(), VcsBasePlugin::SshPasswordPrompt); return !response.error; @@ -1087,7 +1087,7 @@ bool SubversionPlugin::managesFile(const QString &workingDirectory, const QStrin args << QLatin1String("status"); args << SubversionClient::addAuthenticationOptions(client()->settings()) << fileName; SubversionResponse response - = runSvn(workingDirectory, args, m_client->vcsTimeout() * 1000, 0); + = runSvn(workingDirectory, args, m_client->vcsTimeoutS(), 0); return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?'); } diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 4ce214c923d5f82a24bb80c55170244d92a0a4a4..dcc16c3f7151d3d453cacad73a5f96de8c1cbd33 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -92,7 +92,7 @@ public: QString monitorFile(const QString &repository) const; QString synchronousTopic(const QString &repository) const; SubversionResponse runSvn(const QString &workingDir, - const QStringList &arguments, int timeOut, + const QStringList &arguments, int timeOutS, unsigned flags, QTextCodec *outputCodec = 0) const; public slots: diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 75760e3150a2653daa02d1cc68940793dc830291..2120adf094dcbfc222c129ecc3d309f051c3bfa7 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -142,7 +142,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory, JobOutputBindMode mode) const { auto cmd = new VcsCommand(vcsBinary(), workingDirectory, processEnvironment()); - cmd->setDefaultTimeout(vcsTimeout()); + cmd->setDefaultTimeoutS(vcsTimeoutS()); if (editor) d->bindCommandToEditor(cmd, editor); if (mode == VcsWindowOutputBind) { @@ -159,7 +159,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory, void VcsBaseClientImpl::enqueueJob(VcsCommand *cmd, const QStringList &args, Utils::ExitCodeInterpreter *interpreter) { - cmd->addJob(args, vcsTimeout(), interpreter); + cmd->addJob(args, vcsTimeoutS(), interpreter); cmd->execute(); } @@ -188,7 +188,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector annotate(workingDirectory, file, changeCopy, line); } -int VcsBaseClientImpl::vcsTimeout() const +int VcsBaseClientImpl::vcsTimeoutS() const { return settings().intValue(VcsBaseClientSettings::timeoutKey); } @@ -394,11 +394,11 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir, vcsProcess.closeWriteChannel(); QByteArray stdErr; - if (!Utils::SynchronousProcess::readDataFromProcess(vcsProcess, vcsTimeout() * 1000, + if (!Utils::SynchronousProcess::readDataFromProcess(vcsProcess, vcsTimeoutS() * 1000, output, &stdErr, true)) { Utils::SynchronousProcess::stopProcess(vcsProcess); VcsOutputWindow::appendError(tr("Timed out after %1s waiting for the process %2 to finish.") - .arg(vcsTimeout()).arg(binary.toUserOutput())); + .arg(vcsTimeoutS()).arg(binary.toUserOutput())); return false; } if (!stdErr.isEmpty()) @@ -412,8 +412,8 @@ Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QStrin unsigned flags, QTextCodec *outputCodec) const { - return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeout() * 1000, - flags, outputCodec); + return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeoutS(), flags, + outputCodec); } void VcsBaseClient::annotate(const QString &workingDir, const QString &file, diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index aae128ceb3ecf7873b5a2f78f12916b808f2f8f3..1a70f7cfa1bbd57e6cd157049d13fd37cff5ed5a 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -74,7 +74,7 @@ public: VcsBaseClientSettings &settings() const; virtual Utils::FileName vcsBinary() const; - int vcsTimeout() const; + int vcsTimeoutS() const; enum JobOutputBindMode { NoOutputBind, diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 366f76d51f6865c2be9dc092dac048bf529e971b..429181a90883e042bfe3283cb7a35956380ad1cf 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -804,7 +804,7 @@ void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e, SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, const FileName &binary, const QStringList &arguments, - int timeOutMS, + int timeOutS, unsigned flags, QTextCodec *outputCodec, const QProcessEnvironment &env) @@ -813,7 +813,7 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, env.isEmpty() ? QProcessEnvironment::systemEnvironment() : env); command.addFlags(flags); command.setCodec(outputCodec); - return command.runVcs(arguments, timeOutMS); + return command.runVcs(arguments, timeOutS); } } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 3b92423518ddbf138bbdce127ee1127b9ef532d7..8c91e01d0e48a7cd2fd425e9c3221ee3105e0ad8 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -188,7 +188,7 @@ public: static Utils::SynchronousProcessResponse runVcs(const QString &workingDir, const Utils::FileName &binary, const QStringList &arguments, - int timeOutMS, + int timeOutS, unsigned flags = 0, QTextCodec *outputCodec = 0, const QProcessEnvironment &env = QProcessEnvironment()); diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index 1f6c3de5334dc1ff9c0ad9d7b04939304675e171..fc305237b4a59d9b24596bfd2f838ea55ef7e2c9 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -84,7 +84,7 @@ public: explicit Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter = 0); QStringList arguments; - int timeout; + int timeoutS; Utils::ExitCodeInterpreter *exitCodeInterpreter; }; @@ -97,7 +97,7 @@ public: const QString m_workingDirectory; const QProcessEnvironment m_environment; QVariant m_cookie; - int m_defaultTimeout; + int m_defaultTimeoutS; unsigned m_flags; QTextCodec *m_codec; const QString m_sshPasswordPrompt; @@ -120,7 +120,7 @@ VcsCommandPrivate::VcsCommandPrivate(const Utils::FileName &binary, m_binaryPath(binary), m_workingDirectory(workingDirectory), m_environment(environment), - m_defaultTimeout(10), + m_defaultTimeoutS(10), m_flags(0), m_codec(0), m_sshPasswordPrompt(VcsBasePlugin::sshPrompt()), @@ -141,7 +141,7 @@ VcsCommandPrivate::~VcsCommandPrivate() VcsCommandPrivate::Job::Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter) : arguments(a), - timeout(t), + timeoutS(t), exitCodeInterpreter(interpreter) { // Finished cookie is emitted via queued slot, needs metatype @@ -180,14 +180,14 @@ const QProcessEnvironment &VcsCommand::processEnvironment() const return d->m_environment; } -int VcsCommand::defaultTimeout() const +int VcsCommand::defaultTimeoutS() const { - return d->m_defaultTimeout; + return d->m_defaultTimeoutS; } -void VcsCommand::setDefaultTimeout(int timeout) +void VcsCommand::setDefaultTimeoutS(int timeout) { - d->m_defaultTimeout = timeout; + d->m_defaultTimeoutS = timeout; } unsigned VcsCommand::flags() const @@ -202,12 +202,13 @@ void VcsCommand::addFlags(unsigned f) void VcsCommand::addJob(const QStringList &arguments, Utils::ExitCodeInterpreter *interpreter) { - addJob(arguments, defaultTimeout(), interpreter); + addJob(arguments, defaultTimeoutS(), interpreter); } -void VcsCommand::addJob(const QStringList &arguments, int timeout, Utils::ExitCodeInterpreter *interpreter) +void VcsCommand::addJob(const QStringList &arguments, int timeoutS, + Utils::ExitCodeInterpreter *interpreter) { - d->m_jobs.push_back(Internal::VcsCommandPrivate::Job(arguments, timeout, interpreter)); + d->m_jobs.push_back(Internal::VcsCommandPrivate::Job(arguments, timeoutS, interpreter)); } void VcsCommand::execute() @@ -272,11 +273,8 @@ void VcsCommand::run(QFutureInterface<void> &future) d->m_lastExecSuccess = true; for (int j = 0; j < count; j++) { const Internal::VcsCommandPrivate::Job &job = d->m_jobs.at(j); - const int timeOutSeconds = job.timeout; - Utils::SynchronousProcessResponse resp = runVcs( - job.arguments, - timeOutSeconds >= 0 ? timeOutSeconds * 1000 : -1, - job.exitCodeInterpreter); + Utils::SynchronousProcessResponse resp + = runVcs( job.arguments, job.timeoutS, job.exitCodeInterpreter); stdOut += resp.stdOut; stdErr += resp.stdErr; d->m_lastExecExitCode = resp.exitCode; @@ -334,7 +332,7 @@ signals: void appendMessage(const QString &text); }; -Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &arguments, int timeoutMS, +Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &arguments, int timeoutS, Utils::ExitCodeInterpreter *interpreter) { Utils::SynchronousProcessResponse response; @@ -352,7 +350,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument if (debugExecution) { QDebug nsp = qDebug().nospace(); nsp << "Command::runVcs" << d->m_workingDirectory << d->m_binaryPath << arguments - << timeoutMS; + << timeoutS; if (d->m_flags & VcsBasePlugin::ShowStdOutInLogWindow) nsp << "stdout"; if (d->m_flags & VcsBasePlugin::SuppressStdErrInLogWindow) @@ -379,7 +377,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument // if (d->m_flags & ExpectRepoChanges) // Core::DocumentManager::expectDirectoryChange(d->m_workingDirectory); if (d->m_flags & VcsBasePlugin::FullySynchronously) { - response = runSynchronous(arguments, timeoutMS, interpreter); + response = runSynchronous(arguments, timeoutS, interpreter); } else { Utils::SynchronousProcess process; process.setExitCodeInterpreter(interpreter); @@ -392,7 +390,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument (d->m_flags & VcsBasePlugin::ForceCLocale), d->m_sshPasswordPrompt); process.setProcessEnvironment(env); - process.setTimeout(timeoutMS); + process.setTimeout(timeoutS * 1000); if (d->m_codec) process.setCodec(d->m_codec); @@ -429,11 +427,11 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument if (response.result == Utils::SynchronousProcessResponse::Finished) { if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) { emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath.toUserOutput(), - timeoutMS)); + timeoutS)); } } else if (!(d->m_flags & VcsBasePlugin::SuppressFailMessageInLogWindow)) { emit outputProxy.appendError(response.exitMessage(d->m_binaryPath.toUserOutput(), - timeoutMS)); + timeoutS)); } } emitRepositoryChanged(); @@ -442,7 +440,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument } Utils::SynchronousProcessResponse VcsCommand::runSynchronous(const QStringList &arguments, - int timeoutMS, + int timeoutS, Utils::ExitCodeInterpreter *interpreter) { Utils::SynchronousProcessResponse response; @@ -474,7 +472,7 @@ Utils::SynchronousProcessResponse VcsCommand::runSynchronous(const QStringList & QByteArray stdOut; QByteArray stdErr; const bool timedOut = - !Utils::SynchronousProcess::readDataFromProcess(*process.data(), timeoutMS, + !Utils::SynchronousProcess::readDataFromProcess(*process.data(), timeoutS * 1000, &stdOut, &stdErr, true); if (!d->m_aborted) { @@ -519,7 +517,7 @@ void VcsCommand::emitRepositoryChanged() Core::VcsManager::emitRepositoryChanged(d->m_workingDirectory); } -bool VcsCommand::runFullySynchronous(const QStringList &arguments, int timeoutMS, +bool VcsCommand::runFullySynchronous(const QStringList &arguments, int timeoutS, QByteArray *outputData, QByteArray *errorData) { if (d->m_binaryPath.isEmpty()) @@ -547,9 +545,9 @@ bool VcsCommand::runFullySynchronous(const QStringList &arguments, int timeoutMS return false; } - if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutMS, outputData, errorData, true)) { + if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutS * 1000, outputData, errorData, true)) { if (errorData) - errorData->append(tr("Error: Executable timed out after %1s.").arg(timeoutMS / 1000).toLocal8Bit()); + errorData->append(tr("Error: Executable timed out after %1s.").arg(timeoutS).toLocal8Bit()); Utils::SynchronousProcess::stopProcess(process); return false; } diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index f2eea82553dcac3849b76c178d9e66b943ee2930..966e679c301d38a80aafc923ec8e350c02565d0a 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -83,7 +83,8 @@ public: ~VcsCommand(); void addJob(const QStringList &arguments, Utils::ExitCodeInterpreter *interpreter = 0); - void addJob(const QStringList &arguments, int timeout, Utils::ExitCodeInterpreter *interpreter = 0); + void addJob(const QStringList &arguments, int timeoutS, + Utils::ExitCodeInterpreter *interpreter = 0); void execute(); void abort(); bool lastExecutionSuccess() const; @@ -93,8 +94,8 @@ public: const QString &workingDirectory() const; const QProcessEnvironment &processEnvironment() const; - int defaultTimeout() const; - void setDefaultTimeout(int timeout); + int defaultTimeoutS() const; + void setDefaultTimeoutS(int timeout); unsigned flags() const; void addFlags(unsigned f); @@ -108,15 +109,15 @@ public: void setProgressParser(ProgressParser *parser); void setProgressiveOutput(bool progressive); - Utils::SynchronousProcessResponse runVcs(const QStringList &arguments, int timeoutMS, + Utils::SynchronousProcessResponse runVcs(const QStringList &arguments, int timeoutS, Utils::ExitCodeInterpreter *interpreter = 0); // Make sure to not pass through the event loop at all: - bool runFullySynchronous(const QStringList &arguments, int timeoutMS, + bool runFullySynchronous(const QStringList &arguments, int timeoutS, QByteArray *outputData, QByteArray *errorData); private: void run(QFutureInterface<void> &future); - Utils::SynchronousProcessResponse runSynchronous(const QStringList &arguments, int timeoutMS, + Utils::SynchronousProcessResponse runSynchronous(const QStringList &arguments, int timeoutS, Utils::ExitCodeInterpreter *interpreter = 0); void emitRepositoryChanged();