diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-08-22 14:19:23 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-08-23 17:28:49 +0200 |
commit | 75eedb84533d5bdc90b601beb99e3bdef8ae3690 (patch) | |
tree | 07d61a5062bac637cc7e5fe93cbb87b8e661fd3a /gbp/git.py | |
parent | 46d6c1badef27429b76819025388383ec6163d30 (diff) | |
download | git-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/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('~', '.') |