summaryrefslogtreecommitdiff
path: root/gbp/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/git.py')
-rw-r--r--gbp/git.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 2fc29c9b..014403e9 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -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('~', '.')