Search code examples
clearcase

How do I do a text search across all versions of a clearcase file?


Background

In Clearcase, you can get the graphical version tree of a file by entering the following command in a linux terminal.

ct lsvtree -gra <filename>

This brings up an interface with numerous options to look at the diffs between two versions of a file.

Problem

From the graphical tree interface, I am trying to find if a string exists across any version of the file. This string was lost at some point, and I want to figure where that "somepoint" is.

Question

How can I run a text search across all versions of a file in clearcase?


Solution

  • As I mentioned before (2015), there is no equivalent to a git log -S or -G (pickaxe search) in ClearCase.

    That pickaxe search is done (in Git) to point out past revision where a string has been added or removed.
    But: you would need to script the equivalent feature for ClearCase.

    Since cleartool lsvtree shows you all the version of a given file, you can, starting with the most recent version do a cleartool annotate to see when, and in which version, the line was added.
    If that line include your string, then this version would be relevant.

    If the most recent version does not include your string, then repeat the process with the previous version (do a cleartool annotate on that previous version, if it includes your string).