use of org.codehaus.plexus.util.cli.CommandLineException in project maven-scm by apache.
the class ClearCaseBlameCommand method executeBlameCommand.
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing blame command...");
}
Commandline cl = createCommandLine(workingDirectory.getBasedir(), filename);
ClearCaseBlameConsumer consumer = new ClearCaseBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing cvs command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
}
return new BlameScmResult(cl.toString(), consumer.getLines());
}
use of org.codehaus.plexus.util.cli.CommandLineException in project maven-scm by apache.
the class ClearCaseChangeLogCommand method executeChangeLogCommand.
// ----------------------------------------------------------------------
// AbstractChangeLogCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected ChangeLogScmResult executeChangeLogCommand(ScmProviderRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing changelog command...");
}
Commandline cl = createCommandLine(fileSet.getBasedir(), branch, startDate);
ClearCaseChangeLogConsumer consumer = new ClearCaseChangeLogConsumer(getLogger(), datePattern);
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing cvs command.", ex);
}
if (exitCode != 0) {
return new ChangeLogScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
}
return new ChangeLogScmResult(cl.toString(), new ChangeLogSet(consumer.getModifications(), startDate, endDate));
}
use of org.codehaus.plexus.util.cli.CommandLineException in project maven-scm by apache.
the class ClearCaseCheckInCommand method executeCheckInCommand.
// ----------------------------------------------------------------------
// AbstractCheckOutCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected CheckInScmResult executeCheckInCommand(ScmProviderRepository scmProviderRepository, ScmFileSet fileSet, String message, ScmVersion version) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkin command...");
}
Commandline cl = createCommandLine(fileSet, message);
ClearCaseCheckInConsumer consumer = new ClearCaseCheckInConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing clearcase command.", ex);
}
if (exitCode != 0) {
return new CheckInScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
}
return new CheckInScmResult(cl.toString(), consumer.getCheckedInFiles());
}
use of org.codehaus.plexus.util.cli.CommandLineException in project maven-scm by apache.
the class ClearCaseStatusCommand method executeStatusCommand.
/**
* {@inheritDoc}
*/
protected StatusScmResult executeStatusCommand(ScmProviderRepository scmProviderRepository, ScmFileSet scmFileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing status command...");
}
Commandline cl = createCommandLine(scmFileSet);
ClearCaseStatusConsumer consumer = new ClearCaseStatusConsumer(getLogger(), scmFileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing clearcase command.", ex);
}
if (exitCode != 0) {
return new StatusScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
}
return new StatusScmResult(cl.toString(), consumer.getCheckedOutFiles());
}
use of org.codehaus.plexus.util.cli.CommandLineException in project maven-scm by apache.
the class CvsExeChangeLogCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected ChangeLogScmResult executeCvsCommand(Commandline cl, Date startDate, Date endDate, ScmVersion startVersion, ScmVersion endVersion, String datePattern) throws ScmException {
CvsChangeLogConsumer consumer = new CvsChangeLogConsumer(getLogger(), datePattern);
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing cvs command.", ex);
}
if (exitCode != 0) {
return new ChangeLogScmResult(cl.toString(), "The cvs command failed.", stderr.getOutput(), false);
}
ChangeLogSet changeLogSet = new ChangeLogSet(consumer.getModifications(), startDate, endDate);
changeLogSet.setStartVersion(startVersion);
changeLogSet.setEndVersion(endVersion);
return new ChangeLogScmResult(cl.toString(), changeLogSet);
}
Aggregations