diff --git a/README.rst b/README.rst index 95da5ac..d9fd3b4 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,7 @@ this package allows to extract it from the underlying Git repository: setup( name='foobar', - version_format='{tag}.dev{commitcount}+{gitsha}', + version_format='{tag}.dev{commitcount}+{gitsha}-{dirty}', setup_requires=['setuptools-git-version'], ...) @@ -36,6 +36,7 @@ Fields * ``tag``: The latest tag (probably a release version like ``v1.0.3``) in your repository * ``commitcount``: The number of additional commits on top of this tag (e.g. ``13``) * ``gitsha``: An abbreviated commit hash of the latest commit in your repository +* ``dirty``: Result of the --dirty git option Implementation Details ---------------------- @@ -53,6 +54,11 @@ your repository Changes ------- +1.0.5 - 2019-07-17 +++++++++++++++++++ + +- [feature] added dirty to version_format + 1.0.4 - 2016-06-22 ++++++++++++++++++ diff --git a/setuptools_git_version.py b/setuptools_git_version.py index b788362..cbb9821 100644 --- a/setuptools_git_version.py +++ b/setuptools_git_version.py @@ -3,7 +3,7 @@ command = 'git describe --tags --long --dirty' -fmt = '{tag}.{commitcount}+{gitsha}' +fmt = '{tag}.{commitcount}+{gitsha}-{dirty}' def validate_version_format(dist, attr, value): @@ -23,7 +23,7 @@ def format_version(version, fmt=fmt): tag, count, sha = parts[:3] if count == '0' and not dirty: return tag - return fmt.format(tag=tag, commitcount=count, gitsha=sha.lstrip('g')) + return fmt.format(tag=tag, commitcount=count, gitsha=sha.lstrip('g'), dirty='Dirty' if dirty else '') def get_git_version():