summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-08-22 14:19:23 +0200
committerGuido Günther <agx@sigxcpu.org>2009-08-23 17:28:49 +0200
commit75eedb84533d5bdc90b601beb99e3bdef8ae3690 (patch)
tree07d61a5062bac637cc7e5fe93cbb87b8e661fd3a /gbp
parent46d6c1badef27429b76819025388383ec6163d30 (diff)
downloadgit-buildpackage-75eedb84533d5bdc90b601beb99e3bdef8ae3690.tar.gz
git-buildpackage-75eedb84533d5bdc90b601beb99e3bdef8ae3690.tar.bz2
git-buildpackage-75eedb84533d5bdc90b601beb99e3bdef8ae3690.zip
add doctest
for __sanitize_version() and build_tag()
Diffstat (limited to 'gbp')
-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('~', '.')