/** * Creates a new commit and a new ref based on this commit. * * @param update helper information to define the update that will occur. * @param refName name of the ref that should be created * @return the commit that was created * @throws IOException if there is a storage problem and the update cannot be executed as * requested or if it failed because of a concurrent update to the same reference */ public RevCommit commitToNewRef(MetaDataUpdate update, String refName) throws IOException { BatchMetaDataUpdate batch = openUpdate(update); try { batch.write(update.getCommitBuilder()); return batch.createRef(refName); } finally { batch.close(); } }
/** * Update this metadata branch, recording a new commit on its reference. * * @param update helper information to define the update that will occur. * @return the commit that was created * @throws IOException if there is a storage problem and the update cannot be executed as * requested or if it failed because of a concurrent update to the same reference */ public RevCommit commit(MetaDataUpdate update) throws IOException { BatchMetaDataUpdate batch = openUpdate(update); try { batch.write(update.getCommitBuilder()); return batch.commit(); } finally { batch.close(); } }