Skip to content

models

Data models for source code management functions.

Attributes

Classes

DefaultSCMTool

DefaultSCMTool(config: SCMConfig)

Default implementation of the SCMTool protocol.

Methods:

__repr__
__repr__() -> str

Return a string representation of the SCMTool.

__str__
__str__() -> str

A string representation of the object.

add_path
add_path(path: Pathlike) -> None

Add a path to the pending commit.

assert_nondirty
assert_nondirty() -> None

Always says the repository is clean.

commit_and_tag
commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> None

Pretend to commit and tag files to the repository using the configuration.

get_all_tags
get_all_tags() -> List[str]

Return all tags in the SCM.

is_available
is_available() -> bool

Return whether the SCM tool is available.

latest_tag_info
latest_tag_info() -> LatestTagInfo

Return the latest tag information.

LatestTagInfo dataclass

LatestTagInfo(commit_sha: Optional[str] = None, short_commit_sha: Optional[str] = None, distance_to_latest_tag: int = 0, current_version: Optional[str] = None, current_tag: Optional[str] = None, branch_name: Optional[str] = None, short_branch_name: Optional[str] = None, repository_root: Optional[Path] = None, dirty: Optional[bool] = None)

Information about the latest tag.

SCMConfig dataclass

SCMConfig(tag: bool, sign_tags: bool, tag_name: str, allow_dirty: bool, commit: bool, message: str, parse_pattern: str, tag_message: Optional[str] = None, commit_args: Optional[str] = None, moveable_tags: List[str] = list())

Configuration for source code management functions.

Methods:

from_config classmethod
from_config(config: Config) -> SCMConfig

Return a SCMConfig from a Config object.

get_version_from_tag
get_version_from_tag(tag: str) -> Optional[str]

Return the version from a tag.

SCMInfo

SCMInfo(config: SCMConfig)

Information about the current source code manager and state.

Methods:

__repr__
__repr__() -> str

Return a string representation of the SCMInfo.

as_dict
as_dict() -> Dict[str, Any]

Return the information as a dict.

commit_and_tag
commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> None

Commit the files to the source code management system.

path_in_repo
path_in_repo(path: Pathlike) -> bool

Return whether a path is inside this repository.

SCMTool

SCMTool(config: SCMConfig)

Bases: Protocol

Protocol for source code management tools.

Methods:

add_path
add_path(path: Pathlike) -> None

Add a path to the pending commit.

assert_nondirty
assert_nondirty() -> None

Asserts that the repository is not dirty.

RAISES DESCRIPTION
DirtyWorkingDirectoryError

If the repository is not clean.

commit_and_tag
commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> None

Commit and tag files to the repository using the configuration.

get_all_tags
get_all_tags() -> List[str]

Return all tags in the SCM.

is_available
is_available() -> bool

Return whether the SCM tool is available.

latest_tag_info
latest_tag_info() -> LatestTagInfo

Return the latest tag information.

Functions: