use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class AccuRevTagCommandTckTest method testReleasePluginStyleTagThenCheckout.
@SuppressWarnings("deprecation")
@Test
public void testReleasePluginStyleTagThenCheckout() throws Exception {
String tag = "test-tag";
makeFile(getWorkingCopy(), ".acignore", "target/*\ntarget\n");
ScmRepository scmRepository = getScmRepository();
addToWorkingTree(getWorkingCopy(), new File(".acignore"), scmRepository);
CheckInScmResult checkinResult = getScmManager().checkIn(scmRepository, new ScmFileSet(getWorkingCopy()), "add acignore");
assertResultIsSuccess(checkinResult);
TagScmResult tagResult = getScmManager().getProviderByUrl(getScmUrl()).tag(scmRepository, new ScmFileSet(getWorkingCopy()), tag);
assertResultIsSuccess(tagResult);
scmRepository.getProviderRepository().setPersistCheckout(false);
CheckOutScmResult checkoutResult = getScmManager().checkOut(scmRepository, new ScmFileSet(new File(getWorkingCopy(), "target/checkout")), new ScmTag(tag));
assertResultIsSuccess(checkoutResult);
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class JazzCheckOutCommand method createJazzLoadCommand.
public JazzScmCommand createJazzLoadCommand(JazzScmProviderRepository repo, ScmFileSet fileSet, ScmVersion scmVersion) {
JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_LOAD, JazzConstants.ARG_FORCE, repo, fileSet, getLogger());
if (fileSet != null) {
command.addArgument(JazzConstants.ARG_LOCAL_WORKSPACE_PATH);
command.addArgument(fileSet.getBasedir().getAbsolutePath());
}
// This works in tandem with the Tag Command.
// Currently, RTC can not check out directly from a snapshot.
// So, as a work around, the Tag Command creates a workspace name of the same name as the snapshot.
// The functionality here (in using the ScmTag or ScmBranch) assumes that the workspace has been
// created as a part of the Tag Command.
String workspace = repo.getRepositoryWorkspace();
if (scmVersion != null && StringUtils.isNotEmpty(scmVersion.getName())) {
// Just in case we ever do something different for Tags (snapshots) and Branches (streams)
if (scmVersion instanceof ScmTag) {
workspace = scmVersion.getName();
} else if (scmVersion instanceof ScmBranch) {
workspace = scmVersion.getName();
}
}
command.addArgument(workspace);
return command;
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class SvnChangeLogCommand method createCommandLine.
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmBranch branch, Date startDate, Date endDate, ScmVersion startVersion, ScmVersion endVersion, Integer limit) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
cl.createArg().setValue("log");
cl.createArg().setValue("-v");
if (limit != null && limit > 0) {
cl.createArg().setValue("--limit");
cl.createArg().setValue(Integer.toString(limit));
}
if (startDate != null) {
cl.createArg().setValue("-r");
if (endDate != null) {
cl.createArg().setValue("{" + dateFormat.format(startDate) + "}" + ":" + "{" + dateFormat.format(endDate) + "}");
} else {
cl.createArg().setValue("{" + dateFormat.format(startDate) + "}:HEAD");
}
}
if (startVersion != null) {
cl.createArg().setValue("-r");
if (endVersion != null) {
if (startVersion.getName().equals(endVersion.getName())) {
cl.createArg().setValue(startVersion.getName());
} else {
cl.createArg().setValue(startVersion.getName() + ":" + endVersion.getName());
}
} else {
cl.createArg().setValue(startVersion.getName() + ":HEAD");
}
}
if (branch != null && StringUtils.isNotEmpty(branch.getName())) {
// the changelog of that branch, but limit it to paths that also occur in this repository.
if (branch instanceof ScmTag) {
cl.createArg().setValue(SvnTagBranchUtils.resolveTagUrl(repository, (ScmTag) branch));
} else {
cl.createArg().setValue(SvnTagBranchUtils.resolveBranchUrl(repository, branch));
}
}
if (endVersion == null || !StringUtils.equals("BASE", endVersion.getName())) {
cl.createArg().setValue(repository.getUrl());
}
return cl;
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class SvnCheckOutCommand method executeCheckOutCommand.
/**
* {@inheritDoc}
*/
protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version, boolean recursive, boolean shallow) throws ScmException {
SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;
String url = repository.getUrl();
if (version != null && StringUtils.isNotEmpty(version.getName())) {
if (version instanceof ScmTag) {
url = SvnTagBranchUtils.resolveTagUrl(repository, (ScmTag) version);
} else if (version instanceof ScmBranch) {
url = SvnTagBranchUtils.resolveBranchUrl(repository, (ScmBranch) version);
}
}
url = SvnCommandUtils.fixUrl(url, repository.getUser());
Commandline cl = createCommandLine(repository, fileSet.getBasedir(), version, url, recursive);
SvnCheckOutConsumer consumer = new SvnCheckOutConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
if (getLogger().isInfoEnabled()) {
getLogger().info("Executing: " + SvnCommandLineUtils.cryptPassword(cl));
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
}
}
try {
exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr, getLogger());
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new CheckOutScmResult(cl.toString(), "The svn command failed.", stderr.getOutput(), false);
}
return new CheckOutScmResult(cl.toString(), Integer.toString(consumer.getRevision()), consumer.getCheckedOutFiles());
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class SvnTagCommand method createCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
/**
* @deprecated
* @param repository
* @param workingDirectory
* @param tag
* @param messageFile
* @return
*/
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, String tag, File messageFile) {
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
cl.createArg().setValue("copy");
cl.createArg().setValue("--parents");
cl.createArg().setValue("--file");
cl.createArg().setValue(messageFile.getAbsolutePath());
cl.createArg().setValue(".");
// Note: this currently assumes you have the tag base checked out too
String tagUrl = SvnTagBranchUtils.resolveTagUrl(repository, new ScmTag(tag));
cl.createArg().setValue(SvnCommandUtils.fixUrl(tagUrl, repository.getUser()));
return cl;
}
Aggregations