diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-12-28 09:31:51 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-12-28 10:00:34 +0100 |
commit | 6850005ea0652a314a154e978f3dbe793801d57c (patch) | |
tree | fb7034caf04ceafc1c301fd8d15e5a1c43f1eff9 /gbp/deb | |
parent | 95f46f09eab66acd7d29ef55b855378ab87c56a8 (diff) |
Move _build_legacty_tag from GitRepository to to DebianGitRepository
and add doctest.
Git-Dch: Ignore
Diffstat (limited to 'gbp/deb')
-rw-r--r-- | gbp/deb/git.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py index f8cefedf..5890df22 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -51,6 +51,19 @@ class DebianGitRepository(GitRepository): return None @staticmethod + def _build_legacy_tag(format, version): + """ + Legacy tags (prior to 0.5.5) dropped epochs and didn't honor the '~' + + >>> DebianGitRepository._build_legacy_tag('upstream/%(version)s', '1:2.0~3') + 'upstream/2.0.3' + """ + if ':' in version: # strip of any epochs + version = version.split(':', 1)[1] + version = version.replace('~', '.') + return format % dict(version=version) + + @staticmethod def version_to_tag(format, version): """Generate a tag from a given format and a version |