Move createInitialCheckoutCommand() out from core plugin

Change-Id: I99f4795822838ac084d0d6823db96e5864e0dcdf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-08-01 11:49:33 +02:00
parent bc8ebd3bc7
commit d1284e9101
6 changed files with 34 additions and 31 deletions

View File

@@ -88,18 +88,6 @@ FilePaths IVersionControl::additionalToolsPath() const
return {};
}
VcsBase::VcsCommand *IVersionControl::createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
const QString &localName,
const QStringList &extraArgs)
{
Q_UNUSED(url)
Q_UNUSED(baseDirectory)
Q_UNUSED(localName)
Q_UNUSED(extraArgs)
return nullptr;
}
IVersionControl::RepoUrl::RepoUrl(const QString &location)
{
if (location.isEmpty())

View File

@@ -38,8 +38,6 @@
QT_FORWARD_DECLARE_CLASS(QMenu);
namespace VcsBase { class VcsCommand; }
namespace Core {
class CORE_EXPORT IVersionControl : public QObject
@@ -223,17 +221,6 @@ public:
*/
virtual Utils::FilePaths additionalToolsPath() const;
/*!
* Return a VcsCommand capable of checking out \a url into \a baseDirectory, where
* a new subdirectory with \a localName will be created.
*
* \a extraArgs are passed on to the command being run.
*/
virtual VcsBase::VcsCommand *createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
const QString &localName,
const QStringList &extraArgs);
virtual void fillLinkContextMenu(QMenu *menu,
const Utils::FilePath &workingDirectory,
const QString &reference);

View File

@@ -47,6 +47,7 @@
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <vcsbase/vcsbaseplugin.h>
#include <vcsbase/vcscommand.h>
#include <QApplication>
@@ -61,6 +62,8 @@
#include <QPushButton>
#include <QVBoxLayout>
using namespace VcsBase;
namespace GitLab {
GitLabCloneDialog::GitLabCloneDialog(const Project &project, QWidget *parent)
@@ -147,7 +150,8 @@ void GitLabCloneDialog::updateUi()
void GitLabCloneDialog::cloneProject()
{
Core::IVersionControl *vc = Core::VcsManager::versionControl(Utils::Id::fromString("G.Git"));
VcsBasePluginPrivate *vc = static_cast<VcsBasePluginPrivate *>(
Core::VcsManager::versionControl(Utils::Id::fromString("G.Git")));
QTC_ASSERT(vc, return);
const QStringList extraArgs = m_submodulesCB->isChecked() ? QStringList{ "--recursive" }
: QStringList{};
@@ -156,13 +160,13 @@ void GitLabCloneDialog::cloneProject()
m_directoryLE->text(), extraArgs);
const Utils::FilePath workingDirectory = m_pathChooser->absoluteFilePath();
m_command->setProgressiveOutput(true);
connect(m_command, &VcsBase::VcsCommand::stdOutText, this, [this](const QString &text) {
connect(m_command, &VcsCommand::stdOutText, this, [this](const QString &text) {
m_cloneOutput->appendPlainText(text);
});
connect(m_command, &VcsBase::VcsCommand::stdErrText, this, [this](const QString &text) {
connect(m_command, &VcsCommand::stdErrText, this, [this](const QString &text) {
m_cloneOutput->appendPlainText(text);
});
connect(m_command, &VcsBase::VcsCommand::finished, this, &GitLabCloneDialog::cloneFinished);
connect(m_command, &VcsCommand::finished, this, &GitLabCloneDialog::cloneFinished);
QApplication::setOverrideCursor(Qt::WaitCursor);
m_cloneOutput->clear();

View File

@@ -584,6 +584,18 @@ const VcsBasePluginState &VcsBasePluginPrivate::currentState() const
return m_state;
}
VcsCommand *VcsBasePluginPrivate::createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
const QString &localName,
const QStringList &extraArgs)
{
Q_UNUSED(url)
Q_UNUSED(baseDirectory)
Q_UNUSED(localName)
Q_UNUSED(extraArgs)
return nullptr;
}
bool VcsBasePluginPrivate::enableMenuAction(ActionState as, QAction *menuAction) const
{
qCDebug(baseLog) << "enableMenuAction" << menuAction->text() << as;

View File

@@ -54,6 +54,7 @@ namespace Internal { class State; }
class VcsBaseSubmitEditor;
class VcsBasePluginPrivate;
class VcsBasePluginStateData;
class VcsCommand;
// Documentation inside.
class VCSBASE_EXPORT VcsBasePluginState
@@ -144,6 +145,16 @@ public:
const VcsBasePluginState &currentState() const;
/*!
* Return a VcsCommand capable of checking out \a url into \a baseDirectory, where
* a new subdirectory with \a localName will be created.
*
* \a extraArgs are passed on to the command being run.
*/
virtual VcsCommand *createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
const QString &localName,
const QStringList &extraArgs);
// Display name of the commit action
virtual QString commitDisplayName() const;

View File

@@ -24,9 +24,9 @@
****************************************************************************/
#include "vcscommandpage.h"
#include "vcsbaseplugin.h"
#include "vcscommand.h"
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <projectexplorer/jsonwizard/jsonwizard.h>
@@ -354,7 +354,8 @@ void VcsCommandPage::delayedInitialize()
QTC_ASSERT(wiz, return);
const QString vcsId = wiz->expander()->expand(m_vcsId);
IVersionControl *vc = VcsManager::versionControl(Id::fromString(vcsId));
VcsBasePluginPrivate *vc = static_cast<VcsBasePluginPrivate *>(
VcsManager::versionControl(Id::fromString(vcsId)));
if (!vc) {
qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
"\"%1\" (%2) not found.")