diff options
Diffstat (limited to 'gbp/git.py')
-rw-r--r-- | gbp/git.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -206,12 +206,22 @@ def create_repo(path): def build_tag(format, version): - """Generate a tag from a given format and a version""" + """Generate a tag from a given format and a version + >>> build_tag("debian/%(version)s", "0:0~0") + 'debian/0.0' + """ return format % dict(version=__sanitize_version(version)) def __sanitize_version(version): - """sanitize a version so git accepts it as a tag""" + """sanitize a version so git accepts it as a tag + >>> __sanitize_version("0.0.0") + '0.0.0' + >>> __sanitize_version("0.0~0") + '0.0.0' + >>> __sanitize_version("0:0.0") + '0.0' + """ if ':' in version: # strip of any epochs version = version.split(':', 1)[1] return version.replace('~', '.') |