VcsBase: Partially move vcsTimeoutS() to VcsBaseClientSettings

It's the source of information for this, and the plan is to
ramp down and merge *Client and *BasePlugin.

Change-Id: I13f813d1f94a2bd4a704d120493a28b92443605b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-03 14:56:09 +01:00
parent 625fd913e5
commit b23dc3a0bf
5 changed files with 38 additions and 32 deletions

View File

@@ -851,7 +851,7 @@ void CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(state.topLevel(), args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
if (revertResponse.result == CvsResponse::Ok) if (revertResponse.result == CvsResponse::Ok)
emit repositoryChanged(state.topLevel()); emit repositoryChanged(state.topLevel());
@@ -867,7 +867,7 @@ void CvsPluginPrivate::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, m_client->vcsTimeoutS(), 0); runCvs(state.currentFileTopLevel(), args, m_settings.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
@@ -889,7 +889,7 @@ void CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
if (revertResponse.result == CvsResponse::Ok) if (revertResponse.result == CvsResponse::Ok)
emit filesChanged(QStringList(state.currentFile())); emit filesChanged(QStringList(state.currentFile()));
@@ -954,7 +954,7 @@ void CvsPluginPrivate::startCommit(const QString &workingDir, const QString &fil
// 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, m_client->vcsTimeoutS(), VcsCommand::MergeOutputChannels); runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::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
@@ -1000,7 +1000,7 @@ bool CvsPluginPrivate::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 * m_client->vcsTimeoutS(), runCvs(m_commitRepository, args, 10 * m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
return response.result == CvsResponse::Ok ; return response.result == CvsResponse::Ok ;
} }
@@ -1038,7 +1038,7 @@ void CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt, codec); VcsCommand::SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return; return;
@@ -1079,7 +1079,7 @@ bool CvsPluginPrivate::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 * m_client->vcsTimeoutS(), runCvs(topLevel, args, 10 * m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
const bool ok = response.result == CvsResponse::Ok; const bool ok = response.result == CvsResponse::Ok;
if (ok) if (ok)
@@ -1126,7 +1126,7 @@ bool CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(topLevel, args, m_settings.vcsTimeoutS(),
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt); VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1138,7 +1138,7 @@ bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringL
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, m_client->vcsTimeoutS(), 0); const CvsResponse response = runCvs(topLevel, args, m_settings.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;
@@ -1166,7 +1166,7 @@ bool CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(topLevel, args, m_settings.vcsTimeoutS(),
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt); VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1185,7 +1185,7 @@ void CvsPluginPrivate::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, m_client->vcsTimeoutS(), runCvs(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt, codec); VcsCommand::SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok) if (response.result != CvsResponse::Ok)
return; return;
@@ -1214,7 +1214,7 @@ bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, cons
if (!file.isEmpty()) if (!file.isEmpty())
args.append(file); args.append(file);
const CvsResponse response = const CvsResponse response =
runCvs(topLevel, args, m_client->vcsTimeoutS(), 0); runCvs(topLevel, args, m_settings.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, nullptr); showOutputInEditor(title, response.stdOut, OtherContent, topLevel, nullptr);
@@ -1289,7 +1289,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
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, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); runCvs(toplevel, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) { if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message; *errorMessage = logResponse.message;
return false; return false;
@@ -1311,7 +1311,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
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 * m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); runCvs(toplevel, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
if (repoLogResponse.result != CvsResponse::Ok) { if (repoLogResponse.result != CvsResponse::Ok) {
*errorMessage = repoLogResponse.message; *errorMessage = repoLogResponse.message;
return false; return false;
@@ -1348,7 +1348,7 @@ bool CvsPluginPrivate::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, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); runCvs(repositoryPath, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) { if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message; *errorMessage = logResponse.message;
return false; return false;
@@ -1365,7 +1365,7 @@ bool CvsPluginPrivate::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, m_client->vcsTimeoutS(), 0, codec); runCvs(repositoryPath, args, m_settings.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
@@ -1475,7 +1475,7 @@ bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileN
QStringList args; QStringList args;
args << QLatin1String("add") << rawFileName; args << QLatin1String("add") << rawFileName;
const CvsResponse response = const CvsResponse response =
runCvs(workingDir, args, m_client->vcsTimeoutS(), runCvs(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1485,7 +1485,7 @@ bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFi
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, m_client->vcsTimeoutS(), runCvs(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
return response.result == CvsResponse::Ok; return response.result == CvsResponse::Ok;
} }
@@ -1526,7 +1526,7 @@ bool CvsPluginPrivate::managesFile(const QString &workingDirectory, const QStrin
QStringList args; QStringList args;
args << QLatin1String("status") << fileName; args << QLatin1String("status") << fileName;
const CvsResponse response = const CvsResponse response =
runCvs(workingDirectory, args, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); runCvs(workingDirectory, args, m_settings.vcsTimeoutS(), VcsCommand::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

@@ -689,7 +689,7 @@ void SubversionPluginPrivate::revertAll()
args << SubversionClient::addAuthenticationOptions(m_settings); args << SubversionClient::addAuthenticationOptions(m_settings);
args << QLatin1String("--recursive") << state.topLevel(); args << QLatin1String("--recursive") << state.topLevel();
const SubversionResponse revertResponse const SubversionResponse revertResponse
= runSvn(state.topLevel(), args, m_client->vcsTimeoutS(), = runSvn(state.topLevel(), args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
if (revertResponse.error) if (revertResponse.error)
QMessageBox::warning(ICore::dialogParent(), title, QMessageBox::warning(ICore::dialogParent(), title,
@@ -708,7 +708,7 @@ void SubversionPluginPrivate::revertCurrentFile()
args.push_back(SubversionClient::escapeFile(state.relativeCurrentFile())); args.push_back(SubversionClient::escapeFile(state.relativeCurrentFile()));
const SubversionResponse diffResponse const SubversionResponse diffResponse
= runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0); = runSvn(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), 0);
if (diffResponse.error) if (diffResponse.error)
return; return;
@@ -729,7 +729,7 @@ void SubversionPluginPrivate::revertCurrentFile()
args << SubversionClient::escapeFile(state.relativeCurrentFile()); args << SubversionClient::escapeFile(state.relativeCurrentFile());
const SubversionResponse revertResponse const SubversionResponse revertResponse
= runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), = runSvn(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
if (!revertResponse.error) if (!revertResponse.error)
@@ -795,7 +795,7 @@ void SubversionPluginPrivate::startCommit(const QString &workingDir, const QStri
args += SubversionClient::escapeFiles(files); args += SubversionClient::escapeFiles(files);
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeoutS(), 0); = runSvn(workingDir, args, m_settings.vcsTimeoutS(), 0);
if (response.error) if (response.error)
return; return;
@@ -875,7 +875,7 @@ void SubversionPluginPrivate::svnStatus(const QString &workingDir, const QString
if (!relativePath.isEmpty()) if (!relativePath.isEmpty())
args.append(SubversionClient::escapeFile(relativePath)); args.append(SubversionClient::escapeFile(relativePath));
VcsOutputWindow::setRepository(workingDir); VcsOutputWindow::setRepository(workingDir);
runSvn(workingDir, args, m_client->vcsTimeoutS(), runSvn(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage); VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage);
VcsOutputWindow::clearRepository(); VcsOutputWindow::clearRepository();
} }
@@ -902,7 +902,7 @@ void SubversionPluginPrivate::svnUpdate(const QString &workingDir, const QString
if (!relativePath.isEmpty()) if (!relativePath.isEmpty())
args.append(relativePath); args.append(relativePath);
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, 10 * m_client->vcsTimeoutS(), = runSvn(workingDir, args, 10 * m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
if (!response.error) if (!response.error)
emit repositoryChanged(workingDir); emit repositoryChanged(workingDir);
@@ -932,7 +932,7 @@ void SubversionPluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
args.append(QDir::toNativeSeparators(SubversionClient::escapeFile(file))); args.append(QDir::toNativeSeparators(SubversionClient::escapeFile(file)));
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeoutS(), = runSvn(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ForceCLocale, codec); VcsCommand::SshPasswordPrompt | VcsCommand::ForceCLocale, codec);
if (response.error) if (response.error)
return; return;
@@ -1095,7 +1095,7 @@ bool SubversionPluginPrivate::vcsAdd(const QString &workingDir, const QString &r
<< SubversionClient::addAuthenticationOptions(m_settings) << SubversionClient::addAuthenticationOptions(m_settings)
<< QLatin1String("--parents") << file; << QLatin1String("--parents") << file;
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeoutS(), = runSvn(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
return !response.error; return !response.error;
} }
@@ -1110,7 +1110,7 @@ bool SubversionPluginPrivate::vcsDelete(const QString &workingDir, const QString
<< QLatin1String("--force") << file; << QLatin1String("--force") << file;
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeoutS(), = runSvn(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
return !response.error; return !response.error;
} }
@@ -1122,7 +1122,7 @@ bool SubversionPluginPrivate::vcsMove(const QString &workingDir, const QString &
args << QDir::toNativeSeparators(SubversionClient::escapeFile(from)) args << QDir::toNativeSeparators(SubversionClient::escapeFile(from))
<< QDir::toNativeSeparators(SubversionClient::escapeFile(to)); << QDir::toNativeSeparators(SubversionClient::escapeFile(to));
const SubversionResponse response const SubversionResponse response
= runSvn(workingDir, args, m_client->vcsTimeoutS(), = runSvn(workingDir, args, m_settings.vcsTimeoutS(),
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut
| VcsCommand::FullySynchronously); | VcsCommand::FullySynchronously);
return !response.error; return !response.error;
@@ -1151,7 +1151,7 @@ bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteA
args << QLatin1String(tempUrl.toEncoded()) << directory; args << QLatin1String(tempUrl.toEncoded()) << directory;
const SubversionResponse response const SubversionResponse response
= runSvn(directory, args, 10 * m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); = runSvn(directory, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
return !response.error; return !response.error;
} }
@@ -1186,7 +1186,7 @@ bool SubversionPluginPrivate::managesFile(const QString &workingDirectory, const
args << SubversionClient::addAuthenticationOptions(m_settings) args << SubversionClient::addAuthenticationOptions(m_settings)
<< QDir::toNativeSeparators(SubversionClient::escapeFile(fileName)); << QDir::toNativeSeparators(SubversionClient::escapeFile(fileName));
SubversionResponse response SubversionResponse response
= runSvn(workingDirectory, args, m_client->vcsTimeoutS(), 0); = runSvn(workingDirectory, args, m_settings.vcsTimeoutS(), 0);
return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?'); return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?');
} }

View File

@@ -214,7 +214,7 @@ SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &
int VcsBaseClientImpl::vcsTimeoutS() const int VcsBaseClientImpl::vcsTimeoutS() const
{ {
return settings().intValue(VcsBaseClientSettings::timeoutKey); return m_clientSettings->vcsTimeoutS();
} }
VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Core::Id kind, QString title, VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Core::Id kind, QString title,

View File

@@ -361,6 +361,11 @@ FilePath VcsBaseClientSettings::binaryPath() const
return d->m_binaryFullPath; return d->m_binaryFullPath;
} }
int VcsBaseClientSettings::vcsTimeoutS() const
{
return intValue(VcsBaseClientSettings::timeoutKey);
}
QStringList VcsBaseClientSettings::searchPathList() const QStringList VcsBaseClientSettings::searchPathList() const
{ {
return stringValue(pathKey).split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); return stringValue(pathKey).split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);

View File

@@ -80,6 +80,7 @@ public:
Utils::FilePath binaryPath() const; Utils::FilePath binaryPath() const;
QStringList searchPathList() const; QStringList searchPathList() const;
int vcsTimeoutS() const;
protected: protected:
QString settingsGroup() const; QString settingsGroup() const;