Good catch, although -
I copied the script and then updated manually since I wanted to try if EQU
V/S LEQ and GEQ makes any difference. It didn't make any difference.
I had tried with /B option on Exit and that didn't make any difference
too...
What actually fixes it is adding port and user as follows.
p4 -u %2 -p %3 describe -s %1|findstr "Jobs"
When I ran script on Command Line outside perforce, it took default user
and port but when I run it through Trigger, it requires user and port.
I hope that Perforce changes their documentation to mention this as must...
I spent good bit of time on this silly script.
Thanks
Regards,
Neeta Roy
"Bruce McPeek"
<brucem@vidiator. To: "Neeta ROY"
<Neeta.ROY@xxxxxxxxxxxxxxxxx>, <perforce-user@xxxxxxxxxxxx>
com> cc:
bcc:
12/29/2005 02:01 Subject: RE: [p4] Trigger /
Script NoJobs Attached issue
PM
Neeta,
I suspect that you may want to add the /B flag to your EXIT commands.
D:\>exit /?
Quits the CMD.EXE program (command interpreter) or the current batch
script.
= = = =
EXIT [/B] [exitCode]
/B specifies to exit the current batch script instead of
CMD.EXE. If executed from outside a batch script, it
will quit CMD.EXE
exitCode specifies a numeric number. if /B is specified, sets
ERRORLEVEL that number. If quitting CMD.EXE, sets the
process
exit code with that number.
= = = =
I'm not sure if you did a copy and paste of your script, but as shown
here, there is a syntax error.
The line
if %ERRORLEVEL% GQU 1 goto nojobfound
Should probably be
if %ERRORLEVEL% GEQ 1 goto nojobfound
If you are trying for "greater than or equal"...
Style-wise, "I" would put some logic at the end of your :doit section to
catch cases of falling through the ERRORLEVEL checking. I would also put
some logic after your change number test so that the script does not
continue. Your style may vary.
I hope this helps,
Bruce
-----Original Message-----
From: perforce-user-bounces@xxxxxxxxxxxx
[mailto:perforce-user-bounces@xxxxxxxxxxxx] On Behalf Of Neeta ROY
Sent: Thursday, December 29, 2005 9:23 AM
To: perforce-user@xxxxxxxxxxxx
Subject: [p4] Trigger / Script NoJobs Attached issue
This is my Script Batch file that I run from trigger table.
Either Job is attached or not Submit fails. %ERRORLEVEL% is always 1.
If I run this Batch file from command line, I get correct result.
Any ideas what am I doing wrong?
NoJob.Bat file contains:
@echo off
if not x%1==x goto doit
echo Usage is %0[change#]
:doit
p4 describe -s %1|findstr "Jobs"
if %ERRORLEVEL% GQU 1 goto nojobfound
if %ERRORLEVEL% LEQ 0 goto jobfound
:nojobfound
echo No jobs FOUND for changelist %1
EXIT 1
:jobfound
echo JOB FOUND
EXIT 0
The trigger table has this entry.
Sample Submit //v2c/... "C:/NoJob.bat %changelist%"
Regards,
Neeta Roy
_______________________________________________
perforce-user mailing list - perforce-user@xxxxxxxxxxxx
http://maillist.perforce.com/mailman/listinfo/perforce-user
_______________________________________________
perforce-user mailing list - perforce-user@xxxxxxxxxxxx
http://maillist.perforce.com/mailman/listinfo/perforce-user
|