summaryrefslogtreecommitdiff
path: root/src/plugins/git
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2015-04-27 15:03:07 +0200
committerTobias Hunger <tobias.hunger@theqtcompany.com>2015-05-04 15:27:25 +0000
commiteec0a03212a13e5cf7377e5c7618471e546f787e (patch)
treee1dcaac87d1a4320eab2ddfd53ced0fd835fcb5c /src/plugins/git
parent1e1fee86c43c70e6377b20d19e757b13137787ad (diff)
downloadqt-creator-eec0a03212a13e5cf7377e5c7618471e546f787e.tar.gz
Vcs: Split up VcsCommand
Move the biggest chunk into Utils::ShellCommand, add some Qt Creator specific magic in Core::ShellCommand and leave the rest in VcsBase::VcsCommand. Change-Id: I5fe6f7076e96023ad2164bcfaacfb3b65a7ff8a8 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/branchmodel.cpp4
-rw-r--r--src/plugins/git/clonewizardpage.cpp2
-rw-r--r--src/plugins/git/gitclient.cpp54
-rw-r--r--src/plugins/git/logchangedialog.cpp4
4 files changed, 31 insertions, 33 deletions
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp
index 58fccad188..41d1bfa59a 100644
--- a/src/plugins/git/branchmodel.cpp
+++ b/src/plugins/git/branchmodel.cpp
@@ -33,7 +33,7 @@
#include <utils/qtcassert.h>
#include <vcsbase/vcsoutputwindow.h>
-#include <vcsbase/vcsbaseplugin.h>
+#include <vcsbase/vcscommand.h>
#include <QFont>
@@ -724,7 +724,7 @@ QString BranchModel::toolTip(const QString &sha) const
QStringList arguments(QLatin1String("-n1"));
arguments << sha;
if (!m_client->synchronousLog(m_workingDirectory, arguments, &output, &errorMessage,
- VcsBasePlugin::SuppressCommandLogging)) {
+ VcsCommand::SuppressCommandLogging)) {
return errorMessage;
}
return output;
diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp
index def24830a6..cfeeae0c90 100644
--- a/src/plugins/git/clonewizardpage.cpp
+++ b/src/plugins/git/clonewizardpage.cpp
@@ -124,7 +124,7 @@ VcsCommand *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) co
args << QLatin1String("--recursive");
args << QLatin1String("--progress") << repository() << checkoutDir;
auto command = new VcsCommand(workingDirectory, client->processEnvironment());
- command->addFlags(VcsBasePlugin::MergeOutputChannels);
+ command->addFlags(VcsCommand::MergeOutputChannels);
command->addJob(client->vcsBinary(), args, -1);
return command;
}
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 3d4d1c5ba1..983e7a11ee 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -99,11 +99,11 @@ namespace Internal {
// Suppress git diff warnings about "LF will be replaced by CRLF..." on Windows.
static unsigned diffExecutionFlags()
{
- return HostOsInfo::isWindowsHost() ? unsigned(VcsBasePlugin::SuppressStdErrInLogWindow) : 0u;
+ return HostOsInfo::isWindowsHost() ? unsigned(VcsCommand::SuppressStdErr) : 0u;
}
-const unsigned silentFlags = unsigned(VcsBasePlugin::SuppressCommandLogging
- | VcsBasePlugin::SuppressStdErrInLogWindow);
+const unsigned silentFlags = unsigned(VcsCommand::SuppressCommandLogging
+ | VcsCommand::SuppressStdErr);
/////////////////////////////////////
@@ -475,7 +475,7 @@ public:
ConflictHandler *handler = new ConflictHandler(command->workingDirectory(), abortCommand);
handler->setParent(command); // delete when command goes out of scope
- command->addFlags(VcsBasePlugin::ExpectRepoChanges);
+ command->addFlags(VcsCommand::ExpectRepoChanges);
connect(command, &VcsCommand::output, handler, &ConflictHandler::readStdOut);
connect(command, &VcsCommand::errorText, handler, &ConflictHandler::readStdErr);
}
@@ -965,7 +965,7 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
QByteArray errorText;
QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, 0,
- VcsBasePlugin::ExpectRepoChanges);
+ VcsCommand::ExpectRepoChanges);
VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText));
if (rc)
updateSubmodulesIfNeeded(workingDirectory, true);
@@ -1044,7 +1044,7 @@ void GitClient::reset(const QString &workingDirectory, const QString &argument,
unsigned flags = 0;
if (argument == QLatin1String("--hard"))
- flags |= VcsBasePlugin::ExpectRepoChanges;
+ flags |= VcsCommand::ExpectRepoChanges;
vcsExec(workingDirectory, arguments, 0, true, flags);
}
@@ -1180,7 +1180,7 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory,
arguments << revision;
arguments << QLatin1String("--") << files;
const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText,
- VcsBasePlugin::ExpectRepoChanges);
+ VcsCommand::ExpectRepoChanges);
if (!rc) {
const QString fileArg = files.join(QLatin1String(", "));
//: Meaning of the arguments: %1: revision, %2: files, %3: repository,
@@ -1392,7 +1392,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
QByteArray output;
QStringList arguments;
arguments << QLatin1String("describe");
- if (vcsFullySynchronousExec(workingDirectory, arguments, &output, 0, VcsBasePlugin::NoOutput)) {
+ if (vcsFullySynchronousExec(workingDirectory, arguments, &output, 0, VcsCommand::NoOutput)) {
const QString describeOutput = commandOutputFromLocal8Bit(output.trimmed());
if (!describeOutput.isEmpty())
return describeOutput;
@@ -1586,9 +1586,9 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
arguments << QLatin1String("--keep-index");
if (!message.isEmpty())
arguments << message;
- const unsigned flags = VcsBasePlugin::ShowStdOutInLogWindow
- | VcsBasePlugin::ExpectRepoChanges
- | VcsBasePlugin::ShowSuccessMessage;
+ const unsigned flags = VcsCommand::ShowStdOut
+ | VcsCommand::ExpectRepoChanges
+ | VcsCommand::ShowSuccessMessage;
const SynchronousProcessResponse response = vcsSynchronousExec(workingDirectory, arguments, flags);
const bool rc = response.result == SynchronousProcessResponse::Finished;
if (!rc)
@@ -1961,7 +1961,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p
arguments << QLatin1String("submodule") << QLatin1String("update");
VcsCommand *cmd = vcsExec(workingDirectory, arguments, 0, true,
- VcsBasePlugin::ExpectRepoChanges);
+ VcsCommand::ExpectRepoChanges);
connect(cmd, &VcsCommand::finished, this, &GitClient::finishSubmoduleUpdate);
}
@@ -2160,9 +2160,9 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
{
QStringList arguments(QLatin1String("ls-remote"));
arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*");
- const unsigned flags = VcsBasePlugin::SshPasswordPrompt
- | VcsBasePlugin::SuppressStdErrInLogWindow
- | VcsBasePlugin::SuppressFailMessageInLogWindow;
+ const unsigned flags = VcsCommand::SshPasswordPrompt
+ | VcsCommand::SuppressStdErr
+ | VcsCommand::SuppressFailMessage;
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
QStringList branches;
branches << tr("<Detached HEAD>");
@@ -2725,10 +2725,10 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
const QString &abortCommand) const
{
// Disable UNIX terminals to suppress SSH prompting.
- const unsigned flags = VcsBasePlugin::SshPasswordPrompt
- | VcsBasePlugin::ShowStdOutInLogWindow
- | VcsBasePlugin::ExpectRepoChanges
- | VcsBasePlugin::ShowSuccessMessage;
+ const unsigned flags = VcsCommand::SshPasswordPrompt
+ | VcsCommand::ShowStdOut
+ | VcsCommand::ExpectRepoChanges
+ | VcsCommand::ShowSuccessMessage;
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
// Notify about changed files or abort the rebase.
const bool ok = resp.result == SynchronousProcessResponse::Finished;
@@ -2768,7 +2768,7 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
QStringList arguments;
arguments << abortCommand << QLatin1String("--abort");
QByteArray stdOut;
- vcsFullySynchronousExec(workingDir, arguments, &stdOut, 0, VcsBasePlugin::ExpectRepoChanges);
+ vcsFullySynchronousExec(workingDir, arguments, &stdOut, 0, VcsCommand::ExpectRepoChanges);
VcsOutputWindow::append(commandOutputFromLocal8Bit(stdOut));
}
@@ -2848,9 +2848,9 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory)
QStringList args;
args << QLatin1String("svn") << QLatin1String("fetch");
// Disable UNIX terminals to suppress SSH prompting.
- const unsigned flags = VcsBasePlugin::SshPasswordPrompt
- | VcsBasePlugin::ShowStdOutInLogWindow
- | VcsBasePlugin::ShowSuccessMessage;
+ const unsigned flags = VcsCommand::SshPasswordPrompt
+ | VcsCommand::ShowStdOut
+ | VcsCommand::ShowSuccessMessage;
vcsSynchronousExec(workingDirectory, args, flags);
}
@@ -2999,8 +2999,7 @@ void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
arguments << QLatin1String("pop");
if (!stash.isEmpty())
arguments << stash;
- VcsCommand *cmd = vcsExec(workingDirectory, arguments, 0, true,
- VcsBasePlugin::ExpectRepoChanges);
+ VcsCommand *cmd = vcsExec(workingDirectory, arguments, 0, true, VcsCommand::ExpectRepoChanges);
ConflictHandler::attachToCommand(cmd);
}
@@ -3083,9 +3082,8 @@ QString GitClient::readConfigValue(const QString &workingDirectory, const QStrin
bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
{
QDir workingDirectory(directory);
- const unsigned flags = VcsBasePlugin::SshPasswordPrompt
- | VcsBasePlugin::ShowStdOutInLogWindow
- | VcsBasePlugin::ShowSuccessMessage;
+ const unsigned flags = VcsCommand::SshPasswordPrompt
+ | VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage;
if (workingDirectory.exists()) {
if (!synchronousInit(workingDirectory.path()))
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp
index 11c13c43fb..aa16937529 100644
--- a/src/plugins/git/logchangedialog.cpp
+++ b/src/plugins/git/logchangedialog.cpp
@@ -33,7 +33,7 @@
#include "gitclient.h"
#include <vcsbase/vcsoutputwindow.h>
-#include <vcsbase/vcsbaseplugin.h>
+#include <vcsbase/vcscommand.h>
#include <utils/qtcassert.h>
@@ -164,7 +164,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
if (!(flags & IncludeRemotes))
arguments << QLatin1String("--not") << QLatin1String("--remotes");
QString output;
- if (!client->synchronousLog(repository, arguments, &output, 0, VcsBasePlugin::NoOutput))
+ if (!client->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput))
return false;
foreach (const QString &line, output.split(QLatin1Char('\n'))) {
const int colonPos = line.indexOf(QLatin1Char(':'));