Search in sources :

Example 1 with TreeCreator

use of com.google.gerrit.server.edit.tree.TreeCreator in project gerrit by GerritCodeReview.

the class ChangeEditModifier method createNewTree.

private static ObjectId createNewTree(Repository repository, RevCommit baseCommit, List<TreeModification> treeModifications) throws IOException, InvalidChangeOperationException {
    TreeCreator treeCreator = new TreeCreator(baseCommit);
    treeCreator.addTreeModifications(treeModifications);
    ObjectId newTreeId = treeCreator.createNewTreeAndGetId(repository);
    if (ObjectId.equals(newTreeId, baseCommit.getTree())) {
        throw new InvalidChangeOperationException("no changes were made");
    }
    return newTreeId;
}
Also used : InvalidChangeOperationException(com.google.gerrit.server.project.InvalidChangeOperationException) TreeCreator(com.google.gerrit.server.edit.tree.TreeCreator) ObjectId(org.eclipse.jgit.lib.ObjectId)

Aggregations

TreeCreator (com.google.gerrit.server.edit.tree.TreeCreator)1 InvalidChangeOperationException (com.google.gerrit.server.project.InvalidChangeOperationException)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1