git_ops
git information access.
| CLASS | DESCRIPTION |
|---|---|
GitTag |
Represents a Git tag and its associated data. |
TagInfo |
Simple storage of tag information. |
| FUNCTION | DESCRIPTION |
|---|---|
get_commits_by_tags |
Group commits by the tags they belong to. |
get_repo |
Get the git repo from a specific path or the current working directory. |
get_tags |
Get all the tags in a repository. |
parse_commits |
Parse the commits for later processing. |
Classes¶
GitTag
dataclass
¶
GitTag(tag_name: str, tag_info: TagInfo, commits: List[Commit])
Represents a Git tag and its associated data.
This class is used to encapsulate details about a Git tag, including its name, additional information, and a list of related commits. It is immutable to ensure the integrity of the stored data, making it safe for concurrent and controlled usage.
| ATTRIBUTE | DESCRIPTION |
|---|---|
tag_name |
The name of the Git tag.
TYPE:
|
tag_info |
Metadata and additional details associated with the Git tag.
TYPE:
|
commits |
The list of commits that are associated with this Git tag.
TYPE:
|
TagInfo
dataclass
¶
TagInfo(
name: str, commit: str, tagger: Union[str, Actor], tagged_datetime: datetime
)
Simple storage of tag information.
| ATTRIBUTE | DESCRIPTION |
|---|---|
date_string |
Convenience method to return an ISO8601 date string.
TYPE:
|
Functions¶
get_commits_by_tags
¶
get_commits_by_tags(
repository: Repo,
tag_filter_pattern: str,
starting_tag: Optional[str] = None,
config: Optional[Configuration] = None,
) -> List[GitTag]
Group commits by the tags they belong to.
| PARAMETER | DESCRIPTION |
|---|---|
repository
|
The git repository object
TYPE:
|
tag_filter_pattern
|
A regular expression pattern that matches valid tags as versions
TYPE:
|
starting_tag
|
Only include tags after this one
TYPE:
|
config
|
The configuration to use. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
List[GitTag]
|
A list of dictionaries with tag information with most recent first |
get_repo
¶
get_repo(repo_path: Optional[str] = None) -> Repo
Get the git repo from a specific path or the current working directory.
| PARAMETER | DESCRIPTION |
|---|---|
repo_path
|
The path to the directory with git repository. If None, the current working directory is used.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Repo
|
Repository object |
get_tags
¶
get_tags(repository: Repo) -> List[TagInfo]
Get all the tags in a repository.
| PARAMETER | DESCRIPTION |
|---|---|
repository
|
The repository object containing the tags
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
List[TagInfo]
|
A list of TagInfo objects with the most recent first |
parse_commits
¶
parse_commits(
repository: Repo,
starting_rev: Optional[str] = None,
ending_rev: Optional[str] = None,
config: Optional[Configuration] = None,
) -> list
Parse the commits for later processing.
| PARAMETER | DESCRIPTION |
|---|---|
repository
|
The repository object.
TYPE:
|
starting_rev
|
Include all commits after this revision.
TYPE:
|
ending_rev
|
include all commmits before and including this revision.
TYPE:
|
config
|
The configuration to use. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list
|
A list of CommitInfo objects. |