use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyTagCommand method executeTagCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeTagCommand(ScmProviderRepository repository, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing tag command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), SynergyRole.BUILD_MGR);
try {
// Make sure, that all changes made until now are reflected in the prep project
// this is especially true for all changes made by maven (ie versions in the poms).
SynergyUtil.reconfigureProperties(getLogger(), repo.getProjectSpec(), ccmAddr);
SynergyUtil.reconfigure(getLogger(), repo.getProjectSpec(), ccmAddr);
SynergyUtil.createBaseline(getLogger(), repo.getProjectSpec(), tag, repo.getProjectRelease(), repo.getProjectPurpose(), ccmAddr);
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> files = new ArrayList<ScmFile>(fileSet.getFileList().size());
for (File f : fileSet.getFileList()) {
files.add(new ScmFile(f.getPath(), ScmFileStatus.TAGGED));
}
return new TagScmResult("", files);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyAddCommand method executeAddCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeAddCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean binary) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing add command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
if (message == null || message.equals("")) {
message = "Maven SCM Synergy provider: adding file(s) to project " + repo.getProjectSpec();
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
int taskNum = SynergyUtil.createTask(getLogger(), message, repo.getProjectRelease(), true, ccmAddr);
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (projectSpec == null) {
throw new ScmException("You should checkout a working project first");
}
File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
File destPath = new File(waPath, repo.getProjectName());
for (File source : fileSet.getFileList()) {
File dest = new File(destPath, SynergyUtil.removePrefix(fileSet.getBasedir(), source));
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Copy file [" + source + "] to Synergy Work Area [" + dest + "].");
}
try {
FileUtils.copyFile(source, dest);
} catch (IOException e) {
throw new ScmException("Unable to copy file in Work Area", e);
}
}
SynergyUtil.create(getLogger(), dest, message, ccmAddr);
}
SynergyUtil.checkinTask(getLogger(), taskNum, message, ccmAddr);
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> scmFiles = new ArrayList<ScmFile>(fileSet.getFileList().size());
for (File f : fileSet.getFileList()) {
scmFiles.add(new ScmFile(f.getPath(), ScmFileStatus.ADDED));
}
return new AddScmResult("", scmFiles);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing edit command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug(fileSet.toString());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
File sourcePath = new File(waPath, repo.getProjectName());
if (projectSpec == null) {
throw new ScmException("You should checkout project first");
}
int taskNum = SynergyUtil.createTask(getLogger(), "Maven SCM Synergy provider: edit command for project " + repo.getProjectSpec(), repo.getProjectRelease(), true, ccmAddr);
if (getLogger().isInfoEnabled()) {
getLogger().info("Task " + taskNum + " was created to perform checkout.");
}
for (File f : fileSet.getFileList()) {
File dest = f;
File source = new File(sourcePath, SynergyUtil.removePrefix(fileSet.getBasedir(), f));
List<File> list = new LinkedList<File>();
list.add(source);
SynergyUtil.checkoutFiles(getLogger(), list, ccmAddr);
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Copy file [" + source + "] to expected folder [" + dest + "].");
}
try {
FileUtils.copyFile(source, dest);
} catch (IOException e) {
throw new ScmException("Unable to copy file from Work Area", e);
}
}
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> scmFiles = new ArrayList<ScmFile>(fileSet.getFileList().size());
for (File f : fileSet.getFileList()) {
scmFiles.add(new ScmFile(f.getPath(), ScmFileStatus.EDITED));
}
return new EditScmResult("", scmFiles);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyStatusCommand method executeStatusCommand.
/**
* {@inheritDoc}
*/
protected StatusScmResult executeStatusCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing status command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
List<String> l;
try {
l = SynergyUtil.getWorkingFiles(getLogger(), repo.getProjectSpec(), repo.getProjectRelease(), ccmAddr);
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> result = new LinkedList<ScmFile>();
for (String filename : l) {
ScmFile f = new ScmFile(filename, ScmFileStatus.MODIFIED);
result.add(f);
}
return new StatusScmResult("ccm dir", result);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyUnEditCommand method executeUnEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeUnEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing unedit command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (projectSpec == null) {
throw new ScmException("You should checkout a working project first");
}
File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
File destPath = new File(waPath, repo.getProjectName());
for (File f : fileSet.getFileList()) {
File source = new File(fileSet.getBasedir(), f.getPath());
File dest = new File(destPath, f.getPath());
SynergyUtil.delete(getLogger(), dest, ccmAddr, true);
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Copy file [" + dest + "] to [" + source + "].");
}
try {
FileUtils.copyFile(dest, source);
} catch (IOException e) {
throw new ScmException("Unable to restore file in output folder", e);
}
}
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> files = new ArrayList<ScmFile>();
for (File f : fileSet.getFileList()) {
files.add(new ScmFile(f.getPath(), ScmFileStatus.UNKNOWN));
}
return new UnEditScmResult("", files);
}
Aggregations