summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pbr/tests/test_setup.py4
-rw-r--r--pbr/version.py8
2 files changed, 11 insertions, 1 deletions
diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py
index cd95c73..f3fcd40 100644
--- a/pbr/tests/test_setup.py
+++ b/pbr/tests/test_setup.py
@@ -99,7 +99,8 @@ class SkipFileWrites(base.BaseTestCase):
(self.option_value.lower() in options.TRUE_VALUES
or self.env_value is not None))
-_changelog_content = """04316fe\x00Make python\x00 (review/monty_taylor/27519)
+_changelog_content = """7780758\x00Break parser\x00 (tag: 1_foo.1)
+04316fe\x00Make python\x00 (review/monty_taylor/27519)
378261a\x00Add an integration test script.\x00
3c373ac\x00Merge "Lib\x00 (HEAD, tag: 2013.2.rc2, tag: 2013.2, mile-proposed)
182feb3\x00Fix pip invocation for old versions of pip.\x00 (tag: 0.5.17)
@@ -159,6 +160,7 @@ class GitLogsTest(base.BaseTestCase):
self.assertNotIn("ev)il", changelog_contents)
self.assertNotIn("e(vi)l", changelog_contents)
self.assertNotIn('Merge "', changelog_contents)
+ self.assertNotIn('1_foo.1', changelog_contents)
def test_generate_authors(self):
author_old = u"Foo Foo <email@foo.com>"
diff --git a/pbr/version.py b/pbr/version.py
index d3fe401..619c432 100644
--- a/pbr/version.py
+++ b/pbr/version.py
@@ -142,6 +142,14 @@ class SemanticVersion(object):
ever released - we're treating that as a critical bug that we ever
made them and have stopped doing that.
"""
+
+ try:
+ return klass._from_pip_string_unsafe(version_string)
+ except IndexError:
+ raise ValueError("Invalid version %r" % version_string)
+
+ @classmethod
+ def _from_pip_string_unsafe(klass, version_string):
# Versions need to start numerically, ignore if not
if not version_string[:1].isdigit():
raise ValueError("Invalid version %r" % version_string)