use of org.apache.maven.scm.ScmBranch in project maven-scm by apache.
the class ClearCaseChangeLogCommandTest method testGetCommandLineWithTag.
public void testGetCommandLineWithTag() throws Exception {
Date startDate = null;
Date endDate = null;
testCommandLine(new ScmBranch("myBranch"), startDate, endDate, "cleartool lshistory -fmt \"NAME:%En\\nDATE:%Nd\\nCOMM:%-12.12o - %o - %c - Activity: %[activity]p\\nUSER:%u\\nREVI:%Ln\\n\" -recurse -nco -branch myBranch");
}
use of org.apache.maven.scm.ScmBranch 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.ScmBranch in project maven-scm by apache.
the class SvnBranchCommand method createCommandLine.
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, String branch, File messageFile, ScmBranchParameters scmBranchParameters) {
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
cl.createArg().setValue("copy");
cl.createArg().setValue("--parents");
cl.createArg().setValue("--file");
cl.createArg().setValue(messageFile.getAbsolutePath());
if (scmBranchParameters != null && scmBranchParameters.isRemoteBranching()) {
if (StringUtils.isNotBlank(scmBranchParameters.getScmRevision())) {
cl.createArg().setValue("--revision");
cl.createArg().setValue(scmBranchParameters.getScmRevision());
}
cl.createArg().setValue(SvnCommandUtils.fixUrl(repository.getUrl(), repository.getUser()));
} else {
cl.createArg().setValue(".");
}
// Note: this currently assumes you have the branch base checked out too
String branchUrl = SvnTagBranchUtils.resolveBranchUrl(repository, new ScmBranch(branch));
cl.createArg().setValue(SvnCommandUtils.fixUrl(branchUrl, repository.getUser()));
return cl;
}
use of org.apache.maven.scm.ScmBranch 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.ScmBranch in project maven-scm by apache.
the class SvnUpdateCommand method createCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmVersion version) {
Settings settings = SvnUtil.getSettings();
String workingDir = workingDirectory.getAbsolutePath();
if (settings.isUseCygwinPath()) {
workingDir = settings.getCygwinMountPath() + "/" + workingDir;
workingDir = StringUtils.replace(workingDir, ":", "");
workingDir = StringUtils.replace(workingDir, "\\", "/");
}
if (version != null && StringUtils.isEmpty(version.getName())) {
version = null;
}
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
if (version == null || SvnTagBranchUtils.isRevisionSpecifier(version)) {
cl.createArg().setValue("update");
if (version != null && StringUtils.isNotEmpty(version.getName())) {
cl.createArg().setValue("-r");
cl.createArg().setValue(version.getName());
}
cl.createArg().setValue(workingDir);
} else {
if (version instanceof ScmBranch) {
// The tag specified does not appear to be numeric, so assume it refers
// to a branch/tag url and perform a switch operation rather than update
cl.createArg().setValue("switch");
if (version instanceof ScmTag) {
cl.createArg().setValue(SvnTagBranchUtils.resolveTagUrl(repository, (ScmTag) version));
} else {
cl.createArg().setValue(SvnTagBranchUtils.resolveBranchUrl(repository, (ScmBranch) version));
}
cl.createArg().setValue(workingDir);
}
}
return cl;
}
Aggregations