View Full Version : 3-way Clearcase merge
Daniel Pensak
23-Jun-2008, 01:46 PM
Hi,
I'm trying to get 3-way merging working in clearcase. I've got the 2-way compare working. The problem seems to be when clearcase is set to automerge and there is a conflict. I've set up my map file to use BComp.exe for the merge:
text_file_delta merge D:\Program Files\Beyond Compare 3\BComp.exe
text_file_delta xmerge D:\Program Files\Beyond Compare 3\BComp.exe
If I merge and there are no conflicts everything works fine -- the file gets merged correctly, and a merge arrow is drawn in clearcase.
However, if there are conflicts, I do not get a BC window -- instead I get a Clearcase dialog that says "The merge completed successfully" even though the file was not changed and no merge arrow was drawn.
If I force a launch of the 3-way merge (via the "merge the file graphically" checkbox in clearcase) everything works great. So I know the capability is there! It only seems to be a bug with automerge when a conflict is detected.
Anyone else run into this? Any ideas/hope for a fix?
BC3 Version 459
command line from clearcase = '-abort -base M:\vob\file@@\main\1 -out M:\vob\file.merge M:\vob\file@@\main\2 M:\vob\file'
- Daniel
Daniel Pensak
23-Jun-2008, 02:07 PM
Example test case:
1) Create file with text "a" and add to Source control.
2) Check out file, replace "a" with "b" and check in.
3) Check out version 1 of file, replace "a" with "c" and check in. You will be told you need a merge. Since there is a conflict you should be presented with a graphical compare window.
Daniel Pensak
23-Jun-2008, 02:52 PM
OK, some more quick info --
Per other posts, I modified "BComp.exe" to "BComp.com" for the non-x version:
text_file_delta merge D:\Program Files\Beyond Compare 3\BComp.com
text_file_delta xmerge D:\Program Files\Beyond Compare 3\BComp.exe
The difference in command lines seems to be "merge..." and "xmerge...". Here is how I would describe the differences between clearcase's default tools and beyond compare:
Clearcase's merge tool:
- If "merge file graphically" unchecked -- "merge" -- brings up graphical merge only if conflicts.
- If "merge file graphically" checked -- "xmerge" -- always brings up graphical merge.
Beyond Compare 3:
- If "merge file graphically" unchecked -- "merge" -- if conflicts, fails but says its successful (however no merge arrow drawn).
- If "merge file graphically" checked -- "xmerge" -- always brings up graphical merge.
What I'd like is a way to only see the graphical merge if there are conflicts...
- Daniel
Craig
23-Jun-2008, 04:37 PM
Daniel,
Thanks for the feedback.
From what I can tell, if "merge file graphically" is unchecked ClearCase adds "-abort" to the command line. That means if it isn't there we should implicitly add /reviewconflicts to our internal command line. If that seems reasonable I can make that change in the next release.
I asked in the other thread, but can you confirm whether using both BComp.com and BComp.exe changed/improved anything?
Daniel Pensak
23-Jun-2008, 06:03 PM
I didn't notice any difference using BComp.com vs. BComp.exe.
I was looking at the command line used to launch the default clearcase tools (using SysInternals Process explorer) and it looks like what happens in the merge conflict case is:
1) Clearcase looks in map file and launches cleardiff to do a non-visual "merge".
2) The non-visual merge fails, so cleardiff returns failure (1?)
3) Clearcase then looks in map file and launches cleardiffmrg to do a visual "xmerge" (x as in x-windows as in visual?)
So maybe as long as Beyond Compare returns a failure exit code if the auto merge fails (the abort), everything will work?
Anyway, some other references:
http://www.agsrhichome.bnl.gov/Controls/doc/ClearCaseEnv/v4.0doc/cpf_4.0/ccase_nt/ccref/cleardiff.html
-abort is intended for use with scripts or batch jobs that involve merges. It allows completely automatic merges to proceed, but aborts any merge that requires user interaction.
http://www.guiffy.com/help/GuiffyHelp/ClearCase.html
The merge action is called to merge files --- if there are no differences(found by running GuiffyDiff quick text verify component), it copies the first file to the merge result file, quits and returns an exitcode=0, if there are differences, it performs a non-GUI SureMerge 3-way auto-merge --- if there are no Attentions and the merge result is saved, it quits and returns an exitcode=0, otherwise it runs the xmerge GUI Guiffy 3-way SureMerge GuiffyFrame component.
Andy Stevenson
01-Jul-2008, 11:08 AM
Sounds like this proposed change should resolve the problem.
It was working fine for me for a very long time when I used the 'BCompare.exe' command-line for all 4 commands in the clearcase map file (merge, xmerge, compare, xcompare)
Do you know which builds of BC had the return value of BComp as always 0?
Or which build fixed the return value of BComp if the automerge fails ('merge', not 'xmerge')?
Craig
01-Jul-2008, 11:57 AM
Andy, it would have been broken in 456 and fixed in 458, but only if you already had an existing instance of BC open.
Daniel Pensak
01-Jul-2008, 01:52 PM
I think (?) the key is in the exit code -- although I haven't verified that. Is there an easy way to see what exit code is returned from the process without writing my own little code wrapper? (Hmm maybe there is a generic launcher app somewhere that will run an exe and give you the exit code when it finishes?)
Craig
08-Jul-2008, 08:50 AM
Daniel,
You can use "echo.%ERRORLEVEL%" to print the return code after using "BComp" from the command line.
Is the current release working any better for you now that we have -abort handled?
Daniel Pensak
30-Sep-2008, 05:10 PM
I'm using the latest beyond compare to do 3-way merges with clearcase and it seems to be working now.
One issue is that sometimes I get a BC crash dialog -- however if I choose to continue it appears everything still works fine.
Another issue is that if I use BComp.exe in the map file and launch a merge from within beyond compare, beyond compare will hang indefinately as it "waits for itself". Yet I need to use BComp.exe in order to launch a merge using other tools such as Clearcase Explorer or Eclipse, or the merge fails due to not finding the ".merge" file. Is there any flag for Beyond Compare that will tell it to launch another instance? Or a way to signal clearcase to use BCompare.exe not BComp.exe? Or any other ideas?
Thanks,
- Daniel
Craig
01-Oct-2008, 03:53 PM
What do you mean by "launching a merge from within BC"?
BC has a /solo switch that forces it to start a new instance, which negates the need for BComp.exe, but AFAIK ClearCase doesn't provide any way to add arbitrary arguments to the command line.
Daniel Pensak
01-Oct-2008, 04:53 PM
I was using the BC source control integration feature. I was right-clicking, going to the "Source Control" menu, and selecting "Check In...". This would force a merge since I had an old version of the file checked out. I got a dialog saying whether I wanted to merge, and I said yes, and then that window hung. I could still use other beyond compare windows but I could not close the application or use the hung window at all (or even minimize it).
My workaround for now is instead of using the "Source Control" menu, I use the "Explorer" menu, which then has a "ClearCase" submenu, which then has the "Check In..." command. This launches clearcase through explorer evidently and so doesn't hang.
- Daniel
vBulletin® v3.7.1, Copyright ©2000-2013, Jelsoft Enterprises Ltd.