*/
@Override
public RevisionMetadata getMetadata(Revision revision) {
HgClonedRepository tipClone = tipCloneSupplier.get();
if (!tipClone.getRepositoryName().equals(revision.repositoryName)) {
throw new MoeProblem(
String.format("Could not get metadata: Revision %s is in repository %s instead of %s",
revision.revId, revision.repositoryName, tipClone.getRepositoryName()));
}
ImmutableList<String> args = ImmutableList.of(
"log",
"--rev=" + revision.revId,
// Ensure one revision only, to be safe.
"--limit=1",
// Format output as "changesetID < author < date < description < parents".
// Since parents is a list, need to use stringify before applying another filter.
"--template={node|escape} < {author|escape} < {date|date|escape} < " +
"{desc|escape} < {parents|stringify|escape}",
// Use the debug option to get all parents
"--debug");
String log;
try {
log = HgRepository.runHgCommand(args, tipClone.getLocalTempDir().getAbsolutePath());
} catch (CommandException e) {
throw new MoeProblem(
String.format("Failed hg run: %s %d %s %s",
args.toString(),
e.returnStatus,
e.stdout,
e.stderr));