Commit 5f7e89d9 authored by hjk's avatar hjk

Vcs: Some naming re-organization

Rename VcsCommand to VcsCommandTag, Command into VcsCommand
(Too generic to not mistake for Core::Command IMNSHO),
remove the now unneeded namespace qualification when not needed,
adjust surrounding code.

Change-Id: Iceb18a21e5e6dffa1a622241286f766985bb8d22
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 29532a69
......@@ -39,35 +39,35 @@
#include <QTextStream>
#include <QDebug>
using namespace Utils;
using namespace VcsBase;
namespace Bazaar {
namespace Internal {
class BazaarDiffExitCodeInterpreter : public Utils::ExitCodeInterpreter
class BazaarDiffExitCodeInterpreter : public ExitCodeInterpreter
{
Q_OBJECT
public:
BazaarDiffExitCodeInterpreter(QObject *parent) : Utils::ExitCodeInterpreter(parent) {}
Utils::SynchronousProcessResponse::Result interpretExitCode(int code) const;
BazaarDiffExitCodeInterpreter(QObject *parent) : ExitCodeInterpreter(parent) {}
SynchronousProcessResponse::Result interpretExitCode(int code) const;
};
Utils::SynchronousProcessResponse::Result BazaarDiffExitCodeInterpreter::interpretExitCode(int code) const
SynchronousProcessResponse::Result BazaarDiffExitCodeInterpreter::interpretExitCode(int code) const
{
if (code < 0 || code > 2)
return Utils::SynchronousProcessResponse::FinishedError;
return Utils::SynchronousProcessResponse::Finished;
return SynchronousProcessResponse::FinishedError;
return SynchronousProcessResponse::Finished;
}
BazaarClient::BazaarClient(BazaarSettings *settings) :
VcsBase::VcsBaseClient(settings)
VcsBaseClient(settings)
{
}
BazaarSettings *BazaarClient::settings() const
{
return dynamic_cast<BazaarSettings *>(VcsBase::VcsBaseClient::settings());
return dynamic_cast<BazaarSettings *>(VcsBaseClient::settings());
}
bool BazaarClient::synchronousSetUserId()
......@@ -143,10 +143,10 @@ QString BazaarClient::findTopLevelForFile(const QFileInfo &file) const
const QString repositoryCheckFile =
QLatin1String(Constants::BAZAARREPO) + QLatin1String("/branch-format");
return file.isDir() ?
VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(),
repositoryCheckFile) :
VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absolutePath(),
repositoryCheckFile);
VcsBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(),
repositoryCheckFile) :
VcsBasePlugin::findRepositoryForDirectory(file.absolutePath(),
repositoryCheckFile);
}
bool BazaarClient::managesFile(const QString &workingDirectory, const QString &fileName) const
......@@ -166,7 +166,7 @@ void BazaarClient::view(const QString &source, const QString &id, const QStringL
VcsBaseClient::view(source, id, args);
}
Core::Id BazaarClient::vcsEditorKind(VcsCommand cmd) const
Core::Id BazaarClient::vcsEditorKind(VcsCommandTag cmd) const
{
switch (cmd) {
case AnnotateCommand:
......@@ -180,7 +180,7 @@ Core::Id BazaarClient::vcsEditorKind(VcsCommand cmd) const
}
}
QString BazaarClient::vcsCommandString(VcsCommand cmd) const
QString BazaarClient::vcsCommandString(VcsCommandTag cmd) const
{
switch (cmd) {
case CloneCommand:
......@@ -190,7 +190,7 @@ QString BazaarClient::vcsCommandString(VcsCommand cmd) const
}
}
Utils::ExitCodeInterpreter *BazaarClient::exitCodeInterpreter(VcsCommand cmd, QObject *parent) const
ExitCodeInterpreter *BazaarClient::exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const
{
switch (cmd) {
case DiffCommand:
......@@ -269,13 +269,13 @@ struct BazaarCommandParameters
};
// Parameter widget controlling whitespace diff mode, associated with a parameter
class BazaarDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
class BazaarDiffParameterWidget : public VcsBaseEditorParameterWidget
{
Q_OBJECT
public:
BazaarDiffParameterWidget(BazaarClient *client,
const BazaarCommandParameters &p, QWidget *parent = 0) :
VcsBase::VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
{
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
client->settings()->boolPointer(BazaarSettings::diffIgnoreWhiteSpaceKey));
......@@ -306,20 +306,20 @@ private:
const BazaarCommandParameters m_params;
};
VcsBase::VcsBaseEditorParameterWidget *BazaarClient::createDiffEditor(
VcsBaseEditorParameterWidget *BazaarClient::createDiffEditor(
const QString &workingDir, const QStringList &files, const QStringList &extraOptions)
{
const BazaarCommandParameters parameters(workingDir, files, extraOptions);
return new BazaarDiffParameterWidget(this, parameters);
}
class BazaarLogParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
class BazaarLogParameterWidget : public VcsBaseEditorParameterWidget
{
Q_OBJECT
public:
BazaarLogParameterWidget(BazaarClient *client,
const BazaarCommandParameters &p, QWidget *parent = 0) :
VcsBase::VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
{
BazaarSettings *settings = m_client->settings();
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
......@@ -351,7 +351,7 @@ private:
const BazaarCommandParameters m_params;
};
VcsBase::VcsBaseEditorParameterWidget *BazaarClient::createLogEditor(
VcsBaseEditorParameterWidget *BazaarClient::createLogEditor(
const QString &workingDir, const QStringList &files, const QStringList &extraOptions)
{
const BazaarCommandParameters parameters(workingDir, files, extraOptions);
......
......@@ -63,9 +63,9 @@ public:
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
protected:
Core::Id vcsEditorKind(VcsCommand cmd) const;
QString vcsCommandString(VcsCommand cmd) const;
Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommand cmd, QObject *parent) const;
Core::Id vcsEditorKind(VcsCommandTag cmd) const;
QString vcsCommandString(VcsCommandTag cmd) const;
Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const;
QStringList revisionSpec(const QString &revision) const;
VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
const QStringList &files,
......
......@@ -35,34 +35,36 @@
#include "bazaarsettings.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/command.h>
#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <QDebug>
using namespace Bazaar::Internal;
using namespace VcsBase;
namespace Bazaar {
namespace Internal {
// --------------------------------------------------------------------
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Core::IVersionControl *vc = BazaarPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
addPage(new VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path.toString());
addPage(page);
}
VcsBase::Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......@@ -99,8 +101,11 @@ VcsBase::Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
args << client->vcsCommandString(BazaarClient::CloneCommand)
<< extraOptions << cwp->repository() << cwp->directory();
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), cwp->path(),
client->processEnvironment());
VcsCommand *command = new VcsCommand(settings.binaryPath(), cwp->path(),
client->processEnvironment());
command->addJob(args, -1);
return command;
}
} // namespace Internal
} // namespace Bazaar
......@@ -44,7 +44,7 @@ public:
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -32,11 +32,13 @@
#include "cvsplugin.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/command.h>
#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
using namespace VcsBase;
namespace Cvs {
namespace Internal {
......@@ -45,17 +47,17 @@ namespace Internal {
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
BaseCheckoutWizard(path, parent)
{
const Core::IVersionControl *vc = CvsPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
addPage(new VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path.toString());
addPage(cwp);
}
VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
VcsCommand *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
......@@ -75,8 +77,8 @@ VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
const QString workingDirectory = cwp->path();
*checkoutDir = Utils::FileName::fromString(workingDirectory + QLatin1Char('/') + repository);
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
QProcessEnvironment::systemEnvironment());
VcsCommand *command = new VcsCommand(binary, workingDirectory,
QProcessEnvironment::systemEnvironment());
command->addJob(settings.addOptions(args), -1);
return command;
}
......
......@@ -44,7 +44,7 @@ public:
CheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -42,23 +42,26 @@
#include <QTextStream>
#include <QDebug>
using namespace Utils;
using namespace VcsBase;
namespace Cvs {
namespace Internal {
class CvsDiffExitCodeInterpreter : public Utils::ExitCodeInterpreter
class CvsDiffExitCodeInterpreter : public ExitCodeInterpreter
{
Q_OBJECT
public:
CvsDiffExitCodeInterpreter(QObject *parent) : Utils::ExitCodeInterpreter(parent) {}
Utils::SynchronousProcessResponse::Result interpretExitCode(int code) const;
CvsDiffExitCodeInterpreter(QObject *parent) : ExitCodeInterpreter(parent) {}
SynchronousProcessResponse::Result interpretExitCode(int code) const;
};
Utils::SynchronousProcessResponse::Result CvsDiffExitCodeInterpreter::interpretExitCode(int code) const
SynchronousProcessResponse::Result CvsDiffExitCodeInterpreter::interpretExitCode(int code) const
{
if (code < 0 || code > 2)
return Utils::SynchronousProcessResponse::FinishedError;
return Utils::SynchronousProcessResponse::Finished;
return SynchronousProcessResponse::FinishedError;
return SynchronousProcessResponse::Finished;
}
// Collect all parameters required for a diff to be able to associate them
......@@ -71,7 +74,7 @@ struct CvsDiffParameters
};
// Parameter widget controlling whitespace diff mode, associated with a parameter
class CvsDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
class CvsDiffParameterWidget : public VcsBaseEditorParameterWidget
{
Q_OBJECT
public:
......@@ -90,7 +93,7 @@ private:
CvsDiffParameterWidget::CvsDiffParameterWidget(CvsClient *client,
const CvsDiffParameters &p,
QWidget *parent)
: VcsBase::VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
: VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
{
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
client->settings()->boolPointer(CvsSettings::diffIgnoreWhiteSpaceKey));
......@@ -112,16 +115,16 @@ void CvsDiffParameterWidget::executeCommand()
}
CvsClient::CvsClient(CvsSettings *settings) :
VcsBase::VcsBaseClient(settings)
VcsBaseClient(settings)
{
}
CvsSettings *CvsClient::settings() const
{
return dynamic_cast<CvsSettings *>(VcsBase::VcsBaseClient::settings());
return dynamic_cast<CvsSettings *>(VcsBaseClient::settings());
}
Core::Id CvsClient::vcsEditorKind(VcsCommand cmd) const
Core::Id CvsClient::vcsEditorKind(VcsCommandTag cmd) const
{
switch (cmd) {
case DiffCommand:
......@@ -131,7 +134,7 @@ Core::Id CvsClient::vcsEditorKind(VcsCommand cmd) const
}
}
Utils::ExitCodeInterpreter *CvsClient::exitCodeInterpreter(VcsCommand cmd, QObject *parent) const
ExitCodeInterpreter *CvsClient::exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const
{
switch (cmd) {
case DiffCommand:
......@@ -159,13 +162,13 @@ QStringList CvsClient::revisionSpec(const QString &revision) const
return QStringList();
}
VcsBase::VcsBaseClient::StatusItem CvsClient::parseStatusLine(const QString &line) const
VcsBaseClient::StatusItem CvsClient::parseStatusLine(const QString &line) const
{
Q_UNUSED(line)
return VcsBase::VcsBaseClient::StatusItem();
return VcsBaseClient::StatusItem();
}
VcsBase::VcsBaseEditorParameterWidget *CvsClient::createDiffEditor(
VcsBaseEditorParameterWidget *CvsClient::createDiffEditor(
const QString &workingDir, const QStringList &files, const QStringList &extraOptions)
{
Q_UNUSED(extraOptions)
......
......@@ -54,8 +54,8 @@ public:
protected:
Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommand cmd, QObject *parent) const;
Core::Id vcsEditorKind(VcsCommand cmd) const;
Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const;
Core::Id vcsEditorKind(VcsCommandTag cmd) const;
VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
const QStringList &files,
const QStringList &extraOptions);
......
......@@ -37,6 +37,8 @@
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
using namespace VcsBase;
namespace Git {
namespace Internal {
......@@ -45,20 +47,20 @@ namespace Internal {
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
addPage(new VcsConfigurationPage(vc));
CloneWizardPage *cwp = new CloneWizardPage;
cwp->setPath(path.toString());
addPage(cwp);
}
VcsBase::Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the clone command.
const CloneWizardPage *cwp = 0;
......
......@@ -44,7 +44,7 @@ public:
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -31,13 +31,16 @@
#include "gitplugin.h"
#include "gitclient.h"
#include <vcsbase/command.h>
#include <vcsbase/vcscommand.h>
#include <QCheckBox>
using namespace VcsBase;
namespace Git {
struct CloneWizardPagePrivate {
struct CloneWizardPagePrivate
{
CloneWizardPagePrivate();
bool urlIsLocal(const QString &url);
......@@ -64,7 +67,7 @@ bool CloneWizardPagePrivate::urlIsLocal(const QString &url)
}
CloneWizardPage::CloneWizardPage(QWidget *parent) :
VcsBase::BaseCheckoutWizardPage(parent),
BaseCheckoutWizardPage(parent),
d(new CloneWizardPagePrivate)
{
setTitle(tr("Location"));
......@@ -104,7 +107,7 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
return url;
}
VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) const
VcsCommand *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) const
{
const Internal::GitClient *client = Internal::GitPlugin::instance()->gitClient();
const QString workingDirectory = path();
......@@ -119,9 +122,9 @@ VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPa
if (d->recursiveCheckBox->isChecked())
args << QLatin1String("--recursive");
args << QLatin1String("--progress") << repository() << checkoutDir;
VcsBase::Command *command = new VcsBase::Command(client->gitExecutable(), workingDirectory,
client->processEnvironment());
command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels);
VcsCommand *command = new VcsCommand(client->gitExecutable(), workingDirectory,
client->processEnvironment());
command->addFlags(VcsBasePlugin::MergeOutputChannels);
command->addJob(args, -1);
return command;
}
......
......@@ -34,7 +34,7 @@
#include <utils/fileutils.h>
namespace VcsBase { class Command; }
namespace VcsBase { class VcsCommand; }
namespace Git {
......@@ -48,7 +48,7 @@ public:
explicit CloneWizardPage(QWidget *parent = 0);
~CloneWizardPage();
VcsBase::Command *createCheckoutJob(Utils::FileName *checkoutPath) const;
VcsBase::VcsCommand *createCheckoutJob(Utils::FileName *checkoutPath) const;
protected:
QString directoryFromRepository(const QString &r) const;
......
This diff is collapsed.
......@@ -54,7 +54,7 @@ QT_END_NAMESPACE
namespace Core { class ICore; }
namespace VcsBase {
class Command;
class VcsCommand;
class SubmitFileModel;
class VcsBaseEditorWidget;
class VcsBaseEditorParameterWidget;
......@@ -374,12 +374,12 @@ private:
const QString &source,
const QString &title) const;
VcsBase::Command *createCommand(const QString &workingDirectory,
VcsBase::VcsCommand *createCommand(const QString &workingDirectory,
VcsBase::VcsBaseEditorWidget* editor = 0,
bool useOutputToWindow = false,
int editorLineNumber = -1);
VcsBase::Command *executeGit(const QString &workingDirectory,
VcsBase::VcsCommand *executeGit(const QString &workingDirectory,
const QStringList &arguments,
VcsBase::VcsBaseEditorWidget* editor = 0,
bool useOutputToWindow = false,
......@@ -407,7 +407,7 @@ private:
bool *isDirectory,
QString *errorMessage,
bool revertStaging);
void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd);
void connectRepositoryChanged(const QString & repository, VcsBase::VcsCommand *cmd);
bool executeAndHandleConflicts(const QString &workingDirectory, const QStringList &arguments,
const QString &abortCommand = QString()) const;
bool tryLauchingGitK(const QProcessEnvironment &env,
......
......@@ -94,7 +94,7 @@ GitoriousCloneWizard::GitoriousCloneWizard(const Utils::FileName &path, QWidget
addPage(clonePage);
}
VcsBase::Command *GitoriousCloneWizard::createCommand(Utils::FileName *checkoutDir)
VcsBase::VcsCommand *GitoriousCloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const Git::CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......
......@@ -47,7 +47,7 @@ public:
GitoriousCloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
......
......@@ -33,19 +33,20 @@
#include "mercurialsettings.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/command.h>
#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
using namespace Mercurial::Internal;
using namespace VcsBase;
namespace Mercurial {
namespace Internal {
// --------------------------------------------------------------------
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
......@@ -58,7 +59,7 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
addPage(page);
}
Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......@@ -77,8 +78,11 @@ Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
QStringList args;
args << QLatin1String("clone") << cwp->repository() << directory;
*checkoutDir = Utils::FileName::fromString(path + QLatin1Char('/') + directory);
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), path,
QProcessEnvironment::systemEnvironment());
VcsCommand *command = new VcsCommand(settings.binaryPath(), path,
QProcessEnvironment::systemEnvironment());
command->addJob(args, -1);
return command;
}
} // namespace Internal
} // namespace Mercurial
......@@ -44,7 +44,7 @@ public:
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);