[Anthill-pro] Changeset ID script returning 0
Christopher Power
chrispower36 at gmail.com
Thu Jan 3 16:38:32 CST 2008
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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080103/667a3238/attachment.htm
More information about the Anthill-pro
mailing list