Sunday, April 16, 2006

ClearCase top 10 script - copy merge

The internet will be a much better place with more links on this issue.
also referred as Clear Case Copy Merge.

The Problem:
You need a copy of the LATEST element versions on the source, branch A, to the target, branch B, where the resulting versions on branch B will be identical to the versions on branch A. However, there will be a merge arrow between the source and target directories. Hence, the procedure is referred to as a copy (merge).

The following commands demonstrate Copying the LATEST directory version of a sub-branch (branch.2) to the MAIN LATEST directory version

On UNIX
cleartool findmerge . -fversion /main/branch.2/LATEST -type d -merge

cleartool find . -type f 'version(.../branch.2/LATEST)' -exec 'cleartool co -nc $CLEARCASE_PN ; cp $CLEARCASE_XPN $CLEARCASE_PN ; cleartool ci -identical -nc $CLEARCASE_PN'



On Windows
cleartool findmerge . -fversion /main/branch.2/LATEST -type d -merge

cleartool find . -type f -version "version(.../main/branch.2/LATEST)" -print -exec "cleartool co -nc %CLEARCASE_PN%"

cleartool find . -type f -version "version(.../main/branch.2/LATEST)" -print -exec "cmd /c copy %CLEARCASE_XPN% %CLEARCASE_PN%"

cleartool find . -type f -version "version(.../main/branch.2/LATEST)" -print -exec "cleartool ci -identical -nc %CLEARCASE_PN%"


More info from IBM:
how to perform a copy (merge) of the exact LATEST directory version on a sub-branch to the MAIN LATEST directory version when using IBM® Rational® ClearCase® on Microsoft® Windows®, UNIX® or Linux™.
http://www-1.ibm.com/support/docview.wss?rs=984&context=SSSH27&q1=merge+copy&uid=swg21125348&loc=en_US&cs=utf-8