I am attempting to write a script for Base ClearCase that will find all the files on a given branch and label, and perform a trivial merge of those files to another branch, and then label the newly merged files with a different label.
For example, given files on branch \main\Proj\Proj_INT1 and labeled Ver4, I want to merge the files to the \main\Proj branch and label them with Ver4X (iff they are in need of merging).
I know that I can use -fver "\main\Proj\Proj_INT1\Ver4" to find the versions of files I want to merge, but I am not sure how to combine the merge with applying the label.
From the documentation, it does not look possible to do a cleartool findmerge ... -merge -exec "cleartool mklabel ...", so I am currently attempting to a cleartool findmerge ... -log <out_file.log> -print, and then parse the resulting log to get all the file versions. However, given that the findmerge command stops at directories, I would need to repeat this operation multiple times until all directories and files are merged (a bit of a headache to try to script and parse cleartool output).
Is there an idiomatic or simple way to perform a merge and then label the files? Perhaps I can perform the merge and have cleartool generate a log which shows what the versions for merged files (so I can then label)?
Additionally, if I perform a cleartool findmerge ... -merge operation, how does it handle non-trivial merges? I am not expecting any non-trivial merges, but I would like to skip with an error or stop the merge entirely if a non-trivial merge is encountered.