since = new Date(geogig.command(ParseTimestamp.class).setString(args.since).call());
}
if (args.until != null) {
until = new Date(geogig.command(ParseTimestamp.class).setString(args.until).call());
if (args.all) {
throw new InvalidParameterException(
"Cannot specify 'until' commit when listing all branches");
}
}
op.setTimeRange(new Range<Date>(Date.class, since, until));
}
if (!args.sinceUntilPaths.isEmpty()) {
List<String> sinceUntil = ImmutableList.copyOf((Splitter.on("..")
.split(args.sinceUntilPaths.get(0))));
checkParameter(sinceUntil.size() == 1 || sinceUntil.size() == 2,
"Invalid refSpec format, expected [<until>]|[<since>..<until>]: %s",
args.sinceUntilPaths.get(0));
String sinceRefSpec;
String untilRefSpec;
if (sinceUntil.size() == 1) {
// just until was given
sinceRefSpec = null;
untilRefSpec = sinceUntil.get(0);
} else {
sinceRefSpec = sinceUntil.get(0);
untilRefSpec = sinceUntil.get(1);
}
if (sinceRefSpec != null) {
Optional<ObjectId> since;
since = geogig.command(RevParse.class).setRefSpec(sinceRefSpec).call();
checkParameter(since.isPresent(), "Object not found '%s'", sinceRefSpec);
op.setSince(since.get());
}
if (untilRefSpec != null) {
if (args.all) {
throw new InvalidParameterException(
"Cannot specify 'until' commit when listing all branches");
}
Optional<ObjectId> until;
until = geogig.command(RevParse.class).setRefSpec(untilRefSpec).call();
checkParameter(until.isPresent(), "Object not found '%s'", sinceRefSpec);