2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-07-15 12:28:40 +02: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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2009-07-15 12:28:40 +02: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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company 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
|
|
|
****************************************************************************/
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
#ifndef CVSPLUGIN_H
|
|
|
|
|
#define CVSPLUGIN_H
|
|
|
|
|
|
|
|
|
|
#include "cvssettings.h"
|
|
|
|
|
#include "cvsutils.h"
|
|
|
|
|
|
2009-12-08 14:26:41 +01:00
|
|
|
#include <vcsbase/vcsbaseplugin.h>
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDir;
|
|
|
|
|
class QAction;
|
|
|
|
|
class QTextCodec;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
2014-01-13 16:17:34 +01:00
|
|
|
class CommandLocator;
|
2012-01-07 16:55:09 +01:00
|
|
|
class IVersionControl;
|
2009-10-05 11:06:05 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
namespace Utils { class ParameterAction; }
|
|
|
|
|
namespace VcsBase { class VcsBaseSubmitEditor; }
|
2009-12-08 14:26:41 +01:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
namespace Cvs {
|
2009-07-15 12:28:40 +02:00
|
|
|
namespace Internal {
|
2012-01-07 16:55:09 +01:00
|
|
|
|
2011-03-25 16:39:33 +01:00
|
|
|
struct CvsDiffParameters;
|
2012-01-07 16:55:09 +01:00
|
|
|
class CvsSubmitEditor;
|
|
|
|
|
class CvsControl;
|
2013-10-15 20:03:22 +02:00
|
|
|
class CvsClient;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
struct CvsResponse
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
|
|
|
|
enum Result { Ok, NonNullExitCode, OtherError };
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsResponse() : result(Ok) {}
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
Result result;
|
|
|
|
|
QString stdOut;
|
|
|
|
|
QString stdErr;
|
|
|
|
|
QString message;
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
class CvsPlugin : public VcsBase::VcsBasePlugin
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2012-02-21 16:52:28 +01:00
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
public:
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsPlugin();
|
|
|
|
|
~CvsPlugin();
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2013-01-17 21:51:27 +02:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsSubmitEditor *openCVSSubmitEditor(const QString &fileName);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsSettings settings() const;
|
|
|
|
|
void setSettings(const CvsSettings &s);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
// IVersionControl
|
2009-12-09 12:41:10 +01:00
|
|
|
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
|
|
|
|
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
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;
|
2010-08-06 16:12:24 +02:00
|
|
|
// cvs 'edit' is used to implement 'open' (cvsnt).
|
|
|
|
|
bool edit(const QString &topLevel, const QStringList &files);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
static CvsPlugin *instance();
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2010-03-19 17:22:18 +01:00
|
|
|
public slots:
|
2013-10-06 20:47:29 +03:00
|
|
|
void vcsAnnotate(const QString &workingDirectory, const QString &file,
|
|
|
|
|
const QString &revision, int lineNumber);
|
2010-03-19 17:22:18 +01:00
|
|
|
|
2009-07-15 12:28:40 +02:00
|
|
|
private slots:
|
|
|
|
|
void addCurrentFile();
|
|
|
|
|
void revertCurrentFile();
|
|
|
|
|
void diffProject();
|
|
|
|
|
void diffCurrentFile();
|
2010-01-11 17:17:16 +01:00
|
|
|
void revertAll();
|
2009-07-15 12:28:40 +02:00
|
|
|
void startCommitAll();
|
2014-10-22 09:11:36 +02:00
|
|
|
void startCommitDirectory();
|
2009-07-15 12:28:40 +02:00
|
|
|
void startCommitCurrentFile();
|
|
|
|
|
void filelogCurrentFile();
|
|
|
|
|
void annotateCurrentFile();
|
|
|
|
|
void projectStatus();
|
|
|
|
|
void slotDescribe(const QString &source, const QString &changeNr);
|
2014-10-22 09:11:36 +02:00
|
|
|
void updateDirectory();
|
2009-07-15 12:28:40 +02:00
|
|
|
void updateProject();
|
|
|
|
|
void submitCurrentLog();
|
2009-12-09 12:41:10 +01:00
|
|
|
void diffCommitFiles(const QStringList &);
|
2010-01-07 11:33:30 +01:00
|
|
|
void logProject();
|
|
|
|
|
void logRepository();
|
2010-08-06 16:12:24 +02:00
|
|
|
void commitProject();
|
|
|
|
|
void diffRepository();
|
|
|
|
|
void statusRepository();
|
|
|
|
|
void updateRepository();
|
|
|
|
|
void editCurrentFile();
|
|
|
|
|
void uneditCurrentFile();
|
|
|
|
|
void uneditCurrentRepository();
|
2013-01-21 22:56:01 +02:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void testDiffFileResolving_data();
|
|
|
|
|
void testDiffFileResolving();
|
2013-01-28 22:02:35 +02:00
|
|
|
void testLogResolving();
|
2013-01-21 22:56:01 +02:00
|
|
|
#endif
|
2009-07-15 12:28:40 +02: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
|
|
|
|
2009-07-15 12:28:40 +02:00
|
|
|
private:
|
2009-09-22 12:23:44 +02:00
|
|
|
bool isCommitEditorOpen() const;
|
2012-01-07 16:55:09 +01:00
|
|
|
Core::IEditor *showOutputInEditor(const QString& title, const QString &output,
|
|
|
|
|
int editorType, const QString &source,
|
|
|
|
|
QTextCodec *codec);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsResponse runCvs(const QString &workingDirectory,
|
2009-07-15 12:28:40 +02:00
|
|
|
const QStringList &arguments,
|
|
|
|
|
int timeOut,
|
2013-10-02 00:18:39 +03:00
|
|
|
unsigned flags,
|
|
|
|
|
QTextCodec *outputCodec = 0) const;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2010-01-06 17:24:40 +01:00
|
|
|
void annotate(const QString &workingDir, const QString &file,
|
|
|
|
|
const QString &revision = QString(), int lineNumber= -1);
|
2009-07-15 12:28:40 +02:00
|
|
|
bool describe(const QString &source, const QString &changeNr, QString *errorMessage);
|
2009-12-09 12:41:10 +01:00
|
|
|
bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
|
2012-01-07 16:55:09 +01:00
|
|
|
bool describe(const QString &repository, QList<CvsLogEntry> entries, QString *errorMessage);
|
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);
|
2010-08-06 16:12:24 +02:00
|
|
|
bool unedit(const QString &topLevel, const QStringList &files);
|
2013-08-06 15:14:54 +03:00
|
|
|
bool status(const QString &topLevel, const QString &file, const QString &title);
|
|
|
|
|
bool update(const QString &topLevel, const QString &file);
|
2010-05-20 16:24:39 +02:00
|
|
|
bool checkCVSDirectory(const QDir &directory) const;
|
2010-08-06 16:12:24 +02:00
|
|
|
// Quick check if files are modified
|
|
|
|
|
bool diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified);
|
2009-07-15 12:28:40 +02:00
|
|
|
QString findTopLevelForDirectoryI(const QString &directory) const;
|
2013-08-06 15:14:54 +03:00
|
|
|
void startCommit(const QString &workingDir, const QString &file = QString());
|
2009-07-15 12:28:40 +02:00
|
|
|
bool commit(const QString &messageFile, const QStringList &subVersionFileList);
|
2009-09-22 12:23:44 +02:00
|
|
|
void cleanCommitMessageFile();
|
2012-01-07 16:55:09 +01:00
|
|
|
inline CvsControl *cvsVersionControl() const;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsSettings m_settings;
|
2013-10-15 20:03:22 +02:00
|
|
|
CvsClient *m_client;
|
|
|
|
|
|
2009-09-22 12:23:44 +02:00
|
|
|
QString m_commitMessageFileName;
|
2009-12-09 12:41:10 +01:00
|
|
|
QString m_commitRepository;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
Core::CommandLocator *m_commandLocator;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::ParameterAction *m_addAction;
|
|
|
|
|
Utils::ParameterAction *m_deleteAction;
|
|
|
|
|
Utils::ParameterAction *m_revertAction;
|
2010-08-06 16:12:24 +02:00
|
|
|
Utils::ParameterAction *m_editCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_uneditCurrentAction;
|
|
|
|
|
QAction *m_uneditRepositoryAction;
|
2009-12-09 12:41:10 +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;
|
2009-07-15 12:28:40 +02:00
|
|
|
QAction *m_commitAllAction;
|
2010-01-11 17:17:16 +01:00
|
|
|
QAction *m_revertRepositoryAction;
|
2009-10-05 11:06:05 +02:00
|
|
|
Utils::ParameterAction *m_commitCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_filelogCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_annotateCurrentAction;
|
2009-12-09 12:41:10 +01:00
|
|
|
Utils::ParameterAction *m_statusProjectAction;
|
|
|
|
|
Utils::ParameterAction *m_updateProjectAction;
|
2010-08-06 16:12:24 +02:00
|
|
|
Utils::ParameterAction *m_commitProjectAction;
|
2014-10-22 09:11:36 +02:00
|
|
|
Utils::ParameterAction *m_updateDirectoryAction;
|
|
|
|
|
Utils::ParameterAction *m_commitDirectoryAction;
|
2010-08-06 16:12:24 +02:00
|
|
|
QAction *m_diffRepositoryAction;
|
|
|
|
|
QAction *m_updateRepositoryAction;
|
|
|
|
|
QAction *m_statusRepositoryAction;
|
2009-07-15 12:28:40 +02: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-07-15 12:28:40 +02:00
|
|
|
bool m_submitActionTriggered;
|
|
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
static CvsPlugin *m_cvsPluginInstance;
|
2009-07-15 12:28:40 +02:00
|
|
|
};
|
|
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
} // namespace Cvs
|
2009-07-15 12:28:40 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
#endif // CVSPLUGIN_H
|