scm
Version control system management.
Classes¶
Git
¶
Bases: SourceCodeManager
Git implementation.
Functions¶
assert_nondirty
classmethod
¶
assert_nondirty() -> None
Assert that the working directory is not dirty.
latest_tag_info
classmethod
¶
latest_tag_info(
tag_name: str, parse_pattern: str
) -> SCMInfo
Return information about the latest tag.
tag
classmethod
¶
tag(
name: str,
sign: bool = False,
message: Optional[str] = None,
) -> None
Create a tag of the new_version in VCS.
If only name is given, bumpversion uses a lightweight tag. Otherwise, it uses an annotated tag.
Parameters:
Mercurial
¶
Bases: SourceCodeManager
Mercurial implementation.
Functions¶
latest_tag_info
classmethod
¶
latest_tag_info(
tag_name: str, parse_pattern: str
) -> SCMInfo
Return information about the latest tag.
tag
classmethod
¶
tag(
name: str,
sign: bool = False,
message: Optional[str] = None,
) -> None
Create a tag of the new_version in VCS.
If only name is given, bumpversion uses a lightweight tag. Otherwise, it uses an annotated tag.
Parameters:
name
-
The name of the tag
TYPE:
str
sign
-
True to sign the tag
TYPE:
bool
DEFAULT:
False
message
-
A optional message to annotate the tag.
DEFAULT:
None
Raises:
-
SignedTagsError
-
If
sign
isTrue
SCMInfo
dataclass
¶
SCMInfo(
tool: Optional[Type[SourceCodeManager]] = None,
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,
)
SourceCodeManager
¶
Base class for version control systems.
Functions¶
assert_nondirty
classmethod
¶
assert_nondirty() -> None
Assert that the working directory is not dirty.
commit
classmethod
¶
commit(
message: str,
current_version: str,
new_version: str,
extra_args: Optional[list] = None,
) -> None
Commit the changes.
commit_to_scm
classmethod
¶
commit_to_scm(
files: List[Union[str, Path]],
config: Config,
context: MutableMapping,
extra_args: Optional[List[str]] = None,
dry_run: bool = False,
) -> None
Commit the files to the source code management system.
format_and_raise_error
classmethod
¶
format_and_raise_error(
exc: Union[TypeError, subprocess.CalledProcessError]
) -> None
Format the error message from an exception and re-raise it as a BumpVersionError.
get_version_from_tag
classmethod
¶
get_version_from_tag(
tag: str, tag_name: str, parse_pattern: str
) -> Optional[str]
Return the version from a tag.
latest_tag_info
classmethod
¶
latest_tag_info(
tag_name: str, parse_pattern: str
) -> SCMInfo
Return information about the latest tag.
tag
classmethod
¶
tag(
name: str,
sign: bool = False,
message: Optional[str] = None,
) -> None
Create a tag of the new_version in VCS.
tag_in_scm
classmethod
¶
tag_in_scm(
config: Config,
context: MutableMapping,
dry_run: bool = False,
) -> None
Tag the current commit in the source code management system.
Functions¶
get_scm_info
¶
get_scm_info(tag_name: str, parse_pattern: str) -> SCMInfo
Return a dict with the latest source code management info.