use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class AccuRevTagCommandTest method testAccuRevError.
@Test
public void testAccuRevError() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(new File("/my/workspace/project/dir"));
final File basedir = testFileSet.getBasedir();
final String basisStream = "basisStream";
final AccuRevInfo info = new AccuRevInfo(basedir);
info.setBasis(basisStream);
AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository();
repo.setStreamName("myStream");
repo.setAccuRev(accurev);
repo.setProjectPath("/project/dir");
when(accurev.info(basedir)).thenReturn(info);
when(accurev.mksnap("theTagName", basisStream)).thenReturn(Boolean.FALSE);
AccuRevTagCommand command = new AccuRevTagCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.TAG_NAME, "theTagName");
TagScmResult result = command.tag(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class PerforceScmProvider method tag.
protected TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
PerforceTagCommand command = new PerforceTagCommand();
command.setLogger(getLogger());
return (TagScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class LocalScmProvider method tag.
/**
* {@inheritDoc}
*/
public TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
LocalTagCommand command = new LocalTagCommand();
command.setLogger(getLogger());
return (TagScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class ClearCaseScmProvider method tag.
/**
* {@inheritDoc}
*/
public TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ClearCaseTagCommand command = new ClearCaseTagCommand();
command.setLogger(getLogger());
return (TagScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class BazaarTagCommand method executeTagCommand.
protected ScmResult executeTagCommand(ScmProviderRepository repository, ScmFileSet fileSet, String tagName, ScmTagParameters scmTagParameters) throws ScmException {
if (tagName == null || StringUtils.isEmpty(tagName.trim())) {
throw new ScmException("tag name must be specified");
}
if (!fileSet.getFileList().isEmpty()) {
throw new ScmException("tagging specific files is not allowed");
}
// Perform the tagging operation
File bazaarRoot = fileSet.getBasedir();
BazaarConsumer consumer = new BazaarConsumer(getLogger());
String[] tagCmd = new String[] { BazaarConstants.TAG_CMD, tagName };
ScmResult tagResult = BazaarUtils.execute(consumer, getLogger(), bazaarRoot, tagCmd);
if (!tagResult.isSuccess()) {
return new TagScmResult(null, tagResult);
}
// Do "bzr ls -R -r tag:tagName" to get a list of the tagged files
BazaarLsConsumer lsConsumer = new BazaarLsConsumer(getLogger(), bazaarRoot, ScmFileStatus.TAGGED);
String[] lsCmd = new String[] { BazaarConstants.LS_CMD, BazaarConstants.RECURSIVE_OPTION, BazaarConstants.REVISION_OPTION, "tag:" + tagName };
ScmResult lsResult = BazaarUtils.execute(lsConsumer, getLogger(), bazaarRoot, lsCmd);
if (!lsResult.isSuccess()) {
return new TagScmResult(null, lsResult);
}
// Push new tags to parent branch if any
BazaarScmProviderRepository bazaarRepository = (BazaarScmProviderRepository) repository;
if (!bazaarRepository.getURI().equals(fileSet.getBasedir().getAbsolutePath()) && repository.isPushChanges()) {
String[] pushCmd = new String[] { BazaarConstants.PUSH_CMD, bazaarRepository.getURI() };
ScmResult pushResult = BazaarUtils.execute(new BazaarConsumer(getLogger()), getLogger(), fileSet.getBasedir(), pushCmd);
if (!pushResult.isSuccess()) {
return new TagScmResult(null, pushResult);
}
}
return new TagScmResult(lsConsumer.getListedFiles(), tagResult);
}
Aggregations