semantic_release.gitproject module¶
Module for git related operations.
- class semantic_release.gitproject.GitProject(directory: Path | str = '.', commit_author: Actor | None = None, credential_masker: MaskingFilter | None = None)[source]¶
Bases:
object- git_add(paths: Sequence[Path | str], force: bool = False, strict: bool = False, noop: bool = False) None[source]¶
- git_commit(message: str, date: int | None = None, commit_all: bool = False, no_verify: bool = False, noop: bool = False) None[source]¶
- git_tag(tag_name: str, message: str, isotimestamp: str, force: bool = False, noop: bool = False) None[source]¶
- git_unshallow(noop: bool = False) None[source]¶
Convert a shallow clone to a full clone by fetching the full history.
- Parameters:
noop – Whether or not to actually run the unshallow command
- is_shallow_clone() bool[source]¶
Check if the repository is a shallow clone.
- Returns:
True if the repository is a shallow clone, False otherwise
- property logger: Logger¶
- property project_root: Path¶
- verify_upstream_unchanged(local_ref: str = 'HEAD', upstream_ref: str = 'origin', remote_url: str | None = None, noop: bool = False) None[source]¶
Verify that the upstream branch has not changed since the given local reference.
- Parameters:
local_ref – The local reference to compare against upstream (default: HEAD)
upstream_ref – The name of the upstream remote or specific remote branch (default: origin)
remote_url – Optional authenticated remote URL to use for fetching (default: None, uses configured remote)
noop – Whether to skip the actual verification (for dry-run mode)
- Raises:
UpstreamBranchChangedError – If the upstream branch has changed