Class CommitUtil


  • public class CommitUtil
    extends Object
    Static utilities for working with RevCommits.
    • Method Detail

      • toCommitInfo

        public static CommitInfo toCommitInfo​(org.eclipse.jgit.revwalk.RevCommit commit,
                                              org.eclipse.jgit.revwalk.RevWalk walk)
                                       throws IOException
        Throws:
        IOException
      • createRevertCommit

        public org.eclipse.jgit.lib.ObjectId createRevertCommit​(String message,
                                                                ChangeNotes notes,
                                                                CurrentUser user)
                                                         throws ResourceConflictException,
                                                                IOException
        Allows creating a revert commit.
        Parameters:
        message - Commit message for the revert commit.
        notes - ChangeNotes of the change being reverted.
        user - Current User performing the revert.
        Returns:
        ObjectId that represents the newly created commit.
        Throws:
        ResourceConflictException - Can't revert the initial commit.
        IOException - Thrown in case of I/O errors.
      • createRevertCommit

        public org.eclipse.jgit.lib.ObjectId createRevertCommit​(String message,
                                                                ChangeNotes notes,
                                                                CurrentUser user,
                                                                org.eclipse.jgit.lib.ObjectId generatedChangeId,
                                                                Timestamp ts,
                                                                org.eclipse.jgit.lib.ObjectInserter oi,
                                                                org.eclipse.jgit.revwalk.RevWalk revWalk)
                                                         throws ResourceConflictException,
                                                                IOException
        Parameters:
        message - Commit message for the revert commit.
        notes - ChangeNotes of the change being reverted.
        user - Current User performing the revert.
        generatedChangeId - The changeId for the commit message, can be null since it is not needed for commits, only for changes.
        ts - Timestamp of creation for the commit.
        oi - ObjectInserter for inserting the newly created commit.
        revWalk - Used for parsing the original commit.
        Returns:
        ObjectId that represents the newly created commit.
        Throws:
        ResourceConflictException - Can't revert the initial commit.
        IOException - Thrown in case of I/O errors.