Commit 3ae01935 authored by Michael Reeves's avatar Michael Reeves

Remove remnents clearCase support

parent df86b3be
......@@ -10,6 +10,7 @@ Version 1.7.0 - 2017-01-23
-Don't sort twice when sorting in reverse order.
-fix memmory leak introduced in 0.9.91.
-change version numbering.
-scrap ClearCase support
Version 0.9.98 - 2014-07-04
===========================
......
This diff is collapsed.
......@@ -246,32 +246,6 @@ void FileAccess::setFile(const QFileInfo& fi, FileAccess* pParent)
{
d()->m_url.setPath(absoluteFilePath());
}
if(!m_bExists && absoluteFilePath().contains("@@"))
{
// Try reading a clearcase file
d()->m_localCopy = FileAccess::tempFileName();
QString cmd = "cleartool get -to \"" + d()->m_localCopy + "\" \"" + absoluteFilePath() + "\"";
QProcess process;
process.start(cmd);
process.waitForFinished(-1);
//::system( cmd.local8Bit() );
QFile::setPermissions(d()->m_localCopy, QFile::ReadUser | QFile::WriteUser); // Clearcase creates a write protected file, allow delete.
QFileInfo fi(d()->m_localCopy);
#if defined(Q_OS_WIN)
d()->m_bReadable = true; //fi.isReadable();
m_bWritable = true; //fi.isWritable();
d()->m_bExecutable = false; //fi.isExecutable();
#else
d()->m_bReadable = fi.isReadable();
d()->m_bExecutable = fi.isExecutable();
#endif
//d()->m_creationTime = fi.created();
//d()->m_accessTime = fi.lastRead();
m_bExists = fi.exists();
m_size = fi.size();
}
}
}
......
......@@ -1538,15 +1538,6 @@ void OptionDialog::setupRegionalPage(void)
topLayout->addStretch(10);
}
// TODO: Integrate this properly in the build system.
// Currently breaks compilation on Windows b/c of:
// src\ccInstHelper.cpp(15): fatal error C1083: Cannot open include file: 'C:/Program Files/NSIS/Contrib/ExDll/exdll.h': No such file or directory
#define ENABLE_CC_INTEGRATION 0
#if ENABLE_CC_INTEGRATION
#include "ccInstHelper.cpp"
#endif
void OptionDialog::setupIntegrationPage(void)
{
QFrame* page = new QFrame();
......@@ -1581,46 +1572,9 @@ void OptionDialog::setupIntegrationPage(void)
"For those who are used to using the Escape key."));
++line;
#if ENABLE_CC_INTEGRATION
QPushButton* pIntegrateWithClearCase = new QPushButton(i18n("Integrate with ClearCase"), page);
gbox->addWidget(pIntegrateWithClearCase, line, 0);
pIntegrateWithClearCase->setToolTip(i18n(
"Integrate with Rational ClearCase from IBM.\n"
"Modifies the \"map\" file in ClearCase subdir \"lib/mgrs\"\n"
"(Only enabled when ClearCase \"bin\" directory is in the path.)"));
connect(pIntegrateWithClearCase, &QPushButton::clicked, this, &OptionDialog::slotIntegrateWithClearCase);
pIntegrateWithClearCase->setEnabled(integrateWithClearCase("existsClearCase", "") != 0);
QPushButton* pRemoveClearCaseIntegration = new QPushButton(i18n("Remove ClearCase Integration"), page);
gbox->addWidget(pRemoveClearCaseIntegration, line, 1);
pRemoveClearCaseIntegration->setToolTip(i18n(
"Restore the old \"map\" file from before doing the ClearCase integration."));
connect(pRemoveClearCaseIntegration, &QPushButton::clicked, this, &OptionDialog::slotRemoveClearCaseIntegration);
pRemoveClearCaseIntegration->setEnabled(integrateWithClearCase("existsClearCase", "") != 0);
++line;
#endif
topLayout->addStretch(10);
}
void OptionDialog::slotIntegrateWithClearCase()
{
#if ENABLE_CC_INTEGRATION
char kdiff3CommandPath[1000];
GetModuleFileNameA(0, kdiff3CommandPath, sizeof(kdiff3CommandPath) - 1);
integrateWithClearCase("install", kdiff3CommandPath);
#endif
}
void OptionDialog::slotRemoveClearCaseIntegration()
{
#if ENABLE_CC_INTEGRATION
char kdiff3CommandPath[1000];
GetModuleFileNameA(0, kdiff3CommandPath, sizeof(kdiff3CommandPath) - 1);
integrateWithClearCase("uninstall", kdiff3CommandPath);
#endif
}
void OptionDialog::slotEncodingChanged()
{
......
......@@ -68,8 +68,6 @@ protected Q_SLOTS:
void slotEncodingChanged();
void slotHistoryMergeRegExpTester();
void slotIntegrateWithClearCase();
void slotRemoveClearCaseIntegration();
Q_SIGNALS:
void applyDone();
private:
......
......@@ -62,15 +62,6 @@ Installation:
(C:\Documents and Settings\Username\Application Data\Subversion\diff3_cmd.bat)
(Installation is disabled by default)
- Integration with Rational ClearCase from IBM: Allows to use KDiff3 as comparison
and merge tool for text files under Clearcase. KDiff3 tries to locate the "map"-file
(e.g.: C:\Program Files\Rational\Clearcase\lib\mgrs\map) which tells clearcase
which tool to use for which filetype and operation. KDiff3 stores a backup in
map.preKDiff3Install (if is doesn't exist yet) and modifies the map file so that
KDiff3 is used for text files. On KDiff3-uninstallation the entries containing
"KDiff3" are restored. The map-file is normal text, so you can also adjust it
yourself. (Installation for ClearCase is disabled by default)
Since this program was actually developed for GNU/Linux, there might be Windows
specific problems I don't know of yet. Please write me about problems you encounter.
......
Clearcase install helper plugin DLL-Readme
==========================================
Copyright (C) 2007 Joachim Eibl, All rights reserved.
License: GPL Version 2 or any later version.
This subdirectory contains files to build a NSIS-plugin which is
called during installation and uninstallation.
The plugin tries to locate clearcase by looking for cleartool.exe in the
PATH environment variable.
Then it searches for the "map" file relative to the cleartool.exe in
../lib/mgrs/map.
This file contains a map which tells clearcase which tool to use for a certain
operation. It is readable and modifiable with any text editor.
During installation this plugin replaces several entries with the
KDiff3-executable.
The original file is renamed into "map.preKDiff3Install".
During uninstallation the plugin restores the original contents from the
"map.preKDiff3Install" but only for those entries where KDiff3 is used.
NSIS integrates the plugin as part of the installer executable and in the
"Uninstall.exe" file.
// uninstallHelper.cpp : Defines the entry point for the console application.
//
#define _CRT_SECURE_NO_DEPRECATE
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <windows.h>
#include <string.h>
#include <io.h>
//#define __stdcall
// For compilation download the NSIS source package and modify the following
// line to point to the exdll.h-file
#include "C:/Programme/NSIS/Contrib/ExDll/exdll.h"
struct ReplacementItem
{ char* fileType; char* operationType; };
ReplacementItem g_replacementTable[] = {
"text_file_delta", "xcompare",
"text_file_delta", "xmerge",
"whole_copy", "xcompare",
"whole_copy", "xmerge",
"z_text_file_delta", "xcompare",
"z_text_file_delta", "xmerge",
"z_whole_copy", "xcompare",
"z_whole_copy", "xmerge",
"_xml", "xcompare",
"_xml", "xmerge",
"_xml2", "xcompare",
"_xml2", "xmerge",
"_rftdef", "xcompare",
"_rftmap", "xcompare",
"_rftvp", "xcompare",
"_xtools", "xcompare",
0,0
};
struct LineItem
{
std::string fileType;
std::string opType;
std::string command;
std::string fileOpPart;
};
// Return true if successful, else false
bool readAndParseMapFile( const std::string& filename, std::list<LineItem>& lineItemList )
{
// Read file
FILE* pFile = fopen( filename.c_str(), "r" );
if (pFile)
{
fseek(pFile,0,SEEK_END);
int size = ftell(pFile);
fseek(pFile,0,SEEK_SET);
std::vector<char> buf( size );
fread( &buf[0], 1, size, pFile );
fclose( pFile );
// Replace strings
int lineStartPos=0;
int wordInLine = 0;
LineItem lineItem;
for( int i=0; i<size; )
{
if( buf[i] == '\n' || buf[i] == '\r' )
{
++i;
wordInLine = 0;
lineStartPos = i;
continue;
}
if( buf[i] == ' ' || buf[i] == '\t' )
{
++i;
continue;
}
else
{
int wordStartPos = i;
if (wordInLine<2)
{
while ( i<size && !( buf[i] == ' ' || buf[i] == '\t' ) )
++i;
std::string word( &buf[wordStartPos], i-wordStartPos );
if (wordInLine==0)
lineItem.fileType = word;
else
lineItem.opType = word;
++wordInLine;
}
else
{
lineItem.fileOpPart = std::string( &buf[lineStartPos], i-lineStartPos );
while ( i<size && !( buf[i] == '\n' || buf[i] == '\r' ) )
++i;
std::string word( &buf[wordStartPos], i-wordStartPos );
lineItem.command = word;
lineItemList.push_back( lineItem );
}
}
}
}
else
{
return false;
}
return true;
}
bool writeMapFile( const std::string& filename, const std::list<LineItem>& lineItemList )
{
FILE* pFile = fopen( filename.c_str(), "w" );
if (pFile)
{
std::list<LineItem>::const_iterator i = lineItemList.begin();
for( ; i!=lineItemList.end(); ++i )
{
const LineItem& li = *i;
fprintf( pFile, "%s%s\n", li.fileOpPart.c_str(), li.command.c_str() );
}
fclose( pFile );
}
else
{
return false;
}
return true;
}
std::string toUpper( const std::string& s )
{
std::string s2 = s;
for( unsigned int i=0; i<s.length(); ++i )
{
s2[i] = toupper( s2[i] );
}
return s2;
}
int install( const _TCHAR* subCommand, const _TCHAR* kdiff3CommandPath )
{
std::string installCommand = subCommand; // "install" or "uninstall"
std::string kdiff3Command = kdiff3CommandPath;
/*
std::wstring installCommand = subCommand; // "install" or "uninstall"
std::wstring wKDiff3Command = kdiff3CommandPath;
std::string kdiff3Command;
kdiff3Command.reserve( wKDiff3Command.length()+1 );
kdiff3Command.resize( wKDiff3Command.length() );
BOOL bUsedDefaultChar = FALSE;
int successLen = WideCharToMultiByte( CP_ACP, 0,
wKDiff3Command.c_str(), int(wKDiff3Command.length()),
&kdiff3Command[0], int(kdiff3Command.length()), 0, &bUsedDefaultChar );
if ( successLen != kdiff3Command.length() || bUsedDefaultChar )
{
std::cerr << "KDiff3 command contains characters that don't map to ansi code page.\n"
"Aborting clearcase installation.\n"
"Try to install KDiff3 in another path that doesn't require special characters.\n";
return -1;
}
*/
// Try to locate cleartool, the clearcase tool in the path
char buffer[1000];
char* pLastPart = 0;
int len = SearchPathA(0, "cleartool.exe", 0, sizeof(buffer)/sizeof(buffer[0]),
buffer, &pLastPart );
if ( len+1<int(sizeof(buffer)/sizeof(buffer[0])) && pLastPart )
{
pLastPart[-1] = 0;
pLastPart = strchr( buffer, '\\' ); // cd up (because cleartool.exe is in bin subdir)
if ( pLastPart )
pLastPart[1]=0;
std::string path( buffer );
path += _T("lib\\mgrs\\map");
std::string bakName = path + _T(".preKDiff3Install");
if ( installCommand == _T("install") )
{
std::list<LineItem> lineItemList;
bool bSuccess = readAndParseMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error reading original map file.\n";
return -1;
}
// Create backup
if ( access( bakName.c_str(), 0 )!=0 ) // Create backup only if not exists yet
{
if ( rename( path.c_str(), bakName.c_str() ) )
{
std::cerr << "Error renaming original map file.\n";
return -1;
}
}
std::list<LineItem>::iterator i = lineItemList.begin();
for( ; i!=lineItemList.end(); ++i )
{
LineItem& li = *i;
for (int j=0;;++j)
{
ReplacementItem& ri = g_replacementTable[j];
if ( ri.fileType==0 || ri.operationType==0 )
break;
if ( li.fileType == ri.fileType && li.opType == ri.operationType )
{
li.command = kdiff3Command.c_str();
break;
}
}
}
bSuccess = writeMapFile( path, lineItemList );
if ( !bSuccess )
{
if ( rename( bakName.c_str(), path.c_str() ) )
std::cerr << "Error writing new map file, restoring old file also failed.\n";
else
std::cerr << "Error writing new map file, old file restored.\n";
return -1;
}
}
else if ( installCommand == _T("uninstall") )
{
std::list<LineItem> lineItemList;
bool bSuccess = readAndParseMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error reading original map file\n.";
return -1;
}
std::list<LineItem> lineItemListBak;
bSuccess = readAndParseMapFile( bakName, lineItemListBak );
if ( !bSuccess )
{
std::cerr << "Error reading backup map file.\n";
return -1;
}
std::list<LineItem>::iterator i = lineItemList.begin();
for( ; i!=lineItemList.end(); ++i )
{
LineItem& li = *i;
if ((int)toUpper(li.command).find("KDIFF3")>=0)
{
std::list<LineItem>::const_iterator j = lineItemListBak.begin();
for (;j!=lineItemListBak.end();++j)
{
const LineItem& bi = *j; // backup iterator
if ( li.fileType == bi.fileType && li.opType == bi.opType )
{
li.command = bi.command;
break;
}
}
}
}
bSuccess = writeMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error writing map file.";
return -1;
}
}
}
return 0;
}
extern "C"
void __declspec(dllexport) nsisPlugin(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop,
extra_parameters *extra)
{
//g_hwndParent=hwndParent;
EXDLL_INIT();
{
std::string param1( g_stringsize, ' ' );
int retVal = popstring( &param1[0] );
if ( retVal == 0 )
{
std::string param2( g_stringsize, ' ' );
retVal = popstring( &param2[0] );
if ( retVal == 0 )
install( param1.c_str(), param2.c_str() );
return;
}
std::cerr << "Not enough parameters." << std::endl;
}
}
/*
int _tmain(int argc, _TCHAR* argv[])
{
if ( argc<3 )
{
std::cout << "This program is needed to install/uninstall KDiff3 for clearcase.\n"
"It tries to patch the map file (clearcase-subdir\\lib\\mgrs\\map)\n"
"Usage 1: ccInstHelper install pathToKdiff3.exe\n"
"Usage 2: ccInstHelper uninstall pathToKdiff3.exe\n"
"Backups of the original map files are created in the dir of the map file.\n";
}
else
{
return install( argv[1], argv[2] );
}
return 0;
}
*/
LIBRARY "ccinstallhelper"
EXPORTS
nsisPlugin
......@@ -383,15 +383,6 @@ Section /o "SVN Merge tool" SecIntegrationSubversionDiff3Cmd
CopyFiles '$INSTDIR\diff3_cmd.bat' '$APPDATA\Subversion'
SectionEnd
Section /o "ClearCase" SecIntegrationClearCase
DetailPrint "Integrate with Rational ClearCase from IBM"
ccInstallHelper::nsisPlugin "install" "$INSTDIR\kdiff3.exe"
;File "ccInstHelper.exe"
;ExecWait '"$INSTDIR\ccInstHelper.exe" install "$INSTDIR\kdiff3.exe"'
SectionEnd
SubSectionEnd
;--------------------------------
......@@ -429,7 +420,6 @@ FunctionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationWinCVS} "Integrate KDiff3 with WinCVS. (Please close WinCVS before proceeding.)"
!insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationTortoiseSVN} "Integrate KDiff3 with TortoiseSVN."
!insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationSubversionDiff3Cmd} "Install diff3_cmd.bat for Subversion merge"
!insertmacro MUI_DESCRIPTION_TEXT ${SecIntegrationClearCase} "Integrate KDiff3 with Rational Clearcase from IBM"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
......@@ -513,11 +503,6 @@ ${EndIf}
DeleteRegKey SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\$DIFF_EXT_ID"
DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID"
; clearcase
ccInstallHelper::nsisPlugin "uninstall" "$INSTDIR\kdiff3.exe"
;ExecWait '"$INSTDIR\ccInstHelper.exe" uninstall "$INSTDIR\kdiff3.exe"'
;Delete "$INSTDIR\ccInstHelper.exe"
SectionEnd
;--------------------------------
......
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