forked from qt-creator/qt-creator
Add support for base ClearCase.
Current implementation only works for UCM views, which is a bug. UCM is layered on top of base ClearCase. UCM has concepts such as projects, streams and activities. When a view is base ClearCase disable all prompting for activity, UCM menu entries and dialogs. Change-Id: I81fb1a014373ece97d3f681623d314344a59b75a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
8676b58fb4
commit
d1ef970a19
@@ -49,6 +49,8 @@ ActivitySelector::ActivitySelector(QWidget *parent) :
|
|||||||
m_plugin(ClearCasePlugin::instance()),
|
m_plugin(ClearCasePlugin::instance()),
|
||||||
m_changed(false)
|
m_changed(false)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_plugin->isUcm(), return);
|
||||||
|
|
||||||
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
|
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
|
||||||
hboxLayout->setContentsMargins(0, 0, 0, 0);
|
hboxLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "checkoutdialog.h"
|
#include "checkoutdialog.h"
|
||||||
#include "clearcaseplugin.h"
|
|
||||||
#include "ui_checkoutdialog.h"
|
#include "ui_checkoutdialog.h"
|
||||||
|
#include "activityselector.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
@@ -41,11 +41,23 @@
|
|||||||
namespace ClearCase {
|
namespace ClearCase {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CheckOutDialog::CheckOutDialog(const QString &fileName, QWidget *parent) :
|
CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, QWidget *parent) :
|
||||||
QDialog(parent), ui(new Ui::CheckOutDialog)
|
QDialog(parent), ui(new Ui::CheckOutDialog), m_actSelector(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->lblFileName->setText(fileName);
|
ui->lblFileName->setText(fileName);
|
||||||
|
|
||||||
|
if (isUcm) {
|
||||||
|
m_actSelector = new ActivitySelector(this);
|
||||||
|
|
||||||
|
ui->verticalLayout->insertWidget(0, m_actSelector);
|
||||||
|
|
||||||
|
QFrame *line = new QFrame(this);
|
||||||
|
line->setFrameShape(QFrame::HLine);
|
||||||
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
|
ui->verticalLayout->insertWidget(1, line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckOutDialog::~CheckOutDialog()
|
CheckOutDialog::~CheckOutDialog()
|
||||||
@@ -55,7 +67,7 @@ CheckOutDialog::~CheckOutDialog()
|
|||||||
|
|
||||||
QString CheckOutDialog::activity() const
|
QString CheckOutDialog::activity() const
|
||||||
{
|
{
|
||||||
return ui->actSelector->activity();
|
return m_actSelector ? m_actSelector->activity() : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CheckOutDialog::comment() const
|
QString CheckOutDialog::comment() const
|
||||||
|
|||||||
@@ -42,12 +42,14 @@ namespace Ui {
|
|||||||
class CheckOutDialog;
|
class CheckOutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ActivitySelector;
|
||||||
|
|
||||||
class CheckOutDialog : public QDialog
|
class CheckOutDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CheckOutDialog(const QString &fileName, QWidget *parent = 0);
|
explicit CheckOutDialog(const QString &fileName, bool isUcm, QWidget *parent = 0);
|
||||||
~CheckOutDialog();
|
~CheckOutDialog();
|
||||||
QString activity() const;
|
QString activity() const;
|
||||||
QString comment() const;
|
QString comment() const;
|
||||||
@@ -62,6 +64,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CheckOutDialog *ui;
|
Ui::CheckOutDialog *ui;
|
||||||
|
ActivitySelector *m_actSelector;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -21,16 +21,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="ActivitySelector" name="actSelector" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lblComment">
|
<widget class="QLabel" name="lblComment">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -110,14 +100,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>ActivitySelector</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>activityselector.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|||||||
@@ -84,18 +84,20 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include <QtConcurrentRun>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QProcess>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QtPlugin>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QtConcurrentRun>
|
|
||||||
#include <QtPlugin>
|
|
||||||
|
|
||||||
namespace ClearCase {
|
namespace ClearCase {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -161,6 +163,7 @@ ClearCasePlugin *ClearCasePlugin::m_clearcasePluginInstance = 0;
|
|||||||
ClearCasePlugin::ClearCasePlugin() :
|
ClearCasePlugin::ClearCasePlugin() :
|
||||||
VcsBase::VcsBasePlugin(QLatin1String(ClearCase::Constants::CLEARCASECHECKINEDITOR_ID)),
|
VcsBase::VcsBasePlugin(QLatin1String(ClearCase::Constants::CLEARCASECHECKINEDITOR_ID)),
|
||||||
m_isDynamic(false),
|
m_isDynamic(false),
|
||||||
|
m_isUcm(false),
|
||||||
m_commandLocator(0),
|
m_commandLocator(0),
|
||||||
m_checkOutAction(0),
|
m_checkOutAction(0),
|
||||||
m_checkInCurrentAction(0),
|
m_checkInCurrentAction(0),
|
||||||
@@ -226,6 +229,7 @@ QString ClearCasePlugin::findTopLevel(const QString &directory) const
|
|||||||
findRepositoryForDirectory(directory, QLatin1String(ClearCase::Constants::CLEARCASE_ROOT_FILE));
|
findRepositoryForDirectory(directory, QLatin1String(ClearCase::Constants::CLEARCASE_ROOT_FILE));
|
||||||
if (!topLevel.isEmpty() || !clearCaseControl()->isConfigured())
|
if (!topLevel.isEmpty() || !clearCaseControl()->isConfigured())
|
||||||
return topLevel;
|
return topLevel;
|
||||||
|
|
||||||
// Dynamic view
|
// Dynamic view
|
||||||
if (directory.startsWith(m_topLevel) && directory.at(m_topLevel.size()) == QLatin1Char('/'))
|
if (directory.startsWith(m_topLevel) && directory.at(m_topLevel.size()) == QLatin1Char('/'))
|
||||||
return m_topLevel;
|
return m_topLevel;
|
||||||
@@ -562,7 +566,7 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr
|
|||||||
return response.stdOut;
|
return response.stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString &fileName)
|
ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString &fileName, bool isUcm)
|
||||||
{
|
{
|
||||||
Core::IEditor *editor =
|
Core::IEditor *editor =
|
||||||
Core::EditorManager::openEditor(fileName,
|
Core::EditorManager::openEditor(fileName,
|
||||||
@@ -573,18 +577,28 @@ ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString
|
|||||||
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
|
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
|
||||||
connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(diffCheckInFiles(QStringList)));
|
connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(diffCheckInFiles(QStringList)));
|
||||||
submitEditor->setCheckScriptWorkingDirectory(m_checkInView);
|
submitEditor->setCheckScriptWorkingDirectory(m_checkInView);
|
||||||
|
submitEditor->setIsUcm(isUcm);
|
||||||
return submitEditor;
|
return submitEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePlugin::updateStatusActions()
|
void ClearCasePlugin::updateStatusActions()
|
||||||
{
|
{
|
||||||
bool hasFile = currentState().hasFile();
|
bool hasFile = currentState().hasFile();
|
||||||
FileStatus fileStatus = m_statusMap->value(currentState().relativeCurrentFile(), FileStatus(FileStatus::Unknown));
|
QString fileName = currentState().relativeCurrentFile();
|
||||||
|
|
||||||
|
FileStatus fileStatus = m_statusMap->value(fileName, FileStatus(FileStatus::Unknown));
|
||||||
|
|
||||||
|
if (ClearCase::Constants::debug)
|
||||||
|
qDebug() << Q_FUNC_INFO << fileName << ", status = " << fileStatus.status;
|
||||||
|
|
||||||
m_checkOutAction->setEnabled(hasFile && (fileStatus.status & (FileStatus::CheckedIn | FileStatus::Hijacked)));
|
m_checkOutAction->setEnabled(hasFile && (fileStatus.status & (FileStatus::CheckedIn | FileStatus::Hijacked)));
|
||||||
m_undoCheckOutAction->setEnabled(hasFile && (fileStatus.status & FileStatus::CheckedOut));
|
m_undoCheckOutAction->setEnabled(hasFile && (fileStatus.status & FileStatus::CheckedOut));
|
||||||
m_undoHijackAction->setEnabled(!m_isDynamic && hasFile && (fileStatus.status & FileStatus::Hijacked));
|
m_undoHijackAction->setEnabled(!m_isDynamic && hasFile && (fileStatus.status & FileStatus::Hijacked));
|
||||||
m_checkInCurrentAction->setEnabled(hasFile && (fileStatus.status & FileStatus::CheckedOut));
|
m_checkInCurrentAction->setEnabled(hasFile && (fileStatus.status & FileStatus::CheckedOut));
|
||||||
m_addFileAction->setEnabled(hasFile && (fileStatus.status & FileStatus::NotManaged));
|
m_addFileAction->setEnabled(hasFile && (fileStatus.status & FileStatus::NotManaged));
|
||||||
|
|
||||||
|
m_checkInActivityAction->setEnabled(m_isUcm);
|
||||||
|
m_diffActivityAction->setEnabled(m_isUcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
|
void ClearCasePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
|
||||||
@@ -928,8 +942,11 @@ void ClearCasePlugin::startCheckInAll()
|
|||||||
|
|
||||||
void ClearCasePlugin::startCheckInActivity()
|
void ClearCasePlugin::startCheckInActivity()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(isUcm(), return);
|
||||||
|
|
||||||
const VcsBase::VcsBasePluginState state = currentState();
|
const VcsBase::VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasProject(), return);
|
QTC_ASSERT(state.hasProject(), return);
|
||||||
|
|
||||||
QDialog dlg;
|
QDialog dlg;
|
||||||
QVBoxLayout *layout = new QVBoxLayout(&dlg);
|
QVBoxLayout *layout = new QVBoxLayout(&dlg);
|
||||||
ActivitySelector *actSelector = new ActivitySelector(&dlg);
|
ActivitySelector *actSelector = new ActivitySelector(&dlg);
|
||||||
@@ -941,6 +958,7 @@ void ClearCasePlugin::startCheckInActivity()
|
|||||||
dlg.setWindowTitle(tr("Check In Activity"));
|
dlg.setWindowTitle(tr("Check In Activity"));
|
||||||
if (!dlg.exec())
|
if (!dlg.exec())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString topLevel = state.topLevel();
|
QString topLevel = state.topLevel();
|
||||||
int topLevelLen = topLevel.length();
|
int topLevelLen = topLevel.length();
|
||||||
QStringList versions = ccGetActivityVersions(topLevel, actSelector->activity());
|
QStringList versions = ccGetActivityVersions(topLevel, actSelector->activity());
|
||||||
@@ -991,9 +1009,10 @@ void ClearCasePlugin::startCheckIn(const QString &workingDir, const QStringList
|
|||||||
m_checkInMessageFileName = saver.fileName();
|
m_checkInMessageFileName = saver.fileName();
|
||||||
m_checkInView = workingDir;
|
m_checkInView = workingDir;
|
||||||
// Create a submit editor and set file list
|
// Create a submit editor and set file list
|
||||||
ClearCaseSubmitEditor *editor = openClearCaseSubmitEditor(m_checkInMessageFileName);
|
ClearCaseSubmitEditor *editor = openClearCaseSubmitEditor(m_checkInMessageFileName, m_isUcm);
|
||||||
editor->setStatusList(files);
|
editor->setStatusList(files);
|
||||||
if (files.size() == 1) {
|
|
||||||
|
if (m_isUcm && (files.size() == 1)) {
|
||||||
QString activity = ccGetFileActivity(workingDir, files.first());
|
QString activity = ccGetFileActivity(workingDir, files.first());
|
||||||
editor->submitEditorWidget()->setActivity(activity);
|
editor->submitEditorWidget()->setActivity(activity);
|
||||||
}
|
}
|
||||||
@@ -1053,6 +1072,8 @@ void ClearCasePlugin::history(const QString &workingDir,
|
|||||||
|
|
||||||
void ClearCasePlugin::viewStatus()
|
void ClearCasePlugin::viewStatus()
|
||||||
{
|
{
|
||||||
|
if (m_view.isEmpty())
|
||||||
|
m_view = ccGetView(m_topLevel);
|
||||||
QTC_ASSERT(!m_view.isEmpty() && !m_settings.disableIndexer, return);
|
QTC_ASSERT(!m_view.isEmpty() && !m_settings.disableIndexer, return);
|
||||||
VcsBase::VcsBaseOutputWindow *outputwindow = VcsBase::VcsBaseOutputWindow::instance();
|
VcsBase::VcsBaseOutputWindow *outputwindow = VcsBase::VcsBaseOutputWindow::instance();
|
||||||
outputwindow->appendCommand(QLatin1String("Indexed files status (C=Checked Out, H=Hijacked, ?=Missing)"));
|
outputwindow->appendCommand(QLatin1String("Indexed files status (C=Checked Out, H=Hijacked, ?=Missing)"));
|
||||||
@@ -1297,7 +1318,8 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
|
|||||||
|
|
||||||
const QString file = QDir::toNativeSeparators(relFile);
|
const QString file = QDir::toNativeSeparators(relFile);
|
||||||
const QString title = QString::fromLatin1("Checkout %1").arg(file);
|
const QString title = QString::fromLatin1("Checkout %1").arg(file);
|
||||||
CheckOutDialog coDialog(title);
|
CheckOutDialog coDialog(title, m_isUcm);
|
||||||
|
|
||||||
if (!m_settings.disableIndexer &&
|
if (!m_settings.disableIndexer &&
|
||||||
(fi.isWritable() || m_statusMap->value(relFile).status == FileStatus::Unknown))
|
(fi.isWritable() || m_statusMap->value(relFile).status == FileStatus::Unknown))
|
||||||
QtConcurrent::run(&sync, topLevel, QStringList(relFile)).waitForFinished();
|
QtConcurrent::run(&sync, topLevel, QStringList(relFile)).waitForFinished();
|
||||||
@@ -1310,8 +1332,9 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
|
|||||||
if (!isHijacked)
|
if (!isHijacked)
|
||||||
coDialog.hideHijack();
|
coDialog.hideHijack();
|
||||||
if (coDialog.exec() == QDialog::Accepted) {
|
if (coDialog.exec() == QDialog::Accepted) {
|
||||||
if (!vcsSetActivity(topLevel, title, coDialog.activity()))
|
if (m_isUcm && !vcsSetActivity(topLevel, title, coDialog.activity()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Core::FileChangeBlocker fcb(absPath);
|
Core::FileChangeBlocker fcb(absPath);
|
||||||
QStringList args(QLatin1String("checkout"));
|
QStringList args(QLatin1String("checkout"));
|
||||||
QString comment = coDialog.comment();
|
QString comment = coDialog.comment();
|
||||||
@@ -1444,7 +1467,7 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
|
|||||||
const QString file = QDir::toNativeSeparators(fileName);
|
const QString file = QDir::toNativeSeparators(fileName);
|
||||||
bool noCheckout = false;
|
bool noCheckout = false;
|
||||||
QVBoxLayout *verticalLayout;
|
QVBoxLayout *verticalLayout;
|
||||||
ActivitySelector *actSelector;
|
ActivitySelector *actSelector = 0;
|
||||||
QLabel *commentLabel;
|
QLabel *commentLabel;
|
||||||
QTextEdit *commentEdit;
|
QTextEdit *commentEdit;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
@@ -1452,8 +1475,10 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
|
|||||||
fileOpDlg.setWindowTitle(title);
|
fileOpDlg.setWindowTitle(title);
|
||||||
|
|
||||||
verticalLayout = new QVBoxLayout(&fileOpDlg);
|
verticalLayout = new QVBoxLayout(&fileOpDlg);
|
||||||
actSelector = new ActivitySelector;
|
if (m_isUcm) {
|
||||||
verticalLayout->addWidget(actSelector);
|
actSelector = new ActivitySelector;
|
||||||
|
verticalLayout->addWidget(actSelector);
|
||||||
|
}
|
||||||
|
|
||||||
commentLabel = new QLabel(tr("Enter &comment:"));
|
commentLabel = new QLabel(tr("Enter &comment:"));
|
||||||
verticalLayout->addWidget(commentLabel);
|
verticalLayout->addWidget(commentLabel);
|
||||||
@@ -1474,9 +1499,11 @@ bool ClearCasePlugin::ccFileOp(const QString &workingDir, const QString &title,
|
|||||||
|
|
||||||
if (!fileOpDlg.exec())
|
if (!fileOpDlg.exec())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QString comment = commentEdit->toPlainText();
|
QString comment = commentEdit->toPlainText();
|
||||||
if (actSelector->changed())
|
if (m_isUcm && actSelector->changed())
|
||||||
vcsSetActivity(workingDir, fileOpDlg.windowTitle(), actSelector->activity());
|
vcsSetActivity(workingDir, fileOpDlg.windowTitle(), actSelector->activity());
|
||||||
|
|
||||||
QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir, fileName).absolutePath());
|
QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir, fileName).absolutePath());
|
||||||
QStringList commentArg;
|
QStringList commentArg;
|
||||||
if (comment.isEmpty())
|
if (comment.isEmpty())
|
||||||
@@ -1670,7 +1697,18 @@ bool ClearCasePlugin::newActivity()
|
|||||||
return (!response.error);
|
return (!response.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClearCasePlugin::ccGetView(const QString &workingDir, bool *isDynamic) const
|
// check if the view is UCM
|
||||||
|
bool ClearCasePlugin::ccCheckUcm(const QString &viewname, const QString &workingDir) const
|
||||||
|
{
|
||||||
|
QStringList catcsArgs(QLatin1String("catcs"));
|
||||||
|
catcsArgs << QLatin1String("-tag") << viewname;
|
||||||
|
QString catcsData = runCleartoolSync(workingDir, catcsArgs);
|
||||||
|
|
||||||
|
// check output for the word "ucm"
|
||||||
|
return QRegExp(QLatin1String("(^|\\n)ucm\\n")).indexIn(catcsData) != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ClearCasePlugin::ccGetView(const QString &workingDir, bool *isDynamic, bool *isUcm) const
|
||||||
{
|
{
|
||||||
QStringList args(QLatin1String("lsview"));
|
QStringList args(QLatin1String("lsview"));
|
||||||
args << QLatin1String("-cview");
|
args << QLatin1String("-cview");
|
||||||
@@ -1682,7 +1720,13 @@ QString ClearCasePlugin::ccGetView(const QString &workingDir, bool *isDynamic) c
|
|||||||
}
|
}
|
||||||
if (isDynamic)
|
if (isDynamic)
|
||||||
*isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
|
*isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
|
||||||
return data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
|
|
||||||
|
QString viewname = data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
|
||||||
|
if (isUcm)
|
||||||
|
*isUcm = ccCheckUcm(viewname, workingDir);
|
||||||
|
|
||||||
|
return viewname;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePlugin::updateStreamAndView()
|
void ClearCasePlugin::updateStreamAndView()
|
||||||
@@ -1695,7 +1739,7 @@ void ClearCasePlugin::updateStreamAndView()
|
|||||||
QRegExp intStreamExp(QLatin1String("stream:([^@]*)"));
|
QRegExp intStreamExp(QLatin1String("stream:([^@]*)"));
|
||||||
if (intStreamExp.indexIn(sresponse.mid(tabPos + 1)) != -1)
|
if (intStreamExp.indexIn(sresponse.mid(tabPos + 1)) != -1)
|
||||||
m_intStream = intStreamExp.cap(1);
|
m_intStream = intStreamExp.cap(1);
|
||||||
m_view = ccGetView(m_topLevel, &m_isDynamic);
|
m_view = ccGetView(m_topLevel, &m_isDynamic, &m_isUcm);
|
||||||
m_updateViewAction->setParameter(m_isDynamic ? QString() : m_view);
|
m_updateViewAction->setParameter(m_isDynamic ? QString() : m_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *error_message);
|
bool initialize(const QStringList &arguments, QString *error_message);
|
||||||
|
|
||||||
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName);
|
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
|
||||||
|
|
||||||
const ClearCaseSettings &settings() const;
|
const ClearCaseSettings &settings() const;
|
||||||
void setSettings(const ClearCaseSettings &s);
|
void setSettings(const ClearCaseSettings &s);
|
||||||
@@ -148,6 +148,9 @@ public:
|
|||||||
FileStatus vcsStatus(const QString &file) const;
|
FileStatus vcsStatus(const QString &file) const;
|
||||||
QString currentView() const { return m_view; }
|
QString currentView() const { return m_view; }
|
||||||
void refreshActivities();
|
void refreshActivities();
|
||||||
|
inline bool isUcm() const { return m_isUcm; }
|
||||||
|
|
||||||
|
bool ccCheckUcm(const QString &viewname, const QString &workingDir) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void vcsAnnotate(const QString &workingDir, const QString &file,
|
void vcsAnnotate(const QString &workingDir, const QString &file,
|
||||||
@@ -216,7 +219,7 @@ private:
|
|||||||
static void rmdir(const QString &path);
|
static void rmdir(const QString &path);
|
||||||
QString runExtDiff(const QString &workingDir, const QStringList &arguments,
|
QString runExtDiff(const QString &workingDir, const QStringList &arguments,
|
||||||
int timeOut, QTextCodec *outputCodec = 0);
|
int timeOut, QTextCodec *outputCodec = 0);
|
||||||
QString ccGetView(const QString &workingDir, bool *isDynamic = 0) const;
|
QString ccGetView(const QString &workingDir, bool *isDynamic = 0, bool *isUcm = 0) const;
|
||||||
|
|
||||||
ClearCaseSettings m_settings;
|
ClearCaseSettings m_settings;
|
||||||
|
|
||||||
@@ -226,6 +229,7 @@ private:
|
|||||||
QString m_stream;
|
QString m_stream;
|
||||||
QString m_view;
|
QString m_view;
|
||||||
bool m_isDynamic;
|
bool m_isDynamic;
|
||||||
|
bool m_isUcm;
|
||||||
QString m_intStream;
|
QString m_intStream;
|
||||||
QString m_activity;
|
QString m_activity;
|
||||||
QString m_diffPrefix;
|
QString m_diffPrefix;
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ ClearCaseSubmitEditorWidget *ClearCaseSubmitEditor::submitEditorWidget()
|
|||||||
return static_cast<ClearCaseSubmitEditorWidget *>(widget());
|
return static_cast<ClearCaseSubmitEditorWidget *>(widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearCaseSubmitEditor::setIsUcm(bool isUcm)
|
||||||
|
{
|
||||||
|
submitEditorWidget()->addActivitySelector(isUcm);
|
||||||
|
}
|
||||||
|
|
||||||
void ClearCaseSubmitEditor::setStatusList(const QStringList &statusOutput)
|
void ClearCaseSubmitEditor::setStatusList(const QStringList &statusOutput)
|
||||||
{
|
{
|
||||||
typedef QStringList::const_iterator ConstIterator;
|
typedef QStringList::const_iterator ConstIterator;
|
||||||
|
|||||||
@@ -54,8 +54,11 @@ public:
|
|||||||
void setStatusList(const QStringList &statusOutput);
|
void setStatusList(const QStringList &statusOutput);
|
||||||
ClearCaseSubmitEditorWidget *submitEditorWidget();
|
ClearCaseSubmitEditorWidget *submitEditorWidget();
|
||||||
|
|
||||||
|
void setIsUcm(bool isUcm);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QByteArray fileContents() const;
|
virtual QByteArray fileContents() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -42,32 +42,26 @@
|
|||||||
using namespace ClearCase::Internal;
|
using namespace ClearCase::Internal;
|
||||||
|
|
||||||
ClearCaseSubmitEditorWidget::ClearCaseSubmitEditorWidget(QWidget *parent) :
|
ClearCaseSubmitEditorWidget::ClearCaseSubmitEditorWidget(QWidget *parent) :
|
||||||
Utils::SubmitEditorWidget(parent)
|
Utils::SubmitEditorWidget(parent),
|
||||||
|
m_actSelector(0)
|
||||||
{
|
{
|
||||||
setDescriptionMandatory(false);
|
setDescriptionMandatory(false);
|
||||||
QWidget *checkInWidget = new QWidget(this);
|
QWidget *checkInWidget = new QWidget(this);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout(checkInWidget);
|
m_verticalLayout = new QVBoxLayout(checkInWidget);
|
||||||
m_actSelector = new ActivitySelector;
|
|
||||||
verticalLayout->addWidget(m_actSelector);
|
|
||||||
|
|
||||||
QFrame *line = new QFrame;
|
|
||||||
line->setFrameShape(QFrame::HLine);
|
|
||||||
line->setFrameShadow(QFrame::Sunken);
|
|
||||||
verticalLayout->addWidget(line);
|
|
||||||
|
|
||||||
m_chkIdentical = new QCheckBox(tr("Chec&k in even if identical to previous version"));
|
m_chkIdentical = new QCheckBox(tr("Chec&k in even if identical to previous version"));
|
||||||
verticalLayout->addWidget(m_chkIdentical);
|
m_verticalLayout->addWidget(m_chkIdentical);
|
||||||
|
|
||||||
m_chkPTime = new QCheckBox(tr("&Preserve file modification time"));
|
m_chkPTime = new QCheckBox(tr("&Preserve file modification time"));
|
||||||
verticalLayout->addWidget(m_chkPTime);
|
m_verticalLayout->addWidget(m_chkPTime);
|
||||||
|
|
||||||
insertTopWidget(checkInWidget);
|
insertTopWidget(checkInWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClearCaseSubmitEditorWidget::activity() const
|
QString ClearCaseSubmitEditorWidget::activity() const
|
||||||
{
|
{
|
||||||
return m_actSelector->activity();
|
return m_actSelector ? m_actSelector->activity() : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClearCaseSubmitEditorWidget::isIdentical() const
|
bool ClearCaseSubmitEditorWidget::isIdentical() const
|
||||||
@@ -82,17 +76,34 @@ bool ClearCaseSubmitEditorWidget::isPreserve() const
|
|||||||
|
|
||||||
void ClearCaseSubmitEditorWidget::setActivity(const QString &act)
|
void ClearCaseSubmitEditorWidget::setActivity(const QString &act)
|
||||||
{
|
{
|
||||||
m_actSelector->setActivity(act);
|
if (m_actSelector)
|
||||||
|
m_actSelector->setActivity(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClearCaseSubmitEditorWidget::activityChanged() const
|
bool ClearCaseSubmitEditorWidget::activityChanged() const
|
||||||
{
|
{
|
||||||
return m_actSelector->changed();
|
return m_actSelector ? m_actSelector->changed() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCaseSubmitEditorWidget::addKeep()
|
void ClearCaseSubmitEditorWidget::addKeep()
|
||||||
{
|
{
|
||||||
m_actSelector->addKeep();
|
if (m_actSelector)
|
||||||
|
m_actSelector->addKeep();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Add the ActivitySelector if \a isUcm is set
|
||||||
|
void ClearCaseSubmitEditorWidget::addActivitySelector(bool isUcm)
|
||||||
|
{
|
||||||
|
if (!isUcm || m_actSelector)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_actSelector = new ActivitySelector;
|
||||||
|
m_verticalLayout->insertWidget(0, m_actSelector);
|
||||||
|
|
||||||
|
QFrame* line = new QFrame;
|
||||||
|
line->setFrameShape(QFrame::HLine);
|
||||||
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
|
m_verticalLayout->insertWidget(1, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClearCaseSubmitEditorWidget::commitName() const
|
QString ClearCaseSubmitEditorWidget::commitName() const
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
class QVBoxLayout;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ClearCase {
|
namespace ClearCase {
|
||||||
@@ -56,6 +57,7 @@ public:
|
|||||||
void setActivity(const QString &act);
|
void setActivity(const QString &act);
|
||||||
bool activityChanged() const;
|
bool activityChanged() const;
|
||||||
void addKeep();
|
void addKeep();
|
||||||
|
void addActivitySelector(bool isUcm);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString commitName() const;
|
QString commitName() const;
|
||||||
@@ -64,6 +66,7 @@ private:
|
|||||||
ActivitySelector *m_actSelector;
|
ActivitySelector *m_actSelector;
|
||||||
QCheckBox *m_chkIdentical;
|
QCheckBox *m_chkIdentical;
|
||||||
QCheckBox *m_chkPTime;
|
QCheckBox *m_chkPTime;
|
||||||
|
QVBoxLayout *m_verticalLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "clearcasesync.h"
|
#include "clearcasesync.h"
|
||||||
|
#include "clearcaseconstants.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
@@ -30,7 +31,8 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
|
|||||||
total = settings.totalFiles.value(view, total);
|
total = settings.totalFiles.value(view, total);
|
||||||
|
|
||||||
// refresh activities list
|
// refresh activities list
|
||||||
m_plugin->refreshActivities();
|
if (m_plugin->isUcm())
|
||||||
|
m_plugin->refreshActivities();
|
||||||
|
|
||||||
if (settings.disableIndexer)
|
if (settings.disableIndexer)
|
||||||
return;
|
return;
|
||||||
@@ -66,6 +68,7 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
|
|||||||
future.setProgressRange(0, total + 1);
|
future.setProgressRange(0, total + 1);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.setWorkingDirectory(topLevel);
|
process.setWorkingDirectory(topLevel);
|
||||||
|
|
||||||
process.start(program, args);
|
process.start(program, args);
|
||||||
if (!process.waitForStarted())
|
if (!process.waitForStarted())
|
||||||
return;
|
return;
|
||||||
@@ -75,6 +78,7 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
|
|||||||
process.bytesAvailable() && !future.isCanceled())
|
process.bytesAvailable() && !future.isCanceled())
|
||||||
{
|
{
|
||||||
QString line = QString::fromLocal8Bit(process.readLine().constData());
|
QString line = QString::fromLocal8Bit(process.readLine().constData());
|
||||||
|
|
||||||
buffer += line;
|
buffer += line;
|
||||||
if (buffer.endsWith(QLatin1Char('\n')) || process.atEnd()) {
|
if (buffer.endsWith(QLatin1Char('\n')) || process.atEnd()) {
|
||||||
int atatpos = buffer.indexOf(QLatin1String("@@"));
|
int atatpos = buffer.indexOf(QLatin1String("@@"));
|
||||||
|
|||||||
Reference in New Issue
Block a user