diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2015-11-29 17:43:26 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2015-11-29 17:43:26 +0100 |
commit | 25b05296ad7d4d85916741ebdddf4c7dcf01c805 (patch) | |
tree | 733042e9a053df5b96a8e49ba3192eb4a69f00c5 | |
parent | 9672e5795b8b80ca60ab81d2c107acd5f5af8617 (diff) | |
download | setuptools-scm-25b05296ad7d4d85916741ebdddf4c7dcf01c805.tar.gz |
fix issue #63 by passing a match parameter to git describe
-rw-r--r-- | CHANGELOG.rst | 6 | ||||
-rw-r--r-- | setuptools_scm/git.py | 6 | ||||
-rw-r--r-- | 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+') |