2009-07-15 12:28:40 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
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 {
|
2012-01-07 16:55:09 +01:00
|
|
|
class IEditorFactory;
|
|
|
|
|
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; }
|
|
|
|
|
namespace Locator { class CommandLocator; }
|
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;
|
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
|
|
|
|
|
|
|
|
|
|
public:
|
2012-01-07 16:55:09 +01:00
|
|
|
CvsPlugin();
|
|
|
|
|
~CvsPlugin();
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2011-09-21 13:05:15 +02:00
|
|
|
virtual bool initialize(const QStringList &arguments, QString *errorMessage);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2009-12-09 12:41:10 +01:00
|
|
|
void cvsDiff(const QString &workingDir, const QStringList &files);
|
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;
|
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:
|
|
|
|
|
void vcsAnnotate(const QString &file, const QString &revision /* = QString() */, int lineNumber);
|
|
|
|
|
|
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();
|
|
|
|
|
void startCommitCurrentFile();
|
|
|
|
|
void filelogCurrentFile();
|
|
|
|
|
void annotateCurrentFile();
|
|
|
|
|
void projectStatus();
|
|
|
|
|
void slotDescribe(const QString &source, const QString &changeNr);
|
|
|
|
|
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();
|
2012-01-07 16:55:09 +01:00
|
|
|
void cvsDiff(const Cvs::Internal::CvsDiffParameters &p);
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2009-12-08 14:26:41 +01:00
|
|
|
protected:
|
2012-01-07 12:31:48 +01:00
|
|
|
virtual void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
|
|
|
|
virtual bool submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor);
|
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,
|
2010-05-21 17:46:00 +02:00
|
|
|
unsigned flags, QTextCodec *outputCodec = 0);
|
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,
|
|
|
|
|
const QStringList &files = QStringList(),
|
|
|
|
|
bool enableAnnotationContextMenu = false);
|
2010-08-06 16:12:24 +02:00
|
|
|
bool unedit(const QString &topLevel, const QStringList &files);
|
|
|
|
|
bool status(const QString &topLevel, const QStringList &files, const QString &title);
|
|
|
|
|
bool update(const QString &topLevel, const QStringList &files);
|
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;
|
2009-12-09 12:41:10 +01:00
|
|
|
void startCommit(const QString &workingDir, const QStringList &files = QStringList());
|
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;
|
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
|
|
|
|
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;
|
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;
|
|
|
|
|
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
|