use of org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository in project maven-scm by apache.
the class VssCheckInCommand method executeCheckInCommand.
/**
* (non-Javadoc)
*
* @see org.apache.maven.scm.command.checkin.AbstractCheckInCommand# executeCheckInCommand
* (org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet,
* java.lang.String, org.apache.maven.scm.ScmVersion)
*/
protected CheckInScmResult executeCheckInCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, ScmVersion scmVersion) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkin command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
List<Commandline> commandLines = buildCmdLine(repo, fileSet, scmVersion);
VssCheckInConsumer consumer = new VssCheckInConsumer(repo, getLogger());
// TODO handle deleted files from VSS
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
StringBuilder sb = new StringBuilder();
for (Commandline cl : commandLines) {
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 CheckInScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
}
}
return new CheckInScmResult(sb.toString(), new ArrayList<ScmFile>());
}
use of org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository in project maven-scm by apache.
the class VssEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkout command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
List<Commandline> commandLines = buildCmdLine(repo, fileSet);
VssEditConsumer consumer = new VssEditConsumer(repo, getLogger());
// TODO handle deleted files from VSS
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
StringBuilder sb = new StringBuilder();
List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
for (Commandline cl : commandLines) {
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 EditScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
break;
}
sb.append(cl.toString() + '\n');
updatedFiles.addAll(consumer.getUpdatedFiles());
}
return new EditScmResult(sb.toString(), updatedFiles);
}
use of org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository in project maven-scm by apache.
the class VssUpdateCommand method executeUpdateCommand.
// TODO handle deleted files from VSS
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing update command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
Commandline cl = buildCmdLine(repo, fileSet, version);
VssUpdateConsumer consumer = new VssUpdateConsumer(repo, getLogger());
// TODO handle deleted files from VSS
// TODO identify local files
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 UpdateScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
}
return new UpdateScmResult(cl.toString(), consumer.getUpdatedFiles());
}
use of org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository in project maven-scm by apache.
the class VssScmProviderTest method testUrl.
private void testUrl(String scmUrl, String expectedVssDir, String expectedProjectPath, String expectedUser, String expectedPassword) throws Exception {
ScmRepository repository = scmManager.makeScmRepository(scmUrl);
assertNotNull("ScmManager.makeScmRepository() returned null", repository);
assertNotNull("The provider repository was null.", repository.getProviderRepository());
assertTrue("The SCM Repository isn't a " + VssScmProviderRepository.class.getName() + ".", repository.getProviderRepository() instanceof VssScmProviderRepository);
VssScmProviderRepository providerRepository = (VssScmProviderRepository) repository.getProviderRepository();
assertEquals("vssdir is incorrect", expectedVssDir, providerRepository.getVssdir());
assertEquals("projectPath is incorrect", expectedProjectPath, providerRepository.getProject());
assertEquals("User is incorrect", expectedUser, providerRepository.getUser());
assertEquals("Password is incorrect", expectedPassword, providerRepository.getPassword());
}
Aggregations