2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2016-02-04 13:07:35 +01:00
|
|
|
#pragma once
|
2009-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
#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;
|
2016-02-04 13:07:35 +01:00
|
|
|
} // namespace Core
|
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
|
|
|
|
|
|
|
|
class CvsSubmitEditor;
|
|
|
|
|
class CvsControl;
|
2013-10-15 20:03:22 +02:00
|
|
|
class CvsClient;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2016-02-04 13:07:35 +01:00
|
|
|
class CvsResponse
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
2016-02-04 13:07:35 +01:00
|
|
|
public:
|
2009-07-15 12:28:40 +02:00
|
|
|
enum Result { Ok, NonNullExitCode, OtherError };
|
|
|
|
|
|
2016-02-04 13:07:35 +01:00
|
|
|
Result result = Ok;
|
2009-07-15 12:28:40 +02:00
|
|
|
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:
|
2016-02-04 13:07:35 +01:00
|
|
|
~CvsPlugin() override;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2015-03-26 12:22:29 +01:00
|
|
|
CvsClient *client() const;
|
|
|
|
|
|
2016-02-04 13:07:35 +01:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
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
|
|
|
|
|
|
|
|
// 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
|
|
|
|
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
|
|
|
|
2015-11-19 16:47:46 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void testDiffFileResolving_data();
|
|
|
|
|
void testDiffFileResolving();
|
|
|
|
|
void testLogResolving();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
protected:
|
2016-02-04 13:07:35 +01:00
|
|
|
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
|
|
|
|
bool submitEditorAboutToClose() override;
|
2015-11-19 16:47:46 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-07-15 12:28:40 +02:00
|
|
|
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();
|
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();
|
2009-07-15 12:28:40 +02:00
|
|
|
|
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,
|
2015-04-10 14:44:17 +02:00
|
|
|
int timeOutS,
|
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;
|
2015-06-16 15:24:42 +02:00
|
|
|
CvsClient *m_client = nullptr;
|
2013-10-15 20:03:22 +02:00
|
|
|
|
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
|
|
|
|
2015-06-18 12:50:16 +02:00
|
|
|
Core::CommandLocator *m_commandLocator = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_addAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_deleteAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_revertAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_editCurrentAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_uneditCurrentAction = nullptr;
|
|
|
|
|
QAction *m_uneditRepositoryAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_diffProjectAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_diffCurrentAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_logProjectAction = nullptr;
|
|
|
|
|
QAction *m_logRepositoryAction = nullptr;
|
|
|
|
|
QAction *m_commitAllAction = nullptr;
|
|
|
|
|
QAction *m_revertRepositoryAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_commitCurrentAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_filelogCurrentAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_annotateCurrentAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_statusProjectAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_updateProjectAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_commitProjectAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_updateDirectoryAction = nullptr;
|
|
|
|
|
Utils::ParameterAction *m_commitDirectoryAction = nullptr;
|
|
|
|
|
QAction *m_diffRepositoryAction = nullptr;
|
|
|
|
|
QAction *m_updateRepositoryAction = nullptr;
|
|
|
|
|
QAction *m_statusRepositoryAction = nullptr;
|
|
|
|
|
|
|
|
|
|
QAction *m_submitCurrentLogAction = nullptr;
|
|
|
|
|
QAction *m_submitDiffAction = nullptr;
|
|
|
|
|
QAction *m_submitUndoAction = nullptr;
|
|
|
|
|
QAction *m_submitRedoAction = nullptr;
|
|
|
|
|
QAction *m_menuAction = nullptr;
|
|
|
|
|
bool m_submitActionTriggered = false;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
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
|