bumpversion.scm.models
Data models for source code management functions.
logger
logger = get_indented_logger(__name__)SCMConfig
class SCMConfig(tag: bool, push_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(), allow_dirty_files: List[str] = list())Configuration for source code management functions.
get_version_from_tag
def get_version_from_tag(tag: str) -> Optional[str]Return the version from a tag.
from_config
def from_config(config: Config) -> SCMConfigReturn a SCMConfig from a Config object.
LatestTagInfo
class 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.
SCMTool
class SCMTool(config: SCMConfig)Protocol for source code management tools.
is_available
def is_available() -> boolReturn whether the SCM tool is available.
latest_tag_info
def latest_tag_info() -> LatestTagInfoReturn the latest tag information.
add_path
def add_path(path: Pathlike) -> NoneAdd a path to the pending commit.
get_all_tags
def get_all_tags() -> List[str]Return all tags in the SCM.
commit_and_tag
def commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> NoneCommit and tag files to the repository using the configuration.
assert_nondirty
def assert_nondirty() -> NoneAsserts that the repository is not dirty.
Raises
DirtyWorkingDirectoryError: If the repository is not clean.
is_allowed_dirty
def is_allowed_dirty(path: str, patterns: List[str]) -> boolReturn True if path matches any of the allow_dirty_files glob patterns.
DefaultSCMTool
class DefaultSCMTool(config: SCMConfig)Default implementation of the SCMTool protocol.
is_available
def is_available() -> boolReturn whether the SCM tool is available.
latest_tag_info
def latest_tag_info() -> LatestTagInfoReturn the latest tag information.
add_path
def add_path(path: Pathlike) -> NoneAdd a path to the pending commit.
get_all_tags
def get_all_tags() -> List[str]Return all tags in the SCM.
commit_and_tag
def commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> NonePretend to commit and tag files to the repository using the configuration.
assert_nondirty
def assert_nondirty() -> NoneAlways says the repository is clean.
SCMInfo
class SCMInfo(config: SCMConfig)Information about the current source code manager and state.
as_dict
def as_dict() -> Dict[str, Any]Return the information as a dict.
path_in_repo
def path_in_repo(path: Pathlike) -> boolReturn whether a path is inside this repository.
commit_and_tag
def commit_and_tag(files: List[Pathlike], context: MutableMapping, dry_run: bool = False) -> NoneCommit the files to the source code management system.