Class GitScmProviderRepository


public class GitScmProviderRepository extends ScmProviderRepositoryWithHost
  • Field Details

    • URL_DELIMITER_FETCH

      public static final String URL_DELIMITER_FETCH
      sequence used to delimit the fetch URL
      See Also:
    • URL_DELIMITER_PUSH

      public static final String URL_DELIMITER_PUSH
      sequence used to delimit the push URL
      See Also:
    • PROTOCOL_SEPARATOR

      public static final String PROTOCOL_SEPARATOR
      this trails every protocol
      See Also:
    • PROTOCOL_FILE

      public static final String PROTOCOL_FILE
      use local file as transport
      See Also:
    • PROTOCOL_GIT

      public static final String PROTOCOL_GIT
      use gits internal protocol
      See Also:
    • PROTOCOL_SSH

      public static final String PROTOCOL_SSH
      use secure shell protocol
      See Also:
    • PROTOCOL_HTTP

      public static final String PROTOCOL_HTTP
      use the standard port 80 http protocol
      See Also:
    • PROTOCOL_HTTPS

      public static final String PROTOCOL_HTTPS
      use the standard port 443 https protocol
      See Also:
    • PROTOCOL_RSYNC

      public static final String PROTOCOL_RSYNC
      use rsync for retrieving the data TODO implement!
      See Also:
    • HOST_AND_PORT_EXTRACTOR

      private static final Pattern HOST_AND_PORT_EXTRACTOR
    • PROTOCOL_NONE

      public static final String PROTOCOL_NONE
      No special protocol specified. Git will either use git:// or ssh:// depending on whether we work locally or over the network
      See Also:
    • provider

      private String provider
      this may either 'git' or 'jgit' depending on the underlying implementation being used
    • fetchInfo

      private RepositoryUrl fetchInfo
      the URL used to fetch from the upstream repository
    • pushInfo

      private RepositoryUrl pushInfo
      the URL used to push to the upstream repository
  • Constructor Details

  • Method Details

    • getProvider

      public String getProvider()
      Returns:
      either 'git' or 'jgit' depending on the underlying implementation being used
    • getFetchInfo

      public RepositoryUrl getFetchInfo()
    • getPushInfo

      public RepositoryUrl getPushInfo()
    • getFetchUrl

      public String getFetchUrl()
      Returns:
      the URL used to fetch from the upstream repository
    • getPushUrl

      public String getPushUrl()
      Returns:
      the URL used to push to the upstream repository
    • parseUrl

      private RepositoryUrl parseUrl(String url) throws ScmException
      Parse the given url string and store all the extracted information in a RepositoryUrl
      Parameters:
      url - to parse
      Returns:
      filled with the information from the given URL
      Throws:
      ScmException
    • getUrl

      private String getUrl(RepositoryUrl repoUrl)
      Parameters:
      repoUrl -
      Returns:
    • parseProtocol

      private String parseProtocol(RepositoryUrl repoUrl, String url) throws ScmException
      Parse the protocol from the given url and fill it into the given RepositoryUrl.
      Parameters:
      repoUrl -
      url -
      Returns:
      the given url with the protocol parts removed
      Throws:
      ScmException
    • parseUserInfo

      private String parseUserInfo(RepositoryUrl repoUrl, String url) throws ScmException
      Parse the user information from the given url and fill user name and password into the given RepositoryUrl.
      Parameters:
      repoUrl -
      url -
      Returns:
      the given url with the user parts removed
      Throws:
      ScmException
    • parseHostAndPort

      private String parseHostAndPort(RepositoryUrl repoUrl, String url) throws ScmException
      Parse server and port from the given url and fill it into the given RepositoryUrl.
      Parameters:
      repoUrl -
      url -
      Returns:
      the given url with the server parts removed
      Throws:
      ScmException
    • getRelativePath

      public String getRelativePath(ScmProviderRepository ancestor)
      Get the relative path between the repository provided as argument and the current repository.
      Overrides:
      getRelativePath in class ScmProviderRepository
      Parameters:
      ancestor - another repository that should be ancestor of this one
      Returns:
      the relative path or null if it can't be resolved
    • toString

      public String toString()
      Overrides:
      toString in class Object