Reputation: 11
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
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.
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
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
Reputation: 1324337
You need to merge:
branchA
: findmerge . -fversion /main/brancha/latest -print
branchB
: findmerge . -fversion /main/brancha/branchb/latest -print
That way, you will find files from branchA
, and then files from branchB
.
Upvotes: 1