Skip to main content

Classes for Mercurial and Git repositories

Project description

https://img.shields.io/pypi/v/hgtools.svg https://img.shields.io/pypi/pyversions/hgtools.svg tests Ruff Code style: Black https://img.shields.io/badge/skeleton-2023-informational

Usage

hgtools provides classes for inspecting and working with repositories in the Mercurial and Git version control systems (VCS).

The classes provided by hgtools are designed to use subprocess invocation to leverage the command-line interfaces of the VCS tools hg and git. An in-process RepoManager for Mercurial exists but has been disabled due to issues that arise when run in certain environments (namely setuptools sandboxing).

Auto Version Numbering

With the 0.4 release, hgtools adds support for automatically generating project version numbers from the repository in which the project is developed.

To use this feature, the project must follow the following assumptions:

  • Repo tags are used to indicate released versions.

  • Tag names are specified as the version only (i.e. 0.1 or v0.1 and not release-0.1)

  • Released versions currently must conform to the Version in packaging. Any tags that don’t match this scheme will be ignored.

Thereafter, use the RepoManager.get_current_version to determine the version of the local code. If the current revision is tagged with a valid version, that version will be used. Otherwise, the tags in the repo will be searched, the latest release will be found, and hgtools will infer the upcoming release version.

For example, if the repo contains the tags 0.1, 0.2, and 0.3 and the repo is not on any of those tags, get_current_version will return ‘0.3.1dev’ and get_current_version(increment=’0.1’) will return ‘0.4dev’.

Example:

>>> from hgtools.managers import RepoManager
>>> RepoManager().get_first_valid_manager().get_current_version()
'9.0.1.dev0'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hgtools-10.0.0.tar.gz (19.3 kB view hashes)

Uploaded Source

Built Distribution

hgtools-10.0.0-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page