use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.
the class ListCommandTckTest method runList.
private List<ScmFile> runList(ScmFileSet fileSet, boolean recursive) throws Exception {
ScmProvider provider = getScmManager().getProviderByUrl(getScmUrl());
ListScmResult result = provider.list(getScmRepository(), fileSet, recursive, (ScmVersion) null);
assertTrue("SCM command failed: " + result.getCommandLine() + " : " + result.getProviderMessage() + (result.getCommandOutput() == null ? "" : ": " + result.getCommandOutput()), result.isSuccess());
return result.getFiles();
}
use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.
the class GitListCommand method executeListCommand.
/**
* {@inheritDoc}
*/
protected ListScmResult executeListCommand(ScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, ScmVersion scmVersion) throws ScmException {
GitScmProviderRepository repository = (GitScmProviderRepository) repo;
if (GitScmProviderRepository.PROTOCOL_FILE.equals(repository.getFetchInfo().getProtocol()) && repository.getFetchInfo().getPath().indexOf(fileSet.getBasedir().getPath()) >= 0) {
throw new ScmException("remote repository must not be the working directory");
}
int exitCode;
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
GitListConsumer consumer = new GitListConsumer(getLogger(), fileSet.getBasedir().getParentFile(), ScmFileStatus.CHECKED_IN);
Commandline cl = createCommandLine(repository, fileSet.getBasedir());
exitCode = GitCommandLineUtils.execute(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new ListScmResult(cl.toString(), "The git-ls-files command failed.", stderr.getOutput(), false);
}
return new ListScmResult(cl.toString(), consumer.getListedFiles());
}
use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.
the class TfsScmProvider method list.
protected ListScmResult list(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsListCommand command = new TfsListCommand();
command.setLogger(getLogger());
return (ListScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.
the class CvsExeListCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected ListScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsListConsumer consumer = new CvsListConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new ListScmResult(cl.toString(), "The cvs command failed.", stderr.getOutput(), false);
}
return new ListScmResult(cl.toString(), consumer.getEntries());
}
use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.
the class SvnMkdirCommandTckTest method testMkdirCommandDirAlreadyAdded.
public void testMkdirCommandDirAlreadyAdded() throws Exception {
ScmFileSet fileSet = new ScmFileSet(getWorkingCopy(), new File(getMissingDirectory()));
MkdirScmResult result = getScmManager().mkdir(getScmRepository(), fileSet, null, false);
assertResultIsSuccess(result);
assertNotNull(result.getRevision());
ListScmResult listResult = getScmManager().list(getScmRepository(), fileSet, true, null);
assertTrue("Directory should have been found.", listResult.isSuccess());
// add the directory again
result = getScmManager().mkdir(getScmRepository(), fileSet, null, false);
printOutputError(result);
assertFalse(result.isSuccess());
}
Aggregations