Class SvnTagBranchUtils

java.lang.Object
org.apache.maven.scm.provider.svn.SvnTagBranchUtils

public final class SvnTagBranchUtils extends Object
  • Field Details

  • Constructor Details

    • SvnTagBranchUtils

      private SvnTagBranchUtils()
  • Method Details

    • appendPath

      static String appendPath(String basePath, String addlPath)
      Simple helper function to concatenate two paths together with a "/". Handles trailing / on basePath. Returns no trailing "/" if the addlPath is null
    • getProjectRoot

      public static String getProjectRoot(String repoPath)
      Returns the project root for the given repository url, where "project root" is the root of the /trunk, /branches, /tags directories
      Parameters:
      repoPath - Repository path/url to be searched
      Returns:
    • resolveTagBase

      public static String resolveTagBase(SvnScmProviderRepository repository)
    • resolveTagBase

      public static String resolveTagBase(String repositoryUrl)
    • resolveBranchBase

      public static String resolveBranchBase(SvnScmProviderRepository repository)
    • resolveBranchBase

      public static String resolveBranchBase(String repositoryUrl)
    • resolveTagUrl

      public static String resolveTagUrl(SvnScmProviderRepository repository, ScmTag tag)
      Resolves a tag to a repository url. By supplying the repository to this function (rather than calling resolveTagUrl(String,ScmTag) the resolution can use the repository's tagBase to override the default tag location.
      Parameters:
      repository - the repository to use as a base for tag resolution
      tag - tag name
      Returns:
      See Also:
    • resolveTagUrl

      public static String resolveTagUrl(String repositoryUrl, ScmTag tag)
      Resolves a tag to a repository url. Will not use the SvnScmProviderRepository.getTagBase() during resolution.
      Parameters:
      repositoryUrl - string url for the repository
      tag - tag name
      Returns:
      See Also:
    • resolveBranchUrl

      public static String resolveBranchUrl(SvnScmProviderRepository repository, ScmBranch branch)
      Resolves a branch name to a repository url. By supplying the repository to this function (rather than calling resolveBranchUrl(String,ScmBranch) the resolution can use the repository's tagBase to override the default tag location.
      Parameters:
      repository - the repository to use as a base for tag resolution
      branch - tag name
      Returns:
      See Also:
    • resolveBranchUrl

      public static String resolveBranchUrl(String repositoryUrl, ScmBranch branch)
      Resolves a branch name to a repository url. Will not use the SvnScmProviderRepository.getTagBase() during resolution.
      Parameters:
      repositoryUrl - string url for the repository
      branch - branch name
      Returns:
      See Also:
    • addSuffix

      private static String addSuffix(String baseString, String suffix)
    • resolveUrl

      public static String resolveUrl(String repositoryUrl, String tagBase, String subdir, ScmBranch branchTag)
      Resolves a tag or branch name to a repository url.
      If the branchTagName is an absolute URL, that value is returned. (i.e. http://foo.com/svn/myproject/tags/my-tag)

      If the repository has a SvnScmProviderRepository.getTagBase() specified, the tag is simply appended to the tagBase value. Note that at this time, we are using the tagBase as a base for both branches and tags.

      If the branchTagName contains a branch/tag specifier (i.e. "/branches", "/tags", "/trunk"), the branchTagName is appended to the projectRoot without adding the subdir.
      Else, the result is in the format of projectRoot/subdir/branchTagName directory.

      Parameters:
      repositoryUrl - string url for the repository
      tagBase - tagBase to use.
      subdir - Subdirectory to append to the project root (for branching use "branches", tags use "tags")
      branchTag - Name of the actual branch or tag. Can be an absolute url, simple tag/branch name, or even contain a relative path to the root like "branches/my-branch"
      Returns:
    • checkRevisionArg

      private static boolean checkRevisionArg(String arg)
    • isRevisionSpecifier

      public static boolean isRevisionSpecifier(ScmVersion version)
      Returns whether the supplied tag refers to an actual revision or is specifying a tag/branch url in the repository. According to the subversion documentation, the following are valid revision specifiers: NUMBER revision number "{" DATE "}" revision at start of the date "HEAD" latest in repository "BASE" base rev of item's working copy "COMMITTED" last commit at or before BASE "PREV"

      For command such as diff, the revision argument can be in the format of: IDENTIFIER:IDENTIFIER where IDENTIFIER is one of the args listed above