com.atlassian.stash.scm.ScmCommandFactory |
Creates commands
which provide basic SCM functionality such as creating repositories, retrieving
commits and viewing diffs. Each command accepts a set of CommandParameters
which are used to control the
command's behaviour and output.
PageRequest
describing the page of output that should be returned and return
an object graph when the command is executedVoid
(usually null
) when the
command is executedrepository
against which created commands will operate was specified when the factory
was retrieved from the ScmService
, and cannot be changed.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves blame (also sometimes referred to as annotations) for a file at a given revision.
| |||||||||||
Retrieves
changeset details for the specified commit. | |||||||||||
Retrieves all descendant commits of any of the refs (commitHash, tagname, branchname) in
refs . | |||||||||||
Retrieves a
page of commits matching the specified parameters . | |||||||||||
Creates and initialises the repository, performing any initial configuration that is appropriate for the SCM.
| |||||||||||
Retrieves a
Command which will resolve the default branch for the specified repository when executed. | |||||||||||
This method is deprecated.
in 2.1 for removal in 3.0. Deleting branches is SCM-specific.
| |||||||||||
Creates a fork of repository
parent | |||||||||||
Creates a command that, when executed, will merge the specified
fromChangesetId into the specified
toBranch . | |||||||||||
Returns a
Command that will, when executed, retrieve the content of the given file, try to detect its
MIME type, obtain an java.io.OutputStream OutputStream from the provided TypeAwareOutputSupplier
and copy all the content into it. | |||||||||||
This method is deprecated.
in 2.4 for removal in 3.0, with no replacement. API consumers should have no need to ever reparent
a repository, and some SCM implementations may have no need for such a function. When a repository
is deleted, if reparenting is necessary, the SCM should handle it internally automatically.
| |||||||||||
Traverse the commit graph in topological order.
| |||||||||||
Returns a
Command which, when executed, will set the default branch for the specified repository to the
named branch. |
Retrieves blame (also sometimes referred to as annotations) for a file at a given revision.
This command is paged somewhat differently than others, in that it does not return aPage
and instead
returns a List
. The PageRequest
provided determines the lines in the file for which blame is
calculated, and only lines within the scope of the page request will be returned. However, because adjacent
lines may be spanned
by a single author
, the number
of distinct Blame
objects returned will frequently be less than the limit
.parameters | parameters describing the file and revision used to calculate blame |
---|---|
pageRequest | describes the set of lines in the file to calculate blame for |
Blame
for the specified file and
revision for the requested set of linesRetrieves a page
of branches
ordered either alphabetically or by modification and
optionally filtered.
alphabetical
ordermodification
orderparameters | parameters describing desired order and filter text |
---|---|
pageRequest | describes the set of branches to return |
Retrieves a page
of changes
describing the modifications made between two
revisions, optionally filtered by path.
"since"
revision is specified, it defaults to the
parent of the "until"
revision. If the "until" revision specifies
a merge commit (a commit with multiple parents), no changes will be returned.
Note: Some changes
, such as copies
and moves
,
affect more than one path. When filtering by path, if both paths are not available the change's type may not
be correctly detected by some SCMs.parameters | parameters describing the revisions to compare and paths to filter by |
---|---|
pageRequest | describes the set of changes to return |
Retrieves a Command
which, when executed, will stream changes
describing modifications
made between two revisions, optionally filtered by path.
"since"
revision is specified, it defaults to the
parent of the "until"
revision. If the "until" revision specifies
a merge commit (a commit with multiple parents), no changes will be returned.
Note: Some changes
, such as copies
and moves
,
affect more than one path. When filtering by path, if both paths are not available the change's type may not
be correctly detected by some SCMs.parameters | parameters describing the revisions to compare and paths to filter by |
---|---|
callback | the callback to receive streamed changesets |
Retrieves changeset details
for the specified commit.
path
is provided, the Changeset
returned may not
be for the specified commit
. Instead, that commit is used as
a starting point and details for the first commit in its ancestry which affects that path are returned.parameters | parameters describing the commit to retrieve details for |
---|
Retrieves all descendant commits of any of the refs (commitHash, tagname, branchname) in refs
.
parameters | previous heads |
---|---|
callback | the changeset callback that will be called for each of the matching commits. |
Retrieves a page
of commits matching the specified parameters
.
parameters | parameters describing which commits to retrive details for. |
---|---|
pageRequest | describes the set of commits to return |
Creates and initialises the repository, performing any initial configuration that is appropriate for the SCM.
Note: This command may be called exactly once for any repository. Subsequent executions will fail; they will not reinitialise the repository.Retrieves a Command
which will resolve the default branch for the specified repository when executed.
NoDefaultBranchException
, when executed, if the specified repository does not have a resolvable default branch.
This might happen, for example, on a new repository with no commits, or if the only commits to a repository have
been to a branch other than the default branch.NoDefaultBranchException | if the repository does not have a resolvable default branch |
---|
This method is deprecated.
in 2.1 for removal in 3.0. Deleting branches is SCM-specific.
Returns a Command
which, when executed, will delete the specified branch
.
branch | to be deleted |
---|
Creates a fork of repository parent
fork | the fork |
---|
Creates a command that, when executed, will merge the specified fromChangesetId
into the specified
toBranch
.
fromChangesetId
may be:
toBranch
, as the parameter name suggests, must be a branch name, either fully
qualified or short; using a hash (full or short) is not supported.Returns a Command
that will, when executed, retrieve the content of the given file, try to detect its
MIME type, obtain an java.io.OutputStream OutputStream from the provided TypeAwareOutputSupplier
and copy all the content into it.
parameters | parameters used to specify the path and version of the file to stream |
---|---|
outputSupplier | the supplier which, when given a content type, will provide an output stream |
This method is deprecated.
in 2.4 for removal in 3.0, with no replacement. API consumers should have no need to ever reparent
a repository, and some SCM implementations may have no need for such a function. When a repository
is deleted, if reparenting is necessary, the SCM should handle it internally automatically.
Returns a Command
that will, when executed, update the origin
for the
repository to reference the newParent
.
newParent | the new parent which should be used as the repository's origin |
---|
Traverse the commit graph in topological order.
callback | the callback for traversing the commit graph |
---|
Returns a Command
which, when executed, will set the default branch for the specified repository to the
named branch. This operation may not be supported by all SCM implementations. Such implementations should throw
an UnsupportedOperationException
.
branchName | the branch to make the default |
---|
IllegalArgumentException | Thrown if the provided branchName is null or blank. |
---|---|
UnsupportedOperationException | Thrown if the underlying SCM does not support setting the default branch. |