use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamDiffCommand method executeDiffCommand.
// ----------------------------------------------------------------------
// AbstractDiffCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected DiffScmResult executeDiffCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
if (fileSet.getFileList().isEmpty()) {
throw new ScmException("This provider doesn't support diff command on a subsets of a directory");
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamDiffConsumer consumer = new StarteamDiffConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
Commandline cl = createCommandLine(repository, fileSet, startVersion, endVersion);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new DiffScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
return new DiffScmResult(cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamEditCommand method executeEditCommand.
// ----------------------------------------------------------------------
// AbstractEditCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamEditConsumer consumer = new StarteamEditConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> editFiles = fileSet.getFileList();
if (editFiles.size() == 0) {
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// edit only interested files already on the local disk
for (int i = 0; i < editFiles.size(); ++i) {
ScmFileSet editFile = new ScmFileSet(fileSet.getBasedir(), (File) editFiles.get(i));
Commandline cl = createCommandLine(repository, editFile);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new EditScmResult(null, consumer.getEditedFiles());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamUnEditCommand method executeUnEditCommand.
// ----------------------------------------------------------------------
// AbstractEditCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected ScmResult executeUnEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamUnEditConsumer consumer = new StarteamUnEditConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> unlockFiles = fileSet.getFileList();
if (unlockFiles.size() == 0) {
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UnEditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// edit only interested files already on the local disk
for (int i = 0; i < unlockFiles.size(); ++i) {
ScmFileSet unlockFile = new ScmFileSet(fileSet.getBasedir(), (File) unlockFiles.get(i));
Commandline cl = createCommandLine(repository, unlockFile);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UnEditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new UnEditScmResult(null, consumer.getUnEditFiles());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamAddCommandTest method testCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet fileSet, String crPath, String commandLine) throws Exception {
ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
Commandline cl = StarteamAddCommand.createCommandLine(repository, fileSet, crPath);
assertCommandLine(commandLine, null, cl);
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamCheckInCommandTest method testCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet fileSet, String message, ScmVersion version, String issueType, String issueValue, String commandLine) throws Exception {
ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
Commandline cl = StarteamCheckInCommand.createCommandLine(repository, fileSet, message, version, issueType, issueValue);
assertCommandLine(commandLine, null, cl);
}
Aggregations