models
Data models for source code management functions.
Attributes¶
Classes¶
DefaultSCMTool
¶
DefaultSCMTool(config: SCMConfig)
LatestTagInfo
dataclass
¶
LatestTagInfo(
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(),
)
SCMInfo
¶
SCMInfo(config: SCMConfig)
Information about the current source code manager and state.
Functions¶
_commit
¶
_commit(
files: list[Pathlike],
context: MutableMapping,
dry_run: bool = False,
) -> None
Commit the files to the source code management system.
_tag
¶
_tag(
context: MutableMapping, dry_run: bool = False
) -> None
Tag the current commit in the source code management system.
_update_from_latest_tag_info
¶
_update_from_latest_tag_info(
latest_tag_info: LatestTagInfo,
)
Update information from the latest tag information.
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.
Functions¶
assert_nondirty
¶
assert_nondirty() -> None
Asserts that the repository is not dirty.
Raises:
-
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.