* @param lastBuildTime
* @param checkTime
* @return CommandLine for "cvs -d CVSROOT -q log -N -dlastbuildtime<checktime "
*/
public Commandline buildHistoryCommand(Date lastBuildTime, Date checkTime) throws CruiseControlException {
Commandline commandLine = getCommandline();
commandLine.setExecutable("cvs");
if (cvsroot != null) {
commandLine.createArgument().setValue("-d");
commandLine.createArgument().setValue(cvsroot);
}
commandLine.createArgument().setValue("-q");
if (local != null) {
commandLine.setWorkingDirectory(local);
commandLine.createArgument().setValue("log");
} else {
commandLine.createArgument().setValue("rlog");
}
boolean useHead = tag == null || tag.equals(CVS_HEAD_TAG) || tag.equals("");
if (useHead) {
commandLine.createArgument().setValue("-N");
}
String dateRange = formatCVSDate(lastBuildTime) + "<" + formatCVSDate(checkTime);
commandLine.createArgument().setValue("-d" + dateRange);
if (!useHead) {
// add -b and -rTAG to list changes relative to the current branch,
// not relative to the default branch, which is HEAD
// note: -r cannot have a space between itself and the tag spec.
commandLine.createArgument().setValue("-r" + tag);
} else {
// This is used to include the head only if a Tag is not specified.
commandLine.createArgument().setValue("-b");
}
if (local == null) {
commandLine.createArgument().setValue(module);
}
return commandLine;
}