More Software posts
May 07, 2005
What's fixed in this build?

This describes how we find part of the answer to this question at work. First you need to know that we use perforce for source control and bugzilla for defect tracking. Each time we make a build for QA the build process labels the source code using the p4 label and p4 labelsync commands. So what we need to do is to find what changed between two labels and translate that into what bugs were fixed.

Perforce and bugzilla are linked using p4dti so that each bug in bugzilla becomes a job in perforce and changes to the status of the job are propogated to changes to the status of the bug. Therefore, if we know what jobs were fixed between two builds we know which bugs were closed.

Based on information from this perforce technical note I devised the following procedure.

First find the highest numbered changelist in each label. This can be done using the command p4 changes -m 1 //path/to/release/...@label for each label.

Now find all the changes that apply to the release between the two release found in the first step. p4 changes //path/to/release/...@change1,@change2

Finally, find for each change which jobs it fixes and these jobs are the bugzilla changes that we're after. p4 fixes -c changeNumber

All of this can be incorporated into a little shell script that returns the result we're after. I've put the script on the next page because the lines don't wrap well. The last line does the following, finds all of the changes, uses cut to extract just the change numbers, uses xargs to call p4 fixes for each change, uses cut to extract the perforce job names returned, and finally uses sort to order the result and remove any duplicates.

get_change_number() {
    release=$1
    build=$2
    CHANGE=`p4 changes -m1 //path/to/releases/$release/...@$build | cut -f 2 -d ' '`
}

if [ $# -ne 3 ]
then
    echo "Usage: changes.sh   "
    exit 1
fi

RELEASE=$1
FROM_BUILD=$2
TO_BUILD=$3
get_change_number $RELEASE $FROM_BUILD
change1=$CHANGE
get_change_number $RELEASE $TO_BUILD
change2=$CHANGE

p4 changes //path/to/releases/$RELEASE/...@$change1,@$change2 | cut -f 2 -d ' ' | xargs -n 1 p4 fixes -c | cut -f 1 -d ' ' | sort -u
Posted by Alex at May 07, 2005 09:38 PM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?