Hi,
I’ve been trying to get BC3 to work with ClearCase snapshot views. These are the ones that CC provides the diff/merge tool with temp files and “-fname blabla” real name labels. These extra arguments confuse BC3. So that, for example, a version tree difference comes out as a 3-way diff not a 2 way compare, also merge goes completely mad with both left and right BC3 panes empty!
I read the other BC3+CC threads, but most people are trying to get it to work with dynamic views and there seems to be some support for this. I only use snapshot views so my workaround might not work if you use both.
Im using windows, but I figure the problem will be the same for linux if snapshot views are used there too.
Basically, my workaround for now, is to write a little wrapper called “ccbc3.exe” which you put in the libs/mgrs file in the same place as the “bcomp.exe” is meant to go. My workaround wrapper simply discards parameters and re-arranges those left to give either 2 or 4 to bcomp.exe, but it also puts back in the original names as “/title<N>=bla” options for the UI.
It’s a complete hack, but it might help start proper CC support. Compile this program and put it in the same directory as bcomp.exe so that it can find it to exec it, and then edit libs/mgrs to call it.
any better ideas welcome!
-- hugh.
ccbc3.cpp
------------------------------
I’ve been trying to get BC3 to work with ClearCase snapshot views. These are the ones that CC provides the diff/merge tool with temp files and “-fname blabla” real name labels. These extra arguments confuse BC3. So that, for example, a version tree difference comes out as a 3-way diff not a 2 way compare, also merge goes completely mad with both left and right BC3 panes empty!
I read the other BC3+CC threads, but most people are trying to get it to work with dynamic views and there seems to be some support for this. I only use snapshot views so my workaround might not work if you use both.
Im using windows, but I figure the problem will be the same for linux if snapshot views are used there too.
Basically, my workaround for now, is to write a little wrapper called “ccbc3.exe” which you put in the libs/mgrs file in the same place as the “bcomp.exe” is meant to go. My workaround wrapper simply discards parameters and re-arranges those left to give either 2 or 4 to bcomp.exe, but it also puts back in the original names as “/title<N>=bla” options for the UI.
It’s a complete hack, but it might help start proper CC support. Compile this program and put it in the same directory as bcomp.exe so that it can find it to exec it, and then edit libs/mgrs to call it.
any better ideas welcome!
-- hugh.
ccbc3.cpp
------------------------------
Code:
#include <process.h> #include <windows.h> #include <iostream> using namespace std; //#define EXENAME "c:\\bc3\\bcomp.exe" #define EXENAME "bcomp.exe" #define MAX_ARGS 16 #define BUFSIZE 4096 int main(int argc, char** argv) { char* argv2[MAX_ARGS]; char* fnames[MAX_ARGS]; char* buf = new char[BUFSIZE]; int i; int j = 0; int f = 0; argv2[j++] = EXENAME; for (i = 1; i < argc; ++i) { // remember the real names if (!strcmp(argv[i], "-fname")) { fnames[f++] = argv[i+1]; ++i; // skip this and next. } // skip a bunch of stuff else if (!strcmp(argv[i], "-base")) { // skip } else if (!strcmp(argv[i], "-abort")) { // skip } else if (!strcmp(argv[i], "-out")) { // skip } else if (!strcmp(argv[i], "-serial")) { // skip } else { // keep all other args argv2[j++] = argv[i]; } } if (j == 3) // A B { // 2 way diff // each one has names, put them in char* p = buf; for (int k = 0; k < f; ++k) { sprintf(p, "/title%d=%s", k+1, fnames[k]); argv2[j++] = p; p = p + strlen(p) + 1; } } else if (j == 5) { // 3 way // BASE OUT A B // 1 2 3 4 char* base = argv2[1]; char* left = argv2[3]; char* right = argv2[4]; char* out = argv2[2]; j = 1; argv2[j++] = left; argv2[j++] = right; argv2[j++] = base; argv2[j++] = out; char* p = buf; sprintf(p, "/title1=%s", fnames[1]); argv2[j++] = p; p = p + strlen(p) + 1; sprintf(p, "/title3=%s", fnames[0]); argv2[j++] = p; // the merge title is left alone } argv2[j] = 0; // exec BC3 and wait intptr_t pro = _spawnv(_P_WAIT, EXENAME, argv2); if (pro == -1) { const char* e = strerror(errno); cerr << "Problem exec (" << hex << errno << dec << "): " << e << endl; } delete buf; // return result of BC3 as our result return pro; }
Comment