diff options
author | Jeremy Stanley <fungi@yuggoth.org> | 2014-12-22 00:20:04 +0000 |
---|---|---|
committer | Jeremy Stanley <fungi@yuggoth.org> | 2014-12-22 03:02:49 +0000 |
commit | aef4f7ef4faec987d553d1ca40b55951235af0b1 (patch) | |
tree | a0b541b086a12fea205dea828be7a67a73a38ea1 | |
parent | cd7da23937b66fea3ec42fa2f5a128f363a97e7e (diff) | |
download | pbr-aef4f7ef4faec987d553d1ca40b55951235af0b1.tar.gz |
_get_revno only returns a commit count0.10.7
* pbr/packaging.py(_get_revno): The _get_revno_and_last_tag method
always returns the same number of elements, so don't try to treat it
as an iterable and also rename it to something sensible.
Change-Id: I8a83135b979a13f8cd129126a29159e93c147467
-rw-r--r-- | pbr/packaging.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py index c84ce73..9a8f1c5 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -447,8 +447,8 @@ def have_sphinx(): return _have_sphinx -def _get_revno_and_last_tag(git_dir): - """Return the commit data about the most recent tag. +def _get_revno(git_dir): + """Return the commit count since the most recent tag. We use git-describe to find this out, but if there are no tags then we fall back to counting commits since the beginning @@ -478,8 +478,7 @@ def _get_version_from_git(pre_version): ['describe', '--exact-match'], git_dir, throw_on_error=True).replace('-', '.') except Exception: - return "%s.dev%s" % (pre_version, - _get_revno_and_last_tag(git_dir)[0]) + return "%s.dev%s" % (pre_version, _get_revno(git_dir)) else: # git describe always is going to return one of three things # - a short-sha if there are no tags @@ -490,7 +489,7 @@ def _get_version_from_git(pre_version): # First, if there are no -'s or .'s, then it's just a short sha. # Create a synthetic version for it. if '-' not in raw_version and '.' not in raw_version: - return "0.0.0.post%s" % _get_revno_and_last_tag(git_dir) + return "0.0.0.post%s" % _get_revno(git_dir) # Now, we want to strip the short-sha prefix stripped_version = raw_version.split('-g')[0] # Finally, if we convert - to .post, which will turn the remaining |