use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class BazaarScmProvider method checkout.
/**
* {@inheritDoc}
*/
public CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
BazaarCheckOutCommand command = new BazaarCheckOutCommand();
command.setLogger(getLogger());
return (CheckOutScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class VssScmProvider method checkout.
/**
* {@inheritDoc}
*/
public CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
VssCheckOutCommand command = new VssCheckOutCommand();
command.setLogger(getLogger());
return (CheckOutScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class TfsCheckOutCommand method executeCheckOutCommand.
protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v, boolean recursive, boolean shallow) throws ScmException {
TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
String url = tfsRepo.getServerPath();
String tfsUrl = tfsRepo.getTfsUrl();
String workspace = tfsRepo.getWorkspace();
// Try creating workspace
boolean workspaceProvided = workspace != null && !workspace.trim().equals("");
if (workspaceProvided) {
createWorkspace(r, f, workspace, tfsUrl);
}
TfsCommand command;
int status;
if (workspaceProvided) {
status = executeUnmapCommand(r, f);
}
ErrorStreamConsumer out = new ErrorStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
if (workspaceProvided) {
command = new TfsCommand("workfold", r, null, getLogger());
command.addArgument("-workspace:" + workspace);
command.addArgument("-map");
command.addArgument(url);
command.addArgument(f.getBasedir().getAbsolutePath());
status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (workfold map) command - " + status, err.getOutput(), false);
}
}
FileListConsumer fileConsumer = new FileListConsumer();
err = new ErrorStreamConsumer();
command = createGetCommand(r, f, v, recursive);
status = command.execute(fileConsumer, err);
if (status != 0 || err.hasBeenFed()) {
return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (get) command - " + status, err.getOutput(), false);
}
return new CheckOutScmResult(command.getCommandString(), fileConsumer.getFiles());
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class CheckInCommandTckTest method testCheckInCommandTest.
public void testCheckInCommandTest() throws Exception {
// Make sure that the correct files was checked out
File fooJava = new File(getWorkingCopy(), "src/main/java/Foo.java");
File barJava = new File(getWorkingCopy(), "src/main/java/Bar.java");
File readmeTxt = new File(getWorkingCopy(), "readme.txt");
assertFalse("check Foo.java doesn't yet exist", fooJava.canRead());
assertFalse("check Bar.java doesn't yet exist", barJava.canRead());
assertTrue("check can read readme.txt", readmeTxt.canRead());
// Change the files
createFooJava(fooJava);
createBarJava(barJava);
changeReadmeTxt(readmeTxt);
AddScmResult addResult = getScmManager().add(getScmRepository(), new ScmFileSet(getWorkingCopy(), "src/main/java/Foo.java", null));
assertResultIsSuccess(addResult);
CheckInScmResult result = getScmManager().checkIn(getScmRepository(), new ScmFileSet(getWorkingCopy()), "Commit message");
assertResultIsSuccess(result);
List<ScmFile> files = result.getCheckedInFiles();
assertNotNull(files);
assertEquals(2, files.size());
Map<String, ScmFile> fileMap = mapFilesByPath(files);
ScmFile file1 = fileMap.get("src/main/java/Foo.java");
assertNotNull(file1);
assertEquals(ScmFileStatus.CHECKED_IN, file1.getStatus());
ScmFile file2 = fileMap.get("readme.txt");
assertNotNull(file2);
assertEquals(ScmFileStatus.CHECKED_IN, file2.getStatus());
CheckOutScmResult checkoutResult = getScmManager().checkOut(getScmRepository(), new ScmFileSet(getAssertionCopy()));
assertResultIsSuccess(checkoutResult);
fooJava = new File(getAssertionCopy(), "src/main/java/Foo.java");
barJava = new File(getAssertionCopy(), "src/main/java/Bar.java");
readmeTxt = new File(getAssertionCopy(), "readme.txt");
assertTrue("check can read Foo.java", fooJava.canRead());
assertFalse("check Bar.java doesn't exist", barJava.canRead());
assertTrue("check can read readme.txt", readmeTxt.canRead());
assertEquals("check readme.txt contents", "changed file", FileUtils.fileRead(readmeTxt));
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project maven-scm by apache.
the class HgScmProvider method checkout.
/**
* {@inheritDoc}
*/
public CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
HgCheckOutCommand command = new HgCheckOutCommand();
command.setLogger(getLogger());
return (CheckOutScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations