Bhadrinarayanan
Bhadrinarayanan

Reputation: 11

Clearcase - findmerge for recursive branches

I have a ClearCase main branch, and have a subbranch A created out of main branch.
Once again I have subbranch B created out of Subbranch A by editing the config spec.

Now I need to merge the files present in both the branches using findmerge command.
There are some files in sub branch A, which are not checked-out in subbranch B. So, what is the way I can have the latest files from both the nested branches to be merged to main branch using findmerge command.

findmerge . -fversion /main/brancha/branchb/latest -print 

That gives only files changed under branch B and not on branch A.
There are some files for which branchB was not necessary and files are not created under Branch B.

Upvotes: 1

Views: 613

Answers (3)

Tim
Tim

Reputation: 2027

Although the answers from @VonC and @hack will both work and are fine for just identifying what content will need a merge, in many cases the best approach to actually perform the merge is to merge from branch B to branch A (resolving any conflicts along the way) and then merge from branch A to main.

  • from a view with branch A active in the config spec: findmerge . -fversion /main/brancha/branchb/latest -merge
  • from a view with only main active in the config spec: findmerge . -fversion /main/brancha/latest -merge

This allows you to resolve any merge conflicts in branch A rather than in main, reducing the risk of breaking the build for the rest of the team. In some cases it won't make sense (if branch A is explicitly not supposed to contain the content from branch B), but when it does, I find it to be the better option for no extra work.

Upvotes: 0

hack
hack

Reputation: 146

Another option is to have a view (I'm giving it a view tag, 'other_view' in this example) whose config spec that selects branch B first and then branch A, for example:

element * .../branchB/LATEST
element * .../branchA/LATEST
element * /main/LATEST

From a view selecting /main/LATEST, you can then use the '-ftag' option to 'findmerge' to merge from the versions selected by that "other_view". The following command will preview what will be merged:

cleartool findmerge . -ftag other_view -print

Upvotes: 1

VonC
VonC

Reputation: 1324337

You need to merge:

  • first branchA: findmerge . -fversion /main/brancha/latest -print
  • then branchB: findmerge . -fversion /main/brancha/branchb/latest -print

That way, you will find files from branchA, and then files from branchB.

Upvotes: 1

Related Questions