forked from qt-creator/qt-creator
Mercurial: code cosmetics
Change-Id: Id7257fc5ccdcc4d36b276278906902f12d7e8c57 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -41,12 +41,13 @@
|
|||||||
#include <vcsbase/vcsconfigurationpage.h>
|
#include <vcsbase/vcsconfigurationpage.h>
|
||||||
|
|
||||||
using namespace Mercurial::Internal;
|
using namespace Mercurial::Internal;
|
||||||
|
using namespace VcsBase;
|
||||||
|
|
||||||
CloneWizard::CloneWizard(QObject *parent)
|
CloneWizard::CloneWizard(QObject *parent)
|
||||||
: VcsBase::BaseCheckoutWizard(parent),
|
: BaseCheckoutWizard(parent),
|
||||||
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
|
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
|
||||||
{
|
{
|
||||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_MERCURIAL));
|
setId(QLatin1String(Constants::VCS_ID_MERCURIAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon CloneWizard::icon() const
|
QIcon CloneWizard::icon() const
|
||||||
@@ -64,25 +65,25 @@ QString CloneWizard::displayName() const
|
|||||||
return tr("Mercurial Clone");
|
return tr("Mercurial Clone");
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
|
QList<QWizardPage *> CloneWizard::createParameterPages(const QString &path)
|
||||||
{
|
{
|
||||||
QList<QWizardPage*> wizardPageList;
|
QList<QWizardPage *> wizardPageList;
|
||||||
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
|
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
|
||||||
if (!vc->isConfigured())
|
if (!vc->isConfigured())
|
||||||
wizardPageList.append(new VcsBase::VcsConfigurationPage(vc));
|
wizardPageList.append(new VcsConfigurationPage(vc));
|
||||||
CloneWizardPage *page = new CloneWizardPage;
|
CloneWizardPage *page = new CloneWizardPage;
|
||||||
page->setPath(path);
|
page->setPath(path);
|
||||||
wizardPageList.append(page);
|
wizardPageList.append(page);
|
||||||
return wizardPageList;
|
return wizardPageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<VcsBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> ¶meterPages,
|
QSharedPointer<AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> ¶meterPages,
|
||||||
QString *checkoutPath)
|
QString *checkoutPath)
|
||||||
{
|
{
|
||||||
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
|
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
|
||||||
|
|
||||||
if (!page)
|
if (!page)
|
||||||
return QSharedPointer<VcsBase::AbstractCheckoutJob>();
|
return QSharedPointer<AbstractCheckoutJob>();
|
||||||
|
|
||||||
const MercurialSettings &settings = MercurialPlugin::instance()->settings();
|
const MercurialSettings &settings = MercurialPlugin::instance()->settings();
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ QSharedPointer<VcsBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("clone") << page->repository() << directory;
|
args << QLatin1String("clone") << page->repository() << directory;
|
||||||
*checkoutPath = path + QLatin1Char('/') + directory;
|
*checkoutPath = path + QLatin1Char('/') + directory;
|
||||||
VcsBase::ProcessCheckoutJob *job = new VcsBase::ProcessCheckoutJob;
|
ProcessCheckoutJob *job = new ProcessCheckoutJob;
|
||||||
job->addStep(settings.stringValue(MercurialSettings::binaryPathKey), args, path);
|
job->addStep(settings.stringValue(MercurialSettings::binaryPathKey), args, path);
|
||||||
return QSharedPointer<VcsBase::AbstractCheckoutJob>(job);
|
return QSharedPointer<AbstractCheckoutJob>(job);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ CloneWizardPage::CloneWizardPage(QWidget *parent)
|
|||||||
|
|
||||||
QString CloneWizardPage::directoryFromRepository(const QString &repository) const
|
QString CloneWizardPage::directoryFromRepository(const QString &repository) const
|
||||||
{
|
{
|
||||||
//mercurial repositories are generally of the form protocol://repositoryUrl/repository/
|
// Mercurial repositories are generally of the form protocol://repositoryUrl/repository/
|
||||||
//we are just looking for repository.
|
// We are just looking for repository.
|
||||||
const QChar slash = QLatin1Char('/');
|
const QChar slash = QLatin1Char('/');
|
||||||
QString repo = repository.trimmed();
|
QString repo = repository.trimmed();
|
||||||
if (repo.endsWith(slash))
|
if (repo.endsWith(slash))
|
||||||
repo.truncate(repo.size() - 1);
|
repo.truncate(repo.size() - 1);
|
||||||
|
|
||||||
//Take the basename or the repository url
|
// Take the basename or the repository url.
|
||||||
return repo.mid(repo.lastIndexOf(slash) + 1);
|
return repo.mid(repo.lastIndexOf(slash) + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,13 +36,13 @@
|
|||||||
#include <vcsbase/submitfilemodel.h>
|
#include <vcsbase/submitfilemodel.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtCore/QDir> //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED
|
#include <QtCore/QDir> //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED
|
||||||
|
|
||||||
using namespace Mercurial::Internal;
|
using namespace Mercurial::Internal;
|
||||||
|
using namespace VcsBase;
|
||||||
|
|
||||||
CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
|
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
|
||||||
: VcsBase::VcsBaseSubmitEditor(parameters, new MercurialCommitWidget(parent)),
|
: VcsBaseSubmitEditor(parameters, new MercurialCommitWidget(parent)),
|
||||||
fileModel(0)
|
fileModel(0)
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Commit Editor"));
|
setDisplayName(tr("Commit Editor"));
|
||||||
@@ -55,7 +55,7 @@ MercurialCommitWidget *CommitEditor::commitWidget()
|
|||||||
|
|
||||||
void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &branch,
|
void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &branch,
|
||||||
const QString &userName, const QString &email,
|
const QString &userName, const QString &email,
|
||||||
const QList<VcsBase::VcsBaseClient::StatusItem> &repoStatus)
|
const QList<VcsBaseClient::StatusItem> &repoStatus)
|
||||||
{
|
{
|
||||||
MercurialCommitWidget *mercurialWidget = commitWidget();
|
MercurialCommitWidget *mercurialWidget = commitWidget();
|
||||||
if (!mercurialWidget)
|
if (!mercurialWidget)
|
||||||
@@ -63,23 +63,23 @@ void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &bra
|
|||||||
|
|
||||||
mercurialWidget->setFields(repositoryRoot.absoluteFilePath(), branch, userName, email);
|
mercurialWidget->setFields(repositoryRoot.absoluteFilePath(), branch, userName, email);
|
||||||
|
|
||||||
fileModel = new VcsBase::SubmitFileModel(this);
|
fileModel = new SubmitFileModel(this);
|
||||||
|
|
||||||
//TODO Messy tidy this up
|
//TODO Messy tidy this up
|
||||||
QStringList shouldTrack;
|
QStringList shouldTrack;
|
||||||
|
|
||||||
foreach (const VcsBase::VcsBaseClient::StatusItem &item, repoStatus) {
|
foreach (const VcsBaseClient::StatusItem &item, repoStatus) {
|
||||||
if (item.flags == QLatin1String("Untracked"))
|
if (item.flags == QLatin1String("Untracked"))
|
||||||
shouldTrack.append(item.file);
|
shouldTrack.append(item.file);
|
||||||
else
|
else
|
||||||
fileModel->addFile(item.file, item.flags, false);
|
fileModel->addFile(item.file, item.flags, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBase::VcsBaseSubmitEditor::filterUntrackedFilesOfProject(repositoryRoot.absoluteFilePath(),
|
VcsBaseSubmitEditor::filterUntrackedFilesOfProject(repositoryRoot.absoluteFilePath(),
|
||||||
&shouldTrack);
|
&shouldTrack);
|
||||||
|
|
||||||
foreach (const QString &track, shouldTrack) {
|
foreach (const QString &track, shouldTrack) {
|
||||||
foreach (const VcsBase::VcsBaseClient::StatusItem &item, repoStatus) {
|
foreach (const VcsBaseClient::StatusItem &item, repoStatus) {
|
||||||
if (item.file == track)
|
if (item.file == track)
|
||||||
fileModel->addFile(item.file, item.flags, false);
|
fileModel->addFile(item.file, item.flags, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef CONSTANTS_H
|
#ifndef MERCURIAL_CONSTANTS_H
|
||||||
#define CONSTANTS_H
|
#define MERCURIAL_CONSTANTS_H
|
||||||
|
|
||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
@@ -40,14 +40,14 @@ enum { debug = 0 };
|
|||||||
const char MECURIALREPO[] = ".hg";
|
const char MECURIALREPO[] = ".hg";
|
||||||
const char MERCURIALDEFAULT[] = "hg";
|
const char MERCURIALDEFAULT[] = "hg";
|
||||||
|
|
||||||
//changeset identifiers
|
// Changeset identifiers
|
||||||
const char CHANGESETID12[] = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
|
const char CHANGESETID12[] = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
|
||||||
const char CHANGESETID40[] = " ([a-f0-9]{40,40}) ";
|
const char CHANGESETID40[] = " ([a-f0-9]{40,40}) ";
|
||||||
const char CHANGEIDEXACT12[] = "[a-f0-9]{12,12}"; //match 12 hex chars a
|
const char CHANGEIDEXACT12[] = "[a-f0-9]{12,12}"; //match 12 hex chars a
|
||||||
const char CHANGEIDEXACT40[] = "[a-f0-9]{40,40}";
|
const char CHANGEIDEXACT40[] = "[a-f0-9]{40,40}";
|
||||||
const char DIFFIDENTIFIER[] = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
|
const char DIFFIDENTIFIER[] = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
|
||||||
|
|
||||||
//BaseEditorParameters
|
// Base editor parameters
|
||||||
const char COMMANDLOG_ID[] = "Mercurial Command Log Editor";
|
const char COMMANDLOG_ID[] = "Mercurial Command Log Editor";
|
||||||
const char COMMANDLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
|
const char COMMANDLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
|
||||||
const char COMMANDLOG[] = "Mercurial Command Log Editor";
|
const char COMMANDLOG[] = "Mercurial Command Log Editor";
|
||||||
@@ -72,13 +72,12 @@ const char DIFFLOG[] = "Mercurial Diff Editor";
|
|||||||
const char DIFFAPP[] = "text/x-patch";
|
const char DIFFAPP[] = "text/x-patch";
|
||||||
const char DIFFEXT[] = "diff";
|
const char DIFFEXT[] = "diff";
|
||||||
|
|
||||||
//SubmitEditorParameters
|
// Submit editor parameters
|
||||||
const char COMMIT_ID[] = "Mercurial Commit Log Editor";
|
const char COMMIT_ID[] = "Mercurial Commit Log Editor";
|
||||||
const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
|
const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
|
||||||
const char COMMITMIMETYPE[] = "application/vnd.nokia.text.scs_mercurial_commitlog";
|
const char COMMITMIMETYPE[] = "application/vnd.nokia.text.scs_mercurial_commitlog";
|
||||||
|
|
||||||
//menu items
|
// File menu actions
|
||||||
//File menu actions
|
|
||||||
const char ADD[] = "Mercurial.AddSingleFile";
|
const char ADD[] = "Mercurial.AddSingleFile";
|
||||||
const char DELETE[] = "Mercurial.DeleteSingleFile";
|
const char DELETE[] = "Mercurial.DeleteSingleFile";
|
||||||
const char ANNOTATE[] = "Mercurial.Annotate";
|
const char ANNOTATE[] = "Mercurial.Annotate";
|
||||||
@@ -87,13 +86,13 @@ const char LOG[] = "Mercurial.LogSingleFile";
|
|||||||
const char REVERT[] = "Mercurial.RevertSingleFile";
|
const char REVERT[] = "Mercurial.RevertSingleFile";
|
||||||
const char STATUS[] = "Mercurial.Status";
|
const char STATUS[] = "Mercurial.Status";
|
||||||
|
|
||||||
//directory menu Actions
|
// Directory menu actions
|
||||||
const char DIFFMULTI[] = "Mercurial.Action.DiffMulti";
|
const char DIFFMULTI[] = "Mercurial.Action.DiffMulti";
|
||||||
const char REVERTMULTI[] = "Mercurial.Action.RevertMulti";
|
const char REVERTMULTI[] = "Mercurial.Action.RevertMulti";
|
||||||
const char STATUSMULTI[] = "Mercurial.Action.StatusMulti";
|
const char STATUSMULTI[] = "Mercurial.Action.StatusMulti";
|
||||||
const char LOGMULTI[] = "Mercurial.Action.Logmulti";
|
const char LOGMULTI[] = "Mercurial.Action.Logmulti";
|
||||||
|
|
||||||
//repository menu actions
|
// Repository menu actions
|
||||||
const char PULL[] = "Mercurial.Action.Pull";
|
const char PULL[] = "Mercurial.Action.Pull";
|
||||||
const char PUSH[] = "Mercurial.Action.Push";
|
const char PUSH[] = "Mercurial.Action.Push";
|
||||||
const char UPDATE[] = "Mercurial.Action.Update";
|
const char UPDATE[] = "Mercurial.Action.Update";
|
||||||
@@ -103,10 +102,10 @@ const char OUTGOING[] = "Mercurial.Action.Outgoing";
|
|||||||
const char COMMIT[] = "Mercurial.Action.Commit";
|
const char COMMIT[] = "Mercurial.Action.Commit";
|
||||||
const char CREATE_REPOSITORY[] = "Mercurial.Action.CreateRepository";
|
const char CREATE_REPOSITORY[] = "Mercurial.Action.CreateRepository";
|
||||||
|
|
||||||
//submit editor actions
|
// Submit editor actions
|
||||||
const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
|
const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace mercurial
|
} // namespace mercurial
|
||||||
|
|
||||||
#endif // CONSTANTS_H
|
#endif // MERCURIAL_CONSTANTS_H
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ private:
|
|||||||
const QChar m_hashChar;
|
const QChar m_hashChar;
|
||||||
};
|
};
|
||||||
|
|
||||||
MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit * parent) :
|
MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit *parent) :
|
||||||
QSyntaxHighlighter(parent),
|
QSyntaxHighlighter(parent),
|
||||||
m_commentFormat(commentFormat()),
|
m_commentFormat(commentFormat()),
|
||||||
m_keywordPattern(QLatin1String("^\\w+:")),
|
m_keywordPattern(QLatin1String("^\\w+:")),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
using namespace Mercurial::Internal;
|
using namespace Mercurial::Internal;
|
||||||
|
|
||||||
MercurialControl::MercurialControl(MercurialClient *client)
|
MercurialControl::MercurialControl(MercurialClient *client)
|
||||||
: mercurialClient(client)
|
: mercurialClient(client)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,12 @@ namespace Internal {
|
|||||||
|
|
||||||
class MercurialClient;
|
class MercurialClient;
|
||||||
|
|
||||||
//Implements just the basics of the Version Control Interface
|
// Implements just the basics of the Version Control Interface
|
||||||
//MercurialClient handles all the work
|
// MercurialClient handles all the work.
|
||||||
class MercurialControl: public Core::IVersionControl
|
class MercurialControl: public Core::IVersionControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MercurialControl(MercurialClient *mercurialClient);
|
explicit MercurialControl(MercurialClient *mercurialClient);
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ private:
|
|||||||
MercurialClient *mercurialClient;
|
MercurialClient *mercurialClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace Internal
|
} // namespace Internal
|
||||||
} //namespace Mercurial
|
} // namespace Mercurial
|
||||||
|
|
||||||
#endif // MERCURIALCONTROL_H
|
#endif // MERCURIALCONTROL_H
|
||||||
|
|||||||
@@ -133,4 +133,3 @@ QStringList MercurialEditor::annotationPreviousVersions(const QString &revision)
|
|||||||
return QStringList();
|
return QStringList();
|
||||||
return descriptions;
|
return descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,4 +63,5 @@ private:
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Mercurial
|
} // namespace Mercurial
|
||||||
|
|
||||||
#endif // MERCURIALEDITOR_H
|
#endif // MERCURIALEDITOR_H
|
||||||
|
|||||||
@@ -76,31 +76,33 @@
|
|||||||
|
|
||||||
using namespace Mercurial::Internal;
|
using namespace Mercurial::Internal;
|
||||||
using namespace Mercurial;
|
using namespace Mercurial;
|
||||||
|
using namespace VcsBase;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
static const VcsBaseEditorParameters editorParameters[] = {
|
||||||
{
|
{
|
||||||
VcsBase::RegularCommandOutput, //type
|
RegularCommandOutput, //type
|
||||||
Constants::COMMANDLOG_ID, // id
|
Constants::COMMANDLOG_ID, // id
|
||||||
Constants::COMMANDLOG_DISPLAY_NAME, // display name
|
Constants::COMMANDLOG_DISPLAY_NAME, // display name
|
||||||
Constants::COMMANDLOG, // context
|
Constants::COMMANDLOG, // context
|
||||||
Constants::COMMANDAPP, // mime type
|
Constants::COMMANDAPP, // mime type
|
||||||
Constants::COMMANDEXT}, //extension
|
Constants::COMMANDEXT}, //extension
|
||||||
|
|
||||||
{ VcsBase::LogOutput,
|
{ LogOutput,
|
||||||
Constants::FILELOG_ID,
|
Constants::FILELOG_ID,
|
||||||
Constants::FILELOG_DISPLAY_NAME,
|
Constants::FILELOG_DISPLAY_NAME,
|
||||||
Constants::FILELOG,
|
Constants::FILELOG,
|
||||||
Constants::LOGAPP,
|
Constants::LOGAPP,
|
||||||
Constants::LOGEXT},
|
Constants::LOGEXT},
|
||||||
|
|
||||||
{ VcsBase::AnnotateOutput,
|
{ AnnotateOutput,
|
||||||
Constants::ANNOTATELOG_ID,
|
Constants::ANNOTATELOG_ID,
|
||||||
Constants::ANNOTATELOG_DISPLAY_NAME,
|
Constants::ANNOTATELOG_DISPLAY_NAME,
|
||||||
Constants::ANNOTATELOG,
|
Constants::ANNOTATELOG,
|
||||||
Constants::ANNOTATEAPP,
|
Constants::ANNOTATEAPP,
|
||||||
Constants::ANNOTATEEXT},
|
Constants::ANNOTATEEXT},
|
||||||
|
|
||||||
{ VcsBase::DiffOutput,
|
{ DiffOutput,
|
||||||
Constants::DIFFLOG_ID,
|
Constants::DIFFLOG_ID,
|
||||||
Constants::DIFFLOG_DISPLAY_NAME,
|
Constants::DIFFLOG_DISPLAY_NAME,
|
||||||
Constants::DIFFLOG,
|
Constants::DIFFLOG,
|
||||||
@@ -108,7 +110,7 @@ static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
|||||||
Constants::DIFFEXT}
|
Constants::DIFFEXT}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = {
|
static const VcsBaseSubmitEditorParameters submitEditorParameters = {
|
||||||
Constants::COMMITMIMETYPE,
|
Constants::COMMITMIMETYPE,
|
||||||
Constants::COMMIT_ID,
|
Constants::COMMIT_ID,
|
||||||
Constants::COMMIT_DISPLAY_NAME,
|
Constants::COMMIT_DISPLAY_NAME,
|
||||||
@@ -116,17 +118,17 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Utility to find a parameter set by type
|
// Utility to find a parameter set by type
|
||||||
static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
|
static const VcsBaseEditorParameters *findType(int ie)
|
||||||
{
|
{
|
||||||
const VcsBase::EditorContentType et = static_cast<VcsBase::EditorContentType>(ie);
|
const EditorContentType et = static_cast<EditorContentType>(ie);
|
||||||
return VcsBase::VcsBaseEditorWidget::findType(editorParameters,
|
return VcsBaseEditorWidget::findType(editorParameters,
|
||||||
sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters), et);
|
sizeof(editorParameters)/sizeof(editorParameters[0]), et);
|
||||||
}
|
}
|
||||||
|
|
||||||
MercurialPlugin *MercurialPlugin::m_instance = 0;
|
MercurialPlugin *MercurialPlugin::m_instance = 0;
|
||||||
|
|
||||||
MercurialPlugin::MercurialPlugin() :
|
MercurialPlugin::MercurialPlugin() :
|
||||||
VcsBase::VcsBasePlugin(QLatin1String(Constants::COMMIT_ID)),
|
VcsBasePlugin(QLatin1String(Constants::COMMIT_ID)),
|
||||||
optionsPage(0),
|
optionsPage(0),
|
||||||
m_client(0),
|
m_client(0),
|
||||||
core(0),
|
core(0),
|
||||||
@@ -154,7 +156,7 @@ MercurialPlugin::~MercurialPlugin()
|
|||||||
|
|
||||||
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
|
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
|
||||||
{
|
{
|
||||||
typedef VcsBase::VcsEditorFactory<MercurialEditor> MercurialEditorFactory;
|
typedef VcsEditorFactory<MercurialEditor> MercurialEditorFactory;
|
||||||
|
|
||||||
m_client = new MercurialClient(&mercurialSettings);
|
m_client = new MercurialClient(&mercurialSettings);
|
||||||
initializeVcs(new MercurialControl(m_client));
|
initializeVcs(new MercurialControl(m_client));
|
||||||
@@ -169,11 +171,11 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
|
|||||||
connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant)));
|
connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant)));
|
||||||
|
|
||||||
static const char *describeSlot = SLOT(view(QString,QString));
|
static const char *describeSlot = SLOT(view(QString,QString));
|
||||||
const int editorCount = sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters);
|
const int editorCount = sizeof(editorParameters)/sizeof(editorParameters[0]);
|
||||||
for (int i = 0; i < editorCount; i++)
|
for (int i = 0; i < editorCount; i++)
|
||||||
addAutoReleasedObject(new MercurialEditorFactory(editorParameters + i, m_client, describeSlot));
|
addAutoReleasedObject(new MercurialEditorFactory(editorParameters + i, m_client, describeSlot));
|
||||||
|
|
||||||
addAutoReleasedObject(new VcsBase::VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
|
addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
|
||||||
|
|
||||||
addAutoReleasedObject(new CloneWizard);
|
addAutoReleasedObject(new CloneWizard);
|
||||||
|
|
||||||
@@ -230,14 +232,14 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
|||||||
{
|
{
|
||||||
Core::Command *command;
|
Core::Command *command;
|
||||||
|
|
||||||
annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context);
|
command = actionManager->registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
|
connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
|
||||||
mercurialContainer->addAction(command);
|
mercurialContainer->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
diffFile = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(diffFile, Core::Id(Constants::DIFF), context);
|
command = actionManager->registerAction(diffFile, Core::Id(Constants::DIFF), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+D")));
|
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+D")));
|
||||||
@@ -245,7 +247,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
|||||||
mercurialContainer->addAction(command);
|
mercurialContainer->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
logFile = new ParameterAction(tr("Log Current File"), tr("Log \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(logFile, Core::Id(Constants::LOG), context);
|
command = actionManager->registerAction(logFile, Core::Id(Constants::LOG), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+L")));
|
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+L")));
|
||||||
@@ -253,7 +255,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
|||||||
mercurialContainer->addAction(command);
|
mercurialContainer->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
statusFile = new ParameterAction(tr("Status Current File"), tr("Status \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(statusFile, Core::Id(Constants::STATUS), context);
|
command = actionManager->registerAction(statusFile, Core::Id(Constants::STATUS), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+S")));
|
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+S")));
|
||||||
@@ -263,21 +265,21 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
|||||||
|
|
||||||
createSeparator(context, Core::Id("Mercurial.FileDirSeperator1"));
|
createSeparator(context, Core::Id("Mercurial.FileDirSeperator1"));
|
||||||
|
|
||||||
m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context);
|
command = actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
|
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
|
||||||
mercurialContainer->addAction(command);
|
mercurialContainer->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
|
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
|
command = actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
|
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
|
||||||
mercurialContainer->addAction(command);
|
mercurialContainer->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
|
revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||||
command = actionManager->registerAction(revertFile, Core::Id(Constants::REVERT), context);
|
command = actionManager->registerAction(revertFile, Core::Id(Constants::REVERT), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
|
connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
|
||||||
@@ -287,28 +289,28 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
|||||||
|
|
||||||
void MercurialPlugin::addCurrentFile()
|
void MercurialPlugin::addCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::annotateCurrentFile()
|
void MercurialPlugin::annotateCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::diffCurrentFile()
|
void MercurialPlugin::diffCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::logCurrentFile()
|
void MercurialPlugin::logCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
m_client->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
m_client->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
||||||
QStringList(), true);
|
QStringList(), true);
|
||||||
@@ -316,7 +318,7 @@ void MercurialPlugin::logCurrentFile()
|
|||||||
|
|
||||||
void MercurialPlugin::revertCurrentFile()
|
void MercurialPlugin::revertCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
|
|
||||||
RevertDialog reverter;
|
RevertDialog reverter;
|
||||||
@@ -327,7 +329,7 @@ void MercurialPlugin::revertCurrentFile()
|
|||||||
|
|
||||||
void MercurialPlugin::statusCurrentFile()
|
void MercurialPlugin::statusCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return)
|
QTC_ASSERT(state.hasFile(), return)
|
||||||
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||||
}
|
}
|
||||||
@@ -369,21 +371,21 @@ void MercurialPlugin::createDirectoryActions(const Core::Context &context)
|
|||||||
|
|
||||||
void MercurialPlugin::diffRepository()
|
void MercurialPlugin::diffRepository()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
m_client->diff(state.topLevel());
|
m_client->diff(state.topLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::logRepository()
|
void MercurialPlugin::logRepository()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
m_client->log(state.topLevel());
|
m_client->log(state.topLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::revertMulti()
|
void MercurialPlugin::revertMulti()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
RevertDialog reverter;
|
RevertDialog reverter;
|
||||||
@@ -394,7 +396,7 @@ void MercurialPlugin::revertMulti()
|
|||||||
|
|
||||||
void MercurialPlugin::statusMulti()
|
void MercurialPlugin::statusMulti()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
m_client->status(state.topLevel());
|
m_client->status(state.topLevel());
|
||||||
@@ -460,7 +462,7 @@ void MercurialPlugin::createRepositoryActions(const Core::Context &context)
|
|||||||
|
|
||||||
void MercurialPlugin::pull()
|
void MercurialPlugin::pull()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
SrcDestDialog dialog;
|
SrcDestDialog dialog;
|
||||||
@@ -472,7 +474,7 @@ void MercurialPlugin::pull()
|
|||||||
|
|
||||||
void MercurialPlugin::push()
|
void MercurialPlugin::push()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
SrcDestDialog dialog;
|
SrcDestDialog dialog;
|
||||||
@@ -484,7 +486,7 @@ void MercurialPlugin::push()
|
|||||||
|
|
||||||
void MercurialPlugin::update()
|
void MercurialPlugin::update()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
RevertDialog updateDialog;
|
RevertDialog updateDialog;
|
||||||
@@ -496,7 +498,7 @@ void MercurialPlugin::update()
|
|||||||
|
|
||||||
void MercurialPlugin::import()
|
void MercurialPlugin::import()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
QFileDialog importDialog;
|
QFileDialog importDialog;
|
||||||
@@ -512,7 +514,7 @@ void MercurialPlugin::import()
|
|||||||
|
|
||||||
void MercurialPlugin::incoming()
|
void MercurialPlugin::incoming()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
SrcDestDialog dialog;
|
SrcDestDialog dialog;
|
||||||
@@ -524,7 +526,7 @@ void MercurialPlugin::incoming()
|
|||||||
|
|
||||||
void MercurialPlugin::outgoing()
|
void MercurialPlugin::outgoing()
|
||||||
{
|
{
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
m_client->outgoing(state.topLevel());
|
m_client->outgoing(state.topLevel());
|
||||||
}
|
}
|
||||||
@@ -534,12 +536,12 @@ void MercurialPlugin::createSubmitEditorActions()
|
|||||||
Core::Context context(Constants::COMMIT_ID);
|
Core::Context context(Constants::COMMIT_ID);
|
||||||
Core::Command *command;
|
Core::Command *command;
|
||||||
|
|
||||||
editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||||
command = actionManager->registerAction(editorCommit, Core::Id(Constants::COMMIT), context);
|
command = actionManager->registerAction(editorCommit, Core::Id(Constants::COMMIT), context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Core::Command::CA_UpdateText);
|
||||||
connect(editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
|
connect(editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
|
||||||
|
|
||||||
editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||||
command = actionManager->registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context);
|
command = actionManager->registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context);
|
||||||
|
|
||||||
editorUndo = new QAction(tr("&Undo"), this);
|
editorUndo = new QAction(tr("&Undo"), this);
|
||||||
@@ -551,26 +553,26 @@ void MercurialPlugin::createSubmitEditorActions()
|
|||||||
|
|
||||||
void MercurialPlugin::commit()
|
void MercurialPlugin::commit()
|
||||||
{
|
{
|
||||||
if (VcsBase::VcsBaseSubmitEditor::raiseSubmitEditor())
|
if (VcsBaseSubmitEditor::raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return)
|
QTC_ASSERT(state.hasTopLevel(), return)
|
||||||
|
|
||||||
m_submitRepository = state.topLevel();
|
m_submitRepository = state.topLevel();
|
||||||
|
|
||||||
connect(m_client, SIGNAL(parsedStatus(QList<VcsBase::VcsBaseClient::StatusItem>)),
|
connect(m_client, SIGNAL(parsedStatus(QList<VcsBaseClient::StatusItem>)),
|
||||||
this, SLOT(showCommitWidget(QList<VcsBase::VcsBaseClient::StatusItem>)));
|
this, SLOT(showCommitWidget(QList<VcsBaseClient::StatusItem>)));
|
||||||
m_client->emitParsedStatus(m_submitRepository);
|
m_client->emitParsedStatus(m_submitRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status)
|
void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
||||||
{
|
{
|
||||||
|
|
||||||
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
|
VcsBaseOutputWindow *outputWindow = VcsBaseOutputWindow::instance();
|
||||||
//Once we receive our data release the connection so it can be reused elsewhere
|
//Once we receive our data release the connection so it can be reused elsewhere
|
||||||
disconnect(m_client, SIGNAL(parsedStatus(QList<VcsBase::VcsBaseClient::StatusItem>)),
|
disconnect(m_client, SIGNAL(parsedStatus(QList<VcsBaseClient::StatusItem>)),
|
||||||
this, SLOT(showCommitWidget(QList<VcsBase::VcsBaseClient::StatusItem>)));
|
this, SLOT(showCommitWidget(QList<VcsBaseClient::StatusItem>)));
|
||||||
|
|
||||||
if (status.isEmpty()) {
|
if (status.isEmpty()) {
|
||||||
outputWindow->appendError(tr("There are no changes to commit."));
|
outputWindow->appendError(tr("There are no changes to commit."));
|
||||||
@@ -630,7 +632,7 @@ void MercurialPlugin::commitFromEditor()
|
|||||||
core->editorManager()->closeEditors(core->editorManager()->editorsForFileName(changeLog->fileName()));
|
core->editorManager()->closeEditors(core->editorManager()->editorsForFileName(changeLog->fileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MercurialPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor)
|
bool MercurialPlugin::submitEditorAboutToClose(VcsBaseSubmitEditor *submitEditor)
|
||||||
{
|
{
|
||||||
if (!changeLog)
|
if (!changeLog)
|
||||||
return true;
|
return true;
|
||||||
@@ -640,15 +642,15 @@ bool MercurialPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *sub
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool dummyPrompt = mercurialSettings.boolValue(MercurialSettings::promptOnSubmitKey);
|
bool dummyPrompt = mercurialSettings.boolValue(MercurialSettings::promptOnSubmitKey);
|
||||||
const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response =
|
const VcsBaseSubmitEditor::PromptSubmitResult response =
|
||||||
commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"),
|
commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"),
|
||||||
tr("Message check failed. Do you want to proceed?"),
|
tr("Message check failed. Do you want to proceed?"),
|
||||||
&dummyPrompt, dummyPrompt);
|
&dummyPrompt, dummyPrompt);
|
||||||
|
|
||||||
switch (response) {
|
switch (response) {
|
||||||
case VcsBase::VcsBaseSubmitEditor::SubmitCanceled:
|
case VcsBaseSubmitEditor::SubmitCanceled:
|
||||||
return false;
|
return false;
|
||||||
case VcsBase::VcsBaseSubmitEditor::SubmitDiscarded:
|
case VcsBaseSubmitEditor::SubmitDiscarded:
|
||||||
deleteCommitLog();
|
deleteCommitLog();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@@ -704,7 +706,7 @@ void MercurialPlugin::createSeparator(const Core::Context &context, const Core::
|
|||||||
mercurialContainer->addAction(actionManager->registerAction(action, id, context));
|
mercurialContainer->addAction(actionManager->registerAction(action, id, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MercurialPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
|
void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||||
{
|
{
|
||||||
if (!enableMenuAction(as, m_menuAction)) {
|
if (!enableMenuAction(as, m_menuAction)) {
|
||||||
m_commandLocator->setEnabled(false);
|
m_commandLocator->setEnabled(false);
|
||||||
|
|||||||
@@ -39,36 +39,22 @@
|
|||||||
#include <vcsbase/vcsbaseplugin.h>
|
#include <vcsbase/vcsbaseplugin.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QHash>
|
|
||||||
#include <QtCore/qglobal.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAction;
|
class QAction;
|
||||||
class QTemporaryFile;
|
class QTemporaryFile;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ActionManager;
|
|
||||||
class ActionContainer;
|
class ActionContainer;
|
||||||
|
class ActionManager;
|
||||||
class ICore;
|
class ICore;
|
||||||
class Id;
|
class Id;
|
||||||
class IVersionControl;
|
|
||||||
class IEditorFactory;
|
|
||||||
class IEditor;
|
class IEditor;
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils { class ParameterAction; }
|
||||||
class ParameterAction;
|
namespace VcsBase { class VcsBaseSubmitEditor; }
|
||||||
} //namespace Utils
|
namespace Locator { class CommandLocator; }
|
||||||
|
|
||||||
namespace VcsBase {
|
|
||||||
class VcsBaseSubmitEditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Locator {
|
|
||||||
class CommandLocator;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -95,7 +81,7 @@ public:
|
|||||||
void setSettings(const MercurialSettings &settings);
|
void setSettings(const MercurialSettings &settings);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// File menu action Slots
|
// File menu action slots
|
||||||
void addCurrentFile();
|
void addCurrentFile();
|
||||||
void annotateCurrentFile();
|
void annotateCurrentFile();
|
||||||
void diffCurrentFile();
|
void diffCurrentFile();
|
||||||
@@ -103,13 +89,13 @@ private slots:
|
|||||||
void revertCurrentFile();
|
void revertCurrentFile();
|
||||||
void statusCurrentFile();
|
void statusCurrentFile();
|
||||||
|
|
||||||
//Directory menu Action slots
|
// Directory menu action slots
|
||||||
void diffRepository();
|
void diffRepository();
|
||||||
void logRepository();
|
void logRepository();
|
||||||
void revertMulti();
|
void revertMulti();
|
||||||
void statusMulti();
|
void statusMulti();
|
||||||
|
|
||||||
//repository menu action slots
|
// Repository menu action slots
|
||||||
void pull();
|
void pull();
|
||||||
void push();
|
void push();
|
||||||
void update();
|
void update();
|
||||||
@@ -140,7 +126,6 @@ protected:
|
|||||||
virtual bool submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor);
|
virtual bool submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//methods
|
|
||||||
void createMenu();
|
void createMenu();
|
||||||
void createSubmitEditorActions();
|
void createSubmitEditorActions();
|
||||||
void createSeparator(const Core::Context &context, const Core::Id &id);
|
void createSeparator(const Core::Context &context, const Core::Id &id);
|
||||||
@@ -151,7 +136,7 @@ private:
|
|||||||
void createLessUsedActions(const Core::Context &context);
|
void createLessUsedActions(const Core::Context &context);
|
||||||
void deleteCommitLog();
|
void deleteCommitLog();
|
||||||
|
|
||||||
//Variables
|
// Variables
|
||||||
static MercurialPlugin *m_instance;
|
static MercurialPlugin *m_instance;
|
||||||
MercurialSettings mercurialSettings;
|
MercurialSettings mercurialSettings;
|
||||||
OptionsPage *optionsPage;
|
OptionsPage *optionsPage;
|
||||||
@@ -165,7 +150,7 @@ private:
|
|||||||
QList<QAction *> m_repositoryActionList;
|
QList<QAction *> m_repositoryActionList;
|
||||||
QTemporaryFile *changeLog;
|
QTemporaryFile *changeLog;
|
||||||
|
|
||||||
//Menu Items (file actions)
|
// Menu items (file actions)
|
||||||
Utils::ParameterAction *m_addAction;
|
Utils::ParameterAction *m_addAction;
|
||||||
Utils::ParameterAction *m_deleteAction;
|
Utils::ParameterAction *m_deleteAction;
|
||||||
Utils::ParameterAction *annotateFile;
|
Utils::ParameterAction *annotateFile;
|
||||||
@@ -176,7 +161,7 @@ private:
|
|||||||
Utils::ParameterAction *statusFile;
|
Utils::ParameterAction *statusFile;
|
||||||
|
|
||||||
QAction *m_createRepositoryAction;
|
QAction *m_createRepositoryAction;
|
||||||
//submit editor actions
|
// Submit editor actions
|
||||||
QAction *editorCommit;
|
QAction *editorCommit;
|
||||||
QAction *editorDiff;
|
QAction *editorDiff;
|
||||||
QAction *editorUndo;
|
QAction *editorUndo;
|
||||||
@@ -186,7 +171,7 @@ private:
|
|||||||
QString m_submitRepository;
|
QString m_submitRepository;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace Internal
|
} // namespace Internal
|
||||||
} //namespace Mercurial
|
} // namespace Mercurial
|
||||||
|
|
||||||
#endif // MERCURIALPLUGIN_H
|
#endif // MERCURIALPLUGIN_H
|
||||||
|
|||||||
@@ -38,16 +38,17 @@
|
|||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const QLatin1String MercurialSettings::diffIgnoreWhiteSpaceKey("diffIgnoreWhiteSpace");
|
const QLatin1String MercurialSettings::diffIgnoreWhiteSpaceKey("diffIgnoreWhiteSpace");
|
||||||
const QLatin1String MercurialSettings::diffIgnoreBlankLinesKey("diffIgnoreBlankLines");
|
const QLatin1String MercurialSettings::diffIgnoreBlankLinesKey("diffIgnoreBlankLines");
|
||||||
|
|
||||||
|
MercurialSettings::MercurialSettings()
|
||||||
|
{
|
||||||
|
setSettingsGroup(QLatin1String("Mercurial"));
|
||||||
|
// Override default binary path
|
||||||
|
declareKey(binaryPathKey, QLatin1String(Constants::MERCURIALDEFAULT));
|
||||||
|
declareKey(diffIgnoreWhiteSpaceKey, false);
|
||||||
|
declareKey(diffIgnoreBlankLinesKey, false);
|
||||||
|
}
|
||||||
|
|
||||||
MercurialSettings::MercurialSettings()
|
|
||||||
{
|
|
||||||
setSettingsGroup(QLatin1String("Mercurial"));
|
|
||||||
// Override default binary path
|
|
||||||
declareKey(binaryPathKey, QLatin1String(Constants::MERCURIALDEFAULT));
|
|
||||||
declareKey(diffIgnoreWhiteSpaceKey, false);
|
|
||||||
declareKey(diffIgnoreBlankLinesKey, false);
|
|
||||||
}
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Mercurial
|
} // namespace Mercurial
|
||||||
|
|||||||
@@ -30,20 +30,20 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef REVERTDIALOG_H
|
#ifndef MERCURIAL_REVERTDIALOG_H
|
||||||
#define REVERTDIALOG_H
|
#define MERCURIAL_REVERTDIALOG_H
|
||||||
|
|
||||||
#include "ui_revertdialog.h"
|
#include "ui_revertdialog.h"
|
||||||
|
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
|
|
||||||
|
|
||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class RevertDialog : public QDialog
|
class RevertDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RevertDialog(QWidget *parent = 0);
|
RevertDialog(QWidget *parent = 0);
|
||||||
~RevertDialog();
|
~RevertDialog();
|
||||||
@@ -59,4 +59,5 @@ private:
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Mercurial
|
} // namespace Mercurial
|
||||||
#endif // REVERTDIALOG_H
|
|
||||||
|
#endif // MERCURIAL_REVERTDIALOG_H
|
||||||
|
|||||||
@@ -58,10 +58,9 @@ QString SrcDestDialog::getRepositoryString() const
|
|||||||
{
|
{
|
||||||
if (m_ui->defaultButton->isChecked())
|
if (m_ui->defaultButton->isChecked())
|
||||||
return QString();
|
return QString();
|
||||||
else if (m_ui->localButton->isChecked())
|
if (m_ui->localButton->isChecked())
|
||||||
return m_ui->localPathChooser->path();
|
return m_ui->localPathChooser->path();
|
||||||
else
|
return m_ui->urlLineEdit->text();
|
||||||
return m_ui->urlLineEdit->text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrcDestDialog::changeEvent(QEvent *e)
|
void SrcDestDialog::changeEvent(QEvent *e)
|
||||||
|
|||||||
@@ -33,21 +33,19 @@
|
|||||||
#ifndef SRCDESTDIALOG_H
|
#ifndef SRCDESTDIALOG_H
|
||||||
#define SRCDESTDIALOG_H
|
#define SRCDESTDIALOG_H
|
||||||
|
|
||||||
#include <QtGui/QDialog>
|
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
#include <QtGui/QDialog>
|
||||||
|
|
||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui { class SrcDestDialog; }
|
||||||
class SrcDestDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SrcDestDialog : public QDialog
|
class SrcDestDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
SrcDestDialog(QWidget *parent = 0);
|
SrcDestDialog(QWidget *parent = 0);
|
||||||
~SrcDestDialog();
|
~SrcDestDialog();
|
||||||
void setPathChooserKind(Utils::PathChooser::Kind kind);
|
void setPathChooserKind(Utils::PathChooser::Kind kind);
|
||||||
@@ -62,4 +60,5 @@ private:
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Mercurial
|
} // namespace Mercurial
|
||||||
|
|
||||||
#endif // SRCDESTDIALOG_H
|
#endif // SRCDESTDIALOG_H
|
||||||
|
|||||||
Reference in New Issue
Block a user