Skip to content

bumpversion.scm.models ​

Data models for source code management functions.

logger ​

python
logger = get_indented_logger(__name__)

SCMConfig ​

python
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 ​

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

Return the version from a tag.

from_config ​

python
def from_config(config: Config) -> SCMConfig

Return a SCMConfig from a Config object.

LatestTagInfo ​

python
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 ​

python
class SCMTool(config: SCMConfig)

Protocol for source code management tools.

is_available ​

python
def is_available() -> bool

Return whether the SCM tool is available.

latest_tag_info ​

python
def latest_tag_info() -> LatestTagInfo

Return the latest tag information.

add_path ​

python
def add_path(path: Pathlike) -> None

Add a path to the pending commit.

get_all_tags ​

python
def get_all_tags() -> List[str]

Return all tags in the SCM.

commit_and_tag ​

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

Commit and tag files to the repository using the configuration.

assert_nondirty ​

python
def assert_nondirty() -> None

Asserts that the repository is not dirty.

Raises

  • DirtyWorkingDirectoryError: If the repository is not clean.

is_allowed_dirty ​

python
def is_allowed_dirty(path: str, patterns: List[str]) -> bool

Return True if path matches any of the allow_dirty_files glob patterns.

DefaultSCMTool ​

python
class DefaultSCMTool(config: SCMConfig)

Default implementation of the SCMTool protocol.

is_available ​

python
def is_available() -> bool

Return whether the SCM tool is available.

latest_tag_info ​

python
def latest_tag_info() -> LatestTagInfo

Return the latest tag information.

add_path ​

python
def add_path(path: Pathlike) -> None

Add a path to the pending commit.

get_all_tags ​

python
def get_all_tags() -> List[str]

Return all tags in the SCM.

commit_and_tag ​

python
def 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.

assert_nondirty ​

python
def assert_nondirty() -> None

Always says the repository is clean.

SCMInfo ​

python
class SCMInfo(config: SCMConfig)

Information about the current source code manager and state.

as_dict ​

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

Return the information as a dict.

path_in_repo ​

python
def path_in_repo(path: Pathlike) -> bool

Return whether a path is inside this repository.

commit_and_tag ​

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

Commit the files to the source code management system.