diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-11-16 14:12:15 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-11-16 14:12:15 +0100 |
commit | 53fa200700db07d7f71d08f06bd2210d0449d05a (patch) | |
tree | 9ec04978aaea8e3bd92a42aa33c7d5b3ccaa17be | |
parent | f982ccbb8aea0902788256ff177300d6c6f196e2 (diff) |
DebianGitRepository: split out _unsanitize_version
to be symmetric with _sanitize_version
Git-Dch: Ignore
-rw-r--r-- | gbp/deb/git.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py index 02c7c28f..5f4cdf4f 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -181,6 +181,15 @@ class DebianGitRepository(GitRepository): return version.replace('~', '_').replace(':', '%') @staticmethod + def _unsanitize_version(tag): + """Reverse _sanitize_version + + >>> DebianGitRepository._unsanitize_version("1%0_bpo3") + '1:0~bpo3' + """ + return tag.replace('_', '~').replace('%', ':') + + @staticmethod def tag_to_version(tag, format): """Extract the version from a tag @@ -194,8 +203,7 @@ class DebianGitRepository(GitRepository): '(?P<version>[\w_%+-.]+)') r = re.match(version_re, tag) if r: - version = r.group('version').replace('_', '~').replace('%', ':') - return version + return DebianGitRepository._unsanitize_version(r.group('version')) return None @property |