From 25b05296ad7d4d85916741ebdddf4c7dcf01c805 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 29 Nov 2015 17:43:26 +0100 Subject: fix issue #63 by passing a match parameter to git describe --- CHANGELOG.rst | 6 ++++++ setuptools_scm/git.py | 6 ++++-- testing/test_git.py | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e5ce195..430fc52 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,9 @@ + + +* fix isssue #63 by adding the --match parameter to the git describe call + and prepare the possibility of passing more options to scm backends + + v1.9.0 ====== diff --git a/setuptools_scm/git.py b/setuptools_scm/git.py index b271be0..a032fd8 100644 --- a/setuptools_scm/git.py +++ b/setuptools_scm/git.py @@ -6,7 +6,7 @@ from os.path import abspath, realpath FILES_COMMAND = 'git ls-files' -def parse(root): +def parse(root, match_tags=r'\d+'): real_root, _, ret = do_ex('git rev-parse --show-toplevel', root) trace('real root', real_root) if abspath(realpath(real_root)) != abspath(realpath(root)): @@ -15,7 +15,9 @@ def parse(root): if ret: return meta('0.0') rev_node = rev_node[:7] - out, err, ret = do_ex('git describe --dirty --tags --long', root) + out, err, ret = do_ex( + 'git describe --dirty --tags --long --match %r' % match_tags, + root) if '-' not in out and '.' not in out: revs = do('git rev-list HEAD', root) count = revs.count('\n') diff --git a/testing/test_git.py b/testing/test_git.py index 2fe98c1..5401b66 100644 --- a/testing/test_git.py +++ b/testing/test_git.py @@ -36,3 +36,9 @@ def test_find_files_stop_at_root_git(wd): wd.commit_testfile() wd.cwd.ensure('project/setup.cfg') assert integration.find_files(str(wd.cwd/'project')) == [] + + +def test_alphanumeric_tags_match(wd): + wd.commit_testfile() + wd('git tag newstyle-development-started') + assert wd.version.startswith('0.1.dev1+') -- cgit v1.2.1