2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef SUBVERSIONPLUGIN_H
|
|
|
|
|
#define SUBVERSIONPLUGIN_H
|
|
|
|
|
|
|
|
|
|
#include "subversionsettings.h"
|
|
|
|
|
|
2009-12-08 14:26:41 +01:00
|
|
|
#include <vcsbase/vcsbaseplugin.h>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStringList>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDir;
|
|
|
|
|
class QAction;
|
|
|
|
|
class QTextCodec;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IVersionControl;
|
2009-12-08 14:26:41 +01:00
|
|
|
class IEditor;
|
2009-10-05 11:06:05 +02:00
|
|
|
}
|
|
|
|
|
namespace Utils {
|
|
|
|
|
class ParameterAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
namespace VcsBase {
|
|
|
|
|
class VcsBaseSubmitEditor;
|
2009-12-08 14:26:41 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-12 16:03:08 +01:00
|
|
|
namespace Locator {
|
|
|
|
|
class CommandLocator;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Subversion {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class SubversionSubmitEditor;
|
2009-11-11 14:32:54 +01:00
|
|
|
class SubversionControl;
|
2011-03-25 16:39:33 +01:00
|
|
|
struct SubversionDiffParameters;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
struct SubversionResponse
|
|
|
|
|
{
|
|
|
|
|
SubversionResponse() : error(false) {}
|
|
|
|
|
bool error;
|
|
|
|
|
QString stdOut;
|
|
|
|
|
QString stdErr;
|
|
|
|
|
QString message;
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
class SubversionPlugin : public VcsBase::VcsBasePlugin
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2012-02-21 16:52:28 +01:00
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Subversion.json")
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SubversionPlugin();
|
|
|
|
|
~SubversionPlugin();
|
|
|
|
|
|
2011-09-21 13:05:15 +02:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-12-08 16:50:27 +01:00
|
|
|
void svnDiff(const QString &workingDir, const QStringList &files, QString diffname = QString());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
SubversionSubmitEditor *openSubversionSubmitEditor(const QString &fileName);
|
|
|
|
|
|
|
|
|
|
SubversionSettings settings() const;
|
|
|
|
|
void setSettings(const SubversionSettings &s);
|
|
|
|
|
|
|
|
|
|
// IVersionControl
|
2009-12-08 16:50:27 +01:00
|
|
|
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
|
|
|
|
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
2010-05-11 14:13:38 +02:00
|
|
|
bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
|
2010-05-20 16:24:39 +02:00
|
|
|
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
2013-10-02 00:18:39 +03:00
|
|
|
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
2013-01-17 21:51:27 +02:00
|
|
|
bool vcsCheckout(const QString &directory, const QByteArray &url);
|
|
|
|
|
QString vcsGetRepositoryURL(const QString &directory);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-04-20 15:49:06 +02:00
|
|
|
static SubversionPlugin *instance();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-08 10:04:23 +02:00
|
|
|
// Add authorization options to the command line arguments.
|
|
|
|
|
static QStringList addAuthenticationOptions(const QStringList &args,
|
|
|
|
|
const QString &userName = QString(),
|
|
|
|
|
const QString &password = QString());
|
|
|
|
|
|
2013-05-31 18:47:22 +02:00
|
|
|
class Version {
|
|
|
|
|
public:
|
|
|
|
|
int majorVersion;
|
|
|
|
|
int minorVersion;
|
|
|
|
|
int patchVersion;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Version svnVersion();
|
|
|
|
|
|
2010-03-19 17:22:18 +01:00
|
|
|
public slots:
|
|
|
|
|
void vcsAnnotate(const QString &workingDir, const QString &file,
|
|
|
|
|
const QString &revision = QString(), int lineNumber = -1);
|
2011-03-25 16:39:33 +01:00
|
|
|
void svnDiff(const Subversion::Internal::SubversionDiffParameters &p);
|
2010-03-19 17:22:18 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private slots:
|
|
|
|
|
void addCurrentFile();
|
|
|
|
|
void revertCurrentFile();
|
|
|
|
|
void diffProject();
|
|
|
|
|
void diffCurrentFile();
|
|
|
|
|
void startCommitAll();
|
2010-04-27 12:16:51 +02:00
|
|
|
void startCommitProject();
|
2008-12-02 12:01:29 +01:00
|
|
|
void startCommitCurrentFile();
|
2010-01-11 17:17:16 +01:00
|
|
|
void revertAll();
|
2008-12-02 12:01:29 +01:00
|
|
|
void filelogCurrentFile();
|
|
|
|
|
void annotateCurrentFile();
|
2013-10-06 20:47:29 +03:00
|
|
|
void annotateVersion(const QString &workingDirectory, const QString &file, const QString &revision, int lineNumber);
|
2008-12-02 12:01:29 +01:00
|
|
|
void projectStatus();
|
|
|
|
|
void describe(const QString &source, const QString &changeNr);
|
2009-02-09 17:33:31 +01:00
|
|
|
void slotDescribe();
|
2008-12-02 12:01:29 +01:00
|
|
|
void updateProject();
|
|
|
|
|
void submitCurrentLog();
|
2009-12-08 16:50:27 +01:00
|
|
|
void diffCommitFiles(const QStringList &);
|
2010-01-07 11:33:30 +01:00
|
|
|
void logProject();
|
|
|
|
|
void logRepository();
|
2010-04-27 12:16:51 +02:00
|
|
|
void diffRepository();
|
|
|
|
|
void statusRepository();
|
|
|
|
|
void updateRepository();
|
2013-01-19 23:19:38 +02:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void testDiffFileResolving_data();
|
|
|
|
|
void testDiffFileResolving();
|
2013-01-28 22:02:35 +02:00
|
|
|
void testLogResolving();
|
2013-01-19 23:19:38 +02:00
|
|
|
#endif
|
2010-01-06 17:24:40 +01:00
|
|
|
|
2009-12-08 14:26:41 +01:00
|
|
|
protected:
|
2013-01-17 21:51:27 +02:00
|
|
|
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
2013-04-18 12:06:43 +02:00
|
|
|
bool submitEditorAboutToClose();
|
2009-12-08 14:26:41 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
2009-09-22 12:23:44 +02:00
|
|
|
inline bool isCommitEditorOpen() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
Core::IEditor * showOutputInEditor(const QString& title, const QString &output,
|
|
|
|
|
int editorType, const QString &source,
|
|
|
|
|
QTextCodec *codec);
|
2010-06-08 10:04:23 +02:00
|
|
|
// Run using the settings' authentication options.
|
2009-12-08 16:50:27 +01:00
|
|
|
SubversionResponse runSvn(const QString &workingDir,
|
|
|
|
|
const QStringList &arguments, int timeOut,
|
2013-10-02 00:18:39 +03:00
|
|
|
unsigned flags, QTextCodec *outputCodec = 0) const;
|
2010-06-08 10:04:23 +02:00
|
|
|
// Run using custom authentication options.
|
|
|
|
|
SubversionResponse runSvn(const QString &workingDir,
|
|
|
|
|
const QString &userName, const QString &password,
|
|
|
|
|
const QStringList &arguments, int timeOut,
|
2013-10-02 00:18:39 +03:00
|
|
|
unsigned flags, QTextCodec *outputCodec = 0) const;
|
2010-06-08 10:04:23 +02:00
|
|
|
|
2010-01-07 11:33:30 +01:00
|
|
|
void filelog(const QString &workingDir,
|
2013-08-06 15:14:54 +03:00
|
|
|
const QString &file = QString(),
|
2010-01-07 11:33:30 +01:00
|
|
|
bool enableAnnotationContextMenu = false);
|
2013-08-06 15:14:54 +03:00
|
|
|
void svnStatus(const QString &workingDir, const QString &relativePath = QString());
|
|
|
|
|
void svnUpdate(const QString &workingDir, const QString &relativePath = QString());
|
2011-10-19 14:06:40 +00:00
|
|
|
bool checkSVNSubDir(const QDir &directory, const QString &fileName = QString()) const;
|
2009-12-08 16:50:27 +01:00
|
|
|
void startCommit(const QString &workingDir, const QStringList &files = QStringList());
|
2008-12-02 12:01:29 +01:00
|
|
|
bool commit(const QString &messageFile, const QStringList &subVersionFileList);
|
2009-09-22 12:23:44 +02:00
|
|
|
void cleanCommitMessageFile();
|
2009-12-08 14:26:41 +01:00
|
|
|
inline SubversionControl *subVersionControl() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-05-26 12:25:32 +02:00
|
|
|
const QStringList m_svnDirectories;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
SubversionSettings m_settings;
|
2009-09-22 12:23:44 +02:00
|
|
|
QString m_commitMessageFileName;
|
2009-12-08 16:50:27 +01:00
|
|
|
QString m_commitRepository;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-12 16:03:08 +01:00
|
|
|
Locator::CommandLocator *m_commandLocator;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::ParameterAction *m_addAction;
|
|
|
|
|
Utils::ParameterAction *m_deleteAction;
|
|
|
|
|
Utils::ParameterAction *m_revertAction;
|
2009-12-08 16:50:27 +01:00
|
|
|
Utils::ParameterAction *m_diffProjectAction;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::ParameterAction *m_diffCurrentAction;
|
2010-01-07 11:33:30 +01:00
|
|
|
Utils::ParameterAction *m_logProjectAction;
|
|
|
|
|
QAction *m_logRepositoryAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
QAction *m_commitAllAction;
|
2010-01-11 17:17:16 +01:00
|
|
|
QAction *m_revertRepositoryAction;
|
2010-04-27 12:16:51 +02:00
|
|
|
QAction *m_diffRepositoryAction;
|
|
|
|
|
QAction *m_statusRepositoryAction;
|
|
|
|
|
QAction *m_updateRepositoryAction;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::ParameterAction *m_commitCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_filelogCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_annotateCurrentAction;
|
2009-12-08 16:50:27 +01:00
|
|
|
Utils::ParameterAction *m_statusProjectAction;
|
|
|
|
|
Utils::ParameterAction *m_updateProjectAction;
|
2010-04-27 12:16:51 +02:00
|
|
|
Utils::ParameterAction *m_commitProjectAction;
|
2009-02-09 17:33:31 +01:00
|
|
|
QAction *m_describeAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QAction *m_submitCurrentLogAction;
|
|
|
|
|
QAction *m_submitDiffAction;
|
|
|
|
|
QAction *m_submitUndoAction;
|
|
|
|
|
QAction *m_submitRedoAction;
|
2009-12-08 14:26:41 +01:00
|
|
|
QAction *m_menuAction;
|
2009-03-20 10:16:18 +01:00
|
|
|
bool m_submitActionTriggered;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-05-31 18:47:22 +02:00
|
|
|
QString m_svnVersionBinary;
|
|
|
|
|
QString m_svnVersion;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
static SubversionPlugin *m_subversionPluginInstance;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Subversion
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
#endif // SUBVERSIONPLUGIN_H
|