public abstract class VersionStrategy<T extends VersionStrategy> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
VersionStrategy.StrategySearchMode |
| Constructor and Description |
|---|
VersionStrategy(VersionNamingConfiguration vnc,
org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.api.Git git,
MetadataRegistrar registrar)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract Version |
build(Commit head,
List<Commit> parents)
Build a version using the given information extracted from the git repository.
|
protected TagType |
computeTagType(org.eclipse.jgit.lib.Ref tagToUse,
org.eclipse.jgit.lib.Ref annotatedTag) |
protected Version |
enhanceVersionWithBranch(Version baseVersion,
String branch) |
protected Commit |
findMaxVersionCommit(Commit head,
List<Commit> parents) |
protected org.eclipse.jgit.lib.Ref |
findTagToUse(Commit head,
Commit base) |
protected Commit |
findVersionCommit(Commit head,
List<Commit> parents) |
protected Version |
getBaseVersionAndRegisterMetadata(Commit base,
org.eclipse.jgit.lib.Ref tagToUse) |
protected org.eclipse.jgit.api.Git |
getGit() |
protected MetadataRegistrar |
getRegistrar() |
protected org.eclipse.jgit.lib.Repository |
getRepository() |
protected VersionNamingConfiguration |
getVersionNamingConfiguration() |
protected boolean |
isBaseCommitOnHead(Commit head,
Commit base) |
protected boolean |
isGitDirty() |
boolean |
isVersionTag(org.eclipse.jgit.lib.Ref tag)
Checks regarding the current strategy if the given
Ref corresponds to a tag of a version. |
protected Optional<org.eclipse.jgit.lib.Ref> |
maxVersionTag(List<org.eclipse.jgit.lib.Ref> tags) |
protected org.eclipse.jgit.lib.Ref |
maxVersionTag(List<org.eclipse.jgit.lib.Ref> primaryTags,
List<org.eclipse.jgit.lib.Ref> secondaryTags) |
protected T |
runAndGetSelf(Runnable runnable) |
int |
searchDepthLimit()
Defines the history commit depth, starting from HEAD, until which parent commits will be parsed to find tags
information.
|
VersionStrategy.StrategySearchMode |
searchMode() |
protected T |
self() |
T |
setSearchDepthLimit(int newLimit)
Sets a limit to the depth of lookup for base version tags.
|
protected Version |
tagToVersion(String tagName) |
protected fr.brouillard.oss.jgitver.impl.VersionStrategy.VersionTarget<Commit> |
toVersionTarget(Commit head,
Commit commit) |
protected fr.brouillard.oss.jgitver.impl.VersionStrategy.VersionTarget<org.eclipse.jgit.lib.Ref> |
toVersionTarget(org.eclipse.jgit.lib.Ref tagRef) |
Version |
versionFromTag(org.eclipse.jgit.lib.Ref ref)
Computes a
Version object from the given tag reference using the strategy configuration. |
public VersionStrategy(VersionNamingConfiguration vnc, org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.api.Git git, MetadataRegistrar registrar)
vnc - the configuration to userepository - the git repositorygit - a git helper object built from the repositoryregistrar - a storage for found/calculated metadataprotected MetadataRegistrar getRegistrar()
public abstract Version build(Commit head, List<Commit> parents) throws VersionCalculationException
head - cannot be null the current head commitparents - a non null list of commits that will be involved in version naming.
The list cannot be null and contains the first commit of the repository if no commit with version tag can be found.VersionCalculationException - in case an error occurred while computing the versionpublic int searchDepthLimit()
searchMode()
is VersionStrategy.StrategySearchMode.DEPTH.public T setSearchDepthLimit(int newLimit)
newLimit - a positive value or 0 if the given value is negativepublic boolean isVersionTag(org.eclipse.jgit.lib.Ref tag)
Ref corresponds to a tag of a version.tag - a non null tag as a Ref objectpublic VersionStrategy.StrategySearchMode searchMode()
protected TagType computeTagType(org.eclipse.jgit.lib.Ref tagToUse, org.eclipse.jgit.lib.Ref annotatedTag)
protected T self()
protected Version getBaseVersionAndRegisterMetadata(Commit base, org.eclipse.jgit.lib.Ref tagToUse)
protected boolean isGitDirty()
protected org.eclipse.jgit.lib.Ref maxVersionTag(List<org.eclipse.jgit.lib.Ref> primaryTags, List<org.eclipse.jgit.lib.Ref> secondaryTags)
protected Optional<org.eclipse.jgit.lib.Ref> maxVersionTag(List<org.eclipse.jgit.lib.Ref> tags)
public Version versionFromTag(org.eclipse.jgit.lib.Ref ref)
Version object from the given tag reference using the strategy configuration.ref - a git Ref object corresponding to the tagprotected fr.brouillard.oss.jgitver.impl.VersionStrategy.VersionTarget<org.eclipse.jgit.lib.Ref> toVersionTarget(org.eclipse.jgit.lib.Ref tagRef)
protected fr.brouillard.oss.jgitver.impl.VersionStrategy.VersionTarget<Commit> toVersionTarget(Commit head, Commit commit)
protected VersionNamingConfiguration getVersionNamingConfiguration()
protected org.eclipse.jgit.lib.Repository getRepository()
protected org.eclipse.jgit.api.Git getGit()
Copyright © 2016–2021 Matthieu Brouillard. All rights reserved.