use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class TfsCheckOutCommandTest method testCommand.
public void testCommand() {
consumer.consumeLine("C:\\temp\\maven\\c8:");
consumer.consumeLine("Replacing .tpattributes");
consumer.consumeLine("Replacing .classpath");
consumer.consumeLine("Replacing .myclasspath");
consumer.consumeLine("Replacing .project");
consumer.consumeLine("");
consumer.consumeLine("C:\\temp\\maven\\c8\\.settings:");
consumer.consumeLine("");
consumer.consumeLine("C:\\temp\\maven\\c8:");
consumer.consumeLine("Replacing .tpignore");
consumer.consumeLine("Replacing about.html");
consumer.consumeLine("");
consumer.consumeLine("C:\\temp\\maven\\c8\\bin:");
consumer.consumeLine("");
consumer.consumeLine("C:\\temp\\maven\\c8:");
consumer.consumeLine("Replacing build.properties");
consumer.consumeLine("Replacing customBuildCallbacks.xml");
consumer.consumeLine("");
String exp1 = new File("C:\\temp\\maven\\c8", ".classpath").getAbsolutePath();
String exp2 = new File("C:\\temp\\maven\\c8", "build.properties").getAbsolutePath();
ScmFile expFile1 = new ScmFile(exp1, ScmFileStatus.CHECKED_OUT);
ScmFile expFile2 = new ScmFile(exp2, ScmFileStatus.CHECKED_OUT);
assertNotNull(consumer.getFiles());
assertEquals(11, consumer.getFiles().size());
assertTrue(consumer.getFiles().contains(expFile1));
assertTrue(consumer.getFiles().contains(expFile2));
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class ChangedFileConsumer method extractChangedFile.
private void extractChangedFile() {
String change = getChange();
if (change != null) {
ScmFileStatus stat = ScmFileStatus.UNKNOWN;
if (change.equals(ChangedFileConsumer.CHANGE_EDIT)) {
stat = ScmFileStatus.MODIFIED;
}
if (change.equals(ChangedFileConsumer.CHANGE_ADD)) {
stat = ScmFileStatus.ADDED;
}
changedFiles.add(new ScmFile(getLocalPath(), stat));
values.clear();
}
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class FileListConsumer method consumeLine.
public void consumeLine(String line) {
fed = true;
if (line.endsWith(":")) {
currentDir = line.substring(0, line.lastIndexOf(':'));
ScmFile scmFile = new ScmFile(currentDir, ScmFileStatus.CHECKED_OUT);
if (!files.contains(scmFile)) {
files.add(scmFile);
}
} else if (line.trim().equals("")) {
currentDir = "";
} else if (!currentDir.equals("") && line.indexOf(' ') >= 0) {
String filename = line.split(" ")[1];
files.add(getScmFile(filename));
} else {
files.add(getScmFile(line));
}
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class MavenScmCli method checkOut.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private void checkOut(ScmRepository scmRepository, File workingDirectory, ScmVersion version) throws ScmException {
if (workingDirectory.exists()) {
System.err.println("The working directory already exist: '" + workingDirectory.getAbsolutePath() + "'.");
return;
}
if (!workingDirectory.mkdirs()) {
System.err.println("Error while making the working directory: '" + workingDirectory.getAbsolutePath() + "'.");
return;
}
CheckOutScmResult result = scmManager.checkOut(scmRepository, new ScmFileSet(workingDirectory), version);
if (!result.isSuccess()) {
showError(result);
return;
}
List<ScmFile> checkedOutFiles = result.getCheckedOutFiles();
System.out.println("Checked out these files: ");
for (ScmFile file : checkedOutFiles) {
System.out.println(" " + file.getPath());
}
}
use of org.apache.maven.scm.ScmFile in project maven-scm by apache.
the class MavenScmCli method update.
private void update(ScmRepository scmRepository, File workingDirectory, ScmVersion version) throws ScmException {
if (!workingDirectory.exists()) {
System.err.println("The working directory doesn't exist: '" + workingDirectory.getAbsolutePath() + "'.");
return;
}
UpdateScmResult result = scmManager.update(scmRepository, new ScmFileSet(workingDirectory), version);
if (!result.isSuccess()) {
showError(result);
return;
}
List<ScmFile> updatedFiles = result.getUpdatedFiles();
System.out.println("Updated these files: ");
for (ScmFile file : updatedFiles) {
System.out.println(" " + file.getPath());
}
}
Aggregations