aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-12-28 10:30:07 +0100
committerGuido Günther <agx@sigxcpu.org>2011-12-28 10:44:36 +0100
commit747c05d728d3ab15c84ff22e077c7943d924d695 (patch)
treee672e40af1429aa878a5bcbe1ab2ec5f88c2393c /gbp/scripts
parent0a462f437763014123b75f9784f4bf17cfc809cd (diff)
dch: Honor epoch when guessing new upstream version
Closes: #652366 Thanks: a lot to Daniel Dehennin for the testcase
Diffstat (limited to 'gbp/scripts')
-rw-r--r--gbp/scripts/dch.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 2d4a8ed4..2ee988d8 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -106,15 +106,16 @@ def guess_version_from_upstream(repo, upstream_tag_format, cp):
"""
Guess the version based on the latest version on the upstream branch
"""
- pattern = upstream_tag_format.replace('%(version)s', '*')
+ pattern = upstream_tag_format % dict(version='*')
try:
tag = repo.find_tag('HEAD', pattern=pattern)
- upstream = repo.tag_to_version(tag, upstream_tag_format)
- if upstream:
- gbp.log.debug("Found upstream version %s." % upstream)
- new_version = "%s-1" % upstream
- if compare_versions(upstream, cp.version) > 0:
- return new_version
+ version = repo.tag_to_version(tag, upstream_tag_format)
+ if version:
+ gbp.log.debug("Found upstream version %s." % version)
+ if cp.has_epoch():
+ version = "%s:%s" % (cp.epoch, version)
+ if compare_versions(version, cp.version) > 0:
+ return "%s-1" % version
except GitRepositoryError:
gbp.log.debug("No tag found matching pattern %s." % pattern)
return None