Tool for getting version info from git history
Project description
A simple tool for extracting version information from git tags and formatting it with optional post-release commit info.
Version tags can optionally use a v prefix, and can include pre-release versions.
Installation
Install from PyPI:
pip install vergit
Usage
Full usage:
vergit [-h] [--format {long,short,default,json}] [path]
The path can be omitted and defaults to the current directory.
There are several different formats which can be used:
long Always include the git revision info.
short Never include the git revision info, only the release version.
default Uses the long format if on a pre-release or there are commits after the release, otherwise the short format.
json Output JSON data describing the version.
Examples
If the current commit is tagged with v1.0.0:
$ vergit 1.0.0 $ vergit --format short 1.0.0 $ vergit --format long 1.0.0+git-0-123abcd $ vergit --format json {"version": "1.0.0", "git": "+git-0-123abcd", "gitn": "0", "gitsha": "123abcd", "pre_release": false}
If the commit before the current is tagged with 1.0.0:
$ vergit 1.0.0+git-1-123abcd $ vergit --format short 1.0.0 $ vergit --format long 1.0.0+git-0-123abcd $ vergit --format json {"version": "1.0.0", "git": "+git-1-123abcd", "gitn": "1", "gitsha": "123abcd", "pre_release": false}
If the current commit is tagged with v1.0.0rc1:
$ vergit 1.0.0rc1+git-0-123abcd $ vergit --format short 1.0.0rc1 $ vergit --format long 1.0.0rc1+git-0-123abcd $ vergit --format json {"version": "1.0.0rc1", "git": "+git-0-123abcd", "gitn": "0", "gitsha": "123abcd", "pre_release": true}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file vergit-1.0.2.tar.gz
.
File metadata
- Download URL: vergit-1.0.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea82a4d6057d4891a4b16e0881bd756ceea2b66253edc05dd619450f88a5ff31 |
|
MD5 | fd69336830c02da83e85554ca21d92c8 |
|
BLAKE2b-256 | d8dc2ef077a97a05633bbe7a46b9cb4b87fbf994a9aaa52b44a8f1086d20951f |