use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class CvsExeTagCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected TagScmResult executeCvsCommand(Commandline cl) throws ScmException {
int exitCode;
CvsTagConsumer consumer = new CvsTagConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
// TODO: Improve this error message
return new TagScmResult(cl.toString(), "The cvs tag command failed.", stderr.getOutput(), false);
}
return new TagScmResult(cl.toString(), consumer.getTaggedFiles());
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class AccuRevTagCommand method executeAccurevCommand.
@Override
protected ScmResult executeAccurevCommand(AccuRevScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException, AccuRevException {
AccuRev accuRev = repository.getAccuRev();
String snapshotName = parameters.getString(CommandParameter.TAG_NAME);
snapshotName = repository.getSnapshotName(snapshotName);
File basedir = fileSet.getBasedir();
boolean success = true;
AccuRevInfo info = accuRev.info(basedir);
List<File> taggedFiles = null;
success = accuRev.mksnap(snapshotName, info.getBasis());
if (success) {
taggedFiles = accuRev.statTag(snapshotName);
}
if (success && taggedFiles != null) {
return new TagScmResult(accuRev.getCommandLines(), getScmFiles(taggedFiles, ScmFileStatus.TAGGED));
} else {
return new TagScmResult(accuRev.getCommandLines(), "AccuRev error", accuRev.getErrorOutput(), false);
}
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class TfsTagCommand method executeTagCommand.
protected ScmResult executeTagCommand(ScmProviderRepository r, ScmFileSet f, String tag, ScmTagParameters scmTagParameters) throws ScmException {
TfsCommand command = createCommand(r, f, tag, scmTagParameters);
StringStreamConsumer out = new StringStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new TagScmResult(command.getCommandString(), "Error code for TFS label command - " + status, err.getOutput(), false);
}
List<ScmFile> files = new ArrayList<ScmFile>(f.getFileList().size());
for (File file : f.getFileList()) {
files.add(new ScmFile(file.getPath(), ScmFileStatus.TAGGED));
}
return new TagScmResult(command.getCommandString(), files);
}
use of org.apache.maven.scm.command.tag.TagScmResult in project maven-scm by apache.
the class TfsScmProvider method tag.
protected TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsTagCommand command = new TfsTagCommand();
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 VssTagCommand method executeTagCommand.
/**
* @see org.apache.maven.scm.command.tag.AbstractTagCommand#executeTagCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String, java.lang.String)
*/
protected ScmResult executeTagCommand(ScmProviderRepository repository, ScmFileSet fileSet, String tagName, String message) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing tag command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
Commandline cl = buildCmdLine(repo, fileSet, tagName, message);
VssTagConsumer consumer = new VssTagConsumer(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 TagScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
}
return new TagScmResult(cl.toString(), consumer.getUpdatedFiles());
}
Aggregations