Class AheadBehind

java.lang.Object
pl.project13.core.AheadBehind

public class AheadBehind extends Object
A local git repository can either be "ahead", or "behind" in the number of commits relative to the remote repository. This class tracks the amount of commits the local git repository is "behind", or "ahead" relative to it's remote. :warning: You must set the offline-setting of the plugin to false when you want to ensure that the properties generated are truly up-to-date. Otherwise the local state of the git repository is used which might be out-of-date.
  • Field Details

    • NO_REMOTE

      public static final AheadBehind NO_REMOTE
      Indication that we could not find a remote repository to calculate a "behind", or "ahead" relation.
  • Method Details

    • of

      public static AheadBehind of(int ahead, int behind)
      Constructor for a "AheadBehind"-object.
      Parameters:
      ahead - Number of commits the local repository is "ahead" in relation to it's remote.
      behind - Number of commits the local repository is "behind" in relation to it's remote.
      Returns:
      a "AheadBehind"-object.
    • of

      public static AheadBehind of(String ahead, String behind)
      Constructor for a "AheadBehind"-object.
      Parameters:
      ahead - Number of commits the local repository is "ahead" in relation to it's remote.
      behind - Number of commits the local repository is "behind" in relation to it's remote.
      Returns:
      a "AheadBehind"-object.
    • ahead

      public String ahead()
      Returns:
      Number of commits the local repository is "ahead" in relation to it's remote.
    • behind

      public String behind()
      Returns:
      Number of commits the local repository is "behind" in relation to it's remote.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object