Vcs: Standardize on second based timeouts

Change-Id: Ia273fda05a4c4a1934819f26e5dc1b6b80a89f6f
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-04-10 14:44:17 +02:00
parent a55fb4a378
commit 7719fb669c
17 changed files with 134 additions and 143 deletions

View File

@@ -232,7 +232,7 @@ QStringList ClearCasePlugin::getVobList() const
QStringList args(QLatin1String("lsvob")); QStringList args(QLatin1String("lsvob"));
args << QLatin1String("-s"); args << QLatin1String("-s");
const ClearCaseResponse response = 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); return response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts);
} }
@@ -356,7 +356,7 @@ QString ClearCasePlugin::ccManagesDirectory(const QString &directory) const
{ {
QStringList args(QLatin1String("pwv")); QStringList args(QLatin1String("pwv"));
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(directory, args, m_settings.timeOutMS(), SilentRun); runCleartool(directory, args, m_settings.timeOutS, SilentRun);
if (response.error) if (response.error)
return QString(); return QString();
@@ -404,7 +404,7 @@ QString ClearCasePlugin::ccViewRoot(const QString &directory) const
QStringList args(QLatin1String("pwv")); QStringList args(QLatin1String("pwv"));
args << QLatin1String("-root"); args << QLatin1String("-root");
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(directory, args, m_settings.timeOutMS(), SilentRun); runCleartool(directory, args, m_settings.timeOutS, SilentRun);
QString root = response.stdOut.trimmed(); QString root = response.stdOut.trimmed();
@@ -706,7 +706,7 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const
QStringList args(QLatin1String("describe")); QStringList args(QLatin1String("describe"));
args << QLatin1String("-fmt") << QLatin1String("%En@@%PSn") << version; args << QLatin1String("-fmt") << QLatin1String("%En@@%PSn") << version;
const ClearCaseResponse response = 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>@@ if (response.error || response.stdOut.endsWith(QLatin1Char('@'))) // <name-unknown>@@
return QString(); return QString();
else else
@@ -722,7 +722,7 @@ QStringList ClearCasePlugin::ccGetActiveVobs() const
const QString theViewRoot = viewRoot(); const QString theViewRoot = viewRoot();
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(theViewRoot, args, m_settings.timeOutMS(), SilentRun); runCleartool(theViewRoot, args, m_settings.timeOutS, SilentRun);
if (response.error) if (response.error)
return res; return res;
@@ -774,7 +774,7 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr
args << QLatin1String("-fmt") << QLatin1String("%[activity]p"); args << QLatin1String("-fmt") << QLatin1String("%[activity]p");
args << file; args << file;
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), SilentRun); runCleartool(workingDir, args, m_settings.timeOutS, SilentRun);
return response.stdOut; return response.stdOut;
} }
@@ -911,7 +911,7 @@ void ClearCasePlugin::undoCheckOutCurrent()
args << fileName; args << fileName;
const ClearCaseResponse diffResponse = 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 different = diffResponse.error; // return value is 1 if there is any difference
bool keep = false; bool keep = false;
@@ -940,7 +940,7 @@ bool ClearCasePlugin::vcsUndoCheckOut(const QString &workingDir, const QString &
args << QDir::toNativeSeparators(fileName); args << QDir::toNativeSeparators(fileName);
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
if (!response.error) { if (!response.error) {
@@ -973,7 +973,7 @@ bool ClearCasePlugin::vcsUndoHijack(const QString &workingDir, const QString &fi
args << QDir::toNativeSeparators(fileName); args << QDir::toNativeSeparators(fileName);
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
if (!response.error && !m_settings.disableIndexer) { if (!response.error && !m_settings.disableIndexer) {
const QString absPath = workingDir + QLatin1Char('/') + fileName; const QString absPath = workingDir + QLatin1Char('/') + fileName;
@@ -1080,7 +1080,7 @@ QStringList ClearCasePlugin::ccGetActivityVersions(const QString &workingDir, co
QStringList args(QLatin1String("lsactivity")); QStringList args(QLatin1String("lsactivity"));
args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity; args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity;
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), SilentRun); runCleartool(workingDir, args, m_settings.timeOutS, SilentRun);
if (response.error) if (response.error)
return QStringList(); return QStringList();
QStringList versions = response.stdOut.split(QLatin1String(", ")); QStringList versions = response.stdOut.split(QLatin1String(", "));
@@ -1306,8 +1306,7 @@ void ClearCasePlugin::history(const QString &workingDir,
args.append(QDir::toNativeSeparators(file)); args.append(QDir::toNativeSeparators(file));
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS, 0, codec);
0, codec);
if (response.error) if (response.error)
return; return;
@@ -1367,7 +1366,7 @@ void ClearCasePlugin::ccUpdate(const QString &workingDir, const QStringList &rel
if (!relativePaths.isEmpty()) if (!relativePaths.isEmpty())
args.append(relativePaths); args.append(relativePaths);
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); runCleartool(workingDir, args, m_settings.longTimeOutS(), ShowStdOutInLogWindow);
if (!response.error) if (!response.error)
clearCaseControl()->emitRepositoryChanged(workingDir); clearCaseControl()->emitRepositoryChanged(workingDir);
} }
@@ -1408,7 +1407,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
args.append(QDir::toNativeSeparators(id)); args.append(QDir::toNativeSeparators(id));
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), 0, codec); runCleartool(workingDir, args, m_settings.timeOutS, 0, codec);
if (response.error) if (response.error)
return; return;
@@ -1458,7 +1457,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
args.push_back(id); args.push_back(id);
QTextCodec *codec = VcsBaseEditor::getCodec(source); QTextCodec *codec = VcsBaseEditor::getCodec(source);
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(topLevel, args, m_settings.timeOutMS(), 0, codec); runCleartool(topLevel, args, m_settings.timeOutS, 0, codec);
description = response.stdOut; description = response.stdOut;
if (m_settings.extDiffAvailable) if (m_settings.extDiffAvailable)
description += diffExternal(id); description += diffExternal(id);
@@ -1486,13 +1485,13 @@ void ClearCasePlugin::checkInSelected()
QString ClearCasePlugin::runCleartoolSync(const QString &workingDir, QString ClearCasePlugin::runCleartoolSync(const QString &workingDir,
const QStringList &arguments) const const QStringList &arguments) const
{ {
return runCleartool(workingDir, arguments, m_settings.timeOutMS(), SilentRun).stdOut; return runCleartool(workingDir, arguments, m_settings.timeOutS, SilentRun).stdOut;
} }
ClearCaseResponse ClearCaseResponse
ClearCasePlugin::runCleartool(const QString &workingDir, ClearCasePlugin::runCleartool(const QString &workingDir,
const QStringList &arguments, const QStringList &arguments,
int timeOut, int timeOutS,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
{ {
@@ -1506,12 +1505,12 @@ ClearCasePlugin::runCleartool(const QString &workingDir,
const SynchronousProcessResponse sp_resp = const SynchronousProcessResponse sp_resp =
VcsBasePlugin::runVcs(workingDir, FileName::fromUserInput(executable), VcsBasePlugin::runVcs(workingDir, FileName::fromUserInput(executable),
arguments, timeOut, arguments, timeOutS,
flags, outputCodec); flags, outputCodec);
response.error = sp_resp.result != SynchronousProcessResponse::Finished; response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error) if (response.error)
response.message = sp_resp.exitMessage(executable, timeOut); response.message = sp_resp.exitMessage(executable, timeOutS);
response.stdErr = sp_resp.stdErr; response.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut; response.stdOut = sp_resp.stdOut;
return response; return response;
@@ -1629,7 +1628,7 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
} }
args << file; args << file;
ClearCaseResponse response = ClearCaseResponse response =
runCleartool(topLevel, args, m_settings.timeOutMS(), ShowStdOutInLogWindow | runCleartool(topLevel, args, m_settings.timeOutS, ShowStdOutInLogWindow |
SuppressStdErrInLogWindow | FullySynchronously); SuppressStdErrInLogWindow | FullySynchronously);
if (response.error) { if (response.error) {
if (response.stdErr.contains(QLatin1String("Versions other than the selected version"))) { 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); ccUpdate(workingDir, QStringList() << file);
else else
args.removeOne(QLatin1String("-query")); args.removeOne(QLatin1String("-query"));
response = runCleartool(topLevel, args, m_settings.timeOutMS(), response = runCleartool(topLevel, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
} }
} else { } else {
@@ -1675,7 +1674,7 @@ bool ClearCasePlugin::vcsSetActivity(const QString &workingDir, const QString &t
QStringList args; QStringList args;
args << QLatin1String("setactivity") << activity; args << QLatin1String("setactivity") << activity;
const ClearCaseResponse actResponse = const ClearCaseResponse actResponse =
runCleartool(workingDir, args, m_settings.timeOutMS(), ShowStdOutInLogWindow); runCleartool(workingDir, args, m_settings.timeOutS, ShowStdOutInLogWindow);
if (actResponse.error) { if (actResponse.error) {
QMessageBox::warning(ICore::dialogParent(), title, QMessageBox::warning(ICore::dialogParent(), title,
tr("Set current activity failed: %1").arg(actResponse.message), QMessageBox::Ok); 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); blockers.append(fcb);
} }
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(m_checkInView, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); runCleartool(m_checkInView, args, m_settings.longTimeOutS(), ShowStdOutInLogWindow);
QRegExp checkedIn(QLatin1String("Checked in \\\"([^\"]*)\\\"")); QRegExp checkedIn(QLatin1String("Checked in \\\"([^\"]*)\\\""));
bool anySucceeded = false; bool anySucceeded = false;
int offset = checkedIn.indexIn(response.stdOut); int offset = checkedIn.indexIn(response.stdOut);
@@ -1785,7 +1784,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
QStringList args; QStringList args;
args << QLatin1String("checkout") << commentArg << dirName; args << QLatin1String("checkout") << commentArg << dirName;
const ClearCaseResponse coResponse = const ClearCaseResponse coResponse =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
if (coResponse.error) { if (coResponse.error) {
if (coResponse.stdErr.contains(QLatin1String("already checked out"))) if (coResponse.stdErr.contains(QLatin1String("already checked out")))
@@ -1800,7 +1799,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
if (!file2.isEmpty()) if (!file2.isEmpty())
args << QDir::toNativeSeparators(file2); args << QDir::toNativeSeparators(file2);
const ClearCaseResponse opResponse = const ClearCaseResponse opResponse =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
if (opResponse.error) { if (opResponse.error) {
// on failure - undo checkout for the directory // on failure - undo checkout for the directory
@@ -1814,7 +1813,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
args.clear(); args.clear();
args << QLatin1String("checkin") << commentArg << dirName; args << QLatin1String("checkin") << commentArg << dirName;
const ClearCaseResponse ciResponse = const ClearCaseResponse ciResponse =
runCleartool(workingDir, args, m_settings.timeOutMS(), runCleartool(workingDir, args, m_settings.timeOutS,
ShowStdOutInLogWindow | FullySynchronously); ShowStdOutInLogWindow | FullySynchronously);
return !ciResponse.error; return !ciResponse.error;
} }
@@ -1963,7 +1962,7 @@ bool ClearCasePlugin::newActivity()
} }
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(workingDir, args, m_settings.timeOutMS(), 0); runCleartool(workingDir, args, m_settings.timeOutS, 0);
if (!response.error) if (!response.error)
refreshActivities(); refreshActivities();
@@ -2103,7 +2102,7 @@ QString ClearCasePlugin::getFile(const QString &nativeFile, const QString &prefi
QStringList args(QLatin1String("get")); QStringList args(QLatin1String("get"));
args << QLatin1String("-to") << tempFile << nativeFile; args << QLatin1String("-to") << tempFile << nativeFile;
const ClearCaseResponse response = const ClearCaseResponse response =
runCleartool(m_topLevel, args, m_settings.timeOutMS(), SilentRun); runCleartool(m_topLevel, args, m_settings.timeOutS, SilentRun);
if (response.error) if (response.error)
return QString(); return QString();
QFile::setPermissions(tempFile, QFile::ReadOwner | QFile::ReadUser | QFile::setPermissions(tempFile, QFile::ReadOwner | QFile::ReadUser |
@@ -2146,8 +2145,7 @@ QString ClearCasePlugin::diffExternal(QString file1, QString file2, bool keep)
} else { } else {
args << file2; args << file2;
} }
const QString diffResponse = const QString diffResponse = runExtDiff(m_topLevel, args, m_settings.timeOutS, codec);
runExtDiff(m_topLevel, args, m_settings.timeOutMS(), codec);
if (!keep && !tempFile1.isEmpty()) { if (!keep && !tempFile1.isEmpty()) {
QFile::remove(tempFile1); QFile::remove(tempFile1);
QFileInfo(tempFile1).dir().rmpath(QLatin1String(".")); 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); QProcess::startDetached(m_settings.ccBinaryPath, args, m_topLevel);
} }
QString ClearCasePlugin::runExtDiff(const QString &workingDir, QString ClearCasePlugin::runExtDiff(const QString &workingDir, const QStringList &arguments,
const QStringList &arguments, int timeOutS, QTextCodec *outputCodec)
int timeOut,
QTextCodec *outputCodec)
{ {
const QString executable(QLatin1String("diff")); const QString executable(QLatin1String("diff"));
QStringList args(m_settings.diffArgs.split(QLatin1Char(' '), QString::SkipEmptyParts)); QStringList args(m_settings.diffArgs.split(QLatin1Char(' '), QString::SkipEmptyParts));
@@ -2191,7 +2187,7 @@ QString ClearCasePlugin::runExtDiff(const QString &workingDir,
QProcess process; QProcess process;
process.setWorkingDirectory(workingDir); process.setWorkingDirectory(workingDir);
process.start(executable, args); process.start(executable, args);
if (!process.waitForFinished(timeOut)) if (!process.waitForFinished(timeOutS * 1000))
return QString(); return QString();
QByteArray ba = process.readAll(); QByteArray ba = process.readAll();
return outputCodec ? outputCodec->toUnicode(ba) : return outputCodec ? outputCodec->toUnicode(ba) :

View File

@@ -235,9 +235,8 @@ private:
int editorType, const QString &source, int editorType, const QString &source,
QTextCodec *codec) const; QTextCodec *codec) const;
QString runCleartoolSync(const QString &workingDir, const QStringList &arguments) const; QString runCleartoolSync(const QString &workingDir, const QStringList &arguments) const;
ClearCaseResponse runCleartool(const QString &workingDir, ClearCaseResponse runCleartool(const QString &workingDir, const QStringList &arguments,
const QStringList &arguments, int timeOut, int timeOutS, unsigned flags, QTextCodec *outputCodec = 0) const;
unsigned flags, QTextCodec *outputCodec = 0) const;
static void sync(QFutureInterface<void> &future, QStringList files); static void sync(QFutureInterface<void> &future, QStringList files);
void history(const QString &workingDir, void history(const QString &workingDir,
@@ -255,8 +254,8 @@ private:
QString diffExternal(QString file1, QString file2 = QString(), bool keep = false); QString diffExternal(QString file1, QString file2 = QString(), bool keep = false);
QString getFile(const QString &nativeFile, const QString &prefix); QString getFile(const QString &nativeFile, const QString &prefix);
static void rmdir(const QString &path); static void rmdir(const QString &path);
QString runExtDiff(const QString &workingDir, const QStringList &arguments, QString runExtDiff(const QString &workingDir, const QStringList &arguments, int timeOutS,
int timeOut, QTextCodec *outputCodec = 0); QTextCodec *outputCodec = 0);
static QString getDriveLetterOfPath(const QString &directory); static QString getDriveLetterOfPath(const QString &directory);
FileStatus::Status getFileStatus(const QString &fileName) const; FileStatus::Status getFileStatus(const QString &fileName) const;

View File

@@ -63,17 +63,16 @@ using namespace ClearCase::Internal;
ClearCaseSettings::ClearCaseSettings() : ClearCaseSettings::ClearCaseSettings() :
ccCommand(defaultCommand()), ccCommand(defaultCommand()),
historyCount(defaultHistoryCount),
timeOutS(defaultTimeOutS),
diffType(GraphicalDiff), diffType(GraphicalDiff),
diffArgs(QLatin1String(defaultDiffArgs)), diffArgs(QLatin1String(defaultDiffArgs)),
autoAssignActivityName(true), autoAssignActivityName(true),
autoCheckOut(true), autoCheckOut(true),
promptToCheckIn(false), promptToCheckIn(false),
disableIndexer(false), disableIndexer(false),
extDiffAvailable(false) extDiffAvailable(false),
{ historyCount(defaultHistoryCount),
} timeOutS(defaultTimeOutS)
{ }
void ClearCaseSettings::fromSettings(QSettings *settings) void ClearCaseSettings::fromSettings(QSettings *settings)
{ {

View File

@@ -56,24 +56,23 @@ public:
void fromSettings(QSettings *); void fromSettings(QSettings *);
void toSettings(QSettings *) const; void toSettings(QSettings *) const;
inline int timeOutMS() const { return timeOutS * 1000; } inline int longTimeOutS() const { return timeOutS * 10; }
inline int longTimeOutMS() const { return timeOutS * 10000; }
bool equals(const ClearCaseSettings &s) const; bool equals(const ClearCaseSettings &s) const;
QString ccCommand; QString ccCommand;
QString ccBinaryPath; QString ccBinaryPath;
int historyCount;
int timeOutS;
DiffType diffType; DiffType diffType;
QString diffArgs; QString diffArgs;
QString indexOnlyVOBs;
QHash<QString, int> totalFiles;
bool autoAssignActivityName; bool autoAssignActivityName;
bool autoCheckOut; bool autoCheckOut;
bool promptToCheckIn; bool promptToCheckIn;
bool disableIndexer; bool disableIndexer;
QString indexOnlyVOBs;
bool extDiffAvailable; bool extDiffAvailable;
QHash<QString, int> totalFiles; int historyCount;
int timeOutS;
}; };
inline bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2) inline bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2)

View File

@@ -620,7 +620,7 @@ void CvsPlugin::revertAll()
QStringList args; QStringList args;
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel(); args << QLatin1String("update") << QLatin1String("-C") << state.topLevel();
const CvsResponse revertResponse = const CvsResponse revertResponse =
runCvs(state.topLevel(), args, client()->vcsTimeout(), runCvs(state.topLevel(), args, client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.result == CvsResponse::Ok) if (revertResponse.result == CvsResponse::Ok)
cvsVersionControl()->emitRepositoryChanged(state.topLevel()); cvsVersionControl()->emitRepositoryChanged(state.topLevel());
@@ -636,7 +636,7 @@ void CvsPlugin::revertCurrentFile()
QStringList args; QStringList args;
args << QLatin1String("diff") << state.relativeCurrentFile(); args << QLatin1String("diff") << state.relativeCurrentFile();
const CvsResponse diffResponse = const CvsResponse diffResponse =
runCvs(state.currentFileTopLevel(), args, client()->vcsTimeout(), 0); runCvs(state.currentFileTopLevel(), args, client()->vcsTimeoutS(), 0);
switch (diffResponse.result) { switch (diffResponse.result) {
case CvsResponse::Ok: case CvsResponse::Ok:
return; // Not modified, diff exit code 0 return; // Not modified, diff exit code 0
@@ -658,7 +658,7 @@ void CvsPlugin::revertCurrentFile()
args.clear(); args.clear();
args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile(); args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile();
const CvsResponse revertResponse = const CvsResponse revertResponse =
runCvs(state.currentFileTopLevel(), args, client()->vcsTimeout(), runCvs(state.currentFileTopLevel(), args, client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.result == CvsResponse::Ok) if (revertResponse.result == CvsResponse::Ok)
cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile())); 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. // where we are, so, have stdout/stderr channels merged.
QStringList args = QStringList(QLatin1String("status")); QStringList args = QStringList(QLatin1String("status"));
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, client()->vcsTimeout(), MergeOutputChannels); runCvs(workingDir, args, client()->vcsTimeoutS(), MergeOutputChannels);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return; return;
// Get list of added/modified/deleted files and purge out undesired ones // 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 << QLatin1String("-F") << messageFile;
args.append(fileList); args.append(fileList);
const CvsResponse response = const CvsResponse response =
runCvs(m_commitRepository, args, 10 * client()->vcsTimeout(), runCvs(m_commitRepository, args, 10 * client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok ; return response.result == CvsResponse::Ok ;
} }
@@ -806,7 +806,7 @@ void CvsPlugin::filelog(const QString &workingDir,
args << QLatin1String("log"); args << QLatin1String("log");
args.append(file); args.append(file);
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, client()->vcsTimeout(), runCvs(workingDir, args, client()->vcsTimeoutS(),
SshPasswordPrompt, codec); SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return; return;
@@ -847,7 +847,7 @@ bool CvsPlugin::update(const QString &topLevel, const QString &file)
if (!file.isEmpty()) if (!file.isEmpty())
args.append(file); args.append(file);
const CvsResponse response = const CvsResponse response =
runCvs(topLevel, args, 10 * client()->vcsTimeout(), runCvs(topLevel, args, 10 * client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
const bool ok = response.result == CvsResponse::Ok; const bool ok = response.result == CvsResponse::Ok;
if (ok) if (ok)
@@ -894,7 +894,7 @@ bool CvsPlugin::edit(const QString &topLevel, const QStringList &files)
QStringList args(QLatin1String("edit")); QStringList args(QLatin1String("edit"));
args.append(files); args.append(files);
const CvsResponse response = const CvsResponse response =
runCvs(topLevel, args, client()->vcsTimeout(), runCvs(topLevel, args, client()->vcsTimeoutS(),
ShowStdOutInLogWindow|SshPasswordPrompt); ShowStdOutInLogWindow|SshPasswordPrompt);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -906,7 +906,7 @@ bool CvsPlugin::diffCheckModified(const QString &topLevel, const QStringList &fi
QStringList args(QLatin1String("-q")); QStringList args(QLatin1String("-q"));
args << QLatin1String("diff"); args << QLatin1String("diff");
args.append(files); 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) if (response.result == CvsResponse::OtherError)
return false; return false;
*modified = response.result == CvsResponse::NonNullExitCode; *modified = response.result == CvsResponse::NonNullExitCode;
@@ -934,7 +934,7 @@ bool CvsPlugin::unedit(const QString &topLevel, const QStringList &files)
args.append(QLatin1String("-y")); args.append(QLatin1String("-y"));
args.append(files); args.append(files);
const CvsResponse response = const CvsResponse response =
runCvs(topLevel, args, client()->vcsTimeout(), runCvs(topLevel, args, client()->vcsTimeoutS(),
ShowStdOutInLogWindow|SshPasswordPrompt); ShowStdOutInLogWindow|SshPasswordPrompt);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -953,7 +953,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
args << QLatin1String("-r") << revision; args << QLatin1String("-r") << revision;
args << file; args << file;
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, client()->vcsTimeout(), runCvs(workingDir, args, client()->vcsTimeoutS(),
SshPasswordPrompt, codec); SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return; return;
@@ -982,7 +982,7 @@ bool CvsPlugin::status(const QString &topLevel, const QString &file, const QStri
if (!file.isEmpty()) if (!file.isEmpty())
args.append(file); args.append(file);
const CvsResponse response = const CvsResponse response =
runCvs(topLevel, args, client()->vcsTimeout(), 0); runCvs(topLevel, args, client()->vcsTimeoutS(), 0);
const bool ok = response.result == CvsResponse::Ok; const bool ok = response.result == CvsResponse::Ok;
if (ok) if (ok)
showOutputInEditor(title, response.stdOut, OtherContent, topLevel, 0); showOutputInEditor(title, response.stdOut, OtherContent, topLevel, 0);
@@ -1065,7 +1065,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
QStringList args; QStringList args;
args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file; args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file;
const CvsResponse logResponse = const CvsResponse logResponse =
runCvs(toplevel, args, client()->vcsTimeout(), SshPasswordPrompt); runCvs(toplevel, args, client()->vcsTimeoutS(), SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) { if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message; *errorMessage = logResponse.message;
return false; return false;
@@ -1087,7 +1087,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS); args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS);
const CvsResponse repoLogResponse = const CvsResponse repoLogResponse =
runCvs(toplevel, args, 10 * client()->vcsTimeout(), SshPasswordPrompt); runCvs(toplevel, args, 10 * client()->vcsTimeoutS(), SshPasswordPrompt);
if (repoLogResponse.result != CvsResponse::Ok) { if (repoLogResponse.result != CvsResponse::Ok) {
*errorMessage = repoLogResponse.message; *errorMessage = repoLogResponse.message;
return false; return false;
@@ -1124,7 +1124,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
QStringList args(QLatin1String("log")); QStringList args(QLatin1String("log"));
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file; args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
const CvsResponse logResponse = const CvsResponse logResponse =
runCvs(repositoryPath, args, client()->vcsTimeout(), SshPasswordPrompt); runCvs(repositoryPath, args, client()->vcsTimeoutS(), SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) { if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message; *errorMessage = logResponse.message;
return false; return false;
@@ -1141,7 +1141,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
<< QLatin1String("-r") << previousRev << QLatin1String("-r") << QLatin1String("-r") << previousRev << QLatin1String("-r")
<< it->revisions.front().revision << it->file; << it->revisions.front().revision << it->file;
const CvsResponse diffResponse = const CvsResponse diffResponse =
runCvs(repositoryPath, args, client()->vcsTimeout(), 0, codec); runCvs(repositoryPath, args, client()->vcsTimeoutS(), 0, codec);
switch (diffResponse.result) { switch (diffResponse.result) {
case CvsResponse::Ok: case CvsResponse::Ok:
case CvsResponse::NonNullExitCode: // Diff exit code != 0 case CvsResponse::NonNullExitCode: // Diff exit code != 0
@@ -1185,7 +1185,7 @@ void CvsPlugin::submitCurrentLog()
// the working directory (see above). // the working directory (see above).
CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
const QStringList &arguments, const QStringList &arguments,
int timeOut, int timeOutS,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
{ {
@@ -1199,7 +1199,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
// Run, connect stderr to the output window // Run, connect stderr to the output window
const SynchronousProcessResponse sp_resp = const SynchronousProcessResponse sp_resp =
runVcs(workingDirectory, executable, client()->settings().addOptions(arguments), runVcs(workingDirectory, executable, client()->settings().addOptions(arguments),
timeOut, flags, outputCodec); timeOutS, flags, outputCodec);
response.result = CvsResponse::OtherError; response.result = CvsResponse::OtherError;
response.stdErr = sp_resp.stdErr; response.stdErr = sp_resp.stdErr;
@@ -1218,7 +1218,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
} }
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
response.message = sp_resp.exitMessage(executable.toString(), timeOut); response.message = sp_resp.exitMessage(executable.toString(), timeOutS);
return response; return response;
} }
@@ -1261,7 +1261,7 @@ bool CvsPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
QStringList args; QStringList args;
args << QLatin1String("add") << rawFileName; args << QLatin1String("add") << rawFileName;
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, client()->vcsTimeout(), runCvs(workingDir, args, client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1271,7 +1271,7 @@ bool CvsPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
QStringList args; QStringList args;
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName; args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, client()->vcsTimeout(), runCvs(workingDir, args, client()->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1317,7 +1317,7 @@ bool CvsPlugin::managesFile(const QString &workingDirectory, const QString &file
QStringList args; QStringList args;
args << QLatin1String("status") << fileName; args << QLatin1String("status") << fileName;
const CvsResponse response = const CvsResponse response =
runCvs(workingDirectory, args, client()->vcsTimeout(), SshPasswordPrompt); runCvs(workingDirectory, args, client()->vcsTimeoutS(), SshPasswordPrompt);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return false; return false;
return !response.stdOut.contains(QLatin1String("Status: Unknown")); return !response.stdOut.contains(QLatin1String("Status: Unknown"));

View File

@@ -142,7 +142,7 @@ private:
CvsResponse runCvs(const QString &workingDirectory, CvsResponse runCvs(const QString &workingDirectory,
const QStringList &arguments, const QStringList &arguments,
int timeOut, int timeOutS,
unsigned flags, unsigned flags,
QTextCodec *outputCodec = 0) const; QTextCodec *outputCodec = 0) const;

View File

@@ -157,7 +157,7 @@ void BaseController::runCommand(const QList<QStringList> &args, QTextCodec *code
foreach (const QStringList &arg, args) { foreach (const QStringList &arg, args) {
QTC_ASSERT(!arg.isEmpty(), continue); QTC_ASSERT(!arg.isEmpty(), continue);
m_command->addJob(arg, gitClient()->vcsTimeout()); m_command->addJob(arg, gitClient()->vcsTimeoutS());
} }
m_command->execute(); m_command->execute();
@@ -1998,7 +1998,7 @@ SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirec
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
{ {
return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), gitArguments, vcsTimeout() * 1000, return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), gitArguments, vcsTimeoutS(),
flags, outputCodec, processEnvironment()); flags, outputCodec, processEnvironment());
} }
@@ -2010,8 +2010,7 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory,
{ {
VcsCommand command(vcsBinary(), workingDirectory, processEnvironment()); VcsCommand command(vcsBinary(), workingDirectory, processEnvironment());
command.addFlags(flags); command.addFlags(flags);
return command.runFullySynchronous(gitArguments, vcsTimeout() * 1000, return command.runFullySynchronous(gitArguments, vcsTimeoutS(), outputText, errorText);
outputText, errorText);
} }
void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt) void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt)

View File

@@ -159,7 +159,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString &
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QLatin1String("LANGUAGE"), QLatin1String("C")); env.insert(QLatin1String("LANGUAGE"), QLatin1String("C"));
const SynchronousProcessResponse resp = VcsBasePlugin::runVcs( 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; const bool ok = resp.result == SynchronousProcessResponse::Finished;
parsePullOutput(resp.stdOut.trimmed()); parsePullOutput(resp.stdOut.trimmed());

View File

@@ -222,7 +222,7 @@ QString DiffController::getDescription() const
args << QString::number(m_changeNumber); args << QString::number(m_changeNumber);
const SubversionResponse logResponse = const SubversionResponse logResponse =
SubversionPlugin::instance()->runSvn(m_workingDirectory, args, SubversionPlugin::instance()->runSvn(m_workingDirectory, args,
m_client->vcsTimeout() * 1000, m_client->vcsTimeoutS(),
VcsBasePlugin::SshPasswordPrompt); VcsBasePlugin::SshPasswordPrompt);
if (logResponse.error) if (logResponse.error)
@@ -252,7 +252,7 @@ void DiffController::postCollectTextualDiffOutput()
args << m_filesList; args << m_filesList;
} }
command->addJob(args, m_client->vcsTimeout()); command->addJob(args, m_client->vcsTimeoutS());
command->execute(); command->execute();
} }

View File

@@ -585,7 +585,7 @@ void SubversionPlugin::revertAll()
args << SubversionClient::addAuthenticationOptions(client()->settings()); args << SubversionClient::addAuthenticationOptions(client()->settings());
args << QLatin1String("--recursive") << state.topLevel(); args << QLatin1String("--recursive") << state.topLevel();
const SubversionResponse revertResponse const SubversionResponse revertResponse
= runSvn(state.topLevel(), args, m_client->vcsTimeout() * 1000, = runSvn(state.topLevel(), args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.error) if (revertResponse.error)
QMessageBox::warning(ICore::dialogParent(), title, QMessageBox::warning(ICore::dialogParent(), title,
@@ -604,7 +604,7 @@ void SubversionPlugin::revertCurrentFile()
args.push_back(state.relativeCurrentFile()); args.push_back(state.relativeCurrentFile());
const SubversionResponse diffResponse const SubversionResponse diffResponse
= runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeout() * 1000, 0); = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0);
if (diffResponse.error) if (diffResponse.error)
return; return;
@@ -625,7 +625,7 @@ void SubversionPlugin::revertCurrentFile()
args << state.relativeCurrentFile(); args << state.relativeCurrentFile();
const SubversionResponse revertResponse const SubversionResponse revertResponse
= runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeout() * 1000, = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (!revertResponse.error) if (!revertResponse.error)
@@ -688,7 +688,7 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList
args += files; args += files;
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeout() * 1000, 0); = runSvn(workingDir, args, m_client->vcsTimeoutS(), 0);
if (response.error) if (response.error)
return; return;
@@ -768,8 +768,7 @@ void SubversionPlugin::svnStatus(const QString &workingDir, const QString &relat
if (!relativePath.isEmpty()) if (!relativePath.isEmpty())
args.append(relativePath); args.append(relativePath);
VcsOutputWindow::setRepository(workingDir); VcsOutputWindow::setRepository(workingDir);
runSvn(workingDir, args, m_client->vcsTimeout() * 1000, runSvn(workingDir, args, m_client->vcsTimeoutS(), ShowStdOutInLogWindow|ShowSuccessMessage);
ShowStdOutInLogWindow|ShowSuccessMessage);
VcsOutputWindow::clearRepository(); VcsOutputWindow::clearRepository();
} }
@@ -795,7 +794,7 @@ void SubversionPlugin::svnUpdate(const QString &workingDir, const QString &relat
if (!relativePath.isEmpty()) if (!relativePath.isEmpty())
args.append(relativePath); args.append(relativePath);
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, 10 * m_client->vcsTimeout() * 1000, = runSvn(workingDir, args, 10 * m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (!response.error) if (!response.error)
subVersionControl()->emitRepositoryChanged(workingDir); subVersionControl()->emitRepositoryChanged(workingDir);
@@ -834,7 +833,7 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil
args.append(QDir::toNativeSeparators(file)); args.append(QDir::toNativeSeparators(file));
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeout() * 1000, = runSvn(workingDir, args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ForceCLocale, codec); SshPasswordPrompt|ForceCLocale, codec);
if (response.error) if (response.error)
return; return;
@@ -915,8 +914,9 @@ void SubversionPlugin::submitCurrentLog()
} }
SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
const QStringList &arguments, int timeOut, const QStringList &arguments,
unsigned flags, QTextCodec *outputCodec) const int timeOutS, unsigned flags,
QTextCodec *outputCodec) const
{ {
const FileName executable = client()->vcsBinary(); const FileName executable = client()->vcsBinary();
SubversionResponse response; SubversionResponse response;
@@ -927,12 +927,12 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
} }
const SynchronousProcessResponse sp_resp = const SynchronousProcessResponse sp_resp =
VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOut, VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOutS,
flags, outputCodec); flags, outputCodec);
response.error = sp_resp.result != SynchronousProcessResponse::Finished; response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error) 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.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut; response.stdOut = sp_resp.stdOut;
return response; return response;
@@ -998,7 +998,7 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN
<< SubversionClient::addAuthenticationOptions(client()->settings()) << SubversionClient::addAuthenticationOptions(client()->settings())
<< QLatin1String("--parents") << file; << QLatin1String("--parents") << file;
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeout() * 1000, = runSvn(workingDir, args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
return !response.error; return !response.error;
} }
@@ -1013,7 +1013,7 @@ bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFi
<< QLatin1String("--force") << file; << QLatin1String("--force") << file;
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeout() * 1000, = runSvn(workingDir, args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
return !response.error; return !response.error;
} }
@@ -1024,7 +1024,7 @@ bool SubversionPlugin::vcsMove(const QString &workingDir, const QString &from, c
args << SubversionClient::addAuthenticationOptions(client()->settings()); args << SubversionClient::addAuthenticationOptions(client()->settings());
args << QDir::toNativeSeparators(from) << QDir::toNativeSeparators(to); args << QDir::toNativeSeparators(from) << QDir::toNativeSeparators(to);
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeout() * 1000, = runSvn(workingDir, args, m_client->vcsTimeoutS(),
SshPasswordPrompt|ShowStdOutInLogWindow|FullySynchronously); SshPasswordPrompt|ShowStdOutInLogWindow|FullySynchronously);
return !response.error; return !response.error;
} }
@@ -1052,7 +1052,7 @@ bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &u
args << QLatin1String(tempUrl.toEncoded()) << directory; args << QLatin1String(tempUrl.toEncoded()) << directory;
const SubversionResponse response const SubversionResponse response
= runSvn(directory, args, 10 * m_client->vcsTimeout() * 1000, = runSvn(directory, args, 10 * m_client->vcsTimeoutS(),
VcsBasePlugin::SshPasswordPrompt); VcsBasePlugin::SshPasswordPrompt);
return !response.error; return !response.error;
@@ -1087,7 +1087,7 @@ bool SubversionPlugin::managesFile(const QString &workingDirectory, const QStrin
args << QLatin1String("status"); args << QLatin1String("status");
args << SubversionClient::addAuthenticationOptions(client()->settings()) << fileName; args << SubversionClient::addAuthenticationOptions(client()->settings()) << fileName;
SubversionResponse response 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('?'); return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?');
} }

View File

@@ -92,7 +92,7 @@ public:
QString monitorFile(const QString &repository) const; QString monitorFile(const QString &repository) const;
QString synchronousTopic(const QString &repository) const; QString synchronousTopic(const QString &repository) const;
SubversionResponse runSvn(const QString &workingDir, SubversionResponse runSvn(const QString &workingDir,
const QStringList &arguments, int timeOut, const QStringList &arguments, int timeOutS,
unsigned flags, QTextCodec *outputCodec = 0) const; unsigned flags, QTextCodec *outputCodec = 0) const;
public slots: public slots:

View File

@@ -142,7 +142,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory,
JobOutputBindMode mode) const JobOutputBindMode mode) const
{ {
auto cmd = new VcsCommand(vcsBinary(), workingDirectory, processEnvironment()); auto cmd = new VcsCommand(vcsBinary(), workingDirectory, processEnvironment());
cmd->setDefaultTimeout(vcsTimeout()); cmd->setDefaultTimeoutS(vcsTimeoutS());
if (editor) if (editor)
d->bindCommandToEditor(cmd, editor); d->bindCommandToEditor(cmd, editor);
if (mode == VcsWindowOutputBind) { if (mode == VcsWindowOutputBind) {
@@ -159,7 +159,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory,
void VcsBaseClientImpl::enqueueJob(VcsCommand *cmd, const QStringList &args, void VcsBaseClientImpl::enqueueJob(VcsCommand *cmd, const QStringList &args,
Utils::ExitCodeInterpreter *interpreter) Utils::ExitCodeInterpreter *interpreter)
{ {
cmd->addJob(args, vcsTimeout(), interpreter); cmd->addJob(args, vcsTimeoutS(), interpreter);
cmd->execute(); cmd->execute();
} }
@@ -188,7 +188,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector
annotate(workingDirectory, file, changeCopy, line); annotate(workingDirectory, file, changeCopy, line);
} }
int VcsBaseClientImpl::vcsTimeout() const int VcsBaseClientImpl::vcsTimeoutS() const
{ {
return settings().intValue(VcsBaseClientSettings::timeoutKey); return settings().intValue(VcsBaseClientSettings::timeoutKey);
} }
@@ -394,11 +394,11 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir,
vcsProcess.closeWriteChannel(); vcsProcess.closeWriteChannel();
QByteArray stdErr; QByteArray stdErr;
if (!Utils::SynchronousProcess::readDataFromProcess(vcsProcess, vcsTimeout() * 1000, if (!Utils::SynchronousProcess::readDataFromProcess(vcsProcess, vcsTimeoutS() * 1000,
output, &stdErr, true)) { output, &stdErr, true)) {
Utils::SynchronousProcess::stopProcess(vcsProcess); Utils::SynchronousProcess::stopProcess(vcsProcess);
VcsOutputWindow::appendError(tr("Timed out after %1s waiting for the process %2 to finish.") 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; return false;
} }
if (!stdErr.isEmpty()) if (!stdErr.isEmpty())
@@ -412,8 +412,8 @@ Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QStrin
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
{ {
return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeout() * 1000, return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeoutS(), flags,
flags, outputCodec); outputCodec);
} }
void VcsBaseClient::annotate(const QString &workingDir, const QString &file, void VcsBaseClient::annotate(const QString &workingDir, const QString &file,

View File

@@ -74,7 +74,7 @@ public:
VcsBaseClientSettings &settings() const; VcsBaseClientSettings &settings() const;
virtual Utils::FileName vcsBinary() const; virtual Utils::FileName vcsBinary() const;
int vcsTimeout() const; int vcsTimeoutS() const;
enum JobOutputBindMode { enum JobOutputBindMode {
NoOutputBind, NoOutputBind,

View File

@@ -804,7 +804,7 @@ void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e,
SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
const FileName &binary, const FileName &binary,
const QStringList &arguments, const QStringList &arguments,
int timeOutMS, int timeOutS,
unsigned flags, unsigned flags,
QTextCodec *outputCodec, QTextCodec *outputCodec,
const QProcessEnvironment &env) const QProcessEnvironment &env)
@@ -813,7 +813,7 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
env.isEmpty() ? QProcessEnvironment::systemEnvironment() : env); env.isEmpty() ? QProcessEnvironment::systemEnvironment() : env);
command.addFlags(flags); command.addFlags(flags);
command.setCodec(outputCodec); command.setCodec(outputCodec);
return command.runVcs(arguments, timeOutMS); return command.runVcs(arguments, timeOutS);
} }
} // namespace VcsBase } // namespace VcsBase

View File

@@ -188,7 +188,7 @@ public:
static Utils::SynchronousProcessResponse runVcs(const QString &workingDir, static Utils::SynchronousProcessResponse runVcs(const QString &workingDir,
const Utils::FileName &binary, const Utils::FileName &binary,
const QStringList &arguments, const QStringList &arguments,
int timeOutMS, int timeOutS,
unsigned flags = 0, unsigned flags = 0,
QTextCodec *outputCodec = 0, QTextCodec *outputCodec = 0,
const QProcessEnvironment &env = QProcessEnvironment()); const QProcessEnvironment &env = QProcessEnvironment());

View File

@@ -84,7 +84,7 @@ public:
explicit Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter = 0); explicit Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter = 0);
QStringList arguments; QStringList arguments;
int timeout; int timeoutS;
Utils::ExitCodeInterpreter *exitCodeInterpreter; Utils::ExitCodeInterpreter *exitCodeInterpreter;
}; };
@@ -97,7 +97,7 @@ public:
const QString m_workingDirectory; const QString m_workingDirectory;
const QProcessEnvironment m_environment; const QProcessEnvironment m_environment;
QVariant m_cookie; QVariant m_cookie;
int m_defaultTimeout; int m_defaultTimeoutS;
unsigned m_flags; unsigned m_flags;
QTextCodec *m_codec; QTextCodec *m_codec;
const QString m_sshPasswordPrompt; const QString m_sshPasswordPrompt;
@@ -120,7 +120,7 @@ VcsCommandPrivate::VcsCommandPrivate(const Utils::FileName &binary,
m_binaryPath(binary), m_binaryPath(binary),
m_workingDirectory(workingDirectory), m_workingDirectory(workingDirectory),
m_environment(environment), m_environment(environment),
m_defaultTimeout(10), m_defaultTimeoutS(10),
m_flags(0), m_flags(0),
m_codec(0), m_codec(0),
m_sshPasswordPrompt(VcsBasePlugin::sshPrompt()), m_sshPasswordPrompt(VcsBasePlugin::sshPrompt()),
@@ -141,7 +141,7 @@ VcsCommandPrivate::~VcsCommandPrivate()
VcsCommandPrivate::Job::Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter) : VcsCommandPrivate::Job::Job(const QStringList &a, int t, Utils::ExitCodeInterpreter *interpreter) :
arguments(a), arguments(a),
timeout(t), timeoutS(t),
exitCodeInterpreter(interpreter) exitCodeInterpreter(interpreter)
{ {
// Finished cookie is emitted via queued slot, needs metatype // Finished cookie is emitted via queued slot, needs metatype
@@ -180,14 +180,14 @@ const QProcessEnvironment &VcsCommand::processEnvironment() const
return d->m_environment; 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 unsigned VcsCommand::flags() const
@@ -202,12 +202,13 @@ void VcsCommand::addFlags(unsigned f)
void VcsCommand::addJob(const QStringList &arguments, Utils::ExitCodeInterpreter *interpreter) 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() void VcsCommand::execute()
@@ -272,11 +273,8 @@ void VcsCommand::run(QFutureInterface<void> &future)
d->m_lastExecSuccess = true; d->m_lastExecSuccess = true;
for (int j = 0; j < count; j++) { for (int j = 0; j < count; j++) {
const Internal::VcsCommandPrivate::Job &job = d->m_jobs.at(j); const Internal::VcsCommandPrivate::Job &job = d->m_jobs.at(j);
const int timeOutSeconds = job.timeout; Utils::SynchronousProcessResponse resp
Utils::SynchronousProcessResponse resp = runVcs( = runVcs( job.arguments, job.timeoutS, job.exitCodeInterpreter);
job.arguments,
timeOutSeconds >= 0 ? timeOutSeconds * 1000 : -1,
job.exitCodeInterpreter);
stdOut += resp.stdOut; stdOut += resp.stdOut;
stdErr += resp.stdErr; stdErr += resp.stdErr;
d->m_lastExecExitCode = resp.exitCode; d->m_lastExecExitCode = resp.exitCode;
@@ -334,7 +332,7 @@ signals:
void appendMessage(const QString &text); 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::ExitCodeInterpreter *interpreter)
{ {
Utils::SynchronousProcessResponse response; Utils::SynchronousProcessResponse response;
@@ -352,7 +350,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
if (debugExecution) { if (debugExecution) {
QDebug nsp = qDebug().nospace(); QDebug nsp = qDebug().nospace();
nsp << "Command::runVcs" << d->m_workingDirectory << d->m_binaryPath << arguments nsp << "Command::runVcs" << d->m_workingDirectory << d->m_binaryPath << arguments
<< timeoutMS; << timeoutS;
if (d->m_flags & VcsBasePlugin::ShowStdOutInLogWindow) if (d->m_flags & VcsBasePlugin::ShowStdOutInLogWindow)
nsp << "stdout"; nsp << "stdout";
if (d->m_flags & VcsBasePlugin::SuppressStdErrInLogWindow) if (d->m_flags & VcsBasePlugin::SuppressStdErrInLogWindow)
@@ -379,7 +377,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
// if (d->m_flags & ExpectRepoChanges) // if (d->m_flags & ExpectRepoChanges)
// Core::DocumentManager::expectDirectoryChange(d->m_workingDirectory); // Core::DocumentManager::expectDirectoryChange(d->m_workingDirectory);
if (d->m_flags & VcsBasePlugin::FullySynchronously) { if (d->m_flags & VcsBasePlugin::FullySynchronously) {
response = runSynchronous(arguments, timeoutMS, interpreter); response = runSynchronous(arguments, timeoutS, interpreter);
} else { } else {
Utils::SynchronousProcess process; Utils::SynchronousProcess process;
process.setExitCodeInterpreter(interpreter); process.setExitCodeInterpreter(interpreter);
@@ -392,7 +390,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
(d->m_flags & VcsBasePlugin::ForceCLocale), (d->m_flags & VcsBasePlugin::ForceCLocale),
d->m_sshPasswordPrompt); d->m_sshPasswordPrompt);
process.setProcessEnvironment(env); process.setProcessEnvironment(env);
process.setTimeout(timeoutMS); process.setTimeout(timeoutS * 1000);
if (d->m_codec) if (d->m_codec)
process.setCodec(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 (response.result == Utils::SynchronousProcessResponse::Finished) {
if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) { if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) {
emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath.toUserOutput(), emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath.toUserOutput(),
timeoutMS)); timeoutS));
} }
} else if (!(d->m_flags & VcsBasePlugin::SuppressFailMessageInLogWindow)) { } else if (!(d->m_flags & VcsBasePlugin::SuppressFailMessageInLogWindow)) {
emit outputProxy.appendError(response.exitMessage(d->m_binaryPath.toUserOutput(), emit outputProxy.appendError(response.exitMessage(d->m_binaryPath.toUserOutput(),
timeoutMS)); timeoutS));
} }
} }
emitRepositoryChanged(); emitRepositoryChanged();
@@ -442,7 +440,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
} }
Utils::SynchronousProcessResponse VcsCommand::runSynchronous(const QStringList &arguments, Utils::SynchronousProcessResponse VcsCommand::runSynchronous(const QStringList &arguments,
int timeoutMS, int timeoutS,
Utils::ExitCodeInterpreter *interpreter) Utils::ExitCodeInterpreter *interpreter)
{ {
Utils::SynchronousProcessResponse response; Utils::SynchronousProcessResponse response;
@@ -474,7 +472,7 @@ Utils::SynchronousProcessResponse VcsCommand::runSynchronous(const QStringList &
QByteArray stdOut; QByteArray stdOut;
QByteArray stdErr; QByteArray stdErr;
const bool timedOut = const bool timedOut =
!Utils::SynchronousProcess::readDataFromProcess(*process.data(), timeoutMS, !Utils::SynchronousProcess::readDataFromProcess(*process.data(), timeoutS * 1000,
&stdOut, &stdErr, true); &stdOut, &stdErr, true);
if (!d->m_aborted) { if (!d->m_aborted) {
@@ -519,7 +517,7 @@ void VcsCommand::emitRepositoryChanged()
Core::VcsManager::emitRepositoryChanged(d->m_workingDirectory); 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) QByteArray *outputData, QByteArray *errorData)
{ {
if (d->m_binaryPath.isEmpty()) if (d->m_binaryPath.isEmpty())
@@ -547,9 +545,9 @@ bool VcsCommand::runFullySynchronous(const QStringList &arguments, int timeoutMS
return false; return false;
} }
if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutMS, outputData, errorData, true)) { if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutS * 1000, outputData, errorData, true)) {
if (errorData) 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); Utils::SynchronousProcess::stopProcess(process);
return false; return false;
} }

View File

@@ -83,7 +83,8 @@ public:
~VcsCommand(); ~VcsCommand();
void addJob(const QStringList &arguments, Utils::ExitCodeInterpreter *interpreter = 0); 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 execute();
void abort(); void abort();
bool lastExecutionSuccess() const; bool lastExecutionSuccess() const;
@@ -93,8 +94,8 @@ public:
const QString &workingDirectory() const; const QString &workingDirectory() const;
const QProcessEnvironment &processEnvironment() const; const QProcessEnvironment &processEnvironment() const;
int defaultTimeout() const; int defaultTimeoutS() const;
void setDefaultTimeout(int timeout); void setDefaultTimeoutS(int timeout);
unsigned flags() const; unsigned flags() const;
void addFlags(unsigned f); void addFlags(unsigned f);
@@ -108,15 +109,15 @@ public:
void setProgressParser(ProgressParser *parser); void setProgressParser(ProgressParser *parser);
void setProgressiveOutput(bool progressive); void setProgressiveOutput(bool progressive);
Utils::SynchronousProcessResponse runVcs(const QStringList &arguments, int timeoutMS, Utils::SynchronousProcessResponse runVcs(const QStringList &arguments, int timeoutS,
Utils::ExitCodeInterpreter *interpreter = 0); Utils::ExitCodeInterpreter *interpreter = 0);
// Make sure to not pass through the event loop at all: // 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); QByteArray *outputData, QByteArray *errorData);
private: private:
void run(QFutureInterface<void> &future); 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); Utils::ExitCodeInterpreter *interpreter = 0);
void emitRepositoryChanged(); void emitRepositoryChanged();