aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git
diff options
context:
space:
mode:
authorJarek Kobus <[email protected]>2022-03-02 04:12:25 +0100
committerJarek Kobus <[email protected]>2022-03-02 13:30:39 +0000
commit8e0ae8ba96ec5ca4512e39a16135e2279e88a4fb (patch)
tree0ffc1fb82bf551353e0ff5ade46af0c6565b4fc6 /src/plugins/git
parent6ff1723c4cb709ebffe2bb0c593371c51e6cf736 (diff)
QtcProcess: Limit the inclusion of qtcprocess.h
Move the rest of QtcProcess enums to processenums.h. Move ExitCodeInterpreter into processenums.h. Remove superfluous Utils:: prefix. Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80 Reviewed-by: hjk <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/changeselectiondialog.cpp13
-rw-r--r--src/plugins/git/gerrit/gerritserver.cpp4
-rw-r--r--src/plugins/git/gitclient.cpp72
-rw-r--r--src/plugins/git/gitgrep.cpp10
-rw-r--r--src/plugins/git/gitplugin.cpp1
5 files changed, 51 insertions, 49 deletions
diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp
index b56ee47916a..0313304f7d0 100644
--- a/src/plugins/git/changeselectiondialog.cpp
+++ b/src/plugins/git/changeselectiondialog.cpp
@@ -31,19 +31,20 @@
#include <coreplugin/vcsmanager.h>
#include <utils/pathchooser.h>
+#include <utils/qtcprocess.h>
#include <utils/theme/theme.h>
#include <vcsbase/vcscommand.h>
+#include <QCompleter>
+#include <QDir>
+#include <QFileDialog>
#include <QFormLayout>
-#include <QHBoxLayout>
-#include <QPushButton>
#include <QLabel>
+#include <QLayout>
#include <QLineEdit>
#include <QPlainTextEdit>
-#include <QDir>
-#include <QFileDialog>
-#include <QCompleter>
+#include <QPushButton>
#include <QStringListModel>
#include <QTimer>
@@ -161,7 +162,7 @@ void ChangeSelectionDialog::setDetails()
Theme *theme = creatorTheme();
QPalette palette;
- if (m_process->result() == QtcProcess::FinishedWithSuccess) {
+ if (m_process->result() == ProcessResult::FinishedWithSuccess) {
m_ui->detailsText->setPlainText(m_process->stdOut());
palette.setColor(QPalette::Text, theme->color(Theme::TextColorNormal));
m_ui->changeNumberEdit->setPalette(palette);
diff --git a/src/plugins/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp
index efc1d02520e..eab2e707590 100644
--- a/src/plugins/git/gerrit/gerritserver.cpp
+++ b/src/plugins/git/gerrit/gerritserver.cpp
@@ -247,7 +247,7 @@ int GerritServer::testConnection()
QtcProcess proc;
client->vcsFullySynchronousExec(proc, {}, {curlBinary, arguments},
Core::ShellCommand::NoOutput);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
QString output = proc.stdOut();
// Gerrit returns an empty response for /p/qt-creator/a/accounts/self
// so consider this as 404.
@@ -357,7 +357,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
Core::ShellCommand::NoOutput);
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid
// if it fails.
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
QString output = proc.stdOut();
if (output.isEmpty())
return;
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index febceadd346..cedf7715c37 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -678,7 +678,7 @@ public:
{
ConflictHandler handler(workingDirectory, abortCommand);
// No conflicts => do nothing
- if (proc.result() == QtcProcess::FinishedWithSuccess)
+ if (proc.result() == ProcessResult::FinishedWithSuccess)
return;
handler.readStdOut(proc.stdOut());
handler.readStdErr(proc.stdErr());
@@ -844,7 +844,7 @@ bool GitClient::managesFile(const FilePath &workingDirectory, const QString &fil
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--error-unmatch", fileName},
Core::ShellCommand::NoOutput);
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const
@@ -860,7 +860,7 @@ FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const
args << transform(it.value(), [&wd](const QString &fp) { return wd.relativeFilePath(fp); });
QtcProcess proc;
vcsFullySynchronousExec(proc, it.key(), args, Core::ShellCommand::NoOutput);
- if (proc.result() != QtcProcess::FinishedWithSuccess)
+ if (proc.result() != ProcessResult::FinishedWithSuccess)
return filePaths;
const QStringList managedFilePaths
= transform(proc.stdOut().split('\0', Qt::SkipEmptyParts),
@@ -1433,7 +1433,7 @@ void GitClient::recoverDeletedFiles(const FilePath &workingDirectory)
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"ls-files", "--deleted"},
VcsCommand::SuppressCommandLogging);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
const QString stdOut = proc.stdOut().trimmed();
if (stdOut.isEmpty()) {
VcsOutputWindow::appendError(tr("Nothing to recover"));
@@ -1460,7 +1460,7 @@ bool GitClient::synchronousLog(const FilePath &workingDirectory, const QStringLi
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, allArguments, flags, vcsTimeoutS(),
encoding(workingDirectory, "i18n.logOutputEncoding"));
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
*output = proc.stdOut();
return true;
} else {
@@ -1478,7 +1478,7 @@ bool GitClient::synchronousAdd(const FilePath &workingDirectory,
args += extraOptions + files;
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args);
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
bool GitClient::synchronousDelete(const FilePath &workingDirectory,
@@ -1491,7 +1491,7 @@ bool GitClient::synchronousDelete(const FilePath &workingDirectory,
arguments.append(files);
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments);
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
bool GitClient::synchronousMove(const FilePath &workingDirectory,
@@ -1500,7 +1500,7 @@ bool GitClient::synchronousMove(const FilePath &workingDirectory,
{
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"mv", from, to});
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
bool GitClient::synchronousReset(const FilePath &workingDirectory,
@@ -1520,7 +1520,7 @@ bool GitClient::synchronousReset(const FilePath &workingDirectory,
// Note that git exits with 1 even if the operation is successful
// Assume real failure if the output does not contain "foo.cpp modified"
// or "Unstaged changes after reset" (git 1.7.0).
- if (proc.result() != QtcProcess::FinishedWithSuccess
+ if (proc.result() != ProcessResult::FinishedWithSuccess
&& (!stdOut.contains("modified") && !stdOut.contains("Unstaged changes after reset"))) {
if (files.isEmpty()) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
@@ -1541,7 +1541,7 @@ bool GitClient::synchronousInit(const FilePath &workingDirectory)
vcsFullySynchronousExec(proc, workingDirectory, QStringList{"init"});
// '[Re]Initialized...'
VcsOutputWindow::append(proc.stdOut());
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
resetCachedVcsInfo(workingDirectory);
return true;
} else {
@@ -1567,7 +1567,7 @@ bool GitClient::synchronousCheckoutFiles(const FilePath &workingDirectory, QStri
arguments << "--" << files;
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ExpectRepoChanges);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
const QString fileArg = files.join(", ");
//: Meaning of the arguments: %1: revision, %2: files, %3: repository,
//: %4: Error message
@@ -1619,7 +1619,7 @@ bool GitClient::synchronousRevListCmd(const FilePath &workingDirectory, const QS
const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments;
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1683,7 +1683,7 @@ QString GitClient::synchronousCurrentLocalBranch(const FilePath &workingDirector
QString branch;
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"symbolic-ref", HEAD}, silentFlags);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
branch = proc.stdOut().trimmed();
} else {
const QString gitDir = findGitDirForRepository(workingDirectory);
@@ -1708,7 +1708,7 @@ bool GitClient::synchronousHeadRefs(const FilePath &workingDirectory, QStringLis
const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"};
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1757,7 +1757,7 @@ QString GitClient::synchronousTopic(const FilePath &workingDirectory) const
// No tag or remote branch - try git describe
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, QStringList{"describe"}, VcsCommand::NoOutput);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
const QString stdOut = proc.stdOut().trimmed();
if (!stdOut.isEmpty())
return stdOut;
@@ -1772,7 +1772,7 @@ bool GitClient::synchronousRevParseCmd(const FilePath &workingDirectory, const Q
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
*output = proc.stdOut().trimmed();
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1786,7 +1786,7 @@ QString GitClient::synchronousTopRevision(const FilePath &workingDirectory, QDat
const QStringList arguments = {"show", "-s", "--pretty=format:%H:%ct", HEAD};
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess)
+ if (proc.result() != ProcessResult::FinishedWithSuccess)
return QString();
const QStringList output = proc.stdOut().trimmed().split(':');
if (dateTime && output.size() > 1) {
@@ -1848,7 +1848,7 @@ QString GitClient::synchronousShortDescription(const FilePath &workingDirectory,
"--max-count=1", revision};
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
.arg(revision, workingDirectory.toUserOutput(), proc.stdErr()));
return revision;
@@ -1929,7 +1929,7 @@ bool GitClient::executeSynchronousStash(const FilePath &workingDirectory,
| VcsCommand::ShowSuccessMessage;
QtcProcess proc;
vcsSynchronousExec(proc, workingDirectory, arguments, flags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1970,7 +1970,7 @@ bool GitClient::synchronousBranchCmd(const FilePath &workingDirectory, QStringLi
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, branchArgs);
*output = proc.stdOut();
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(branchArgs, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1984,7 +1984,7 @@ bool GitClient::synchronousTagCmd(const FilePath &workingDirectory, QStringList
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, tagArgs);
*output = proc.stdOut();
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(tagArgs, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -1998,7 +1998,7 @@ bool GitClient::synchronousForEachRefCmd(const FilePath &workingDirectory, QStri
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, args, silentFlags);
*output = proc.stdOut();
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(args, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -2022,7 +2022,7 @@ bool GitClient::synchronousRemoteCmd(const FilePath &workingDirectory, QStringLi
*errorMessage = stdErr;
*output = proc.stdOut();
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(remoteArgs, workingDirectory, stdErr, errorMessage);
return false;
}
@@ -2062,7 +2062,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const FilePath &workingDirecto
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"submodule", "status"}, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(tr("Cannot retrieve submodule status of \"%1\": %2")
.arg(workingDirectory.toUserOutput(), proc.stdErr()), errorMessage);
return QStringList();
@@ -2142,7 +2142,7 @@ QByteArray GitClient::synchronousShow(const FilePath &workingDirectory, const QS
const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id};
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, flags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), nullptr);
return {};
}
@@ -2158,7 +2158,7 @@ bool GitClient::cleanList(const FilePath &workingDirectory, const QString &modul
QtcProcess proc;
vcsFullySynchronousExec(proc, directory, arguments, VcsCommand::ForceCLocale);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, directory, proc.stdErr(), errorMessage);
return false;
}
@@ -2206,7 +2206,7 @@ bool GitClient::synchronousApplyPatch(const FilePath &workingDirectory,
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments);
const QString stdErr = proc.stdErr();
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
if (!stdErr.isEmpty())
*errorMessage = tr("There were warnings while applying \"%1\" to \"%2\":\n%3")
.arg(file, workingDirectory.toUserOutput(), stdErr);
@@ -2347,7 +2347,7 @@ GitClient::StatusResult GitClient::gitStatus(const FilePath &workingDirectory, S
if (output)
*output = stdOut;
- const bool statusRc = proc.result() == QtcProcess::FinishedWithSuccess;
+ const bool statusRc = proc.result() == ProcessResult::FinishedWithSuccess;
const bool branchKnown = !stdOut.startsWith("## HEAD (no branch)\n");
// Is it something really fatal?
if (!statusRc && !branchKnown) {
@@ -2718,7 +2718,7 @@ bool GitClient::readDataFromCommit(const FilePath &repoDirectory, const QString
QtcProcess proc;
vcsFullySynchronousExec(proc, repoDirectory, arguments, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
if (errorMessage) {
*errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".")
.arg(repoDirectory.toUserOutput());
@@ -2974,7 +2974,7 @@ bool GitClient::addAndCommit(const FilePath &repositoryDirectory,
QtcProcess proc;
vcsSynchronousExec(proc, repositoryDirectory, arguments, VcsCommand::NoFullySync);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
GitPlugin::updateCurrentBranch();
return true;
@@ -3116,7 +3116,7 @@ bool GitClient::executeAndHandleConflicts(const FilePath &workingDirectory,
vcsSynchronousExec(proc, workingDirectory, arguments, flags);
// Notify about changed files or abort the rebase.
ConflictHandler::handleResponse(proc, workingDirectory, abortCommand);
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
void GitClient::pull(const FilePath &workingDirectory, bool rebase)
@@ -3175,7 +3175,7 @@ bool GitClient::synchronousSetTrackingBranch(const FilePath &workingDirectory,
QtcProcess proc;
vcsFullySynchronousExec(proc,
workingDirectory, {"branch", "--set-upstream-to=" + tracking, branch});
- return proc.result() == QtcProcess::FinishedWithSuccess;
+ return proc.result() == ProcessResult::FinishedWithSuccess;
}
VcsBase::VcsCommand *GitClient::asyncUpstreamStatus(const FilePath &workingDirectory,
@@ -3498,7 +3498,7 @@ bool GitClient::synchronousStashRemove(const FilePath &workingDirectory, const Q
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments);
- if (proc.result() == QtcProcess::FinishedWithSuccess) {
+ if (proc.result() == ProcessResult::FinishedWithSuccess) {
const QString output = proc.stdOut();
if (!output.isEmpty())
VcsOutputWindow::append(output);
@@ -3517,7 +3517,7 @@ bool GitClient::synchronousStashList(const FilePath &workingDirectory, QList<Sta
const QStringList arguments = {"stash", "list", noColorOption};
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, VcsCommand::ForceCLocale);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(arguments, workingDirectory, proc.stdErr(), errorMessage);
return false;
}
@@ -3557,7 +3557,7 @@ QString GitClient::readOneLine(const FilePath &workingDirectory, const QStringLi
QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, arguments, silentFlags, vcsTimeoutS(), codec);
- if (proc.result() != QtcProcess::FinishedWithSuccess)
+ if (proc.result() != ProcessResult::FinishedWithSuccess)
return QString();
return proc.stdOut().trimmed();
}
@@ -3584,7 +3584,7 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
// run git --version
QtcProcess proc;
vcsSynchronousExec(proc, {}, {"--version"}, silentFlags);
- if (proc.result() != QtcProcess::FinishedWithSuccess) {
+ if (proc.result() != ProcessResult::FinishedWithSuccess) {
msgCannotRun(tr("Cannot determine Git version: %1").arg(proc.stdErr()), errorMessage);
return 0;
}
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp
index f460cb9c7f3..4395c96bd12 100644
--- a/src/plugins/git/gitgrep.cpp
+++ b/src/plugins/git/gitgrep.cpp
@@ -204,13 +204,13 @@ public:
proc.setTimeoutS(0);
m_command->runCommand(proc, {m_vcsBinary, arguments});
switch (proc.result()) {
- case QtcProcess::TerminatedAbnormally:
- case QtcProcess::StartFailed:
- case QtcProcess::Hang:
+ case ProcessResult::TerminatedAbnormally:
+ case ProcessResult::StartFailed:
+ case ProcessResult::Hang:
fi.reportCanceled();
break;
- case QtcProcess::FinishedWithSuccess:
- case QtcProcess::FinishedWithError:
+ case ProcessResult::FinishedWithSuccess:
+ case ProcessResult::FinishedWithError:
// When no results are found, git-grep exits with non-zero status.
// Do not consider this as an error.
break;
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 2dbcfeb56ff..74faef36ddb 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -61,6 +61,7 @@
#include <texteditor/texteditor.h>
#include <utils/algorithm.h>
+#include <utils/commandline.h>
#include <utils/infobar.h>
#include <utils/parameteraction.h>
#include <utils/pathchooser.h>