Search code examples
scriptingmergeclearcase

Find merge arrows pointing to a version in ClearCase


I want to find all the merge arrows pointing to a certain version in a script. When I describe the version of the element with the following command:

ct describe filename@@/main/some_branch/3

I get in the result the following:

Hyperlinks:
  Merge <- filename@@/main/other_branch/2

I want ct describe to output only the relevant information to be used in my script, ie. the versions where the merge arrows come from. In my case, the output should look simply like this:

filename@@/main/other_branch/2

I didn't find any relevant parameters in the -fmt from the man page. Is there any way of doing it?


Solution

  • The only option in the fmt_ccase man page would be

    %[hlink:filter]p
    

    Displays the hyperlink source and target, with an arrow pointing from the source to the target. The optional H argument lists only the hyperlink names.
    You can optionally specify a filter string, preceded by a colon. This filter if present, restricts the output to names that match the filter string. Case is considered when matching the string.

    If this doesn't work, you have to resort to grep/awk commands in order to extract those version from the cleartool describe output.

    The cleartool descr -ahlink restricts a bit the output.

    –ahlink
    

    The listing includes the path names of the objects hyperlinked to pname, annotated with → (listed object is the to- object) or ← (listed object is the from-object).

    For example:

    -> M:\gamma\vob1\proj\include\db.c@@\main\52 <- M:\gamma\vob1\proj\bin\vega@@\main\5
    

    Beside the full script option, you can have a look at external third-party tools like R&D Reporter, which can vizualize and export those same hyperlinks.
    However:

    • this is a commercial tool
    • depending on the export output and what you want, you might end up parsing just another output to extract what you need.

    For more on that tool, contact Tamir Gefen.