[Anthill-pro] Changeset ID script returning 0
Christopher Power
chrispower36 at gmail.com
Thu Jan 3 18:07:10 CST 2008
Great, that fixed it. Thanks.
On Jan 3, 2008 5:50 PM, Eric Minick <etm at urbancode.com> wrote:
> Chris,
>
> Nope, this is a known error in what we did with this script.
>
> Change this:
>
> ChangeSet[] changesetArray = changelogArray[i];
> to
> ChangeSet[] changesetArray = changelogArray[i].getChangeSetArray();
>
> and
> highestChangeSetCount = getMaxChangeSet(life);
> to
> highestChangeSet = getMaxChangeSet(life);
>
> -- Eric
>
> Christopher Power wrote:
> > When I run my build, and it runs the following changeset id script,
> > the logging output at the end outputs 0. Am I doing something wrong?
> >
> > import com.urbancode.vcsdriver3.*;
> > import com.urbancode.anthill3.domain.buildlife.* ;
> > import com.urbancode.anthill3.runtime.scripting.helpers.*;
> >
> > static transient private org.apache.log4j.Logger log =
> > org.apache.log4j.Logger.getLogger("MESSAGE");
> >
> > int getMaxChangeSet(BuildLife life) {
> > int result = 0;
> >
> > ChangeLog[] changelogArray = ChangeLogHelper.getChangeLogArray(life);
> > for (int i = 0; i < changelogArray.length; i++)
> > {
> > ChangeSet[] changesetArray = changelogArray[i];
> > for (int j = 0; j < changesetArray.length; j++)
> > {
> > ChangeSet changeset = changesetArray[j];
> > id = changeset.getId();
> > // edit out the "r" character for svn
> > if ( id.startsWith("r"))
> > {
> > id = id.substring(1);
> > }
> > int num = (new Integer(id.trim())).intValue();
> > if (num > result)
> > {
> > result = num;
> > }
> > }
> > }
> > return result;
> > }
> >
> > // If there is no changelog, look up the previous build
> > // and take the highest number from that (if present, else keep
> > searching).
> > int highestChangeset = 0;
> > BuildLife life = BuildLifeLookup.getCurrent();
> > while(highestChangeSetCount == 0 && life != null)
> > {
> > highestChangeSetCount = getMaxChangeSet(life);
> > life = life.getPrevBuildLife();
> > }
> >
> > log.warn("Found changeset id = " + highestChangeset + ", for build
> > life = " + life.getVersion());
> > stampContext.put("changeset", ""+highestChangeset);
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Anthill-pro mailing list
> > Anthill-pro at lists.urbancode.com
> > http://lists.urbancode.com/mailman/listinfo/anthill-pro
> >
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080103/216b2eea/attachment-0001.htm
More information about the Anthill-pro
mailing list