use of org.apache.maven.scm.provider.accurev.AccuRev in project maven-scm by apache.
the class AccuRevExportCommand method extractSource.
@Override
protected List<File> extractSource(AccuRevScmProviderRepository repository, File basedir, AccuRevVersion version) throws AccuRevException {
AccuRev accuRev = repository.getAccuRev();
AccuRevInfo info = accuRev.info(basedir);
String basisStream = version.getBasisStream();
String transactionId = version.getTimeSpec();
if (!AccuRevVersion.isNow(transactionId) && !AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported(accuRev.getClientVersion())) {
getLogger().warn(String.format("Ignoring transaction id %s, Export can only extract current sources", transactionId));
transactionId = "now";
} else {
// We might be heading to a transaction id that is not yet available on a replica
accuRev.syncReplica();
}
boolean removedWorkspace = false;
if (info.isWorkSpace()) {
String stat = accuRev.stat(basedir);
if (stat != null) {
throw new AccuRevException(String.format("Cannot populate %s, as it is a non-ignored " + "subdirectory of workspace %s rooted at %s.", basedir.getAbsolutePath(), info.getWorkSpace(), info.getTop()));
}
// ok, the subdirectory must be ignored. temporarily remove the workspace.
removedWorkspace = accuRev.rmws(info.getWorkSpace());
}
try {
File path = new File(repository.getDepotRelativeProjectPath());
return accuRev.popExternal(basedir, basisStream, transactionId, Collections.singletonList(path));
} finally {
if (removedWorkspace) {
accuRev.reactivate(info.getWorkSpace());
}
}
}
Aggregations