forked from qt-creator/qt-creator
VCS: Do not claim to support any operation if unconfigured
Make sure none of the VCS systems claims it does support any VCS operation while unconfigured. This stops the specific VCS from showing up in wizards, etc. till they can actually be used.
This commit is contained in:
@@ -33,6 +33,8 @@
|
|||||||
#include "bazaarcontrol.h"
|
#include "bazaarcontrol.h"
|
||||||
#include "bazaarclient.h"
|
#include "bazaarclient.h"
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseclientsettings.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
@@ -59,9 +61,19 @@ bool BazaarControl::managesDirectory(const QString &directory, QString *topLevel
|
|||||||
return !topLevelFound.isEmpty();
|
return !topLevelFound.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BazaarControl::isConfigured() const
|
||||||
|
{
|
||||||
|
const QString binary = m_bazaarClient->settings().binary();
|
||||||
|
if (binary.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(binary);
|
||||||
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
bool BazaarControl::supportsOperation(Operation operation) const
|
bool BazaarControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
bool supported = true;
|
bool supported = isConfigured();
|
||||||
|
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case Core::IVersionControl::AddOperation:
|
case Core::IVersionControl::AddOperation:
|
||||||
case Core::IVersionControl::DeleteOperation:
|
case Core::IVersionControl::DeleteOperation:
|
||||||
|
@@ -54,6 +54,7 @@ public:
|
|||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
bool managesDirectory(const QString &filename, QString *topLevel = 0) const;
|
bool managesDirectory(const QString &filename, QString *topLevel = 0) const;
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
bool vcsAdd(const QString &filename);
|
bool vcsAdd(const QString &filename);
|
||||||
|
@@ -75,8 +75,14 @@ public:
|
|||||||
|
|
||||||
virtual bool managesDirectory(const QString &filename, QString *topLevel = 0) const = 0;
|
virtual bool managesDirectory(const QString &filename, QString *topLevel = 0) const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns true is the VCS is configured to run.
|
||||||
|
*/
|
||||||
|
virtual bool isConfigured() const = 0;
|
||||||
/*!
|
/*!
|
||||||
* Called to query whether a VCS supports the respective operations.
|
* Called to query whether a VCS supports the respective operations.
|
||||||
|
*
|
||||||
|
* Return false if the VCS is not configured yet.
|
||||||
*/
|
*/
|
||||||
virtual bool supportsOperation(Operation operation) const = 0;
|
virtual bool supportsOperation(Operation operation) const = 0;
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "cvscontrol.h"
|
#include "cvscontrol.h"
|
||||||
#include "cvsplugin.h"
|
#include "cvsplugin.h"
|
||||||
|
#include "cvssettings.h"
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
@@ -48,9 +49,18 @@ QString CVSControl::displayName() const
|
|||||||
return QLatin1String("cvs");
|
return QLatin1String("cvs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CVSControl::isConfigured() const
|
||||||
|
{
|
||||||
|
const QString binary = m_plugin->settings().cvsCommand;
|
||||||
|
if (binary.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(binary);
|
||||||
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
bool CVSControl::supportsOperation(Operation operation) const
|
bool CVSControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
bool rc = true;
|
bool rc = isConfigured();
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case AddOperation:
|
case AddOperation:
|
||||||
case DeleteOperation:
|
case DeleteOperation:
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
||||||
|
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
bool vcsAdd(const QString &fileName);
|
bool vcsAdd(const QString &fileName);
|
||||||
|
@@ -277,13 +277,14 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
|
m_core = Core::ICore::instance();
|
||||||
|
m_gitClient = new GitClient(this);
|
||||||
|
|
||||||
typedef VCSBase::VCSEditorFactory<GitEditor> GitEditorFactory;
|
typedef VCSBase::VCSEditorFactory<GitEditor> GitEditorFactory;
|
||||||
typedef VCSBase::VCSSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
|
typedef VCSBase::VCSSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
|
||||||
|
|
||||||
VCSBase::VCSBasePlugin::initialize(new GitVersionControl(m_gitClient));
|
VCSBase::VCSBasePlugin::initialize(new GitVersionControl(m_gitClient));
|
||||||
|
|
||||||
m_core = Core::ICore::instance();
|
|
||||||
m_gitClient = new GitClient(this);
|
|
||||||
// Create the globalcontext list to register actions accordingly
|
// Create the globalcontext list to register actions accordingly
|
||||||
Core::Context globalcontext(Core::Constants::C_GLOBAL);
|
Core::Context globalcontext(Core::Constants::C_GLOBAL);
|
||||||
|
|
||||||
|
@@ -46,13 +46,7 @@ static const char stashRevisionIdC[] = "revision";
|
|||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static inline GitClient *gitClient()
|
|
||||||
{
|
|
||||||
return GitPlugin::instance()->gitClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
GitVersionControl::GitVersionControl(GitClient *client) :
|
GitVersionControl::GitVersionControl(GitClient *client) :
|
||||||
m_enabled(true),
|
|
||||||
m_client(client)
|
m_client(client)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -62,18 +56,22 @@ QString GitVersionControl::displayName() const
|
|||||||
return QLatin1String("git");
|
return QLatin1String("git");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add: Implement using "git add --intent-to-add" starting from 1.6.1
|
bool GitVersionControl::isConfigured() const
|
||||||
static inline bool addOperationSupported()
|
|
||||||
{
|
{
|
||||||
return gitClient()->gitVersion(true) >= version(1, 6, 1);
|
bool ok = false;
|
||||||
|
m_client->settings().gitBinaryPath(&ok);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::supportsOperation(Operation operation) const
|
bool GitVersionControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
|
if (!isConfigured())
|
||||||
|
return false;
|
||||||
|
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case AddOperation:
|
case AddOperation:
|
||||||
rc = addOperationSupported();
|
rc = m_client->gitVersion(true) >= version(1, 6, 1);;
|
||||||
break;
|
break;
|
||||||
case DeleteOperation:
|
case DeleteOperation:
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -106,37 +104,37 @@ bool GitVersionControl::vcsOpen(const QString & /*fileName*/)
|
|||||||
bool GitVersionControl::vcsAdd(const QString & fileName)
|
bool GitVersionControl::vcsAdd(const QString & fileName)
|
||||||
{
|
{
|
||||||
// Implement in terms of using "--intent-to-add"
|
// Implement in terms of using "--intent-to-add"
|
||||||
QTC_ASSERT(addOperationSupported(), return false);
|
QTC_ASSERT(m_client->gitVersion(true) >= version(1, 6, 1), return false);
|
||||||
const QFileInfo fi(fileName);
|
const QFileInfo fi(fileName);
|
||||||
return gitClient()->synchronousAdd(fi.absolutePath(), true, QStringList(fi.fileName()));
|
return m_client->synchronousAdd(fi.absolutePath(), true, QStringList(fi.fileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::vcsDelete(const QString & fileName)
|
bool GitVersionControl::vcsDelete(const QString & fileName)
|
||||||
{
|
{
|
||||||
const QFileInfo fi(fileName);
|
const QFileInfo fi(fileName);
|
||||||
return gitClient()->synchronousDelete(fi.absolutePath(), true, QStringList(fi.fileName()));
|
return m_client->synchronousDelete(fi.absolutePath(), true, QStringList(fi.fileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::vcsMove(const QString &from, const QString &to)
|
bool GitVersionControl::vcsMove(const QString &from, const QString &to)
|
||||||
{
|
{
|
||||||
const QFileInfo fromInfo(from);
|
const QFileInfo fromInfo(from);
|
||||||
const QFileInfo toInfo(to);
|
const QFileInfo toInfo(to);
|
||||||
return gitClient()->synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
return m_client->synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::vcsCreateRepository(const QString &directory)
|
bool GitVersionControl::vcsCreateRepository(const QString &directory)
|
||||||
{
|
{
|
||||||
return gitClient()->synchronousInit(directory);
|
return m_client->synchronousInit(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::vcsCheckout(const QString &directory, const QByteArray &url)
|
bool GitVersionControl::vcsCheckout(const QString &directory, const QByteArray &url)
|
||||||
{
|
{
|
||||||
return gitClient()->cloneRepository(directory,url);
|
return m_client->cloneRepository(directory,url);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GitVersionControl::vcsGetRepositoryURL(const QString &directory)
|
QString GitVersionControl::vcsGetRepositoryURL(const QString &directory)
|
||||||
{
|
{
|
||||||
return gitClient()->vcsGetRepositoryURL(directory);
|
return m_client->vcsGetRepositoryURL(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Snapshots are implement using stashes, relying on stash messages for
|
/* Snapshots are implement using stashes, relying on stash messages for
|
||||||
@@ -153,7 +151,7 @@ QString GitVersionControl::vcsCreateSnapshot(const QString &topLevel)
|
|||||||
static int n = 1;
|
static int n = 1;
|
||||||
QString keyword = QLatin1String(stashMessageKeywordC) + QString::number(n++);
|
QString keyword = QLatin1String(stashMessageKeywordC) + QString::number(n++);
|
||||||
const QString stashMessage =
|
const QString stashMessage =
|
||||||
gitClient()->synchronousStash(topLevel, keyword,
|
m_client->synchronousStash(topLevel, keyword,
|
||||||
GitClient::StashImmediateRestore|GitClient::StashIgnoreUnchanged,
|
GitClient::StashImmediateRestore|GitClient::StashIgnoreUnchanged,
|
||||||
&repositoryUnchanged);
|
&repositoryUnchanged);
|
||||||
if (!stashMessage.isEmpty())
|
if (!stashMessage.isEmpty())
|
||||||
@@ -162,7 +160,7 @@ QString GitVersionControl::vcsCreateSnapshot(const QString &topLevel)
|
|||||||
// For unchanged repository state: return identifier + top revision
|
// For unchanged repository state: return identifier + top revision
|
||||||
QString topRevision;
|
QString topRevision;
|
||||||
QString branch;
|
QString branch;
|
||||||
if (!gitClient()->synchronousTopRevision(topLevel, &topRevision, &branch))
|
if (!m_client->synchronousTopRevision(topLevel, &topRevision, &branch))
|
||||||
return QString();
|
return QString();
|
||||||
const QChar colon = QLatin1Char(':');
|
const QChar colon = QLatin1Char(':');
|
||||||
QString id = QLatin1String(stashRevisionIdC);
|
QString id = QLatin1String(stashRevisionIdC);
|
||||||
@@ -178,7 +176,7 @@ QString GitVersionControl::vcsCreateSnapshot(const QString &topLevel)
|
|||||||
QStringList GitVersionControl::vcsSnapshots(const QString &topLevel)
|
QStringList GitVersionControl::vcsSnapshots(const QString &topLevel)
|
||||||
{
|
{
|
||||||
QList<Stash> stashes;
|
QList<Stash> stashes;
|
||||||
if (!gitClient()->synchronousStashList(topLevel, &stashes))
|
if (!m_client->synchronousStashList(topLevel, &stashes))
|
||||||
return QStringList();
|
return QStringList();
|
||||||
// Return the git stash 'message' as identifier, ignoring empty ones
|
// Return the git stash 'message' as identifier, ignoring empty ones
|
||||||
QStringList rc;
|
QStringList rc;
|
||||||
@@ -200,15 +198,15 @@ bool GitVersionControl::vcsRestoreSnapshot(const QString &topLevel, const QStrin
|
|||||||
break;
|
break;
|
||||||
const QString branch = tokens.at(1);
|
const QString branch = tokens.at(1);
|
||||||
const QString revision = tokens.at(2);
|
const QString revision = tokens.at(2);
|
||||||
success = gitClient()->synchronousReset(topLevel)
|
success = m_client->synchronousReset(topLevel)
|
||||||
&& gitClient()->synchronousCheckoutBranch(topLevel, branch)
|
&& m_client->synchronousCheckoutBranch(topLevel, branch)
|
||||||
&& gitClient()->synchronousCheckoutFiles(topLevel, QStringList(), revision);
|
&& m_client->synchronousCheckoutFiles(topLevel, QStringList(), revision);
|
||||||
} else {
|
} else {
|
||||||
// Restore stash if it can be resolved.
|
// Restore stash if it can be resolved.
|
||||||
QString stashName;
|
QString stashName;
|
||||||
success = gitClient()->stashNameFromMessage(topLevel, name, &stashName)
|
success = m_client->stashNameFromMessage(topLevel, name, &stashName)
|
||||||
&& gitClient()->synchronousReset(topLevel)
|
&& m_client->synchronousReset(topLevel)
|
||||||
&& gitClient()->synchronousStashRestore(topLevel, stashName);
|
&& m_client->synchronousStashRestore(topLevel, stashName);
|
||||||
}
|
}
|
||||||
} while (false);
|
} while (false);
|
||||||
return success;
|
return success;
|
||||||
@@ -220,8 +218,8 @@ bool GitVersionControl::vcsRemoveSnapshot(const QString &topLevel, const QString
|
|||||||
if (name.startsWith(QLatin1String(stashRevisionIdC)))
|
if (name.startsWith(QLatin1String(stashRevisionIdC)))
|
||||||
return true;
|
return true;
|
||||||
QString stashName;
|
QString stashName;
|
||||||
return gitClient()->stashNameFromMessage(topLevel, name, &stashName)
|
return m_client->stashNameFromMessage(topLevel, name, &stashName)
|
||||||
&& gitClient()->synchronousStashRemove(topLevel, stashName);
|
&& m_client->synchronousStashRemove(topLevel, stashName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitVersionControl::managesDirectory(const QString &directory, QString *topLevel) const
|
bool GitVersionControl::managesDirectory(const QString &directory, QString *topLevel) const
|
||||||
@@ -235,7 +233,7 @@ bool GitVersionControl::managesDirectory(const QString &directory, QString *topL
|
|||||||
bool GitVersionControl::vcsAnnotate(const QString &file, int line)
|
bool GitVersionControl::vcsAnnotate(const QString &file, int line)
|
||||||
{
|
{
|
||||||
const QFileInfo fi(file);
|
const QFileInfo fi(file);
|
||||||
gitClient()->blame(fi.absolutePath(), QStringList(), fi.fileName(), QString(), line);
|
m_client->blame(fi.absolutePath(), QStringList(), fi.fileName(), QString(), line);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
bool managesDirectory(const QString &directory, QString *topLevel) const;
|
bool managesDirectory(const QString &directory, QString *topLevel) const;
|
||||||
|
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
bool vcsAdd(const QString &fileName);
|
bool vcsAdd(const QString &fileName);
|
||||||
@@ -70,7 +71,6 @@ public:
|
|||||||
void emitRepositoryChanged(const QString &);
|
void emitRepositoryChanged(const QString &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_enabled;
|
|
||||||
GitClient *m_client;
|
GitClient *m_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include "mercurialcontrol.h"
|
#include "mercurialcontrol.h"
|
||||||
#include "mercurialclient.h"
|
#include "mercurialclient.h"
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseclientsettings.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
@@ -59,9 +61,18 @@ bool MercurialControl::managesDirectory(const QString &directory, QString *topLe
|
|||||||
return !topLevelFound.isEmpty();
|
return !topLevelFound.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MercurialControl::isConfigured() const
|
||||||
|
{
|
||||||
|
const QString binary = mercurialClient->settings().binary();
|
||||||
|
if (binary.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(binary);
|
||||||
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
bool MercurialControl::supportsOperation(Operation operation) const
|
bool MercurialControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
bool supported = true;
|
bool supported = isConfigured();
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case Core::IVersionControl::AddOperation:
|
case Core::IVersionControl::AddOperation:
|
||||||
case Core::IVersionControl::DeleteOperation:
|
case Core::IVersionControl::DeleteOperation:
|
||||||
|
@@ -54,6 +54,7 @@ public:
|
|||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
bool managesDirectory(const QString &filename, QString *topLevel = 0) const;
|
bool managesDirectory(const QString &filename, QString *topLevel = 0) const;
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
bool vcsAdd(const QString &filename);
|
bool vcsAdd(const QString &filename);
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "perforceversioncontrol.h"
|
#include "perforceversioncontrol.h"
|
||||||
#include "perforceplugin.h"
|
#include "perforceplugin.h"
|
||||||
#include "perforceconstants.h"
|
#include "perforceconstants.h"
|
||||||
|
#include "perforcesettings.h"
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -41,7 +42,6 @@ namespace Perforce {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
PerforceVersionControl::PerforceVersionControl(PerforcePlugin *plugin) :
|
PerforceVersionControl::PerforceVersionControl(PerforcePlugin *plugin) :
|
||||||
m_enabled(true),
|
|
||||||
m_plugin(plugin)
|
m_plugin(plugin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -51,15 +51,25 @@ QString PerforceVersionControl::displayName() const
|
|||||||
return QLatin1String("perforce");
|
return QLatin1String("perforce");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PerforceVersionControl::isConfigured() const
|
||||||
|
{
|
||||||
|
const QString binary = m_plugin->settings().p4Command();
|
||||||
|
if (binary.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(binary);
|
||||||
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
bool PerforceVersionControl::supportsOperation(Operation operation) const
|
bool PerforceVersionControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
|
bool supported = isConfigured();
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case AddOperation:
|
case AddOperation:
|
||||||
case DeleteOperation:
|
case DeleteOperation:
|
||||||
case MoveOperation:
|
case MoveOperation:
|
||||||
case OpenOperation:
|
case OpenOperation:
|
||||||
case AnnotateOperation:
|
case AnnotateOperation:
|
||||||
return true;
|
return supported;
|
||||||
case CreateRepositoryOperation:
|
case CreateRepositoryOperation:
|
||||||
case SnapshotOperations:
|
case SnapshotOperations:
|
||||||
case CheckoutOperation:
|
case CheckoutOperation:
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
||||||
|
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
SettingsFlags settingsFlags() const;
|
SettingsFlags settingsFlags() const;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "subversioncontrol.h"
|
#include "subversioncontrol.h"
|
||||||
#include "subversionplugin.h"
|
#include "subversionplugin.h"
|
||||||
|
#include "subversionsettings.h"
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
@@ -48,9 +49,18 @@ QString SubversionControl::displayName() const
|
|||||||
return QLatin1String("subversion");
|
return QLatin1String("subversion");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SubversionControl::isConfigured() const
|
||||||
|
{
|
||||||
|
const QString binary = m_plugin->settings().svnCommand;
|
||||||
|
if (binary.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(binary);
|
||||||
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
bool SubversionControl::supportsOperation(Operation operation) const
|
bool SubversionControl::supportsOperation(Operation operation) const
|
||||||
{
|
{
|
||||||
bool rc = true;
|
bool rc = isConfigured();
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case AddOperation:
|
case AddOperation:
|
||||||
case DeleteOperation:
|
case DeleteOperation:
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
||||||
|
|
||||||
|
bool isConfigured() const;
|
||||||
bool supportsOperation(Operation operation) const;
|
bool supportsOperation(Operation operation) const;
|
||||||
bool vcsOpen(const QString &fileName);
|
bool vcsOpen(const QString &fileName);
|
||||||
bool vcsAdd(const QString &fileName);
|
bool vcsAdd(const QString &fileName);
|
||||||
|
Reference in New Issue
Block a user