Commit 856b7f15 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ClearCase: Support systems without external diff

CC's internal diff is worthless, just disable multiple files actions

Change-Id: Ia8541e6edc6582777fc141da849819a5a11543b6
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@nokia.com>
parent b9c58161
......@@ -706,8 +706,13 @@ void ClearCasePlugin::undoHijackCurrent()
const QString fileName = state.relativeCurrentFile();
bool keep = false;
QString diffres = diffExternal(ccGetFileVersion(state.topLevel(), fileName), fileName);
if (diffres.at(0) != QLatin1Char('F')) { // Files are identical
bool askKeep = true;
if (m_settings.extDiffAvailable) {
QString diffres = diffExternal(ccGetFileVersion(state.topLevel(), fileName), fileName);
if (diffres.at(0) == QLatin1Char('F')) // Files are identical
askKeep = false;
}
if (askKeep) {
Ui::UndoCheckOut unhijackUi;
QDialog unhijackDlg;
unhijackUi.setupUi(&unhijackDlg);
......@@ -749,6 +754,11 @@ void ClearCasePlugin::ccDiffWithPred(const QStringList &files)
diffGraphical(file);
return; // done here, diff is opened in a new window
}
if (!m_settings.extDiffAvailable) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(
tr("External diff is required to compare multiple files."));
return;
}
QString result;
foreach (const QString &file, files) {
if (m_statusMap->value(QDir::fromNativeSeparators(file)).status == FileStatus::Hijacked)
......@@ -814,6 +824,11 @@ void ClearCasePlugin::diffActivity()
QTC_ASSERT(state.hasTopLevel(), return);
if (ClearCase::Constants::debug)
qDebug() << Q_FUNC_INFO;
if (!m_settings.extDiffAvailable) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(
tr("External diff is required to compare multiple files."));
return;
}
QString topLevel = state.topLevel();
QString activity = QInputDialog::getText(0, tr("Enter Activity"), tr("Activity Name"), QLineEdit::Normal, m_activity);
if (activity.isEmpty())
......@@ -1148,7 +1163,8 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
const ClearCaseResponse response =
runCleartool(topLevel, args, m_settings.timeOutMS(), 0, codec);
description = response.stdOut;
description += diffExternal(id);
if (m_settings.extDiffAvailable)
description += diffExternal(id);
// Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file
......
......@@ -98,6 +98,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
promptToCheckIn = settings->value(QLatin1String(promptToCheckInKeyC), false).toBool();
disableIndexer = settings->value(QLatin1String(disableIndexerKeyC), false).toBool();
indexOnlyVOBs = settings->value(QLatin1String(indexOnlyVOBsC), QString()).toString();
extDiffAvailable = !Utils::Environment::systemEnvironment().searchInPath(QLatin1String("diff")).isEmpty();
settings->beginGroup(QLatin1String(totalFilesKeyC));
foreach (const QString &view, settings->childKeys())
totalFiles[view] = settings->value(view).toInt();
......
......@@ -73,6 +73,7 @@ public:
bool promptToCheckIn;
bool disableIndexer;
QString indexOnlyVOBs;
bool extDiffAvailable;
QHash<QString, int> totalFiles;
};
......
......@@ -37,6 +37,7 @@
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/environment.h>
#include <utils/pathchooser.h>
#include <QCoreApplication>
......@@ -71,6 +72,7 @@ ClearCaseSettings SettingsPageWidget::settings() const
rc.disableIndexer = m_ui.disableIndexerCheckBox->isChecked();
rc.diffArgs = m_ui.diffArgsEdit->text();
rc.indexOnlyVOBs = m_ui.indexOnlyVOBsEdit->text();
rc.extDiffAvailable = m_ui.externalDiffRadioButton->isEnabled();
return rc;
}
......@@ -79,16 +81,23 @@ void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
m_ui.commandPathChooser->setPath(s.ccCommand);
m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.autoCheckOutCheckBox->setChecked(s.autoCheckOut);
switch (s.diffType) {
case GraphicalDiff:
m_ui.graphicalDiffRadioButton->setChecked(true);
m_ui.diffWidget->setEnabled(false);
break;
case ExternalDiff:
m_ui.externalDiffRadioButton->setChecked(true);
m_ui.diffWidget->setEnabled(true);
break;
bool extDiffAvailable = !Utils::Environment::systemEnvironment().searchInPath(QLatin1String("diff")).isEmpty();
if (extDiffAvailable) {
m_ui.diffWarningLabel->setVisible(false);
} else {
QString diffWarning = tr("In order to use External diff, 'diff' command needs to be accessible.");
#ifdef Q_OS_WIN
diffWarning.append(tr(" DiffUtils is available for free download "
"<a href=\"http://gnuwin32.sourceforge.net/packages/diffutils.htm\">here</a>. "
"Please extract it to a directory in your PATH."));
#endif
m_ui.diffWarningLabel->setText(diffWarning);
m_ui.externalDiffRadioButton->setEnabled(false);
}
if (extDiffAvailable && s.diffType == ExternalDiff)
m_ui.externalDiffRadioButton->setChecked(true);
else
m_ui.graphicalDiffRadioButton->setChecked(true);
m_ui.autoAssignActivityCheckBox->setChecked(s.autoAssignActivityName);
m_ui.historyCountSpinBox->setValue(s.historyCount);
m_ui.promptCheckBox->setChecked(s.promptToCheckIn);
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>363</width>
<height>384</height>
<height>403</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -39,11 +39,17 @@
<string>Diff</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="graphicalDiffRadioButton">
<property name="text">
<string>&amp;Graphical (Single file only)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
......@@ -55,6 +61,9 @@
</item>
<item row="1" column="1">
<widget class="QWidget" name="diffWidget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
......@@ -75,6 +84,53 @@
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="diffWarningLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>96</green>
<blue>92</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment