use of org.apache.maven.scm.ScmVersion in project maven-scm by apache.
the class AbstractScmProvider method diff.
/**
* {@inheritDoc}
*
* @deprecated
*/
public DiffScmResult diff(ScmRepository repository, ScmFileSet fileSet, String startRevision, String endRevision) throws ScmException {
ScmVersion startVersion = null;
ScmVersion endVersion = null;
if (StringUtils.isNotEmpty(startRevision)) {
startVersion = new ScmRevision(startRevision);
}
if (StringUtils.isNotEmpty(endRevision)) {
endVersion = new ScmRevision(endRevision);
}
return diff(repository, fileSet, startVersion, endVersion);
}
use of org.apache.maven.scm.ScmVersion in project maven-scm by apache.
the class AbstractChangeLogCommand method executeCommand.
/**
* {@inheritDoc}
*/
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
Date startDate = parameters.getDate(CommandParameter.START_DATE, null);
Date endDate = parameters.getDate(CommandParameter.END_DATE, null);
int numDays = parameters.getInt(CommandParameter.NUM_DAYS, 0);
Integer limit = parameters.getInt(CommandParameter.LIMIT, -1);
if (limit < 1) {
limit = null;
}
ScmBranch branch = (ScmBranch) parameters.getScmVersion(CommandParameter.BRANCH, null);
ScmVersion startVersion = parameters.getScmVersion(CommandParameter.START_SCM_VERSION, null);
ScmVersion endVersion = parameters.getScmVersion(CommandParameter.END_SCM_VERSION, null);
String datePattern = parameters.getString(CommandParameter.CHANGELOG_DATE_PATTERN, null);
if (startVersion != null || endVersion != null) {
return executeChangeLogCommand(repository, fileSet, startVersion, endVersion, datePattern);
} else {
if (numDays != 0 && (startDate != null || endDate != null)) {
throw new ScmException("Start or end date cannot be set if num days is set.");
}
if (endDate != null && startDate == null) {
throw new ScmException("The end date is set but the start date isn't.");
}
if (numDays > 0) {
@SuppressWarnings("checkstyle:magicnumber") int day = 24 * 60 * 60 * 1000;
startDate = new Date(System.currentTimeMillis() - (long) numDays * day);
endDate = new Date(System.currentTimeMillis() + (long) day);
} else if (endDate == null) {
endDate = new Date();
}
return executeChangeLogCommand(repository, fileSet, startDate, endDate, branch, datePattern);
}
}
use of org.apache.maven.scm.ScmVersion in project maven-scm by apache.
the class MavenScmCli method main.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public static void main(String[] args) {
MavenScmCli cli;
try {
cli = new MavenScmCli();
} catch (Exception ex) {
System.err.println("Error while starting Maven Scm.");
ex.printStackTrace(System.err);
return;
}
String scmUrl;
String command;
if (args.length != 3) {
System.err.println("Usage: maven-scm-client <command> <working directory> <scm url> [<scmVersion> [<scmVersionType>]]");
System.err.println("scmVersion is a branch name/tag name/revision number.");
System.err.println("scmVersionType can be 'branch', 'tag', 'revision'. " + "The default value is 'revision'.");
return;
}
command = args[0];
// SCM-641
File workingDirectory = new File(args[1]).getAbsoluteFile();
scmUrl = args[2];
ScmVersion scmVersion = null;
if (args.length > 3) {
String version = args[3];
if (args.length > 4) {
String type = args[4];
if ("tag".equals(type)) {
scmVersion = new ScmTag(version);
} else if ("branch".equals(type)) {
scmVersion = new ScmBranch(version);
} else if ("revision".equals(type)) {
scmVersion = new ScmRevision(version);
} else {
throw new IllegalArgumentException("'" + type + "' version type isn't known.");
}
} else {
scmVersion = new ScmRevision(args[3]);
}
}
cli.execute(scmUrl, command, workingDirectory, scmVersion);
cli.stop();
}
use of org.apache.maven.scm.ScmVersion in project maven-scm by apache.
the class AbstractCheckInCommand method executeCommand.
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
String message = parameters.getString(CommandParameter.MESSAGE);
ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
return executeCheckInCommand(repository, fileSet, message, scmVersion);
}
use of org.apache.maven.scm.ScmVersion in project maven-scm by apache.
the class AbstractDiffCommand method executeCommand.
/**
* {@inheritDoc}
*/
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ScmVersion startRevision = parameters.getScmVersion(CommandParameter.START_SCM_VERSION, null);
ScmVersion endRevision = parameters.getScmVersion(CommandParameter.END_SCM_VERSION, null);
return executeDiffCommand(repository, fileSet, startRevision, endRevision);
}
Aggregations