Question

In ClearCase, Due to different workflow among several developers, we ended up with some files on two branches even though they are identical; this causes unnecessary headache during rebase/merge. To remove those from one of the branch, First, I need to find the list of elements (files/directories) that are identical on BRANCH_1 and BRANCH_2. Is there a way to find this list?

I know how to use Report Builder ( and cleartool scripts) and find difference between two labels, but that does not seem to help here.

Any help would be appreciated !

Was it helpful?

Solution

In your case, we are talking about the same file, with two identical versions on different branches.

The easiest way to detect those is through 2 snapshot views (snapshot because quicker for read-access than dynamic views), and by using a simple diff tool (like kdiff3 for instance)

For each identical file detected, you can then draw a merge arrow between the two versions from the two different branches. See "Merge arrow in clear case".

That merge arrow will be enough for ClearCase to not consider (i.e. ignore) those same files during the next regular ClearCase merge.

The OP notes that:

both views have some common files on branch1 that show up as identical because snapshot has same copy for each view.
What I need is just files that exist on different branch but are identical in contents.

Again, the cleartool descr -fmt approach is useful: it will allow you to describe an element with their full extended path (with %n: /main/x/branch1/y): that way, for a file which exists in both views and has been found "identical" by the diff tool, you can check if it is found with 2 different extended pathnames, or with the same one (in which case, you don't have to do anything to that file)


Original answer: two identical files on different branches "causing unnecessary headache during rebase/merge" are usually evil twins.

The official IBM documentation about Evil Twin does advise for a simple cleartool find (you also have an old 2010 video on it).
Combined with fmt_ccase, you can launch 2 searches with a descr -fmt "%En %On\n":

  • one in aview on branch1
  • one in a view on branch2

That would display the full name of the elements found, along with their oid (object id): 2 files with the same name but different oid would be an evil twin.

You would find a similar approach in "What's the easiest way to detect “evil twins” in Rational ClearCase?"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top