Reputation: 1539
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?
Upvotes: 1
Views: 498
Reputation: 1323553
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).
Upvotes: 1
Reputation: 1073
If you use dynamic views, you could take advantage of how it accesses element versions via version-extended naming. using "foo.c@@/main/branch/1" as an example, you have "foo.c@@" as the root of a directory structure, with "main" and "branch" being subdirectories, and "1" being a "file"
You can use this by doing the following:
For example:
cd foo.c@@
grep -rl "target-string" *
to get the files without the string:
cd foo.c@@
grep -rlv "target-string" *
You could also use lsvtree output to power a search in a script, but the above is is the simplest trick to do this. This works on Unix and Windows, but you may want to use something other than the standard Windows "findstr" if your target string contains multiple words, as findstr handles them strangely: findstr "foo bar oof" will print lines that contain "foo", "bar", or "oof", occasionally even when /L for "literal" is used.
If you're using snapshot or web views, this is a lot trickier and will need a script to iterate on the output of lsvtree.
Upvotes: 1