Class PatchSetUtil


  • public class PatchSetUtil
    extends Object
    Utilities for manipulating patch sets.
    • Method Detail

      • byChange

        public com.google.common.collect.ImmutableCollection<PatchSet> byChange​(ChangeNotes notes)
      • isPatchSetLocked

        public boolean isPatchSetLocked​(ChangeNotes notes)
        Is the current patch set locked against state changes?
      • getRevCommit

        public org.eclipse.jgit.revwalk.RevCommit getRevCommit​(Project.NameKey project,
                                                               PatchSet patchSet)
                                                        throws IOException
        Returns the commit for the given project at the given patchset revision
        Throws:
        IOException
      • getCurrentRevCommitIncludingPending

        public static org.eclipse.jgit.revwalk.RevCommit getCurrentRevCommitIncludingPending​(RepoContext ctx,
                                                                                             ChangeNotes.Factory notesFactory,
                                                                                             Change.Id changeId)
                                                                                      throws IOException
        Gets the commit ID for the latest patch-set of a given change.

        This also takes into account the patch sets that are added in the provided RepoContext.

        Parameters:
        ctx - to look for pending updates in.
        notesFactory - to fetch existing patch sets with.
        changeId - to get the latest commit for.
        Returns:
        the latest commit ID.
        Throws:
        IOException - if no committed nor pending commits found for the change.
      • getCurrentCommittedRevCommit

        public static org.eclipse.jgit.revwalk.RevCommit getCurrentCommittedRevCommit​(Project.NameKey project,
                                                                                      org.eclipse.jgit.revwalk.RevWalk revWalk,
                                                                                      ChangeNotes.Factory notesFactory,
                                                                                      Change.Id changeId)
                                                                               throws IOException
        Gets the commit ID for the latest committed patch-set of a given change.

        This DOES NOT take into account the patch sets that are added in the provided RepoContext.

        Parameters:
        project - name.
        notesFactory - to fetch existing patch sets with.
        changeId - to get the latest commit for.
        Returns:
        the latest commit ID.
        Throws:
        IOException - if no committed commits found for the change.