use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class CvsCheckoutCommandTest method testCheckOutWithTag.
/**
* @todo move this test to the TCK - checkout with "revision", then have one for tag as well.
*/
public void testCheckOutWithTag() throws Exception {
if (!isSystemCmd(CvsScmTestUtils.CVS_COMMAND_LINE)) {
System.err.println("'" + CvsScmTestUtils.CVS_COMMAND_LINE + "' is not a system command. Ignored " + getName() + ".");
return;
}
ScmManager scmManager = getScmManager();
@SuppressWarnings("deprecation") CheckOutScmResult result = scmManager.getProviderByRepository(getScmRepository()).checkOut(getScmRepository(), getScmFileSet(), "MAVEN_1_0");
if (!result.isSuccess()) {
fail(result.getProviderMessage() + "\n" + result.getCommandOutput());
}
List<ScmFile> files = result.getCheckedOutFiles();
assertNotNull(files);
assertEquals(1, files.size());
File mavenUtils = assertCheckedOutFile(files, 0, "/src/java/org/apache/maven/MavenUtils.java", ScmFileStatus.UPDATED);
assertBetween(38403, 39511, mavenUtils.length());
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class BootstrapMojo method execute.
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException {
super.execute();
if (this.getCheckoutResult() != null) {
ScmResult checkoutResult = this.getCheckoutResult();
// At the time of useExport feature is requested only SVN and and CVS have export command implemented
// we will deal with this as more user using this feature specially clearcase where we need to
// add relativePathProjectDirectory support to ExportScmResult
String relativePathProjectDirectory = "";
if (checkoutResult instanceof CheckOutScmResult) {
relativePathProjectDirectory = ((CheckOutScmResult) checkoutResult).getRelativePathProjectDirectory();
}
runGoals(relativePathProjectDirectory);
}
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class AccuRevScmProvider method checkout.
@Override
protected CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
// workaround deprecated behaviour
// TODO pull up to AbstractScmProvider
AccuRevScmProviderRepository accuRevRepo = (AccuRevScmProviderRepository) repository;
if (!repository.isPersistCheckout() && accuRevRepo.shouldUseExportForNonPersistentCheckout()) {
ExportScmResult result = export(repository, fileSet, parameters);
if (result.isSuccess()) {
return new CheckOutScmResult(result.getCommandLine(), result.getExportedFiles(), accuRevRepo.getExportRelativePath());
} else {
return new CheckOutScmResult(result.getCommandLine(), result.getProviderMessage(), result.getCommandOutput(), false);
}
}
AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
return command.checkout(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class VssCheckOutCommand method executeCheckOutCommand.
/**
* {@inheritDoc}
*/
protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version, boolean recursive, boolean shallow) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkout command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
Commandline cl = buildCmdLine(repo, fileSet, version);
VssCheckOutConsumer consumer = new VssCheckOutConsumer(repo, getLogger());
// TODO handle deleted files from VSS
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = VssCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
String error = stderr.getOutput();
if (getLogger().isDebugEnabled()) {
getLogger().debug("VSS returns error: [" + error + "] return code: [" + exitCode + "]");
}
if (error.indexOf("A writable copy of") < 0) {
return new CheckOutScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
}
return new CheckOutScmResult(cl.toString(), consumer.getUpdatedFiles());
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class TfsScmProvider method checkout.
protected CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsCheckOutCommand command = new TfsCheckOutCommand();
command.setLogger(getLogger());
return (CheckOutScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations