Class GitVersionService

  • All Implemented Interfaces:

    
    public final class GitVersionService
    
                        

    Calculate the version from a Git Repository. The repository uses GitFlow for the development. The start parameter is the local source directory.

    • Constructor Detail

      • GitVersionService

        GitVersionService(File directory, VersionType versionType)
        creates the service from a directory
        Parameters:
        directory - local source directory
        versionType - default value com.intershop.release.version.VersionType.fourDigits.
      • GitVersionService

        GitVersionService(File directory)
        creates the service from a directory
        Parameters:
        directory - local source directory
    • Method Detail

      • getClient

         final Git getClient()

        Git client for the existing working copy.

      • getRepository

         final Repository getRepository()

        Repository for the existing working copy.

      • getMajorBranch

         final String getMajorBranch()

        Name/path of the feature branch with major changes for the next major version. The branch starts with feature.

      • setMajorBranch

         final Unit setMajorBranch(String majorBranch)

        Name/path of the feature branch with major changes for the next major version. The branch starts with feature.

      • getSeparator

         final String getSeparator()

        Separator for prefix and branch name. Default value is /.

      • setSeparator

         final Unit setSeparator(String separator)

        Separator for prefix and branch name. Default value is /.

      • getFullbranch

         final Boolean getFullbranch()

        Version is shortened for branches and hotfixes with a hash for the string if shortened is true.

      • setFullbranch

         final Unit setFullbranch(Boolean fullbranch)

        Version is shortened for branches and hotfixes with a hash for the string if shortened is true.

      • getDefaultVersion

         final Version getDefaultVersion()

        Default version. Default value is Version.Builder(versionType).build().

      • setDefaultVersion

         final Unit setDefaultVersion(Version defaultVersion)

        Default version. Default value is Version.Builder(versionType).build().

      • getPullRequestID

         final String getPullRequestID()

        Pull Request ID Default value is an empty string. Used to identify a merge build

      • setPullRequestID

         final Unit setPullRequestID(String pullRequestID)

        Pull Request ID Default value is an empty string. Used to identify a merge build

      • getBuildID

         final String getBuildID()

        Build ID for Pull Requests and unique container version Default value is an empty string. Used to identify a merge build

      • setBuildID

         final Unit setBuildID(String buildID)

        Build ID for Pull Requests and unique container version Default value is an empty string. Used to identify a merge build

      • isMergeBuild

         final Boolean isMergeBuild()

        This must be set to true, if the version should be calculated for a pull request. Therefore the following environment variables must be set: sourceBranch, pullRequestID, buildID

      • setMergeBuild

         final Unit setMergeBuild(Boolean isMergeBuild)

        This must be set to true, if the version should be calculated for a pull request. Therefore the following environment variables must be set: sourceBranch, pullRequestID, buildID

      • getVersionWithID

         final String getVersionWithID()

        This is the calculated version of the Git repository. If a buildID is specified for special branches a build id is added.

      • getVersion

         final String getVersion()

        This is the calculated version of the Git repository.

      • getRevObjectFrom

         final RevCommit getRevObjectFrom(Version version)

        Calculates the commit for a specified version.

        Parameters:
        version - is version tag