if (refList.isEmpty()) {
ref = null;
} else {
ref = refList.get(0);
}
Deduplicator deduplicator = cli.getGeogig().command(CreateDeduplicator.class).call();
try {
Iterator<RevObject> iter = cli.getGeogig() //
.command(WalkGraphOp.class).setReference(ref) //
.setDeduplicator(deduplicator) //
// .setStrategy(lsStrategy) //
.call();
final ConsoleReader console = cli.getConsole();
if (!iter.hasNext()) {
if (ref == null) {
console.println("The working tree is empty");
} else {
console.println("The specified path is empty");
}
return;
}
Function<RevObject, CharSequence> printFunctor = new Function<RevObject, CharSequence>() {
@Override
public CharSequence apply(RevObject input) {
if (verbose) {
return String.format("%s: %s %s", input.getId(), input.getType(), input);
} else {
return String.format("%s: %s", input.getId(), input.getType());
}
}
};
Iterator<CharSequence> lines = Iterators.transform(iter, printFunctor);
while (lines.hasNext()) {
console.println(lines.next());
}
console.flush();
} finally {
deduplicator.release();
}
}