Search Harvest Projects for Keywords
search cancel

Search Harvest Projects for Keywords

book

Article ID: 270072

calendar_today

Updated On:

Products

CA Harvest Software Change Manager CA Harvest Software Change Manager - OpenMake Meister

Issue/Introduction

We are looking for a way to search all of our Harvest projects for a keyword

How do we accomplish this?

Environment

Release : 14.0 and up

Resolution

The "hsv" command line utility can be used to search a specific project and state for a specific keyword.  Here is where you can read more about this command: hsv Command-Select Version

The limitation of the command is that it can search only one project and state for only one keyword.  If you want to search a list of different projects for a keyword or list of keywords, the solution is to build a Windows batch script that can read a list of projects and keywords, and use the hsv command for each combination of a project, state and keyword.

Attached is an example of what this type of script might look like. 

The script has been enhanced to allow usage with a plain text userid and password, or with an encrypted password file instead.  

To take advantage of this new option, you'll use the "svrenc" command line utility to create an encrypted password file.  Information on the svrenc command can be found here: svrenc Command-Encrypt User and Password Credentials to a File

To build the encrypted password file execute this command:

svrenc -f <filename>

Then, let it prompt for userid and password.  The file will be placed in the folder where Harvest is installed and will have the "hidden" flag set so if you want to verify the file is there in Windows File Explorer be sure to check the checkbox to display hidden files.

For Userid and password usage the command syntax is

find-keywords-in-projects.bat -b <brokername> -vp <viewpath> -usr <username> -pw <password>


Example:

find-keywords-in-projects.bat -b example-broker -vp \SampleRepository -usr exampleuser -pw examplepassword


For dfo file usage the command syntax is

find-keywords-in-projects.bat -b <brokername> -vp <viewpath> -eh <full path and dfo file name>


Example:

find-keywords-in-projects.bat -b example-broker -vp \SampleRepository -eh "C:\Program Files\CA\SCM\testuser1.dfo"


It is offered as-is, and Broadcom Support cannot provide customizations or support beyond basic questions and answers about how to use it.
 

The user is free to use this idea as a starting point and customize to make it work for their particular set of requirements.

This script is experimental.  Broadcom is not responsible for the results of the script.

Additional Information

For the viewpath, if you are searching across many projects that do not all share the same repository, it can be difficult to figure out the viewpath to use with the command.  However, if you use "\\" as your viewpath, it works no matter the project or repository name.  For example:

find-keywords-in-projects.bat -b <my broker name> -vp "\\" -usr <userid> -pw <password>


If your password contains special characters, this can cause the command to not function correctly if you use the "userid and password" version of the command.  This is because of the way Windows batch scripts work.  In such cases, you should use the svrenc command as described above to create an encrypted password file, then use the "dfo file" version of the command.

The script will also produce a "hsv.tab" file in addition to the "hsv.log" file.  This tab-delimited text file includes project, state and keyword for each data line so that it can easily be imported into Excel for further analysis.

Attachments

find-keywords-in-projects_v5.zip get_app