VcsBase: Rename vcsFullySynchronousExec into vcsSynchronousExec

Get rid of original vcsSynchronousExec(), as it was calling
vcsFullySynchronousExec().

Change-Id: I911dc786d54c34c211d03661c37df9b58d60a20b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-09-02 15:12:13 +02:00
parent 996e1bfc45
commit 6d6346044c
8 changed files with 67 additions and 83 deletions

View File

@@ -129,7 +129,7 @@ bool BazaarClient::synchronousUncommit(const FilePath &workingDir,
<< revisionSpec(revision) << revisionSpec(revision)
<< extraOptions; << extraOptions;
const CommandResult result = vcsFullySynchronousExec(workingDir, args); const CommandResult result = vcsSynchronousExec(workingDir, args);
VcsOutputWindow::append(result.cleanedStdOut()); VcsOutputWindow::append(result.cleanedStdOut());
return result.result() == ProcessResult::FinishedWithSuccess; return result.result() == ProcessResult::FinishedWithSuccess;
} }
@@ -167,7 +167,7 @@ bool BazaarClient::managesFile(const FilePath &workingDirectory, const QString &
QStringList args(QLatin1String("status")); QStringList args(QLatin1String("status"));
args << fileName; args << fileName;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); const CommandResult result = vcsSynchronousExec(workingDirectory, args);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return false; return false;
return result.rawStdOut().startsWith("unknown"); return result.rawStdOut().startsWith("unknown");

View File

@@ -223,7 +223,7 @@ int GerritServer::testConnection()
{ {
static GitClient *const client = GitClient::instance(); static GitClient *const client = GitClient::instance();
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC); const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
const CommandResult result = client->vcsFullySynchronousExec({}, {curlBinary, arguments}); const CommandResult result = client->vcsSynchronousExec({}, {curlBinary, arguments});
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
QString output = result.cleanedStdOut(); QString output = result.cleanedStdOut();
// Gerrit returns an empty response for /p/qt-creator/a/accounts/self // Gerrit returns an empty response for /p/qt-creator/a/accounts/self
@@ -322,7 +322,7 @@ bool GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
if (port) if (port)
arguments << p.portFlag << QString::number(port); arguments << p.portFlag << QString::number(port);
arguments << hostArgument() << "gerrit" << "version"; arguments << hostArgument() << "gerrit" << "version";
const CommandResult result = client->vcsFullySynchronousExec({}, {p.ssh, arguments}, const CommandResult result = client->vcsSynchronousExec({}, {p.ssh, arguments},
VcsCommand::NoOutput); VcsCommand::NoOutput);
QString stdOut = result.cleanedStdOut().trimmed(); QString stdOut = result.cleanedStdOut().trimmed();
stdOut.remove("gerrit version "); stdOut.remove("gerrit version ");
@@ -331,7 +331,7 @@ bool GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
return false; return false;
} else { } else {
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC); const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
const CommandResult result = client->vcsFullySynchronousExec({}, {curlBinary, arguments}, const CommandResult result = client->vcsSynchronousExec({}, {curlBinary, arguments},
VcsCommand::NoOutput); VcsCommand::NoOutput);
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid // REST endpoint for version is only available from 2.8 and up. Do not consider invalid
// if it fails. // if it fails.

View File

@@ -904,7 +904,7 @@ QString GitClient::findGitDirForRepository(const FilePath &repositoryDir) const
bool GitClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const bool GitClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, const CommandResult result = vcsSynchronousExec(workingDirectory,
{"ls-files", "--error-unmatch", fileName}, VcsCommand::NoOutput); {"ls-files", "--error-unmatch", fileName}, VcsCommand::NoOutput);
return result.result() == ProcessResult::FinishedWithSuccess; return result.result() == ProcessResult::FinishedWithSuccess;
} }
@@ -920,7 +920,7 @@ FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const
QStringList args({"ls-files", "-z"}); QStringList args({"ls-files", "-z"});
const QDir wd(it.key().toString()); const QDir wd(it.key().toString());
args << transform(it.value(), [&wd](const QString &fp) { return wd.relativeFilePath(fp); }); args << transform(it.value(), [&wd](const QString &fp) { return wd.relativeFilePath(fp); });
const CommandResult result = vcsFullySynchronousExec(it.key(), args, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(it.key(), args, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return filePaths; return filePaths;
const QStringList managedFilePaths const QStringList managedFilePaths
@@ -1496,7 +1496,7 @@ void GitClient::removeStaleRemoteBranches(const FilePath &workingDirectory, cons
void GitClient::recoverDeletedFiles(const FilePath &workingDirectory) void GitClient::recoverDeletedFiles(const FilePath &workingDirectory)
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"ls-files", "--deleted"}, const CommandResult result = vcsSynchronousExec(workingDirectory, {"ls-files", "--deleted"},
VcsCommand::SuppressCommandLogging); VcsCommand::SuppressCommandLogging);
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
const QString stdOut = result.cleanedStdOut().trimmed(); const QString stdOut = result.cleanedStdOut().trimmed();
@@ -1522,8 +1522,8 @@ bool GitClient::synchronousLog(const FilePath &workingDirectory, const QStringLi
allArguments.append(arguments); allArguments.append(arguments);
const CommandResult result = vcsFullySynchronousExec(workingDirectory, allArguments, const CommandResult result = vcsSynchronousExec(workingDirectory, allArguments, flags,
flags, vcsTimeoutS(), encoding(workingDirectory, "i18n.logOutputEncoding")); vcsTimeoutS(), encoding(workingDirectory, "i18n.logOutputEncoding"));
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
*output = result.cleanedStdOut(); *output = result.cleanedStdOut();
return true; return true;
@@ -1539,7 +1539,7 @@ bool GitClient::synchronousAdd(const FilePath &workingDirectory,
{ {
QStringList args{"add"}; QStringList args{"add"};
args += extraOptions + files; args += extraOptions + files;
return vcsFullySynchronousExec(workingDirectory, args).result() return vcsSynchronousExec(workingDirectory, args).result()
== ProcessResult::FinishedWithSuccess; == ProcessResult::FinishedWithSuccess;
} }
@@ -1551,7 +1551,7 @@ bool GitClient::synchronousDelete(const FilePath &workingDirectory,
if (force) if (force)
arguments << "--force"; arguments << "--force";
arguments.append(files); arguments.append(files);
return vcsFullySynchronousExec(workingDirectory, arguments).result() return vcsSynchronousExec(workingDirectory, arguments).result()
== ProcessResult::FinishedWithSuccess; == ProcessResult::FinishedWithSuccess;
} }
@@ -1559,7 +1559,7 @@ bool GitClient::synchronousMove(const FilePath &workingDirectory,
const QString &from, const QString &from,
const QString &to) const QString &to)
{ {
return vcsFullySynchronousExec(workingDirectory, {"mv", from, to}).result() return vcsSynchronousExec(workingDirectory, {"mv", from, to}).result()
== ProcessResult::FinishedWithSuccess; == ProcessResult::FinishedWithSuccess;
} }
@@ -1573,7 +1573,7 @@ bool GitClient::synchronousReset(const FilePath &workingDirectory,
else else
arguments << HEAD << "--" << files; arguments << HEAD << "--" << files;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments);
const QString stdOut = result.cleanedStdOut(); const QString stdOut = result.cleanedStdOut();
VcsOutputWindow::append(stdOut); VcsOutputWindow::append(stdOut);
// Note that git exits with 1 even if the operation is successful // Note that git exits with 1 even if the operation is successful
@@ -1596,7 +1596,7 @@ bool GitClient::synchronousReset(const FilePath &workingDirectory,
// Initialize repository // Initialize repository
bool GitClient::synchronousInit(const FilePath &workingDirectory) bool GitClient::synchronousInit(const FilePath &workingDirectory)
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, QStringList{"init"}); const CommandResult result = vcsSynchronousExec(workingDirectory, QStringList{"init"});
// '[Re]Initialized...' // '[Re]Initialized...'
VcsOutputWindow::append(result.cleanedStdOut()); VcsOutputWindow::append(result.cleanedStdOut());
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
@@ -1622,7 +1622,7 @@ bool GitClient::synchronousCheckoutFiles(const FilePath &workingDirectory, QStri
if (revertStaging) if (revertStaging)
arguments << revision; arguments << revision;
arguments << "--" << files; arguments << "--" << files;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, const CommandResult result = vcsSynchronousExec(workingDirectory, arguments,
VcsCommand::ExpectRepoChanges); VcsCommand::ExpectRepoChanges);
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return true; return true;
@@ -1674,7 +1674,7 @@ bool GitClient::synchronousRevListCmd(const FilePath &workingDirectory, const QS
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments; const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage);
return false; return false;
@@ -1737,7 +1737,7 @@ QString GitClient::synchronousShortDescription(const FilePath &workingDirectory,
QString GitClient::synchronousCurrentLocalBranch(const FilePath &workingDirectory) const QString GitClient::synchronousCurrentLocalBranch(const FilePath &workingDirectory) const
{ {
QString branch; QString branch;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"symbolic-ref", HEAD}, const CommandResult result = vcsSynchronousExec(workingDirectory, {"symbolic-ref", HEAD},
VcsCommand::NoOutput); VcsCommand::NoOutput);
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
branch = result.cleanedStdOut().trimmed(); branch = result.cleanedStdOut().trimmed();
@@ -1762,7 +1762,7 @@ bool GitClient::synchronousHeadRefs(const FilePath &workingDirectory, QStringLis
QString *errorMessage) const QString *errorMessage) const
{ {
const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"}; const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage);
return false; return false;
@@ -1810,7 +1810,7 @@ QString GitClient::synchronousTopic(const FilePath &workingDirectory) const
return remoteBranch; return remoteBranch;
// No tag or remote branch - try git describe // No tag or remote branch - try git describe
const CommandResult result = vcsFullySynchronousExec(workingDirectory, QStringList{"describe"}, const CommandResult result = vcsSynchronousExec(workingDirectory, QStringList{"describe"},
VcsCommand::NoOutput); VcsCommand::NoOutput);
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
const QString stdOut = result.cleanedStdOut().trimmed(); const QString stdOut = result.cleanedStdOut().trimmed();
@@ -1824,7 +1824,7 @@ bool GitClient::synchronousRevParseCmd(const FilePath &workingDirectory, const Q
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
const QStringList arguments = {"rev-parse", ref}; const QStringList arguments = {"rev-parse", ref};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
*output = result.cleanedStdOut().trimmed(); *output = result.cleanedStdOut().trimmed();
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return true; return true;
@@ -1836,7 +1836,7 @@ bool GitClient::synchronousRevParseCmd(const FilePath &workingDirectory, const Q
QString GitClient::synchronousTopRevision(const FilePath &workingDirectory, QDateTime *dateTime) QString GitClient::synchronousTopRevision(const FilePath &workingDirectory, QDateTime *dateTime)
{ {
const QStringList arguments = {"show", "-s", "--pretty=format:%H:%ct", HEAD}; const QStringList arguments = {"show", "-s", "--pretty=format:%H:%ct", HEAD};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return QString(); return QString();
const QStringList output = result.cleanedStdOut().trimmed().split(':'); const QStringList output = result.cleanedStdOut().trimmed().split(':');
@@ -1850,14 +1850,14 @@ QString GitClient::synchronousTopRevision(const FilePath &workingDirectory, QDat
bool GitClient::isRemoteCommit(const FilePath &workingDirectory, const QString &commit) bool GitClient::isRemoteCommit(const FilePath &workingDirectory, const QString &commit)
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, const CommandResult result = vcsSynchronousExec(workingDirectory,
{"branch", "-r", "--contains", commit}, VcsCommand::NoOutput); {"branch", "-r", "--contains", commit}, VcsCommand::NoOutput);
return !result.rawStdOut().isEmpty(); return !result.rawStdOut().isEmpty();
} }
bool GitClient::isFastForwardMerge(const FilePath &workingDirectory, const QString &branch) bool GitClient::isFastForwardMerge(const FilePath &workingDirectory, const QString &branch)
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, const CommandResult result = vcsSynchronousExec(workingDirectory,
{"merge-base", HEAD, branch}, VcsCommand::NoOutput); {"merge-base", HEAD, branch}, VcsCommand::NoOutput);
return result.cleanedStdOut().trimmed() == synchronousTopRevision(workingDirectory); return result.cleanedStdOut().trimmed() == synchronousTopRevision(workingDirectory);
} }
@@ -1868,7 +1868,7 @@ QString GitClient::synchronousShortDescription(const FilePath &workingDirectory,
{ {
const QStringList arguments = {"log", noColorOption, ("--pretty=format:" + format), const QStringList arguments = {"log", noColorOption, ("--pretty=format:" + format),
"--max-count=1", revision}; "--max-count=1", revision};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3") VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
.arg(revision, workingDirectory.toUserOutput(), result.cleanedStdErr())); .arg(revision, workingDirectory.toUserOutput(), result.cleanedStdErr()));
@@ -1985,7 +1985,7 @@ bool GitClient::synchronousBranchCmd(const FilePath &workingDirectory, QStringLi
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
branchArgs.push_front("branch"); branchArgs.push_front("branch");
const CommandResult result = vcsFullySynchronousExec(workingDirectory, branchArgs); const CommandResult result = vcsSynchronousExec(workingDirectory, branchArgs);
*output = result.cleanedStdOut(); *output = result.cleanedStdOut();
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return true; return true;
@@ -1997,7 +1997,7 @@ bool GitClient::synchronousTagCmd(const FilePath &workingDirectory, QStringList
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
tagArgs.push_front("tag"); tagArgs.push_front("tag");
const CommandResult result = vcsFullySynchronousExec(workingDirectory, tagArgs); const CommandResult result = vcsSynchronousExec(workingDirectory, tagArgs);
*output = result.cleanedStdOut(); *output = result.cleanedStdOut();
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return true; return true;
@@ -2009,7 +2009,7 @@ bool GitClient::synchronousForEachRefCmd(const FilePath &workingDirectory, QStri
QString *output, QString *errorMessage) const QString *output, QString *errorMessage) const
{ {
args.push_front("for-each-ref"); args.push_front("for-each-ref");
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, args, VcsCommand::NoOutput);
*output = result.cleanedStdOut(); *output = result.cleanedStdOut();
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return true; return true;
@@ -2021,7 +2021,7 @@ bool GitClient::synchronousRemoteCmd(const FilePath &workingDirectory, QStringLi
QString *output, QString *errorMessage, bool silent) const QString *output, QString *errorMessage, bool silent) const
{ {
remoteArgs.push_front("remote"); remoteArgs.push_front("remote");
const CommandResult result = vcsFullySynchronousExec(workingDirectory, remoteArgs, const CommandResult result = vcsSynchronousExec(workingDirectory, remoteArgs,
silent ? VcsCommand::NoOutput : 0); silent ? VcsCommand::NoOutput : 0);
const QString stdErr = result.cleanedStdErr(); const QString stdErr = result.cleanedStdErr();
*errorMessage = stdErr; *errorMessage = stdErr;
@@ -2063,7 +2063,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const FilePath &workingDirecto
QString *errorMessage) const QString *errorMessage) const
{ {
// get submodule status // get submodule status
const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"submodule", "status"}, const CommandResult result = vcsSynchronousExec(workingDirectory, {"submodule", "status"},
VcsCommand::NoOutput); VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
@@ -2144,7 +2144,7 @@ QByteArray GitClient::synchronousShow(const FilePath &workingDirectory, const QS
return {}; return {};
} }
const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id}; const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, flags); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, flags);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), nullptr); msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), nullptr);
return {}; return {};
@@ -2159,8 +2159,7 @@ bool GitClient::cleanList(const FilePath &workingDirectory, const QString &modul
const FilePath directory = workingDirectory.pathAppended(modulePath); const FilePath directory = workingDirectory.pathAppended(modulePath);
const QStringList arguments = {"clean", "--dry-run", flag}; const QStringList arguments = {"clean", "--dry-run", flag};
const CommandResult result = vcsFullySynchronousExec(directory, arguments, const CommandResult result = vcsSynchronousExec(directory, arguments, VcsCommand::ForceCLocale);
VcsCommand::ForceCLocale);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, directory, result.cleanedStdErr(), errorMessage); msgCannotRun(arguments, directory, result.cleanedStdErr(), errorMessage);
return false; return false;
@@ -2206,7 +2205,7 @@ bool GitClient::synchronousApplyPatch(const FilePath &workingDirectory,
QStringList arguments = {"apply", "--whitespace=fix"}; QStringList arguments = {"apply", "--whitespace=fix"};
arguments << extraArguments << file; arguments << extraArguments << file;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments);
const QString stdErr = result.cleanedStdErr(); const QString stdErr = result.cleanedStdErr();
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
if (!stdErr.isEmpty()) if (!stdErr.isEmpty())
@@ -2341,7 +2340,7 @@ GitClient::StatusResult GitClient::gitStatus(const FilePath &workingDirectory, S
arguments << "--ignore-submodules=all"; arguments << "--ignore-submodules=all";
arguments << "--porcelain" << "-b"; arguments << "--porcelain" << "-b";
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, VcsCommand::NoOutput);
const QString stdOut = result.cleanedStdOut(); const QString stdOut = result.cleanedStdOut();
if (output) if (output)
@@ -2710,7 +2709,7 @@ bool GitClient::readDataFromCommit(const FilePath &repoDirectory, const QString
{ {
// Get commit data as "SHA1<lf>author<lf>email<lf>message". // Get commit data as "SHA1<lf>author<lf>email<lf>message".
const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit}; const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit};
const CommandResult result = vcsFullySynchronousExec(repoDirectory, arguments, VcsCommand::NoOutput); const CommandResult result = vcsSynchronousExec(repoDirectory, arguments, VcsCommand::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
if (errorMessage) { if (errorMessage) {
@@ -3141,7 +3140,7 @@ void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QStrin
return; return;
} }
const CommandResult result = vcsFullySynchronousExec(workingDir, {abortCommand, "--abort"}, const CommandResult result = vcsSynchronousExec(workingDir, {abortCommand, "--abort"},
VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage); VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage);
VcsOutputWindow::append(result.cleanedStdOut()); VcsOutputWindow::append(result.cleanedStdOut());
} }
@@ -3166,7 +3165,7 @@ QString GitClient::synchronousTrackingBranch(const FilePath &workingDirectory, c
bool GitClient::synchronousSetTrackingBranch(const FilePath &workingDirectory, bool GitClient::synchronousSetTrackingBranch(const FilePath &workingDirectory,
const QString &branch, const QString &tracking) const QString &branch, const QString &tracking)
{ {
const CommandResult result = vcsFullySynchronousExec(workingDirectory, const CommandResult result = vcsSynchronousExec(workingDirectory,
{"branch", "--set-upstream-to=" + tracking, branch}); {"branch", "--set-upstream-to=" + tracking, branch});
return result.result() == ProcessResult::FinishedWithSuccess; return result.result() == ProcessResult::FinishedWithSuccess;
} }
@@ -3488,7 +3487,7 @@ bool GitClient::synchronousStashRemove(const FilePath &workingDirectory, const Q
else else
arguments << "drop" << stash; arguments << "drop" << stash;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments); const CommandResult result = vcsSynchronousExec(workingDirectory, arguments);
if (result.result() == ProcessResult::FinishedWithSuccess) { if (result.result() == ProcessResult::FinishedWithSuccess) {
const QString output = result.cleanedStdOut(); const QString output = result.cleanedStdOut();
if (!output.isEmpty()) if (!output.isEmpty())
@@ -3505,7 +3504,7 @@ bool GitClient::synchronousStashList(const FilePath &workingDirectory, QList<Sta
stashes->clear(); stashes->clear();
const QStringList arguments = {"stash", "list", noColorOption}; const QStringList arguments = {"stash", "list", noColorOption};
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, const CommandResult result = vcsSynchronousExec(workingDirectory, arguments,
VcsCommand::ForceCLocale); VcsCommand::ForceCLocale);
if (result.result() != ProcessResult::FinishedWithSuccess) { if (result.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage);
@@ -3551,7 +3550,7 @@ QString GitClient::readOneLine(const FilePath &workingDirectory, const QStringLi
? QTextCodec::codecForName("UTF-8") ? QTextCodec::codecForName("UTF-8")
: QTextCodec::codecForLocale(); : QTextCodec::codecForLocale();
const CommandResult result = vcsFullySynchronousExec(workingDirectory, arguments, const CommandResult result = vcsSynchronousExec(workingDirectory, arguments,
VcsCommand::NoOutput, vcsTimeoutS(), codec); VcsCommand::NoOutput, vcsTimeoutS(), codec);
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return result.cleanedStdOut().trimmed(); return result.cleanedStdOut().trimmed();

View File

@@ -74,7 +74,7 @@ bool MercurialClient::manifestSync(const FilePath &repository, const QString &re
// This only works when called from the repo and outputs paths relative to it. // This only works when called from the repo and outputs paths relative to it.
const QStringList args(QLatin1String("manifest")); const QStringList args(QLatin1String("manifest"));
const CommandResult result = vcsFullySynchronousExec(repository, args); const CommandResult result = vcsSynchronousExec(repository, args);
const QDir repositoryDir(repository.toString()); const QDir repositoryDir(repository.toString());
const QFileInfo needle = QFileInfo(repositoryDir, relativeFilename); const QFileInfo needle = QFileInfo(repositoryDir, relativeFilename);
@@ -101,7 +101,7 @@ bool MercurialClient::synchronousClone(const FilePath &workingDirectory,
if (workingDirectory.exists()) { if (workingDirectory.exists()) {
// Let's make first init // Let's make first init
QStringList arguments(QLatin1String("init")); QStringList arguments(QLatin1String("init"));
if (vcsFullySynchronousExec(workingDirectory, arguments).result() if (vcsSynchronousExec(workingDirectory, arguments).result()
!= ProcessResult::FinishedWithSuccess) { != ProcessResult::FinishedWithSuccess) {
return false; return false;
} }
@@ -187,7 +187,7 @@ QStringList MercurialClient::parentRevisionsSync(const FilePath &workingDirector
args << QLatin1String("parents") << QLatin1String("-r") <<revision; args << QLatin1String("parents") << QLatin1String("-r") <<revision;
if (!file.isEmpty()) if (!file.isEmpty())
args << file; args << file;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); const CommandResult result = vcsSynchronousExec(workingDirectory, args);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return {}; return {};
/* Looks like: \code /* Looks like: \code
@@ -229,7 +229,7 @@ QString MercurialClient::shortDescriptionSync(const FilePath &workingDirectory,
if (!format.isEmpty()) if (!format.isEmpty())
args << QLatin1String("--template") << format; args << QLatin1String("--template") << format;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); const CommandResult result = vcsSynchronousExec(workingDirectory, args);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return revision; return revision;
return stripLastNewline(result.cleanedStdOut()); return stripLastNewline(result.cleanedStdOut());
@@ -248,7 +248,7 @@ bool MercurialClient::managesFile(const FilePath &workingDirectory, const QStrin
{ {
QStringList args; QStringList args;
args << QLatin1String("status") << QLatin1String("--unknown") << fileName; args << QLatin1String("status") << QLatin1String("--unknown") << fileName;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); const CommandResult result = vcsSynchronousExec(workingDirectory, args);
return result.cleanedStdOut().isEmpty(); return result.cleanedStdOut().isEmpty();
} }

View File

@@ -130,7 +130,7 @@ QString SubversionClient::synchronousTopic(const FilePath &repository) const
else else
svnVersionBinary = svnVersionBinary.left(pos + 1); svnVersionBinary = svnVersionBinary.left(pos + 1);
svnVersionBinary.append(HostOsInfo::withExecutableSuffix("svnversion")); svnVersionBinary.append(HostOsInfo::withExecutableSuffix("svnversion"));
const CommandResult result = vcsFullySynchronousExec(repository, const CommandResult result = vcsSynchronousExec(repository,
{FilePath::fromString(svnVersionBinary), args}); {FilePath::fromString(svnVersionBinary), args});
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
return result.cleanedStdOut().trimmed(); return result.cleanedStdOut().trimmed();

View File

@@ -994,7 +994,7 @@ SubversionResponse SubversionPluginPrivate::runSvn(const FilePath &workingDir,
return response; return response;
} }
const CommandResult result = m_client->vcsFullySynchronousExec(workingDir, arguments, flags, const CommandResult result = m_client->vcsSynchronousExec(workingDir, arguments, flags,
m_settings.timeout.value() * defaultTimeoutMutiplier, outputCodec); m_settings.timeout.value() * defaultTimeoutMutiplier, outputCodec);
response.error = result.result() != ProcessResult::FinishedWithSuccess; response.error = result.result() != ProcessResult::FinishedWithSuccess;

View File

@@ -119,13 +119,13 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in)
return in; return in;
} }
CommandResult VcsBaseClientImpl::vcsFullySynchronousExec(const FilePath &workingDir, CommandResult VcsBaseClientImpl::vcsSynchronousExec(const FilePath &workingDir,
const QStringList &args, unsigned flags, int timeoutS, QTextCodec *codec) const const QStringList &args, unsigned flags, int timeoutS, QTextCodec *codec) const
{ {
return vcsFullySynchronousExec(workingDir, {vcsBinary(), args}, flags, timeoutS, codec); return vcsSynchronousExec(workingDir, {vcsBinary(), args}, flags, timeoutS, codec);
} }
CommandResult VcsBaseClientImpl::vcsFullySynchronousExec(const FilePath &workingDir, CommandResult VcsBaseClientImpl::vcsSynchronousExec(const FilePath &workingDir,
const CommandLine &cmdLine, unsigned flags, int timeoutS, QTextCodec *codec) const const CommandLine &cmdLine, unsigned flags, int timeoutS, QTextCodec *codec) const
{ {
VcsCommand command(workingDir, processEnvironment()); VcsCommand command(workingDir, processEnvironment());
@@ -167,14 +167,6 @@ VcsCommand *VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory,
return command; return command;
} }
CommandResult VcsBaseClientImpl::vcsSynchronousExec(const FilePath &workingDir,
const QStringList &args,
unsigned flags,
QTextCodec *outputCodec) const
{
return vcsFullySynchronousExec(workingDir, args, flags, vcsTimeoutS(), outputCodec);
}
int VcsBaseClientImpl::vcsTimeoutS() const int VcsBaseClientImpl::vcsTimeoutS() const
{ {
return m_baseSettings->timeout.value(); return m_baseSettings->timeout.value();
@@ -232,7 +224,7 @@ bool VcsBaseClient::synchronousCreateRepository(const FilePath &workingDirectory
{ {
QStringList args(vcsCommandString(CreateRepositoryCommand)); QStringList args(vcsCommandString(CreateRepositoryCommand));
args << extraOptions; args << extraOptions;
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); const CommandResult result = vcsSynchronousExec(workingDirectory, args);
if (result.result() != ProcessResult::FinishedWithSuccess) if (result.result() != ProcessResult::FinishedWithSuccess)
return false; return false;
VcsOutputWindow::append(result.cleanedStdOut()); VcsOutputWindow::append(result.cleanedStdOut());
@@ -251,7 +243,7 @@ bool VcsBaseClient::synchronousClone(const FilePath &workingDir,
args << vcsCommandString(CloneCommand) args << vcsCommandString(CloneCommand)
<< extraOptions << srcLocation << dstLocation; << extraOptions << srcLocation << dstLocation;
const CommandResult result = vcsFullySynchronousExec(workingDir, args); const CommandResult result = vcsSynchronousExec(workingDir, args);
resetCachedVcsInfo(workingDir); resetCachedVcsInfo(workingDir);
return result.result() == ProcessResult::FinishedWithSuccess; return result.result() == ProcessResult::FinishedWithSuccess;
} }
@@ -262,7 +254,7 @@ bool VcsBaseClient::synchronousAdd(const FilePath &workingDir,
{ {
QStringList args; QStringList args;
args << vcsCommandString(AddCommand) << extraOptions << relFileName; args << vcsCommandString(AddCommand) << extraOptions << relFileName;
return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; return vcsSynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess;
} }
bool VcsBaseClient::synchronousRemove(const FilePath &workingDir, bool VcsBaseClient::synchronousRemove(const FilePath &workingDir,
@@ -271,7 +263,7 @@ bool VcsBaseClient::synchronousRemove(const FilePath &workingDir,
{ {
QStringList args; QStringList args;
args << vcsCommandString(RemoveCommand) << extraOptions << filename; args << vcsCommandString(RemoveCommand) << extraOptions << filename;
return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; return vcsSynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess;
} }
bool VcsBaseClient::synchronousMove(const FilePath &workingDir, bool VcsBaseClient::synchronousMove(const FilePath &workingDir,
@@ -281,7 +273,7 @@ bool VcsBaseClient::synchronousMove(const FilePath &workingDir,
{ {
QStringList args; QStringList args;
args << vcsCommandString(MoveCommand) << extraOptions << from << to; args << vcsCommandString(MoveCommand) << extraOptions << from << to;
return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; return vcsSynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess;
} }
bool VcsBaseClient::synchronousPull(const FilePath &workingDir, bool VcsBaseClient::synchronousPull(const FilePath &workingDir,

View File

@@ -76,10 +76,10 @@ public:
static QString stripLastNewline(const QString &in); static QString stripLastNewline(const QString &in);
// Fully synchronous VCS execution (QProcess-based) // Fully synchronous VCS execution (QProcess-based)
CommandResult vcsFullySynchronousExec(const Utils::FilePath &workingDir, CommandResult vcsSynchronousExec(const Utils::FilePath &workingDir,
const QStringList &args, unsigned flags = 0, const QStringList &args, unsigned flags = 0,
int timeoutS = -1, QTextCodec *codec = nullptr) const; int timeoutS = -1, QTextCodec *codec = nullptr) const;
CommandResult vcsFullySynchronousExec(const Utils::FilePath &workingDir, CommandResult vcsSynchronousExec(const Utils::FilePath &workingDir,
const Utils::CommandLine &cmdLine, unsigned flags = 0, const Utils::CommandLine &cmdLine, unsigned flags = 0,
int timeoutS = -1, QTextCodec *codec = nullptr) const; int timeoutS = -1, QTextCodec *codec = nullptr) const;
@@ -95,13 +95,6 @@ protected:
virtual void annotateRevisionRequested(const Utils::FilePath &workingDirectory, const QString &file, virtual void annotateRevisionRequested(const Utils::FilePath &workingDirectory, const QString &file,
const QString &change, int line); const QString &change, int line);
// Synchronous VCS execution using Utils::SynchronousProcess, with
// log windows updating (using VcsBasePlugin::runVcs with flags)
CommandResult vcsSynchronousExec(const Utils::FilePath &workingDir,
const QStringList &args,
unsigned flags = 0,
QTextCodec *outputCodec = nullptr) const;
private: private:
void saveSettings(); void saveSettings();