use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamUpdateCommand method executeUpdateCommand.
// ----------------------------------------------------------------------
// AbstractUpdateCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamCheckOutConsumer consumer = new StarteamCheckOutConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> updateFiles = fileSet.getFileList();
if (updateFiles.size() == 0) {
// update everything
Commandline cl = createCommandLine(repository, fileSet, version);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UpdateScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
} else {
// hiden feature to allow Continuous Integration machine to
// delete local files. It affectively remove all build ouput as well
String doDeleteLocal = System.getProperty("maven.scm.starteam.deleteLocal");
if ("true".equalsIgnoreCase(doDeleteLocal)) {
this.deleteLocal(repository, fileSet, version);
}
}
} else {
// update only interested files already on the local disk
for (int i = 0; i < updateFiles.size(); ++i) {
File updateFile = (File) updateFiles.get(i);
ScmFileSet scmFileSet = new ScmFileSet(fileSet.getBasedir(), updateFile);
Commandline cl = createCommandLine(repository, scmFileSet, version);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UpdateScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new UpdateScmResult(null, consumer.getCheckedOutFiles());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamChangeLogCommandTest method testCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet workingCopy, String commandLine) throws Exception {
ScmRepository repository = getScmManager().makeScmRepository(scmUrl);
StarteamScmProviderRepository svnRepository = (StarteamScmProviderRepository) repository.getProviderRepository();
Commandline cl = StarteamChangeLogCommand.createCommandLine(svnRepository, workingCopy, null);
assertCommandLine(commandLine, null, cl);
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamCheckInCommand method executeCheckInCommand.
// ----------------------------------------------------------------------
// AbstractCheckInCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected CheckInScmResult executeCheckInCommand(ScmProviderRepository repo, ScmFileSet fileSet, String message, ScmVersion version) throws ScmException {
// work around until maven-scm-api allow this
String issueType = System.getProperty("maven.scm.issue.type");
String issueValue = System.getProperty("maven.scm.issue.value");
String deprecatedIssue = System.getProperty("maven.scm.issue");
if (deprecatedIssue != null && deprecatedIssue.trim().length() > 0) {
issueType = "cr";
issueValue = deprecatedIssue;
}
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamCheckInConsumer consumer = new StarteamCheckInConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> checkInFiles = fileSet.getFileList();
if (checkInFiles.isEmpty()) {
Commandline cl = createCommandLine(repository, fileSet, message, version, issueType, issueValue);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new CheckInScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// update only interested files already on the local disk
for (int i = 0; i < checkInFiles.size(); ++i) {
ScmFileSet checkInFile = new ScmFileSet(fileSet.getBasedir(), (File) checkInFiles.get(i));
Commandline cl = createCommandLine(repository, checkInFile, message, version, issueType, issueValue);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new CheckInScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new CheckInScmResult(null, consumer.getCheckedInFiles());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repo, ScmFileSet fileSet, String message) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamCheckInConsumer consumer = new StarteamCheckInConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> remvoveFiles = fileSet.getFileList();
if (remvoveFiles.size() == 0) {
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new RemoveScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// update only interested files already on the local disk
for (int i = 0; i < remvoveFiles.size(); ++i) {
File fileToBeRemoved = (File) remvoveFiles.get(i);
ScmFileSet scmFileSet = new ScmFileSet(fileSet.getBasedir(), fileToBeRemoved);
Commandline cl = createCommandLine(repository, scmFileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new RemoveScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new RemoveScmResult(null, consumer.getCheckedInFiles());
}
use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.
the class StarteamCheckOutCommandTest method testCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet workingCopy, ScmVersion version, String commandLine) throws Exception {
ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
Commandline cl = StarteamCheckOutCommand.createCommandLine(repository, workingCopy, version);
assertCommandLine(commandLine, null, cl);
}
Aggregations