Newer
Older
/****************************************************************************
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include <QStringList>
#include <QPointer>
#include <QPair>
#include <QVector>
class QFileInfo;
class IEditorFactory;
class Command;
class Context;
class ActionManager;
class ActionContainer;
namespace Utils { class ParameterAction; }
namespace Internal { class GerritPlugin; }
class GitVersionControl;
class GitClient;
class GitSubmitEditor;
class BranchDialog;
typedef void (GitClient::*GitClientMemberFunc)(const QString &);
typedef QPair<QAction *, Core::Command* > ActionCommandPair;
typedef QPair<Utils::ParameterAction *, Core::Command* > ParameterActionCommandPair;
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
GitPlugin();
~GitPlugin();
bool initialize(const QStringList &arguments, QString *errorMessage);
GitVersionControl *gitVersionControl() const;
void setSettings(const GitSettings &s);
GitClient *gitClient() const;
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
void updateBranches(const QString &repository);
void diffCurrentFile();
void diffCurrentProject();
void diffRepository();
void submitEditorDiff(const QStringList &unstaged, const QStringList &staged);
void submitEditorMerge(const QStringList &unmerged);
void submitCurrentLog();
void logFile();
void blameFile();
void logProject();
void logRepository();
void undoFileChanges(bool revertStaging = true);
void undoUnstagedFileChanges();
void resetRepository();
void stageFile();
void unstageFile();
void gitkForCurrentFile();
void gitkForCurrentFolder();
void cleanRepository();
void applyCurrentFilePatch();
void promptApplyPatch();
void gitClientMemberFuncRepositoryAction();
void branchList();
void stashList();
void pull();
void push();
void updateContinueAndAbortCommands();
#ifdef WITH_TESTS
void testStatusParsing_data();
void testStatusParsing();
void testDiffFileResolving_data();
void testDiffFileResolving();
void updateActions(VcsBase::VcsBasePlugin::ActionState);
inline ParameterActionCommandPair
createParameterAction(Core::ActionContainer *ac,
const QString &defaultText, const QString ¶meterText,
const Core::Id &id, const Core::Context &context, bool addToLocator);
inline ParameterActionCommandPair
const QString &defaultText, const QString ¶meterText,
const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot);
inline ParameterActionCommandPair
const QString &defaultText, const QString ¶meterText,
const Core::Id &id, const Core::Context &context, bool addToLocator);
inline ParameterActionCommandPair
const QString &defaultText, const QString ¶meterText,
const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot);
inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const Core::Context &context, bool addToLocator);
inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const Core::Context &context,
bool addToLocator, const char *pluginSlot);
inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const Core::Context &context,
bool addToLocator, GitClientMemberFunc);
void updateRepositoryBrowserAction();
bool isCommitEditorOpen() const;
Core::IEditor *openSubmitEditor(const QString &fileName, const CommitData &cd);
void cleanCommitMessageFile();
void cleanRepository(const QString &directory);
void applyPatch(const QString &workingDirectory, QString file = QString());
void startCommit(CommitType commitType);
static GitPlugin *m_instance;
Core::CommandLocator *m_commandLocator;
QAction *m_submitCurrentAction;
QAction *m_diffSelectedFilesAction;
QAction *m_undoAction;
QAction *m_redoAction;
QAction *m_menuAction;
QAction *m_repositoryBrowserAction;
QAction *m_abortMergeAction;
QAction *m_abortRebaseAction;
QAction *m_abortCherryPickAction;
QAction *m_abortRevertAction;
QAction *m_continueRebaseAction;
QAction *m_continueCherryPickAction;
QAction *m_continueRevertAction;
QAction *m_fixupCommitAction;
QAction *m_interactiveRebaseAction;
QVector<Utils::ParameterAction *> m_fileActions;
QVector<Utils::ParameterAction *> m_projectActions;
QVector<QAction *> m_repositoryActions;
Utils::ParameterAction *m_applyCurrentFilePatchAction;
Gerrit::Internal::GerritPlugin *m_gerritPlugin;
QPointer<StashDialog> m_stashDialog;
QPointer<BranchDialog> m_branchDialog;
QPointer<RemoteDialog> m_remoteDialog;
QString m_commitMessageFileName;
bool m_submitActionTriggered;