Class ForkCommandParameters

java.lang.Object
com.atlassian.bitbucket.util.BuilderSupport
com.atlassian.bitbucket.scm.AbstractCommandParameters
com.atlassian.bitbucket.scm.ForkCommandParameters

public class ForkCommandParameters extends com.atlassian.bitbucket.scm.AbstractCommandParameters
Describes the fork being created.

RepositoryService.fork(RepositoryForkRequest) is used to create forks. That service creates the fork Repository in the database, and then calls PluginExtendedCommandFactory.fork(com.atlassian.bitbucket.repository.Repository, com.atlassian.bitbucket.scm.ForkCommandParameters) to create it on disk. As with other commands, the origin repository, which already exists both in the database and on disk, is provided as the first argument when creating the fork command. The fork repository, which only exists in the database, is provided in these parameters.

Since:
4.6
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields inherited from class com.atlassian.bitbucket.util.BuilderSupport

    NOT_BLANK
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the default branch that should be set for the fork after it's created.
    com.atlassian.bitbucket.repository.Repository
    Retrieves the fork repository, which is expected to have already been created in the database and have a valid ID.

    Methods inherited from class com.atlassian.bitbucket.util.BuilderSupport

    addIf, addIf, addIf, addIf, addIf, addIf, checkNotBlank, requireNonBlank

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getFork

      @Nonnull public com.atlassian.bitbucket.repository.Repository getFork()
      Retrieves the fork repository, which is expected to have already been created in the database and have a valid ID. The SCM will use this Repository to create the fork on disk and initialize it from its origin, which is supplied as the first parameter to PluginExtendedCommandFactory.fork(com.atlassian.bitbucket.repository.Repository, com.atlassian.bitbucket.scm.ForkCommandParameters) when creating the Command.
      Returns:
      the fork repository, which exists in the database but not on disk
    • getDefaultBranch

      @Nullable public String getDefaultBranch()
      Retrieves the default branch that should be set for the fork after it's created. If the default branch isn't specified, the fork will inherit its origin's default branch.
      Returns:
      the default branch to set, or null to inherit the origin's default branch
      Since:
      7.5