From aef4f7ef4faec987d553d1ca40b55951235af0b1 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 22 Dec 2014 00:20:04 +0000 Subject: _get_revno only returns a commit count * 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 --- pbr/packaging.py | 9 ++++----- 1 file 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 -- cgit v1.2.1