rez.release_vcs

rez.release_vcs.get_release_vcs_types() list[str]

Returns the available VCS implementations - git, hg etc.

rez.release_vcs.create_release_vcs(path: str, vcs_name: str | None = None) ReleaseVCS

Return a new release VCS that can release from this source path.

class rez.release_vcs.ReleaseVCS

Bases: object

A version control system (VCS) used to release Rez packages.

__init__(pkg_root: str, vcs_root: str | None = None) None
classmethod name() str

Return the name of the VCS type, eg ‘git’.

classmethod find_executable(name: str) str
classmethod is_valid_root(path: str) bool

Return True if the given path is a valid root directory for this version control system.

Note that this is different than whether the path is under the control of this type of vcs; to answer that question, use find_vcs_root

classmethod search_parents_for_root() bool

Return True if this vcs type should check parent directories to find the root directory

classmethod find_vcs_root(path: str) tuple[str, int] | None

Try to find a version control root directory of this type for the given path.

If successful, returns (vcs_root, levels_up), where vcs_root is the path to the version control root directory it found, and levels_up is an integer indicating how many parent directories it had to search through to find it, where 0 means it was found in the indicated path, 1 means it was found in that path’s parent, etc. If not sucessful, returns None

validate_repostate() None

Ensure that the VCS working copy is up-to-date.

get_current_revision() object

Get the current revision, this can be any type (str, dict etc) appropriate to your VCS implementation.

Note

You must ensure that a revision contains enough information to clone/export/checkout the repo elsewhere - otherwise you will not be able to implement export.

get_changelog(previous_revision=None, max_revisions=None) str

Get the changelog text since the given revision.

If previous_revision is not an ancestor (for example, the last release was from a different branch) you should still return a meaningful changelog - perhaps include a warning, and give changelog back to the last common ancestor.

Parameters:

previous_revision – The revision to give the changelog since. If None, give the entire changelog.

Returns:

Changelog, as a string.

tag_exists(tag_name: str) bool

Test if a tag exists in the repo.

Parameters:

tag_name (str) – Tag name to check for.

Returns:

True if the tag exists, False otherwise.

Return type:

bool

create_release_tag(tag_name: str, message: str | None = None) None

Create a tag in the repo.

Create a tag in the repository representing the release of the given version.

Parameters:
  • tag_name (str) – Tag name to write to the repo.

  • message (str) – Message string to associate with the release.

classmethod export(revision: object, path: str) None

Export the repository to the given path at the given revision.

Note

The directory at path must not exist, but the parent directory must exist.

Parameters:
  • revision (object) – Revision to export; current revision if None.

  • path (str) – Directory to export the repository to.