2011-06-05 17:58:02 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2012 AudioCodes Ltd.
|
|
|
|
|
** Author: Orgad Shaneh <orgad.shaneh@audiocodes.com>
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-06-05 17:58:02 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-05 17:58:02 +03: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.
|
2011-06-05 17:58:02 +03: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
|
2011-06-05 17:58:02 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
#ifndef CLEARCASEPLUGIN_H
|
|
|
|
|
#define CLEARCASEPLUGIN_H
|
|
|
|
|
|
|
|
|
|
#include "clearcasesettings.h"
|
|
|
|
|
|
|
|
|
|
#include <vcsbase/vcsbaseplugin.h>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QPair>
|
|
|
|
|
#include <QStringList>
|
2012-09-02 10:20:32 +03:00
|
|
|
#include <QMetaType>
|
|
|
|
|
#include <QSharedPointer>
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QAction;
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QDir;
|
|
|
|
|
template <typename T>
|
|
|
|
|
class QFutureInterface;
|
|
|
|
|
class QMutex;
|
|
|
|
|
typedef QPair<QString, QString> QStringPair;
|
|
|
|
|
class QTextCodec;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
2012-08-21 12:51:56 +02:00
|
|
|
class IVersionControl;
|
|
|
|
|
class IEditor;
|
|
|
|
|
} // namespace Core
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2012-08-21 12:51:56 +02:00
|
|
|
namespace Utils { class ParameterAction; }
|
|
|
|
|
namespace VcsBase { class VcsBaseSubmitEditor; }
|
|
|
|
|
namespace Locator { class CommandLocator; }
|
|
|
|
|
namespace ProjectExplorer { class Project; }
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
namespace ClearCase {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class ClearCaseSubmitEditor;
|
|
|
|
|
class ClearCaseControl;
|
|
|
|
|
|
|
|
|
|
class ClearCaseResponse
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ClearCaseResponse() : error(false) {}
|
|
|
|
|
bool error;
|
|
|
|
|
QString stdOut;
|
|
|
|
|
QString stdErr;
|
|
|
|
|
QString message;
|
|
|
|
|
};
|
|
|
|
|
|
2012-08-21 12:51:56 +02:00
|
|
|
class FileStatus
|
2011-06-05 17:58:02 +03:00
|
|
|
{
|
2012-08-21 12:51:56 +02:00
|
|
|
public:
|
2011-06-05 17:58:02 +03:00
|
|
|
enum Status
|
|
|
|
|
{
|
|
|
|
|
Unknown = 0x0f,
|
|
|
|
|
CheckedIn = 0x01,
|
|
|
|
|
CheckedOut = 0x02,
|
|
|
|
|
Hijacked = 0x04,
|
|
|
|
|
NotManaged = 0x08,
|
|
|
|
|
Missing = 0x10
|
|
|
|
|
} status;
|
|
|
|
|
|
|
|
|
|
QFile::Permissions permissions;
|
|
|
|
|
|
|
|
|
|
FileStatus(Status _status = Unknown, QFile::Permissions perm = 0)
|
|
|
|
|
: status(_status), permissions(perm)
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef QHash<QString, FileStatus> StatusMap;
|
|
|
|
|
|
|
|
|
|
class ClearCasePlugin : public VcsBase::VcsBasePlugin
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClearCase.json")
|
|
|
|
|
|
|
|
|
|
static const unsigned SilentRun =
|
|
|
|
|
SuppressStdErrInLogWindow |
|
|
|
|
|
SuppressFailMessageInLogWindow |
|
|
|
|
|
SuppressCommandLogging |
|
|
|
|
|
FullySynchronously;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ClearCasePlugin();
|
|
|
|
|
~ClearCasePlugin();
|
|
|
|
|
|
|
|
|
|
bool initialize(const QStringList &arguments, QString *error_message);
|
|
|
|
|
|
2012-09-24 11:39:34 +02:00
|
|
|
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
const ClearCaseSettings &settings() const;
|
|
|
|
|
void setSettings(const ClearCaseSettings &s);
|
|
|
|
|
|
|
|
|
|
// IVersionControl
|
|
|
|
|
bool vcsOpen(const QString &workingDir, const QString &fileName);
|
|
|
|
|
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
|
|
|
|
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
|
|
|
|
bool vcsCheckIn(const QString &workingDir, const QStringList &files, const QString &activity,
|
|
|
|
|
bool isIdentical, bool isPreserve, bool replaceActivity);
|
|
|
|
|
bool vcsUndoCheckOut(const QString &workingDir, const QString &fileName, bool keep);
|
|
|
|
|
bool vcsUndoHijack(const QString &workingDir, const QString &fileName, bool keep);
|
|
|
|
|
bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
|
|
|
|
|
bool vcsSetActivity(const QString &workingDir, const QString &title, const QString &activity);
|
|
|
|
|
bool managesDirectory(const QString &directory, QString *topLevel = 0) const;
|
|
|
|
|
bool vcsCheckout(const QString &directory, const QByteArray &url);
|
|
|
|
|
QString vcsGetRepositoryURL(const QString &directory);
|
|
|
|
|
|
|
|
|
|
static ClearCasePlugin *instance();
|
|
|
|
|
|
|
|
|
|
QString ccGetCurrentActivity() const;
|
|
|
|
|
QList<QStringPair> activities(int *current = 0) const;
|
|
|
|
|
QString ccGetPredecessor(const QString &version) const;
|
|
|
|
|
QStringList ccGetActiveVobs() const;
|
|
|
|
|
bool ccFileOp(const QString &workingDir, const QString &title, const QStringList &args,
|
|
|
|
|
const QString &fileName, const QString &file2 = QString());
|
|
|
|
|
FileStatus vcsStatus(const QString &file) const;
|
|
|
|
|
QString currentView() const { return m_view; }
|
2012-09-02 10:20:32 +03:00
|
|
|
void refreshActivities();
|
2012-09-24 11:39:34 +02:00
|
|
|
inline bool isUcm() const { return m_isUcm; }
|
|
|
|
|
|
|
|
|
|
bool ccCheckUcm(const QString &viewname, const QString &workingDir) const;
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void vcsAnnotate(const QString &workingDir, const QString &file,
|
|
|
|
|
const QString &revision = QString(), int lineNumber = -1) const;
|
|
|
|
|
bool newActivity();
|
2012-09-02 10:20:32 +03:00
|
|
|
void updateStreamAndView();
|
|
|
|
|
void setStatus(const QString &file, ClearCase::Internal::FileStatus::Status status, bool update = true);
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void checkOutCurrentFile();
|
|
|
|
|
void addCurrentFile();
|
|
|
|
|
void undoCheckOutCurrent();
|
|
|
|
|
void undoHijackCurrent();
|
|
|
|
|
void diffActivity();
|
|
|
|
|
void diffCurrentFile();
|
|
|
|
|
void startCheckInAll();
|
|
|
|
|
void startCheckInActivity();
|
|
|
|
|
void startCheckInCurrentFile();
|
|
|
|
|
void historyCurrentFile();
|
|
|
|
|
void annotateCurrentFile();
|
|
|
|
|
void annotateVersion(const QString &file, const QString &revision, int lineNumber);
|
|
|
|
|
void describe(const QString &source, const QString &changeNr);
|
|
|
|
|
void viewStatus();
|
|
|
|
|
void checkInSelected();
|
|
|
|
|
void diffCheckInFiles(const QStringList &);
|
|
|
|
|
void updateIndex();
|
|
|
|
|
void updateView();
|
|
|
|
|
void projectChanged(ProjectExplorer::Project *project);
|
|
|
|
|
void tasksFinished(const QString &type);
|
|
|
|
|
void syncSlot();
|
|
|
|
|
void closing();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
|
|
|
|
bool submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor);
|
|
|
|
|
QString ccGet(const QString &workingDir, const QString &file, const QString &prefix = QString());
|
|
|
|
|
QList<QStringPair> ccGetActivities() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
inline bool isCheckInEditorOpen() const;
|
|
|
|
|
QString findTopLevel(const QString &directory) const;
|
2012-08-21 12:51:56 +02:00
|
|
|
Core::IEditor *showOutputInEditor(const QString& title, const QString &output,
|
|
|
|
|
int editorType, const QString &source,
|
|
|
|
|
QTextCodec *codec) const;
|
2011-06-05 17:58:02 +03:00
|
|
|
QString runCleartoolSync(const QString &workingDir, const QStringList &arguments) const;
|
|
|
|
|
ClearCaseResponse runCleartool(const QString &workingDir,
|
|
|
|
|
const QStringList &arguments, int timeOut,
|
|
|
|
|
unsigned flags, QTextCodec *outputCodec = 0) const;
|
|
|
|
|
static void sync(QFutureInterface<void> &future, QString topLevel, QStringList files);
|
|
|
|
|
|
|
|
|
|
void history(const QString &workingDir,
|
|
|
|
|
const QStringList &file = QStringList(),
|
|
|
|
|
bool enableAnnotationContextMenu = false);
|
|
|
|
|
QString ccGetFileVersion(const QString &workingDir, const QString &file) const;
|
|
|
|
|
void ccUpdate(const QString &workingDir, const QStringList &relativePaths = QStringList());
|
2012-09-12 09:27:06 +03:00
|
|
|
void ccDiffWithPred(const QString &workingDir, const QStringList &files);
|
2011-06-05 17:58:02 +03:00
|
|
|
void startCheckIn(const QString &workingDir, const QStringList &files = QStringList());
|
|
|
|
|
void cleanCheckInMessageFile();
|
|
|
|
|
inline ClearCaseControl *clearCaseControl() const;
|
|
|
|
|
QString ccGetFileActivity(const QString &workingDir, const QString &file);
|
|
|
|
|
QStringList ccGetActivityVersions(const QString &workingDir, const QString &activity);
|
|
|
|
|
void updateStatusActions();
|
|
|
|
|
void diffGraphical(const QString &file1, const QString &file2 = QString());
|
|
|
|
|
QString diffExternal(QString file1, QString file2 = QString(), bool keep = false);
|
|
|
|
|
QString getFile(const QString &nativeFile, const QString &prefix);
|
|
|
|
|
static void rmdir(const QString &path);
|
|
|
|
|
QString runExtDiff(const QString &workingDir, const QStringList &arguments,
|
|
|
|
|
int timeOut, QTextCodec *outputCodec = 0);
|
2012-09-24 11:39:34 +02:00
|
|
|
QString ccGetView(const QString &workingDir, bool *isDynamic = 0, bool *isUcm = 0) const;
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
ClearCaseSettings m_settings;
|
|
|
|
|
|
|
|
|
|
QString m_checkInMessageFileName;
|
2012-09-12 09:27:06 +03:00
|
|
|
QString m_checkInView;
|
2011-06-05 17:58:02 +03:00
|
|
|
QString m_topLevel;
|
|
|
|
|
QString m_stream;
|
|
|
|
|
QString m_view;
|
2012-09-17 22:53:51 +02:00
|
|
|
bool m_isDynamic;
|
2012-09-24 11:39:34 +02:00
|
|
|
bool m_isUcm;
|
2011-06-05 17:58:02 +03:00
|
|
|
QString m_intStream;
|
|
|
|
|
QString m_activity;
|
|
|
|
|
QString m_diffPrefix;
|
|
|
|
|
|
|
|
|
|
Locator::CommandLocator *m_commandLocator;
|
|
|
|
|
Utils::ParameterAction *m_checkOutAction;
|
|
|
|
|
Utils::ParameterAction *m_checkInCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_undoCheckOutAction;
|
|
|
|
|
Utils::ParameterAction *m_undoHijackAction;
|
|
|
|
|
Utils::ParameterAction *m_diffCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_historyCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_annotateCurrentAction;
|
|
|
|
|
Utils::ParameterAction *m_addFileAction;
|
|
|
|
|
QAction *m_diffActivityAction;
|
|
|
|
|
QAction *m_updateIndexAction;
|
|
|
|
|
Utils::ParameterAction *m_updateViewAction;
|
|
|
|
|
Utils::ParameterAction *m_checkInActivityAction;
|
|
|
|
|
QAction *m_checkInAllAction;
|
|
|
|
|
QAction *m_statusAction;
|
|
|
|
|
|
|
|
|
|
QAction *m_checkInSelectedAction;
|
|
|
|
|
QAction *m_checkInDiffAction;
|
|
|
|
|
QAction *m_submitUndoAction;
|
|
|
|
|
QAction *m_submitRedoAction;
|
|
|
|
|
QAction *m_menuAction;
|
2012-08-21 12:51:56 +02:00
|
|
|
bool m_submitActionTriggered;
|
2012-09-02 10:18:56 +03:00
|
|
|
QMutex *m_activityMutex;
|
2011-06-05 17:58:02 +03:00
|
|
|
QList<QStringPair> m_activities;
|
2012-09-02 10:20:32 +03:00
|
|
|
QSharedPointer<StatusMap> m_statusMap;
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
static ClearCasePlugin *m_clearcasePluginInstance;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
2012-08-21 12:51:56 +02:00
|
|
|
} // namespace ClearCase
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2012-09-02 10:20:32 +03:00
|
|
|
Q_DECLARE_METATYPE(ClearCase::Internal::FileStatus::Status)
|
|
|
|
|
|
2011-06-05 17:58:02 +03:00
|
|
|
#endif // CLEARCASEPLUGIN_H
|