use of org.apache.maven.scm.ScmFile 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.ScmFile 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.ScmFile in project maven-scm by apache.
the class StarteamCheckOutConsumer method processCheckedOutFile.
private void processCheckedOutFile(String line, int pos) {
String checkedOutFilePath = this.currentDir + "/" + line.substring(0, pos);
this.files.add(new ScmFile(checkedOutFilePath, ScmFileStatus.CHECKED_OUT));
if (logger.isInfoEnabled()) {
logger.info("Checked out: " + checkedOutFilePath);
}
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class StarteamDiffConsumer method extractCurrentFile.
private void extractCurrentFile(String line, int pos) {
currentFile = line.substring(0, pos);
changedFiles.add(new ScmFile(currentFile, ScmFileStatus.MODIFIED));
currentDifference = new StringBuilder();
differences.put(currentFile, currentDifference);
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class StarteamRemoveConsumerTest method testParse.
public void testParse() throws Exception {
File basedir = new File("/usr/scm-starteam/driver");
StarteamRemoveConsumer consumer = new StarteamRemoveConsumer(new DefaultLog(), basedir);
for (int i = 0; i < TEST_OUTPUT.length; ++i) {
consumer.consumeLine(TEST_OUTPUT[i]);
}
Collection<ScmFile> entries = consumer.getRemovedFiles();
assertEquals("Wrong number of entries returned", 7, entries.size());
for (ScmFile entry : entries) {
assertTrue(entry.getPath().startsWith("./"));
assertTrue(entry.getStatus() == ScmFileStatus.DELETED);
}
}
Aggregations