if (status.getModified().size() == 0 && status.getAdded().size() == 0 && status.getRemoved().size() == 0) {
newRevision = Nodeid.NULL;
return new Outcome(Kind.Failure, "nothing to add");
}
final Internals implRepo = Internals.getInstance(repo);
CommitFacility cf = new CommitFacility(implRepo, parentRevs[0], parentRevs[1]);
for (Path m : status.getModified()) {
HgDataFile df = repo.getFileNode(m);
cf.add(df, new WorkingCopyContent(df));
}
for (Path a : status.getAdded()) {
HgDataFile df = repo.getFileNode(a); // TODO need smth explicit, like repo.createNewFileNode(Path) here
// XXX might be an interesting exercise not to demand a content supplier, but instead return a "DataRequester"
// object, that would indicate interest in data, and this code would "push" it to requester, so that any exception
// is handled here, right away, and won't need to travel supplier and CommitFacility. (although try/catch inside
// supplier.read (with empty throws declaration)
cf.add(df, new FileContentSupplier(repo, a));
}
for (Path r : status.getRemoved()) {
HgDataFile df = repo.getFileNode(r);
cf.forget(df);
}
cf.branch(detectBranch());
cf.user(detectUser());
Transaction.Factory trFactory = implRepo.getTransactionFactory();
Transaction tr = trFactory.create(repo);
try {
newRevision = cf.commit(message, tr);
tr.commit();
} catch (RuntimeException ex) {
tr.rollback();
throw ex;
} catch (HgException ex) {