Loading [Contrib]/a11y/accessibility-menu.js
Skip to content

models

Data models for source code management functions.

Attributes

Classes

DefaultSCMTool

DefaultSCMTool(config: SCMConfig)

Default implementation of the SCMTool protocol.

Functions

__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,
    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.

Functions

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.

Functions

__repr__
__repr__() -> str

Return a string representation of the SCMInfo.

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

Commit the files to the source code management system.

_set_from_scm_tool
_set_from_scm_tool()

Set information from the source code management tool.

_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.

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.

Functions

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:

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