[p4] Tracking a bug through its integration history?

Rick Macdonald rickmacd at shaw.ca
Thu Oct 25 08:41:47 PDT 2007


Roy -

I already do exactly this in a script, not to track bugs introduced, but 
to track bugs that are fixed.

You can create and attach a Job temporarily to the changelist that 
introduced the bug. Then, the "p4 jobs -i 
//depot/path/for/each/branch/to/test/..." will tell you if that fix 
(changelist) was integrated to that branch or not. The problem is that 
you have to test each potential target branch individually. In a script, 
you can get a list of dirs from the appropriate area of the depot with 
"p4 dirs -D //depot/path/area/..." (remove -D if you don't care about 
deleted directories) and just loop through it running "p4 jobs -i" for 
each. For each result, you check to see if the output contains the Job 
that you attached.

This can all be scripted, including the creation and deletion of the Job 
used to temporarily mark the changelist that introduced the bug. It 
sounds tedious, but in my case it's as simple as the perl code below 
because the destinations of all later integrations are within the 
"$parentPath/$module" area of the depot. The "$gnotes" variable is the 
Job number to track, which in my case already exists to be able to track 
fixes.

The key to all this in your case is that you can attach a Job to the 
changelist after the fact and Perforce will do the tracking for you!

    $result =  `$P4 dirs $parentPath/$module/v%%1 2>&1`;
    if( $result =~ /no such file/ ) {
        $result = "";
    }

    my($d, $found, $rel, $v, @versions);
    @versions = split /(?:\015{1,2}\012|\015|\012)/, $result;
    @versions = sort {$a <=> $b} @versions;
    $result = `$P4 jobs -l -e $gnotes 2>&1`;

    $found = 0;
    for $v (@versions) {
        ($rel) = $v =~ m,/([^/]+)$,;
        $result = `$P4 jobs -i $v/... 2>&1`;
        @result = split /(?:\015{1,2}\012|\015|\012)/, $result;
        for $d (@result) {
            if( $d =~ /^$gnotes/ ) {
                print "YES $module/$rel\n";
                $found = 1;
                last;
            }
        }
        if (! $found) {
            print "NO  $module/$rel\n";
        }
    }

...RickM...

Roy Smith wrote:
> In change 60384 (about a year ago), we introduced a bug.  In this  
> particular case, the bogus code was confined to a single source file,  
> but in the general case, it might not be.
>
> How do I find all the places this change has been propagated to via  
> integrations into various branches?  I know I can do "p4 filelog",  
> but that just gets the 1st generation of integrations.  It doesn't  
> recursively track all the places the change was integrated into after  
> that.
>
> -------------------
> Roy Smith <smith_roy at emc.com>
> Software Guy, EMC Common Management Group
> 44 South Broadway, 7th floor
> White Plains, NY 10601
> (914) 580-3427
> AIM: roysmith649
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>   


More information about the perforce-user mailing list