forked from qt-creator/qt-creator
VcsBase: Hide VcsCommand class
Make it an implementation detail. Introduce VcsBaseClient::createVcsCommand() method instead for instantiating VcsCommands. Replace all occuriences of VcsBase::VcsCommand in public API with Utils::ShellCommand. Change-Id: Ie438cc3a5e867b3ee8f9e935b56b2f16ea453f8a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -36,10 +36,6 @@
|
||||
#include "ui_revertdialog.h"
|
||||
#include "ui_uncommitdialog.h"
|
||||
|
||||
#include <vcsbase/vcsbaseclient.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
@@ -54,13 +50,16 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||
#include <vcsbase/vcsbaseclient.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QAction>
|
||||
@@ -935,7 +934,7 @@ ShellCommand *BazaarPluginPrivate::createInitialCheckoutCommand(const QString &u
|
||||
|
||||
Environment env = m_client.processEnvironment();
|
||||
env.set("BZR_PROGRESS_BAR", "text");
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, env);
|
||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, env);
|
||||
command->addJob({m_client.vcsBinary(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
|
@@ -62,13 +62,14 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseclient.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
@@ -1667,10 +1668,11 @@ ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
|
||||
QtcProcess proc;
|
||||
proc.setTimeoutS(timeOutS);
|
||||
|
||||
VcsCommand command(workingDir, Environment::systemEnvironment());
|
||||
command.addFlags(flags);
|
||||
command.setCodec(outputCodec);
|
||||
command.runCommand(proc, {FilePath::fromString(executable), arguments});
|
||||
auto *command = VcsBaseClient::createVcsCommand(workingDir, Environment::systemEnvironment());
|
||||
command->addFlags(flags);
|
||||
command->setCodec(outputCodec);
|
||||
command->runCommand(proc, {FilePath::fromString(executable), arguments});
|
||||
delete command;
|
||||
|
||||
response.error = proc.result() != ProcessResult::FinishedWithSuccess;
|
||||
if (response.error)
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
@@ -59,6 +58,7 @@
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QAction>
|
||||
@@ -482,7 +482,7 @@ ShellCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString &url,
|
||||
QStringList args;
|
||||
args << QLatin1String("checkout") << url << extraArgs;
|
||||
|
||||
auto command = new VcsCommand(baseDirectory, Environment::systemEnvironment());
|
||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, Environment::systemEnvironment());
|
||||
command->setDisplayName(tr("CVS Checkout"));
|
||||
command->addJob({m_settings.binaryPath.filePath(), m_settings.addOptions(args)}, -1);
|
||||
return command;
|
||||
@@ -1437,10 +1437,12 @@ CvsResponse CvsPluginPrivate::runCvs(const FilePath &workingDirectory,
|
||||
QtcProcess proc;
|
||||
proc.setTimeoutS(timeOutS);
|
||||
|
||||
VcsCommand command(workingDirectory, Environment::systemEnvironment());
|
||||
command.addFlags(flags);
|
||||
command.setCodec(outputCodec);
|
||||
command.runCommand(proc, {executable, m_settings.addOptions(arguments)});
|
||||
auto *command = VcsBaseClient::createVcsCommand(workingDirectory,
|
||||
Environment::systemEnvironment());
|
||||
command->addFlags(flags);
|
||||
command->setCodec(outputCodec);
|
||||
command->runCommand(proc, {executable, m_settings.addOptions(arguments)});
|
||||
delete command;
|
||||
|
||||
response.result = CvsResponse::OtherError;
|
||||
response.stdErr = proc.cleanedStdErr();
|
||||
|
@@ -28,10 +28,10 @@
|
||||
#include "gitconstants.h"
|
||||
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <utils/filesystemwatcher.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QDateTime>
|
||||
@@ -624,7 +624,7 @@ void BranchModel::removeTag(const QModelIndex &idx)
|
||||
removeNode(idx);
|
||||
}
|
||||
|
||||
VcsCommand *BranchModel::checkoutBranch(const QModelIndex &idx)
|
||||
ShellCommand *BranchModel::checkoutBranch(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = fullName(idx, !isLocal(idx));
|
||||
if (branch.isEmpty())
|
||||
@@ -908,7 +908,7 @@ void BranchModel::updateUpstreamStatus(BranchNode *node)
|
||||
{
|
||||
if (node->tracking.isEmpty())
|
||||
return;
|
||||
VcsCommand *command = d->client->asyncUpstreamStatus(
|
||||
ShellCommand *command = d->client->asyncUpstreamStatus(
|
||||
d->workingDirectory, node->fullRef(), node->tracking);
|
||||
QObject::connect(command, &ShellCommand::stdOutText, node, [this, node](const QString &text) {
|
||||
if (text.isEmpty())
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QVariant>
|
||||
|
||||
namespace VcsBase { class VcsCommand; }
|
||||
namespace Utils { class ShellCommand; }
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
void removeBranch(const QModelIndex &idx);
|
||||
void removeTag(const QModelIndex &idx);
|
||||
VcsBase::VcsCommand *checkoutBranch(const QModelIndex &idx);
|
||||
Utils::ShellCommand *checkoutBranch(const QModelIndex &idx);
|
||||
bool branchIsMerged(const QModelIndex &idx);
|
||||
QModelIndex addBranch(const QString &name, bool track, const QModelIndex &trackedBranch);
|
||||
void setRemoteTracking(const QModelIndex &trackingIndex);
|
||||
|
@@ -40,8 +40,8 @@
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/navigationtreeview.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/utilsicons.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -93,8 +93,8 @@ BranchView::BranchView()
|
||||
, m_includeTagsAction(new QAction(tr("Include Tags"), this))
|
||||
, m_addAction(new QAction(this))
|
||||
, m_refreshAction(new QAction(this))
|
||||
, m_repositoryLabel(new Utils::ElidingLabel(this))
|
||||
, m_branchView(new Utils::NavigationTreeView(this))
|
||||
, m_repositoryLabel(new ElidingLabel(this))
|
||||
, m_branchView(new NavigationTreeView(this))
|
||||
, m_model(new BranchModel(GitClient::instance(), this))
|
||||
, m_filterModel(new BranchFilterModel(this))
|
||||
{
|
||||
@@ -114,9 +114,9 @@ BranchView::BranchView()
|
||||
m_filterModel->setFilterRole(Qt::EditRole);
|
||||
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_branchView->setModel(m_filterModel);
|
||||
auto filterEdit = new Utils::FancyLineEdit(this);
|
||||
auto filterEdit = new FancyLineEdit(this);
|
||||
filterEdit->setFiltering(true);
|
||||
connect(filterEdit, &Utils::FancyLineEdit::textChanged,
|
||||
connect(filterEdit, &FancyLineEdit::textChanged,
|
||||
m_filterModel, QOverload<const QString &>::of(&BranchFilterModel::setFilterRegularExpression));
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->addWidget(filterEdit);
|
||||
@@ -435,7 +435,7 @@ bool BranchView::checkout()
|
||||
return false;
|
||||
}
|
||||
|
||||
VcsBase::VcsCommand *command = m_model->checkoutBranch(selected);
|
||||
ShellCommand *command = m_model->checkoutBranch(selected);
|
||||
const bool moveChanges = branchCheckoutDialog.moveLocalChangesToNextBranch();
|
||||
const bool popStash = branchCheckoutDialog.popStashOfNextBranch();
|
||||
if (command && (moveChanges || popStash)) {
|
||||
|
@@ -32,10 +32,9 @@
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
@@ -195,8 +194,7 @@ void ChangeSelectionDialog::recalculateCompletion()
|
||||
return;
|
||||
|
||||
GitClient *client = GitClient::instance();
|
||||
VcsBase::VcsCommand *command = client->asyncForEachRefCmd(
|
||||
workingDir, {"--format=%(refname:short)"});
|
||||
ShellCommand *command = client->asyncForEachRefCmd(workingDir, {"--format=%(refname:short)"});
|
||||
connect(this, &QObject::destroyed, command, &ShellCommand::abort);
|
||||
connect(command, &ShellCommand::stdOutText, [this](const QString &output) {
|
||||
m_changeModel->setStringList(output.split('\n'));
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/temporaryfile.h>
|
||||
#include <utils/theme/theme.h>
|
||||
@@ -60,7 +61,6 @@
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <diffeditor/descriptionwidgetwatcher.h>
|
||||
@@ -346,7 +346,7 @@ void GitBaseDiffEditorController::updateBranchList()
|
||||
return;
|
||||
|
||||
const FilePath workingDirectory = baseDirectory();
|
||||
VcsCommand *command = m_instance->vcsExec(
|
||||
ShellCommand *command = m_instance->vcsExec(
|
||||
workingDirectory,
|
||||
{"branch", noColorOption, "-a", "--contains", revision}, nullptr,
|
||||
false, 0, workingDirectory.toString());
|
||||
@@ -485,7 +485,7 @@ private:
|
||||
QString m_body;
|
||||
QString m_precedes;
|
||||
std::vector<QString> m_follows;
|
||||
QList<QPointer<VcsCommand>> m_commands;
|
||||
QList<QPointer<ShellCommand>> m_commands;
|
||||
};
|
||||
|
||||
void ShowController::processCommandOutput(const QString &output)
|
||||
@@ -563,7 +563,7 @@ void ShowController::updateDescription()
|
||||
|
||||
void ShowController::abortCommands()
|
||||
{
|
||||
for (QPointer<VcsCommand> command : m_commands) {
|
||||
for (QPointer<ShellCommand> command : m_commands) {
|
||||
if (command)
|
||||
command->abort();
|
||||
}
|
||||
@@ -744,7 +744,7 @@ class ConflictHandler final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void attachToCommand(VcsCommand *command, const QString &abortCommand = QString()) {
|
||||
static void attachToCommand(ShellCommand *command, const QString &abortCommand = QString()) {
|
||||
auto handler = new ConflictHandler(command->defaultWorkingDirectory(), abortCommand);
|
||||
handler->setParent(command); // delete when command goes out of scope
|
||||
|
||||
@@ -812,7 +812,7 @@ private:
|
||||
class GitProgressParser : public ProgressParser
|
||||
{
|
||||
public:
|
||||
static void attachToCommand(VcsCommand *command)
|
||||
static void attachToCommand(ShellCommand *command)
|
||||
{
|
||||
command->setProgressParser(new GitProgressParser);
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ void GitClient::merge(const FilePath &workingDirectory, const QStringList &unmer
|
||||
void GitClient::status(const FilePath &workingDirectory) const
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory.toString());
|
||||
VcsCommand *command = vcsExec(workingDirectory, {"status", "-u"}, nullptr, true);
|
||||
ShellCommand *command = vcsExec(workingDirectory, {"status", "-u"}, nullptr, true);
|
||||
connect(command, &ShellCommand::finished, VcsOutputWindow::instance(),
|
||||
&VcsOutputWindow::clearRepository, Qt::QueuedConnection);
|
||||
}
|
||||
@@ -1383,13 +1383,13 @@ VcsBaseEditorWidget *GitClient::annotate(
|
||||
return editor;
|
||||
}
|
||||
|
||||
VcsCommand *GitClient::checkout(const FilePath &workingDirectory, const QString &ref,
|
||||
ShellCommand *GitClient::checkout(const FilePath &workingDirectory, const QString &ref,
|
||||
StashMode stashMode)
|
||||
{
|
||||
if (stashMode == StashMode::TryStash && !beginStashScope(workingDirectory, "Checkout"))
|
||||
return nullptr;
|
||||
QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
|
||||
VcsCommand *command = vcsExec(
|
||||
ShellCommand *command = vcsExec(
|
||||
workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand::ExpectRepoChanges | ShellCommand::ShowSuccessMessage);
|
||||
connect(command, &ShellCommand::finished,
|
||||
@@ -1501,7 +1501,7 @@ void GitClient::removeStaleRemoteBranches(const FilePath &workingDirectory, cons
|
||||
{
|
||||
const QStringList arguments = {"remote", "prune", remote};
|
||||
|
||||
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand::ShowSuccessMessage);
|
||||
|
||||
connect(command, &ShellCommand::success,
|
||||
@@ -2056,7 +2056,7 @@ bool GitClient::synchronousForEachRefCmd(const FilePath &workingDirectory, QStri
|
||||
return true;
|
||||
}
|
||||
|
||||
VcsCommand *GitClient::asyncForEachRefCmd(const FilePath &workingDirectory, QStringList args) const
|
||||
ShellCommand *GitClient::asyncForEachRefCmd(const FilePath &workingDirectory, QStringList args) const
|
||||
{
|
||||
args.push_front("for-each-ref");
|
||||
return vcsExec(workingDirectory, args, nullptr, false, silentFlags);
|
||||
@@ -2366,7 +2366,7 @@ void GitClient::updateSubmodulesIfNeeded(const FilePath &workingDirectory, bool
|
||||
}
|
||||
}
|
||||
|
||||
VcsCommand *cmd = vcsExec(workingDirectory, {"submodule", "update"}, nullptr, true,
|
||||
ShellCommand *cmd = vcsExec(workingDirectory, {"submodule", "update"}, nullptr, true,
|
||||
ShellCommand::ExpectRepoChanges);
|
||||
connect(cmd, &ShellCommand::finished, this, &GitClient::finishSubmoduleUpdate);
|
||||
}
|
||||
@@ -3146,7 +3146,7 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
||||
void GitClient::fetch(const FilePath &workingDirectory, const QString &remote)
|
||||
{
|
||||
QStringList const arguments = {"fetch", (remote.isEmpty() ? "--all" : remote)};
|
||||
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand::ShowSuccessMessage);
|
||||
connect(command, &ShellCommand::success,
|
||||
this, [workingDirectory] { GitPlugin::updateBranches(workingDirectory); });
|
||||
@@ -3179,7 +3179,7 @@ void GitClient::pull(const FilePath &workingDirectory, bool rebase)
|
||||
abortCommand = "merge";
|
||||
}
|
||||
|
||||
VcsCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase, abortCommand);
|
||||
ShellCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase, abortCommand);
|
||||
connect(command, &ShellCommand::success, this,
|
||||
[this, workingDirectory] { updateSubmodulesIfNeeded(workingDirectory, true); },
|
||||
Qt::QueuedConnection);
|
||||
@@ -3227,7 +3227,7 @@ bool GitClient::synchronousSetTrackingBranch(const FilePath &workingDirectory,
|
||||
return proc.result() == ProcessResult::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
VcsBase::VcsCommand *GitClient::asyncUpstreamStatus(const FilePath &workingDirectory,
|
||||
ShellCommand *GitClient::asyncUpstreamStatus(const FilePath &workingDirectory,
|
||||
const QString &branch,
|
||||
const QString &upstream)
|
||||
{
|
||||
@@ -3323,7 +3323,7 @@ void GitClient::subversionDeltaCommit(const FilePath &workingDirectory) const
|
||||
|
||||
void GitClient::push(const FilePath &workingDirectory, const QStringList &pushArgs)
|
||||
{
|
||||
VcsCommand *command = vcsExec(
|
||||
ShellCommand *command = vcsExec(
|
||||
workingDirectory, QStringList({"push"}) + pushArgs, nullptr, true,
|
||||
ShellCommand::ShowSuccessMessage);
|
||||
connect(command, &ShellCommand::stdErrText, this, [this, command](const QString &text) {
|
||||
@@ -3363,7 +3363,7 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr
|
||||
.arg(QString::number(warnColor.rgba(), 16)),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No) == QMessageBox::Yes) {
|
||||
VcsCommand *rePushCommand = vcsExec(workingDirectory,
|
||||
ShellCommand *rePushCommand = vcsExec(workingDirectory,
|
||||
QStringList({"push", "--force-with-lease"}) + pushArgs,
|
||||
nullptr, true, ShellCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &ShellCommand::success,
|
||||
@@ -3384,7 +3384,7 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr
|
||||
|
||||
const QStringList fallbackCommandParts =
|
||||
m_pushFallbackCommand.split(' ', Qt::SkipEmptyParts);
|
||||
VcsCommand *rePushCommand = vcsExec(workingDirectory,
|
||||
ShellCommand *rePushCommand = vcsExec(workingDirectory,
|
||||
fallbackCommandParts.mid(1), nullptr, true,
|
||||
ShellCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &ShellCommand::success, this, [workingDirectory]() {
|
||||
@@ -3440,7 +3440,7 @@ void GitClient::revert(const FilePath &workingDirectory, const QString &argument
|
||||
|
||||
// Executes a command asynchronously. Work tree is expected to be clean.
|
||||
// Stashing is handled prior to this call.
|
||||
VcsCommand *GitClient::vcsExecAbortable(const FilePath &workingDirectory,
|
||||
ShellCommand *GitClient::vcsExecAbortable(const FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
bool isRebase,
|
||||
QString abortCommand)
|
||||
@@ -3449,7 +3449,7 @@ VcsCommand *GitClient::vcsExecAbortable(const FilePath &workingDirectory,
|
||||
|
||||
if (abortCommand.isEmpty())
|
||||
abortCommand = arguments.at(0);
|
||||
VcsCommand *command = createCommand(workingDirectory, nullptr, VcsWindowOutputBind);
|
||||
ShellCommand *command = createCommand(workingDirectory, nullptr, VcsWindowOutputBind);
|
||||
command->setCookie(workingDirectory.toString());
|
||||
command->addFlags(ShellCommand::SshPasswordPrompt
|
||||
| ShellCommand::ShowStdOut
|
||||
@@ -3518,7 +3518,7 @@ void GitClient::stashPop(const FilePath &workingDirectory, const QString &stash)
|
||||
QStringList arguments = {"stash", "pop"};
|
||||
if (!stash.isEmpty())
|
||||
arguments << stash;
|
||||
VcsCommand *cmd = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand *cmd = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
ShellCommand::ExpectRepoChanges);
|
||||
ConflictHandler::attachToCommand(cmd);
|
||||
}
|
||||
|
@@ -48,17 +48,18 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core { class ICore; }
|
||||
|
||||
namespace VcsBase {
|
||||
class VcsCommand;
|
||||
class SubmitFileModel;
|
||||
class VcsBaseEditorWidget;
|
||||
}
|
||||
|
||||
namespace DiffEditor {
|
||||
class ChunkSelection;
|
||||
class DiffEditorController;
|
||||
}
|
||||
|
||||
namespace Utils { class ShellCommand; }
|
||||
|
||||
namespace VcsBase {
|
||||
class SubmitFileModel;
|
||||
class VcsBaseEditorWidget;
|
||||
}
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -147,7 +148,7 @@ public:
|
||||
Utils::FilePath vcsBinary() const override;
|
||||
QFuture<unsigned> gitVersion() const;
|
||||
|
||||
VcsBase::VcsCommand *vcsExecAbortable(const Utils::FilePath &workingDirectory,
|
||||
Utils::ShellCommand *vcsExecAbortable(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
bool isRebase = false,
|
||||
QString abortCommand = {});
|
||||
@@ -207,7 +208,7 @@ public:
|
||||
QString revision = {}, QString *errorMessage = nullptr,
|
||||
bool revertStaging = true);
|
||||
enum class StashMode { NoStash, TryStash };
|
||||
VcsBase::VcsCommand *checkout(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
Utils::ShellCommand *checkout(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
StashMode stashMode = StashMode::TryStash);
|
||||
|
||||
QStringList setupCheckoutArguments(const Utils::FilePath &workingDirectory, const QString &ref);
|
||||
@@ -236,7 +237,7 @@ public:
|
||||
QString *output, QString *errorMessage) const;
|
||||
bool synchronousForEachRefCmd(const Utils::FilePath &workingDirectory, QStringList args,
|
||||
QString *output, QString *errorMessage = nullptr) const;
|
||||
VcsBase::VcsCommand *asyncForEachRefCmd(const Utils::FilePath &workingDirectory, QStringList args) const;
|
||||
Utils::ShellCommand *asyncForEachRefCmd(const Utils::FilePath &workingDirectory, QStringList args) const;
|
||||
bool synchronousRemoteCmd(const Utils::FilePath &workingDirectory, QStringList remoteArgs,
|
||||
QString *output = nullptr, QString *errorMessage = nullptr,
|
||||
bool silent = false) const;
|
||||
@@ -359,7 +360,7 @@ public:
|
||||
void show(const QString &source, const QString &id, const QString &name = {});
|
||||
void archive(const Utils::FilePath &workingDirectory, QString commit);
|
||||
|
||||
VcsBase::VcsCommand *asyncUpstreamStatus(const Utils::FilePath &workingDirectory,
|
||||
Utils::ShellCommand *asyncUpstreamStatus(const Utils::FilePath &workingDirectory,
|
||||
const QString &branch, const QString &upstream);
|
||||
|
||||
enum class BranchTargetType { Remote, Commit };
|
||||
@@ -394,7 +395,7 @@ private:
|
||||
bool *isDirectory,
|
||||
QString *errorMessage,
|
||||
bool revertStaging);
|
||||
void connectRepositoryChanged(const QString & repository, VcsBase::VcsCommand *cmd);
|
||||
void connectRepositoryChanged(const QString & repository, Utils::ShellCommand *cmd);
|
||||
bool executeAndHandleConflicts(const Utils::FilePath &workingDirectory, const QStringList &arguments,
|
||||
const QString &abortCommand = {}) const;
|
||||
void tryLaunchingGitK(const Utils::Environment &env,
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <texteditor/findinfiles.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -40,6 +39,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/textfileformat.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
@@ -67,6 +67,7 @@
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -74,7 +75,6 @@
|
||||
#include <vcsbase/submitfilemodel.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/cleandialog.h>
|
||||
@@ -1929,7 +1929,7 @@ ShellCommand *GitPluginPrivate::createInitialCheckoutCommand(const QString &url,
|
||||
QStringList args = {"clone", "--progress"};
|
||||
args << extraArgs << url << localName;
|
||||
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_gitClient.processEnvironment());
|
||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, m_gitClient.processEnvironment());
|
||||
command->addFlags(ShellCommand::SuppressStdErr);
|
||||
command->addJob({m_gitClient.vcsBinary(), args}, -1);
|
||||
return command;
|
||||
|
@@ -27,9 +27,9 @@
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
@@ -24,12 +24,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "mercurialclient.h"
|
||||
#include "mercurialplugin.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
@@ -41,6 +39,7 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
@@ -179,9 +178,10 @@ bool MercurialClient::synchronousPull(const FilePath &workingDir, const QString
|
||||
QtcProcess proc;
|
||||
proc.setTimeoutS(vcsTimeoutS());
|
||||
|
||||
VcsCommand command(workingDir, env);
|
||||
command.addFlags(flags);
|
||||
command.runCommand(proc, {vcsBinary(), args});
|
||||
ShellCommand *command = VcsBaseClient::createVcsCommand(workingDir, env);
|
||||
command->addFlags(flags);
|
||||
command->runCommand(proc, {vcsBinary(), args});
|
||||
delete command;
|
||||
|
||||
const bool ok = proc.result() == ProcessResult::FinishedWithSuccess;
|
||||
|
||||
@@ -306,8 +306,7 @@ void MercurialClient::incoming(const FilePath &repositoryRoot, const QString &re
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
"incoming", id);
|
||||
VcsCommand *cmd = createCommand(FilePath::fromString(repository), editor);
|
||||
enqueueJob(cmd, args);
|
||||
enqueueJob(createCommand(FilePath::fromString(repository), editor), args);
|
||||
}
|
||||
|
||||
void MercurialClient::outgoing(const FilePath &repositoryRoot)
|
||||
@@ -320,9 +319,7 @@ void MercurialClient::outgoing(const FilePath &repositoryRoot)
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
"outgoing", repositoryRoot.toString());
|
||||
|
||||
VcsCommand *cmd = createCommand(repositoryRoot, editor);
|
||||
enqueueJob(cmd, args);
|
||||
enqueueJob(createCommand(repositoryRoot, editor), args);
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *MercurialClient::annotate(
|
||||
|
@@ -48,12 +48,12 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QAction>
|
||||
@@ -833,7 +833,7 @@ ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const QString
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << extraArgs << url << localName;
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_client.processEnvironment());
|
||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, m_client.processEnvironment());
|
||||
command->addJob({m_settings.binaryPath.filePath(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
|
@@ -25,12 +25,10 @@
|
||||
|
||||
#include "subversionclient.h"
|
||||
#include "subversionconstants.h"
|
||||
#include "subversionplugin.h"
|
||||
#include "subversionsettings.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbasediffeditorcontroller.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
@@ -45,6 +43,7 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
@@ -29,8 +29,6 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace VcsBase { class VcsCommand; }
|
||||
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
|
@@ -26,19 +26,17 @@
|
||||
#include "subversionplugin.h"
|
||||
|
||||
#include "subversioneditor.h"
|
||||
|
||||
#include "subversionsubmiteditor.h"
|
||||
#include "subversionclient.h"
|
||||
#include "subversionconstants.h"
|
||||
#include "subversionsettings.h"
|
||||
#include "subversionsubmiteditor.h"
|
||||
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
|
||||
@@ -59,20 +57,21 @@
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/shellcommand.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QTextCodec>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QUrl>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTextCodec>
|
||||
#include <QUrl>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include <climits>
|
||||
|
||||
@@ -1290,7 +1289,7 @@ ShellCommand *SubversionPluginPrivate::createInitialCheckoutCommand(const QStrin
|
||||
args << QLatin1String(Subversion::Constants::NON_INTERACTIVE_OPTION);
|
||||
args << extraArgs << url << localName;
|
||||
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_client->processEnvironment());
|
||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, m_client->processEnvironment());
|
||||
command->addJob({m_settings.binaryPath.filePath(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
|
@@ -90,11 +90,11 @@ FilePath VcsBaseClientImpl::vcsBinary() const
|
||||
return m_baseSettings->binaryPath.filePath();
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
|
||||
ShellCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
|
||||
VcsBaseEditorWidget *editor,
|
||||
JobOutputBindMode mode) const
|
||||
{
|
||||
auto cmd = new VcsCommand(workingDirectory, processEnvironment());
|
||||
auto cmd = createVcsCommand(workingDirectory, processEnvironment());
|
||||
cmd->setDefaultTimeoutS(vcsTimeoutS());
|
||||
if (editor)
|
||||
editor->setCommand(cmd);
|
||||
@@ -109,12 +109,12 @@ VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
|
||||
return cmd;
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::execBgCommand(const FilePath &workingDirectory,
|
||||
ShellCommand *VcsBaseClientImpl::execBgCommand(const FilePath &workingDirectory,
|
||||
const QStringList &args,
|
||||
const std::function<void (const QString &)> &outputCallback,
|
||||
unsigned flags) const
|
||||
{
|
||||
VcsCommand *cmd = createCommand(workingDirectory);
|
||||
ShellCommand *cmd = createCommand(workingDirectory);
|
||||
cmd->addFlags(flags | ShellCommand::SuppressCommandLogging
|
||||
| ShellCommand::SuppressStdErr
|
||||
| ShellCommand::SuppressFailMessage);
|
||||
@@ -124,7 +124,7 @@ VcsCommand *VcsBaseClientImpl::execBgCommand(const FilePath &workingDirectory,
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::enqueueJob(VcsCommand *cmd, const QStringList &args,
|
||||
void VcsBaseClientImpl::enqueueJob(ShellCommand *cmd, const QStringList &args,
|
||||
const ExitCodeInterpreter &interpreter) const
|
||||
{
|
||||
cmd->addJob({vcsBinary(), args}, vcsTimeoutS(), {}, interpreter);
|
||||
@@ -193,11 +193,12 @@ void VcsBaseClientImpl::annotateRevisionRequested(const FilePath &workingDirecto
|
||||
annotate(workingDirectory, file, changeCopy, line);
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory, const QStringList &arguments,
|
||||
ShellCommand *VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
VcsBaseEditorWidget *editor, bool useOutputToWindow,
|
||||
unsigned additionalFlags, const QVariant &cookie) const
|
||||
{
|
||||
VcsCommand *command = createCommand(workingDirectory, editor,
|
||||
ShellCommand *command = createCommand(workingDirectory, editor,
|
||||
useOutputToWindow ? VcsWindowOutputBind : NoOutputBind);
|
||||
command->setCookie(cookie);
|
||||
command->addFlags(additionalFlags);
|
||||
@@ -226,6 +227,12 @@ int VcsBaseClientImpl::vcsTimeoutS() const
|
||||
return m_baseSettings->timeout.value();
|
||||
}
|
||||
|
||||
ShellCommand *VcsBaseClientImpl::createVcsCommand(const Utils::FilePath &defaultWorkingDir,
|
||||
const Utils::Environment &environment)
|
||||
{
|
||||
return new VcsCommand(defaultWorkingDir, environment);
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Utils::Id kind, QString title,
|
||||
const QString &source, QTextCodec *codec,
|
||||
const char *registerDynamicProperty,
|
||||
@@ -381,7 +388,7 @@ VcsBaseEditorWidget *VcsBaseClient::annotate(
|
||||
VcsBaseEditor::getCodec(source),
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
|
||||
VcsCommand *cmd = createCommand(workingDir, editor);
|
||||
ShellCommand *cmd = createCommand(workingDir, editor);
|
||||
cmd->setCookie(lineNumber);
|
||||
enqueueJob(cmd, args);
|
||||
return editor;
|
||||
@@ -423,7 +430,7 @@ void VcsBaseClient::diff(const FilePath &workingDir, const QStringList &files,
|
||||
args << files;
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
VcsCommand *command = createCommand(workingDir, editor);
|
||||
ShellCommand *command = createCommand(workingDir, editor);
|
||||
command->setCodec(codec);
|
||||
enqueueJob(command, args, exitCodeInterpreter(DiffCommand));
|
||||
}
|
||||
@@ -473,7 +480,7 @@ void VcsBaseClient::revertFile(const FilePath &workingDir,
|
||||
QStringList args(vcsCommandString(RevertCommand));
|
||||
args << revisionSpec(revision) << extraOptions << file;
|
||||
// Indicate repository change or file list
|
||||
VcsCommand *cmd = createCommand(workingDir);
|
||||
ShellCommand *cmd = createCommand(workingDir);
|
||||
cmd->setCookie(QStringList(workingDir.pathAppended(file).toString()));
|
||||
connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(cmd, args);
|
||||
@@ -486,7 +493,7 @@ void VcsBaseClient::revertAll(const FilePath &workingDir,
|
||||
QStringList args(vcsCommandString(RevertCommand));
|
||||
args << revisionSpec(revision) << extraOptions;
|
||||
// Indicate repository change or file list
|
||||
VcsCommand *cmd = createCommand(workingDir);
|
||||
ShellCommand *cmd = createCommand(workingDir);
|
||||
cmd->setCookie(QStringList(workingDir.toString()));
|
||||
connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(createCommand(workingDir), args);
|
||||
@@ -499,7 +506,7 @@ void VcsBaseClient::status(const FilePath &workingDir,
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions << file;
|
||||
VcsOutputWindow::setRepository(workingDir.toString());
|
||||
VcsCommand *cmd = createCommand(workingDir, nullptr, VcsWindowOutputBind);
|
||||
ShellCommand *cmd = createCommand(workingDir, nullptr, VcsWindowOutputBind);
|
||||
connect(cmd, &ShellCommand::finished,
|
||||
VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository,
|
||||
Qt::QueuedConnection);
|
||||
@@ -510,7 +517,7 @@ void VcsBaseClient::emitParsedStatus(const FilePath &repository, const QStringLi
|
||||
{
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions;
|
||||
VcsCommand *cmd = createCommand(repository);
|
||||
ShellCommand *cmd = createCommand(repository);
|
||||
connect(cmd, &ShellCommand::stdOutText, this, &VcsBaseClient::statusParser);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
@@ -584,7 +591,7 @@ void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revisi
|
||||
{
|
||||
QStringList args(vcsCommandString(UpdateCommand));
|
||||
args << revisionSpec(revision) << extraOptions;
|
||||
VcsCommand *cmd = createCommand(repositoryRoot);
|
||||
ShellCommand *cmd = createCommand(repositoryRoot);
|
||||
cmd->setCookie(repositoryRoot.toString());
|
||||
connect(cmd, &ShellCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(cmd, args);
|
||||
@@ -605,7 +612,7 @@ void VcsBaseClient::commit(const FilePath &repositoryRoot,
|
||||
// for example)
|
||||
QStringList args(vcsCommandString(CommitCommand));
|
||||
args << extraOptions << files;
|
||||
VcsCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind);
|
||||
ShellCommand *cmd = createCommand(repositoryRoot, nullptr, VcsWindowOutputBind);
|
||||
if (!commitMessageFile.isEmpty())
|
||||
connect(cmd, &ShellCommand::finished, [commitMessageFile]() { QFile(commitMessageFile).remove(); });
|
||||
enqueueJob(cmd, args);
|
||||
|
@@ -45,11 +45,13 @@ class QTextCodec;
|
||||
class QToolBar;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class QtcProcess; }
|
||||
namespace Utils {
|
||||
class QtcProcess;
|
||||
class ShellCommand;
|
||||
}
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
class VcsCommand;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsJob;
|
||||
class VcsBaseClientImplPrivate;
|
||||
@@ -73,21 +75,24 @@ public:
|
||||
VcsWindowOutputBind
|
||||
};
|
||||
|
||||
static Utils::ShellCommand *createVcsCommand(const Utils::FilePath &defaultWorkingDir,
|
||||
const Utils::Environment &environment);
|
||||
|
||||
VcsBaseEditorWidget *createVcsEditor(Utils::Id kind, QString title,
|
||||
const QString &source, QTextCodec *codec,
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const;
|
||||
|
||||
VcsCommand *createCommand(const Utils::FilePath &workingDirectory,
|
||||
Utils::ShellCommand *createCommand(const Utils::FilePath &workingDirectory,
|
||||
VcsBaseEditorWidget *editor = nullptr,
|
||||
JobOutputBindMode mode = NoOutputBind) const;
|
||||
|
||||
VcsCommand *execBgCommand(const Utils::FilePath &workingDirectory,
|
||||
Utils::ShellCommand *execBgCommand(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &args,
|
||||
const std::function<void (const QString &)> &outputCallback,
|
||||
unsigned flags = 0) const;
|
||||
|
||||
void enqueueJob(VcsCommand *cmd, const QStringList &args,
|
||||
void enqueueJob(Utils::ShellCommand *cmd, const QStringList &args,
|
||||
const Utils::ExitCodeInterpreter &interpreter = {}) const;
|
||||
|
||||
virtual Utils::Environment processEnvironment() const;
|
||||
@@ -112,9 +117,12 @@ public:
|
||||
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
|
||||
|
||||
// Simple helper to execute a single command using createCommand and enqueueJob.
|
||||
VcsCommand *vcsExec(const Utils::FilePath &workingDirectory, const QStringList &arguments,
|
||||
VcsBaseEditorWidget *editor = nullptr, bool useOutputToWindow = false,
|
||||
unsigned additionalFlags = 0, const QVariant &cookie = {}) const;
|
||||
Utils::ShellCommand *vcsExec(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
VcsBaseEditorWidget *editor = nullptr,
|
||||
bool useOutputToWindow = false,
|
||||
unsigned additionalFlags = 0,
|
||||
const QVariant &cookie = {}) const;
|
||||
|
||||
protected:
|
||||
void resetCachedVcsInfo(const Utils::FilePath &workingDir);
|
||||
|
@@ -24,8 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "vcsbasediffeditorcontroller.h"
|
||||
#include "vcscommand.h"
|
||||
#include "vcsbaseclientsettings.h"
|
||||
#include "vcsbaseclient.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
@@ -35,6 +34,7 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
@@ -73,7 +73,7 @@ static void readPatch(QFutureInterface<QList<FileData>> &futureInterface,
|
||||
class VcsCommandResultProxy : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VcsCommandResultProxy(VcsCommand *command, VcsBaseDiffEditorControllerPrivate *target);
|
||||
VcsCommandResultProxy(ShellCommand *command, VcsBaseDiffEditorControllerPrivate *target);
|
||||
private:
|
||||
void storeOutput(const QString &output);
|
||||
void commandFinished(bool success);
|
||||
@@ -103,14 +103,14 @@ public:
|
||||
QString m_startupFile;
|
||||
QString m_output;
|
||||
QString m_displayName;
|
||||
QPointer<VcsCommand> m_command;
|
||||
QPointer<ShellCommand> m_command;
|
||||
QPointer<VcsCommandResultProxy> m_commandResultProxy;
|
||||
QFutureWatcher<QList<FileData>> *m_processWatcher = nullptr;
|
||||
};
|
||||
|
||||
/////////////////////
|
||||
|
||||
VcsCommandResultProxy::VcsCommandResultProxy(VcsCommand *command,
|
||||
VcsCommandResultProxy::VcsCommandResultProxy(ShellCommand *command,
|
||||
VcsBaseDiffEditorControllerPrivate *target)
|
||||
: QObject(target->q)
|
||||
, m_target(target)
|
||||
@@ -242,7 +242,7 @@ void VcsBaseDiffEditorController::runCommand(const QList<QStringList> &args, uns
|
||||
// and "Waiting for data..." will be shown.
|
||||
d->cancelReload();
|
||||
|
||||
d->m_command = new VcsCommand(workingDirectory(), d->m_processEnvironment);
|
||||
d->m_command = VcsBaseClient::createVcsCommand(workingDirectory(), d->m_processEnvironment);
|
||||
d->m_command->setDisplayName(d->m_displayName);
|
||||
d->m_command->setCodec(codec ? codec : EditorManager::defaultTextCodec());
|
||||
d->m_commandResultProxy = new VcsCommandResultProxy(d->m_command.data(), d);
|
||||
|
@@ -24,12 +24,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "vcsbaseeditor.h"
|
||||
#include "diffandloghighlighter.h"
|
||||
|
||||
#include "baseannotationhighlighter.h"
|
||||
#include "basevcseditorfactory.h"
|
||||
#include "vcsbaseplugin.h"
|
||||
#include "diffandloghighlighter.h"
|
||||
#include "vcsbaseeditorconfig.h"
|
||||
#include "vcscommand.h"
|
||||
#include "vcsbaseplugin.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <utils/porting.h>
|
||||
#include <utils/progressindicator.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
@@ -571,7 +572,7 @@ public:
|
||||
QString m_annotatePreviousRevisionTextFormat;
|
||||
VcsBaseEditorConfig *m_config = nullptr;
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
QPointer<VcsCommand> m_command;
|
||||
QPointer<ShellCommand> m_command;
|
||||
VcsBaseEditorWidget::DescribeFunc m_describeFunc = nullptr;
|
||||
ProgressIndicator *m_progressIndicator = nullptr;
|
||||
bool m_fileLogAnnotateEnabled = false;
|
||||
@@ -1418,7 +1419,7 @@ VcsBaseEditorConfig *VcsBaseEditorWidget::editorConfig() const
|
||||
return d->m_config;
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
||||
void VcsBaseEditorWidget::setCommand(ShellCommand *command)
|
||||
{
|
||||
if (d->m_command) {
|
||||
d->m_command->abort();
|
||||
|
@@ -36,6 +36,8 @@ QT_BEGIN_NAMESPACE
|
||||
class QTextCursor;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class ShellCommand; }
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
namespace Internal {
|
||||
@@ -46,7 +48,6 @@ class VcsBaseEditorWidgetPrivate;
|
||||
class BaseAnnotationHighlighter;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsBaseEditorConfig;
|
||||
class VcsCommand;
|
||||
class VcsEditorFactory;
|
||||
|
||||
// Documentation inside
|
||||
@@ -212,7 +213,7 @@ public:
|
||||
void setEditorConfig(VcsBaseEditorConfig *config);
|
||||
VcsBaseEditorConfig *editorConfig() const;
|
||||
|
||||
void setCommand(VcsCommand *command);
|
||||
void setCommand(Utils::ShellCommand *command);
|
||||
|
||||
virtual void setPlainText(const QString &text);
|
||||
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include "vcsbasesubmiteditor.h"
|
||||
#include "vcsplugin.h"
|
||||
#include "commonvcssettings.h"
|
||||
#include "vcsoutputwindow.h"
|
||||
#include "vcscommand.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -40,19 +38,17 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMessageBox>
|
||||
#include <QSharedData>
|
||||
#include <QScopedPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
using namespace ProjectExplorer;
|
||||
|
@@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vcsbase_global.h"
|
||||
|
||||
#include <coreplugin/progressmanager/futureprogress.h>
|
||||
#include <utils/shellcommand.h>
|
||||
|
||||
@@ -34,24 +32,24 @@
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
class VcsOutputWindow;
|
||||
|
||||
class VCSBASE_EXPORT VcsCommand : public Utils::ShellCommand
|
||||
class VcsCommand : public Utils::ShellCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VcsCommand(const Utils::FilePath &defaultWorkingDirectory, const Utils::Environment &environment);
|
||||
|
||||
protected:
|
||||
Utils::Environment environment() const override;
|
||||
|
||||
private:
|
||||
VcsCommand(const Utils::FilePath &defaultWorkingDirectory,
|
||||
const Utils::Environment &environment);
|
||||
|
||||
void addTask(QFuture<void> &future) override;
|
||||
void postRunCommand(const Utils::FilePath &workDirectory) override;
|
||||
|
||||
QPointer<Core::FutureProgress> m_progress;
|
||||
bool m_preventRepositoryChanged;
|
||||
|
||||
friend class VcsBaseClientImpl;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
|
Reference in New Issue
Block a user