Class Patch

java.lang.Object
com.google.gerrit.entities.Patch

public final class Patch extends Object
Wrapper class for patch related aspects. Originally, this class represented a single modified file in a PatchSet. It's only kept in its current form as Patch.ChangeType and Patch.PatchType are used in diff cache entries for which we would break the serialization if we moved the enums somewhere else.
  • Field Details

    • COMMIT_MSG

      public static final String COMMIT_MSG
      Magical file name which represents the commit message.
      See Also:
    • MERGE_LIST

      public static final String MERGE_LIST
      Magical file name which represents the merge list of a merge commit.
      See Also:
    • PATCHSET_LEVEL

      public static final String PATCHSET_LEVEL
      Magical file name which doesn't represent a file. Used specifically for patchset-level comments.
      See Also:
  • Method Details

    • isMagic

      public static boolean isMagic(String path)
      Checks if the given path represents a magic file. A magic file is a generated file that is automatically included into changes. It does not exist in the commit of the patch set.
      Parameters:
      path - the file path
      Returns:
      true if the path represents a magic file, otherwise false.
    • key

      public static Patch.Key key(PatchSet.Id patchSetId, String fileName)