ClearCase‎ > ‎UCM FAQ‎ > ‎

How to merge using the version tree view browser


In UCM  it's common to handle all merge and situations by starting etiher a rebase or deliver operation. But occasionally it's feasible to do manual - old fasion, non-UCM - merges without having the UCM meta-data being updated with the notion that something is either delivered or rebased. 

At least one scanario is when you want to survive an Evil Twin.

One approach to hand-held merges is to bring up the version tree of an element and toss the version from branch to branch. This approach works only on one single element at a time. The pros about this approach is that it's intuitively quite easy to use and. The cons is that if you are dealing with more then just a few files it starts to categorize as tedious work, and if your merge involves several levels of directories then there are other approaches that are more interesting.

How do I use the version tree browser to survive a potential evil twin?

First step to identify which version you want to merge from. If an Evil Twin trigger is installed in your environment this information ought to be part of the error message, and then it's easy enough, alternatively you must go and search for it - simply by comparing versions again version in the version tree (not always so funny).

Have a look at the error message to the right (click on it to see it full-size). This is the error generated from the Evil Twin trigger in the Acclerated ClearCase Open Source project.

Error occured when I created a file called Array.h in a directory called \265_Rc\Rc_Lib\Src. Apparently this is not allowed since some earlier version of the Src directory already have an Array.h file.

Error message says:

The name: [Array.h]
ALREADY exists for the directory:
The name was added in branch version:

So the last line tells me which version to merge from.

Second step to go into the view where we are trying to introduce the file Array.h and bring up the version tree of the directory that should contain it - that is the Src directory in our example.

In the example it looks as shown to the left (click on the image to enlarge it). I've pointed to version 2 on igbj_Tc9_Domain_Model_Lib_Functionality and selected Merge to from the context menu, and then moved the curson to the version that has the eye icon (currently selected by view) attached to it.

Next you'll be presented to the dialogue shown to the right. Important here is to check that you want to merge graphically. If you do not check this ClearCase will try to merge everything using it's own change-rulez algorithm, and you will not be able to do any cherry-picking (selection of individual elements).

The next thing you see is the classical three-way-merge window where you see one panel at top - the result and three panels at the bottom left to right they are base, from-contributor, to-contributor. I usually just collapse the base view since that is not relevant in merges like this where the from-contributor is one that I carefully picked myself.  So in my example it looks like this:

Notice (to the left) that ClearCase has already chosen to add the Array.h file because of the change-rulez algorithm - it was in the source but not in the target, therefore it's included in the result. If we don't have any more files to consider then we're done and we can save the result and exit back to the view.

Third step

What you see there now in the view is that my Array.h file - the one I tried to add to source control but couldn't because it would be an evil twin - is now renamed to have a .keep extension.  Instead there is another Array.h file but this one has file size 0 (zero). It's because it's selecting then main\0 version which is always empty. If you want to merge the content from this file from somewhere else (e.g. and older devleopment stream) then you can use the same approach as we've just woulde throug on the Src directory, only this time you chose the Array.h file.

If you just simply want the content of the Array.h file to resemble the Array.h.keep file which was you first attempt to add to source control then simply:
  • Check out Array.h
  • Copy the content of Array.h.keep into Array.h
  • Delete Array.h.keep

From the command prompt you could do:
[14:51:09,03] C:
> cd /d C:\cc_view\etools-admin_Rc9_deliver_lab\265_Rc\Rc_Lib\Src>
> cleartool co -nc Array.h
> copy /Y Array.h.keep Array.h
> cleartool ci -nc Array.h
> del Array.h.keep

Just remember that the Src directory is also checked out at this time, so remember to run an find-checkouts on your view before you deliver or rebase.