Class BranchTrackingStatus


  • public class BranchTrackingStatus
    extends java.lang.Object
    Status of a branch's relation to its remote-tracking branch.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private BranchTrackingStatus​(java.lang.String remoteTrackingBranch, int aheadCount, int behindCount)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getAheadCount()
      Get number of commits that the local branch is ahead of the remote-tracking branch
      int getBehindCount()
      Get number of commits that the local branch is behind of the remote-tracking branch
      java.lang.String getRemoteTrackingBranch()
      Get full remote-tracking branch name
      static BranchTrackingStatus of​(Repository repository, java.lang.String branchName)
      Compute the tracking status for the branchName in repository.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • remoteTrackingBranch

        private final java.lang.String remoteTrackingBranch
      • aheadCount

        private final int aheadCount
      • behindCount

        private final int behindCount
    • Constructor Detail

      • BranchTrackingStatus

        private BranchTrackingStatus​(java.lang.String remoteTrackingBranch,
                                     int aheadCount,
                                     int behindCount)
    • Method Detail

      • of

        public static BranchTrackingStatus of​(Repository repository,
                                              java.lang.String branchName)
                                       throws java.io.IOException
        Compute the tracking status for the branchName in repository.
        Parameters:
        repository - the git repository to compute the status from
        branchName - the local branch
        Returns:
        the tracking status, or null if it is not known
        Throws:
        java.io.IOException
      • getRemoteTrackingBranch

        public java.lang.String getRemoteTrackingBranch()
        Get full remote-tracking branch name
        Returns:
        full remote-tracking branch name
      • getAheadCount

        public int getAheadCount()
        Get number of commits that the local branch is ahead of the remote-tracking branch
        Returns:
        number of commits that the local branch is ahead of the remote-tracking branch
      • getBehindCount

        public int getBehindCount()
        Get number of commits that the local branch is behind of the remote-tracking branch
        Returns:
        number of commits that the local branch is behind of the remote-tracking branch