search cancel

Harvest setup

book

Article ID: 216078

calendar_today

Updated On:

Products

CA Harvest Software Change Manager

Issue/Introduction

Is it possible to prevent users from selecting a package name and doing a checkout for update when they don’t select any item?  The developers have done it 3 times already.  Apparently Harvest does a checkout of the whole project.

Environment

Release : 13.0.3

Component : CA HARVEST SCM GUI/Harweb

Resolution

OK, for this one, what we need to do is set up a simple batch script to check and see if files were selected, and return with an exit code if none were found.  Something like this would work:

echo off
set /a count=0
:next
if .%1.==.. goto end
set /a count=%count% + 1
shift
goto next
:end
echo %count% files found
if %count% LSS 1 exit 1
echo We're done

I did this testing on Windows but it would be simple to translate this to Linux batch script.

And then set this script up as a pre-link to the Check Out for Update process.  The Program Name field would look like this:

C:\Users\Administrator\Test.bat ["version"]

Then, if only the package name was selected for checkout, you’d get an error that looks something like this and the checkout fails:

---------- Begin  <Check Out for Update>  Process ---------------
I00020133: C:\Windows\system32>echo off .
I00020133: 0 files found.
E03020516: Execution of server UDP program C:\Users\Administrator\Test.bat  has failed. Exit code: 1.
S10060050: The PreLinked process(es) failed for parent process: Check Out for Update.
E03060019: Process Execute failed. Process Name: Check Out for Update.
---------- End  <Check Out for Update>  Process ---------------