Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching ClearCase for a checkin with a specific comment

I've been asked to provide details of a checkin I did about 3 months ago into ClearCase. I know the QC number that was included in the comment but have so far failed utterly to find a way to search ClearCase for a checkin by comment.

Any ideas?

like image 536
gͫrͣeͬeͨn Avatar asked Apr 21 '09 10:04

gͫrͣeͬeͨn


People also ask

How do you check ClearCase?

To create a permanent new version of the current file or all files in the versioned object base (VOB), select Tools > ClearCase > Check In. To be asked to confirm that you want to check in the files, select Edit > Preferences > Version Control > ClearCase, and then select the Prompt on check-in check box.

How do I find my branch in ClearCase?

Branch, version, and label information for resources under ClearCase source control is available through the ClearTeam Navigator View. and ClearCase properties view. You can also use the ClearCase Version Tree view to find branch, version, and label information for ClearCase resources.

What is check in in Linux?

From a command or terminal window, enter this command: cleartool checkin -comment " comment " filename. For example, after fixing a typo, you would enter one of the following commands to check in the corrected file: cleartool checkin -comment "fixed typo reported in DEF0012345" foo.c.


2 Answers

Brian Agnew is on the right track, but a word of caution:

  • I am sure the second command line is NOT needed (cleartool find . -version !"lbtype(LABEL_NAME)"...)
  • 'cleartool find -all' is useful if you think that your file may have been moved, but on a big VOB, that process can be extra long
  • without the '-nvis' option, it won't find the file if it has been 'rmnamed' (removed)
  • using 'lshistory -minor' is sheer madness: on a vob with a few months or years of history, it will simply take too much time. For each element found, it would display the ALL history for all versions of that element, without any possibility to refine that set of versions displayed. That solution simply does not scale.
    That, and the -minoroption of the 'lshistory' command does not bring any value to the problem at hand: it would only display the same version several times, just because of internal comments like 'Attached hyperlink "Change@13707xx@\my_pvob"' or 'Attached hyperlink "Merge@xxxx@\my_vob"'

You need to refine your query with:

  • the type of element wanted (if it is a file: -type f)
  • the date "created_since(30-Jan)&&!created_since(28-Feb))" for instance would limit the date range to consider
  • the user

I would use:

M:\my_base_view\my_base_vob>
  cleartool find -all -type f -user myLogin -version "{created_since(30-Jan)&&!created_since(28-Feb)}" -exec "cleartool descr -fmt \"%n\t%c\n\" \"%CLEARCASE_XPN%\"" >c:\output.txt

That would only look for files checked-in by me for a certain date period, which is a way to have a smaller set of versions to examine.

Note that I use 'descr' (the describe command) which is only for the current version (and not for displaying the all history of an element like 'lshistory' does).

If your file has been rmnamed, run again the same command with the '-nvis' option (it would only find elements, along with their branches and versions, that are not visible (do not have a standard path name) in the view.

Warning: if you specify a "before" date with a day "in the future" (for instance: '&&!created_since(28-Apr)}' whereas we are not the 28th of April yet), it will always select 0 versions (!?).
This is not relevant for your issue, but if you enter a "wrong before date" by mistake, that can lead to the false impression that there is no version to find, where there actually are versions to be found.

like image 110
VonC Avatar answered Sep 21 '22 18:09

VonC


Have you looked at this ? Specifically the section below.

How to find elements and versions with specific comments

I want to find all elements/versions with specific comments like “Jane changed this on 11-26”

M:\my_base_view\my_base_vob>cleartool find -all -exec "cleartool lshistory -minor -fmt \"%n\t%c\n\" \"%CLEARCASE_XPN%\"" >c:\output.txt

**This will pipe the output to a file and you would have to grep the file for the specific comments you're looking for.

M:\my_base_view\my_base_vob>cleartool find . -version !"lbtype(LABEL_NAME)" -exec "cleartool describe -long %CLEARCASE_PN%" >c:\output2.txt

Looks a bit of a fiddly process, regrettably.

like image 33
Brian Agnew Avatar answered Sep 20 '22 18:09

Brian Agnew