use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class StarteamCheckInConsumerTest method testParse.
public void testParse() throws Exception {
File basedir = new File("/usr/scm-starteam/driver");
StarteamCheckInConsumer consumer = new StarteamCheckInConsumer(new DefaultLog(), basedir);
for (int i = 0; i < TEST_OUTPUT.length; ++i) {
consumer.consumeLine(TEST_OUTPUT[i]);
}
Collection<ScmFile> entries = consumer.getCheckedInFiles();
assertEquals("Wrong number of entries returned", 4, entries.size());
;
for (ScmFile entry : entries) {
assertTrue(entry.getPath().startsWith("./"));
assertTrue(entry.getStatus() == ScmFileStatus.CHECKED_OUT);
}
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class StarteamCheckOutConsumerTest method testParse.
private void testParse(File basedir) throws Exception {
StarteamCheckOutConsumer consumer = new StarteamCheckOutConsumer(new DefaultLog(), basedir);
for (int i = 0; i < TEST_OUTPUT.length; ++i) {
consumer.consumeLine(TEST_OUTPUT[i]);
}
Collection<ScmFile> entries = consumer.getCheckedOutFiles();
assertEquals("Wrong number of entries returned", 9, entries.size());
;
for (ScmFile entry : entries) {
assertTrue(entry.getPath().startsWith("./"));
assertTrue(entry.getStatus() == ScmFileStatus.CHECKED_OUT);
}
}
use of org.apache.maven.scm.ScmFile 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);
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class AbstractUpdateCommand method executeCommand.
/**
* {@inheritDoc}
*/
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
boolean runChangelog = Boolean.valueOf(parameters.getString(CommandParameter.RUN_CHANGELOG_WITH_UPDATE, "true")).booleanValue();
UpdateScmResult updateScmResult = executeUpdateCommand(repository, fileSet, scmVersion);
List<ScmFile> filesList = updateScmResult.getUpdatedFiles();
if (!runChangelog) {
return updateScmResult;
}
ChangeLogCommand changeLogCmd = getChangeLogCommand();
if (filesList != null && filesList.size() > 0 && changeLogCmd != null) {
ChangeLogScmResult changeLogScmResult = (ChangeLogScmResult) changeLogCmd.executeCommand(repository, fileSet, parameters);
List<ChangeSet> changes = new ArrayList<ChangeSet>();
ChangeLogSet changeLogSet = changeLogScmResult.getChangeLog();
if (changeLogSet != null) {
Date startDate = null;
try {
startDate = parameters.getDate(CommandParameter.START_DATE);
} catch (ScmException e) {
// Do nothing, startDate isn't define.
}
for (ChangeSet change : changeLogSet.getChangeSets()) {
if (startDate != null && change.getDate() != null) {
if (startDate.after(change.getDate())) {
continue;
}
}
for (ScmFile currentFile : filesList) {
if (change.containsFilename(currentFile.getPath())) {
changes.add(change);
break;
}
}
}
}
updateScmResult.setChanges(changes);
}
return updateScmResult;
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class MavenScmCli method checkIn.
private void checkIn(ScmRepository scmRepository, File workingDirectory, ScmVersion version) throws ScmException {
if (!workingDirectory.exists()) {
System.err.println("The working directory doesn't exist: '" + workingDirectory.getAbsolutePath() + "'.");
return;
}
String message = "";
CheckInScmResult result = scmManager.checkIn(scmRepository, new ScmFileSet(workingDirectory), version, message);
if (!result.isSuccess()) {
showError(result);
return;
}
List<ScmFile> checkedInFiles = result.getCheckedInFiles();
System.out.println("Checked in these files: ");
for (ScmFile file : checkedInFiles) {
System.out.println(" " + file.getPath());
}
}
Aggregations