use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyCheckOutCommand method executeCheckOutCommand.
/**
* {@inheritDoc}
*/
protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version, boolean recursive, boolean shallow) throws ScmException {
if (fileSet.getFileList().size() != 0) {
throw new ScmException("This provider doesn't support checking out subsets of a project");
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkout command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug(fileSet.toString());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
File waPath;
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (projectSpec != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("A working project already exists [" + projectSpec + "].");
}
SynergyUtil.synchronize(getLogger(), projectSpec, ccmAddr);
} else {
SynergyUtil.checkoutProject(getLogger(), null, repo.getProjectSpec(), version, repo.getProjectPurpose(), repo.getProjectRelease(), ccmAddr);
projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (getLogger().isInfoEnabled()) {
getLogger().info("A new working project [" + projectSpec + "] was created.");
}
}
SynergyUtil.reconfigure(getLogger(), projectSpec, ccmAddr);
waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
File source = new File(waPath, repo.getProjectName());
if (getLogger().isInfoEnabled()) {
getLogger().info("We will now copy files from Synergy Work Area [" + source + "] to expected folder [" + fileSet.getBasedir() + "]");
}
// Move files to the expected folder
try {
FileUtils.copyDirectoryStructure(source, fileSet.getBasedir());
} catch (IOException e1) {
throw new ScmException("Unable to copy directory structure", e1);
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("We will list content of checkout directory.");
}
// We need to list files in the directory
List<ScmFile> files = new ArrayList<ScmFile>();
try {
@SuppressWarnings("unchecked") List<File> realFiles = FileUtils.getFiles(fileSet.getBasedir(), null, "_ccmwaid.inf");
for (File f : realFiles) {
files.add(new ScmFile(f.getPath(), ScmFileStatus.CHECKED_OUT));
}
} catch (IOException e) {
throw new ScmException("Unable to list files in checkout directory", e);
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("checkout command end successfully ...");
}
return new CheckOutScmResult(files, new ScmResult("multiple commandline", "OK", "OK", true));
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing remove 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, false);
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Delete file [" + source + "].");
}
dest.delete();
}
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> scmFiles = new ArrayList<ScmFile>();
for (File file : fileSet.getFileList()) {
scmFiles.add(new ScmFile(file.getPath(), ScmFileStatus.DELETED));
}
return new StatusScmResult("", scmFiles);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyUpdateCommand method executeUpdateCommand.
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing update command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
File waPath;
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
SynergyUtil.reconfigureProperties(getLogger(), projectSpec, ccmAddr);
SynergyUtil.reconfigure(getLogger(), projectSpec, ccmAddr);
// We need to get WA path
waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
File source = new File(waPath, repo.getProjectName());
// Move file from work area to expected dir if not the same
List<ScmFile> modifications = new ArrayList<ScmFile>();
if (!source.equals(fileSet.getBasedir())) {
if (getLogger().isInfoEnabled()) {
getLogger().info("We will copy modified files from Synergy Work Area [" + source + "] to expected folder [" + fileSet.getBasedir() + "]");
}
try {
copyDirectoryStructure(source, fileSet.getBasedir(), modifications);
} catch (IOException e1) {
throw new ScmException("Unable to copy directory structure", e1);
}
}
return new UpdateScmResult("ccm reconcile -uwa ...", modifications);
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyChangeLogCommand method executeChangeLogCommand.
/**
* {@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...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
List<ChangeSet> csList = new ArrayList<ChangeSet>();
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (projectSpec == null) {
throw new ScmException("You should checkout a working project first");
}
List<SynergyTask> tasks = SynergyUtil.getCompletedTasks(getLogger(), projectSpec, startDate, endDate, ccmAddr);
for (SynergyTask t : tasks) {
ChangeSet cs = new ChangeSet();
cs.setAuthor(t.getUsername());
cs.setComment("Task " + t.getNumber() + ": " + t.getComment());
cs.setDate(t.getModifiedTime());
cs.setFiles(SynergyUtil.getModifiedObjects(getLogger(), t.getNumber(), ccmAddr));
csList.add(cs);
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
return new ChangeLogScmResult("ccm query ...", new ChangeLogSet(csList, startDate, endDate));
}
use of org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository in project maven-scm by apache.
the class SynergyCheckInCommand method executeCheckInCommand.
/**
* {@inheritDoc}
*/
protected CheckInScmResult executeCheckInCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, ScmVersion version) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkin command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug(fileSet.toString());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
SynergyTaskManager.getInstance().checkinDefaultTask(getLogger(), 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.CHECKED_IN));
}
return new CheckInScmResult("ccm checkin", scmFiles);
}
Aggregations