Fog Creek Software
Discussion Board




Having trouble with logBugDataP4.pl

Hi,

I seem to be having trouble with logBugDataP4.pl when it's called from a Perforce submit trigger, or even when I run it from the command line myself with all the correct parameters.

It seems the following bit of code is never finding the "BugzID: num" in my log message:
#
# Get BUG number if its there
#
$ixBug = 0;
if ($logmsg =~ /^\s*Bug[zs]*\s*IDs*\s*[#:; ]+(\d+)$/i)
{
        $ixBug = int($1);
}

After this bit of code, $ixBug is still 0, even though it should be 162 (in my case). I've tested that the log message is there by displaying it before and after this bit of code gets called.

In the log message the BugzID bit always prefixed with a tab or spaces (not sure), could this be causing the problem?

has anyone else had to make changes to the script to get it working, and if so what did you need to do?

I'm running on Mac OS X 10.3.6.

Ian Jones
Wednesday, December 15, 2004

Tabs and spaces are fine at the beginning of the line, but anything after the bug number is not.

For example:
  BugzID:6
That works.

BugzID:6 I fixed this bug yesterday.
That does not work.

BugzID:6 (space character after the 6)
That does not work.

If you remove the $ in the pattern above, it will work.

Michael H. Pryor
Fog Creek Software
Wednesday, December 15, 2004

Hmmm, I had tried that already, but I tried again and this time with "BugzID:6" rather than "BugzID: 6", and then again with it being the only description, didn't work.

I stripped the code block down to the below (making it very restrictive):
#
# Get BUG number if its there
#
$ixBug = 0;
if ($logmsg =~ /\s*BugzID:+(\d+)/i)
{
        $ixBug = int($1);
}

And this worked on the command line, but not in an actual trigger from a submit.

Any other ideas Michael?

Ian Jones
Thursday, December 16, 2004

It seems to me it's not the regex but the integration overall that is the problem. Please double check every step here:

http://www.fogcreek.com/FogBUGZ/help/PerforcePerl.html

Do you have perforce passwords enabled?

If you can't find anything that went wrong in the implementation of these steps (typo? incorrect file path? unreachable BUGZ_SERVER?) you can send an email to tech support and please include a screenshot of what status messages are returned when you check something in with a bugzid: 123 in it.

https://shop.fogcreek.com/support/

Dmitri Kalmar
Fog Creek Software
Thursday, December 16, 2004

Well, finally found the problems.

First was that the way I start the p4d server meant it didn't have the path to the p4 client, so the script when called couldn't get the info it needed. Easily fixed by adding /usr/local/bin/p4 in the script where $p4 is set.

I think there were also some problems in the way the $ixBug var was being populated from a another variable, so I used the same schema found in logBugData.pl (the CVS script) to grab the bug IDs from within a foreach. I then extended the foreach to wrap the file parsing so that it now can handle multiple bug IDs.

If anyone wants a copy of my logBugzP4.pl script so that they can now capture multiple Bug IDs from Perforce, please email me from this post.

That's assuming Fog Creek are happy with me re-distributing this bit of code, please let me know.

Ian Jones
Friday, December 17, 2004

*  Recent Topics

*  Fog Creek Home