bumpversion.scm.git
Git source control management implementation.
logger
logger = get_indented_logger(__name__)Git
class Git(config: SCMConfig)Git implementation.
is_available
def is_available() -> boolIs the VCS implementation usable?
latest_tag_info
def latest_tag_info() -> LatestTagInfoReturn information about the latest tag.
add_path
def add_path(path: Pathlike) -> NoneAdd a path to the VCS.
get_all_tags
def get_all_tags() -> List[str]Return all tags in git.
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.
commit
def commit(context: MutableMapping) -> NoneCommit the changes.
update_index
def update_index() -> NoneUpdate the git index.
commit_info
def commit_info(config: SCMConfig) -> dictGet the commit info for the repo.
Parameters
config: The source control configuration.
Returns
- A dictionary containing information about the latest commit.
revision_info
def revision_info() -> dictReturns a dictionary containing revision information.
If an error occurs while running the git command, the dictionary values will be set to None.
Returns
- A dictionary with the following keys: - branch_name: The name of the current branch. - short_branch_name: A 20 lowercase characters of the branch name with special characters removed. - repository_root: The root directory of the Git repository.
tag
def tag(name: str, sign: bool = False, message: Optional[str] = None) -> NoneCreate a tag of the new_version in git.
If only name is given, bumpversion uses a lightweight tag. Otherwise, it uses an annotated tag.
Parameters
name: The name of the tagsign: True to sign the tagmessage: An optional message to annotate the tag.
moveable_tag
def moveable_tag(name: str) -> NoneCreate a new lightweight tag that should overwrite any previous tags with the same name.
Parameters
name: The name of the moveable tag.
assert_nondirty
def assert_nondirty(allow_dirty_files: Optional[List[str]] = None) -> NoneAssert that the working directory is not dirty, ignoring files matching allow_dirty_files.
push_remote
def push_remote(remote_name: str, ref_name: str, force: bool = False) -> NonePush the ref_name to the remote_name repository, optionally forcing the push.
delete_remote_tag
def delete_remote_tag(remote_name: str, ref_name: str) -> NoneDelete ref_name from remote_name, ignoring missing remote tag errors.
has_remote
def has_remote(remote_name: str) -> boolReturn True if remote_name exists in the repository remotes.