From b23dc3a0bf963629b6244b0a752cf284ca6fbe61 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 3 Feb 2020 14:56:09 +0100 Subject: [PATCH] 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 --- src/plugins/cvs/cvsplugin.cpp | 38 +++++++++---------- src/plugins/subversion/subversionplugin.cpp | 24 ++++++------ src/plugins/vcsbase/vcsbaseclient.cpp | 2 +- src/plugins/vcsbase/vcsbaseclientsettings.cpp | 5 +++ src/plugins/vcsbase/vcsbaseclientsettings.h | 1 + 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index e6b922409f4..03d03a7b98d 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -851,7 +851,7 @@ void CvsPluginPrivate::revertAll() QStringList args; args << QLatin1String("update") << QLatin1String("-C") << state.topLevel(); const CvsResponse revertResponse = - runCvs(state.topLevel(), args, m_client->vcsTimeoutS(), + runCvs(state.topLevel(), args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); if (revertResponse.result == CvsResponse::Ok) emit repositoryChanged(state.topLevel()); @@ -867,7 +867,7 @@ void CvsPluginPrivate::revertCurrentFile() QStringList args; args << QLatin1String("diff") << state.relativeCurrentFile(); const CvsResponse diffResponse = - runCvs(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0); + runCvs(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), 0); switch (diffResponse.result) { case CvsResponse::Ok: return; // Not modified, diff exit code 0 @@ -889,7 +889,7 @@ void CvsPluginPrivate::revertCurrentFile() args.clear(); args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile(); const CvsResponse revertResponse = - runCvs(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), + runCvs(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); if (revertResponse.result == CvsResponse::Ok) 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. QStringList args = QStringList(QLatin1String("status")); const CvsResponse response = - runCvs(workingDir, args, m_client->vcsTimeoutS(), VcsCommand::MergeOutputChannels); + runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::MergeOutputChannels); if (response.result != CvsResponse::Ok) return; // 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.append(fileList); const CvsResponse response = - runCvs(m_commitRepository, args, 10 * m_client->vcsTimeoutS(), + runCvs(m_commitRepository, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); return response.result == CvsResponse::Ok ; } @@ -1038,7 +1038,7 @@ void CvsPluginPrivate::filelog(const QString &workingDir, args << QLatin1String("log"); args.append(file); const CvsResponse response = - runCvs(workingDir, args, m_client->vcsTimeoutS(), + runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt, codec); if (response.result != CvsResponse::Ok) return; @@ -1079,7 +1079,7 @@ bool CvsPluginPrivate::update(const QString &topLevel, const QString &file) if (!file.isEmpty()) args.append(file); const CvsResponse response = - runCvs(topLevel, args, 10 * m_client->vcsTimeoutS(), + runCvs(topLevel, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); const bool ok = response.result == CvsResponse::Ok; if (ok) @@ -1126,7 +1126,7 @@ bool CvsPluginPrivate::edit(const QString &topLevel, const QStringList &files) QStringList args(QLatin1String("edit")); args.append(files); const CvsResponse response = - runCvs(topLevel, args, m_client->vcsTimeoutS(), + runCvs(topLevel, args, m_settings.vcsTimeoutS(), VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt); return response.result == CvsResponse::Ok; } @@ -1138,7 +1138,7 @@ bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringL QStringList args(QLatin1String("-q")); args << QLatin1String("diff"); 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) return false; *modified = response.result == CvsResponse::NonNullExitCode; @@ -1166,7 +1166,7 @@ bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files) args.append(QLatin1String("-y")); args.append(files); const CvsResponse response = - runCvs(topLevel, args, m_client->vcsTimeoutS(), + runCvs(topLevel, args, m_settings.vcsTimeoutS(), VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt); return response.result == CvsResponse::Ok; } @@ -1185,7 +1185,7 @@ void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file, args << QLatin1String("-r") << revision; args << file; const CvsResponse response = - runCvs(workingDir, args, m_client->vcsTimeoutS(), + runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt, codec); if (response.result != CvsResponse::Ok) return; @@ -1214,7 +1214,7 @@ bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, cons if (!file.isEmpty()) args.append(file); const CvsResponse response = - runCvs(topLevel, args, m_client->vcsTimeoutS(), 0); + runCvs(topLevel, args, m_settings.vcsTimeoutS(), 0); const bool ok = response.result == CvsResponse::Ok; if (ok) showOutputInEditor(title, response.stdOut, OtherContent, topLevel, nullptr); @@ -1289,7 +1289,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co QStringList args; args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file; const CvsResponse logResponse = - runCvs(toplevel, args, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); + runCvs(toplevel, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt); if (logResponse.result != CvsResponse::Ok) { *errorMessage = logResponse.message; return false; @@ -1311,7 +1311,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS); 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) { *errorMessage = repoLogResponse.message; return false; @@ -1348,7 +1348,7 @@ bool CvsPluginPrivate::describe(const QString &repositoryPath, QStringList args(QLatin1String("log")); args << (QLatin1String("-r") + it->revisions.front().revision) << it->file; const CvsResponse logResponse = - runCvs(repositoryPath, args, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); + runCvs(repositoryPath, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt); if (logResponse.result != CvsResponse::Ok) { *errorMessage = logResponse.message; return false; @@ -1365,7 +1365,7 @@ bool CvsPluginPrivate::describe(const QString &repositoryPath, << QLatin1String("-r") << previousRev << QLatin1String("-r") << it->revisions.front().revision << it->file; const CvsResponse diffResponse = - runCvs(repositoryPath, args, m_client->vcsTimeoutS(), 0, codec); + runCvs(repositoryPath, args, m_settings.vcsTimeoutS(), 0, codec); switch (diffResponse.result) { case CvsResponse::Ok: case CvsResponse::NonNullExitCode: // Diff exit code != 0 @@ -1475,7 +1475,7 @@ bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileN QStringList args; args << QLatin1String("add") << rawFileName; const CvsResponse response = - runCvs(workingDir, args, m_client->vcsTimeoutS(), + runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); return response.result == CvsResponse::Ok; } @@ -1485,7 +1485,7 @@ bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFi QStringList args; args << QLatin1String("remove") << QLatin1String("-f") << rawFileName; const CvsResponse response = - runCvs(workingDir, args, m_client->vcsTimeoutS(), + runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); return response.result == CvsResponse::Ok; } @@ -1526,7 +1526,7 @@ bool CvsPluginPrivate::managesFile(const QString &workingDirectory, const QStrin QStringList args; args << QLatin1String("status") << fileName; const CvsResponse response = - runCvs(workingDirectory, args, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); + runCvs(workingDirectory, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt); if (response.result != CvsResponse::Ok) return false; return !response.stdOut.contains(QLatin1String("Status: Unknown")); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 1193cb1e037..c489977a5b2 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -689,7 +689,7 @@ void SubversionPluginPrivate::revertAll() args << SubversionClient::addAuthenticationOptions(m_settings); args << QLatin1String("--recursive") << state.topLevel(); const SubversionResponse revertResponse - = runSvn(state.topLevel(), args, m_client->vcsTimeoutS(), + = runSvn(state.topLevel(), args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); if (revertResponse.error) QMessageBox::warning(ICore::dialogParent(), title, @@ -708,7 +708,7 @@ void SubversionPluginPrivate::revertCurrentFile() args.push_back(SubversionClient::escapeFile(state.relativeCurrentFile())); const SubversionResponse diffResponse - = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0); + = runSvn(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), 0); if (diffResponse.error) return; @@ -729,7 +729,7 @@ void SubversionPluginPrivate::revertCurrentFile() args << SubversionClient::escapeFile(state.relativeCurrentFile()); const SubversionResponse revertResponse - = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), + = runSvn(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); if (!revertResponse.error) @@ -795,7 +795,7 @@ void SubversionPluginPrivate::startCommit(const QString &workingDir, const QStri args += SubversionClient::escapeFiles(files); const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeoutS(), 0); + = runSvn(workingDir, args, m_settings.vcsTimeoutS(), 0); if (response.error) return; @@ -875,7 +875,7 @@ void SubversionPluginPrivate::svnStatus(const QString &workingDir, const QString if (!relativePath.isEmpty()) args.append(SubversionClient::escapeFile(relativePath)); VcsOutputWindow::setRepository(workingDir); - runSvn(workingDir, args, m_client->vcsTimeoutS(), + runSvn(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage); VcsOutputWindow::clearRepository(); } @@ -902,7 +902,7 @@ void SubversionPluginPrivate::svnUpdate(const QString &workingDir, const QString if (!relativePath.isEmpty()) args.append(relativePath); const SubversionResponse response - = runSvn(workingDir, args, 10 * m_client->vcsTimeoutS(), + = runSvn(workingDir, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); if (!response.error) emit repositoryChanged(workingDir); @@ -932,7 +932,7 @@ void SubversionPluginPrivate::vcsAnnotateHelper(const QString &workingDir, const args.append(QDir::toNativeSeparators(SubversionClient::escapeFile(file))); const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeoutS(), + = runSvn(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ForceCLocale, codec); if (response.error) return; @@ -1095,7 +1095,7 @@ bool SubversionPluginPrivate::vcsAdd(const QString &workingDir, const QString &r << SubversionClient::addAuthenticationOptions(m_settings) << QLatin1String("--parents") << file; const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeoutS(), + = runSvn(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); return !response.error; } @@ -1110,7 +1110,7 @@ bool SubversionPluginPrivate::vcsDelete(const QString &workingDir, const QString << QLatin1String("--force") << file; const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeoutS(), + = runSvn(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut); return !response.error; } @@ -1122,7 +1122,7 @@ bool SubversionPluginPrivate::vcsMove(const QString &workingDir, const QString & args << QDir::toNativeSeparators(SubversionClient::escapeFile(from)) << QDir::toNativeSeparators(SubversionClient::escapeFile(to)); const SubversionResponse response - = runSvn(workingDir, args, m_client->vcsTimeoutS(), + = runSvn(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut | VcsCommand::FullySynchronously); return !response.error; @@ -1151,7 +1151,7 @@ bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteA args << QLatin1String(tempUrl.toEncoded()) << directory; const SubversionResponse response - = runSvn(directory, args, 10 * m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt); + = runSvn(directory, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt); return !response.error; } @@ -1186,7 +1186,7 @@ bool SubversionPluginPrivate::managesFile(const QString &workingDirectory, const args << SubversionClient::addAuthenticationOptions(m_settings) << QDir::toNativeSeparators(SubversionClient::escapeFile(fileName)); 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('?'); } diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 505733145bd..40e5cd85641 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -214,7 +214,7 @@ SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString & int VcsBaseClientImpl::vcsTimeoutS() const { - return settings().intValue(VcsBaseClientSettings::timeoutKey); + return m_clientSettings->vcsTimeoutS(); } VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Core::Id kind, QString title, diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp index de6a7a82f0c..51acbfa4912 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp +++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp @@ -361,6 +361,11 @@ FilePath VcsBaseClientSettings::binaryPath() const return d->m_binaryFullPath; } +int VcsBaseClientSettings::vcsTimeoutS() const +{ + return intValue(VcsBaseClientSettings::timeoutKey); +} + QStringList VcsBaseClientSettings::searchPathList() const { return stringValue(pathKey).split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.h b/src/plugins/vcsbase/vcsbaseclientsettings.h index e722a56564d..db0ca0bf64c 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.h +++ b/src/plugins/vcsbase/vcsbaseclientsettings.h @@ -80,6 +80,7 @@ public: Utils::FilePath binaryPath() const; QStringList searchPathList() const; + int vcsTimeoutS() const; protected: QString settingsGroup() const;