summaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts/dch.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/scripts/dch.py')
-rw-r--r--gbp/scripts/dch.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 9db1a233..0d66a801 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -36,18 +36,20 @@ user_customizations = {}
snapshot_re = re.compile("\s*\*\* SNAPSHOT build @(?P<commit>[a-z0-9]+)\s+\*\*")
-def guess_version_from_upstream(repo, upstream_tag_format, upstream_branch, cp):
+def guess_version_from_upstream(repo, upstream_tag_format, upstream_branch, cp=None):
"""
Guess the version based on the latest version on the upstream branch.
If the version in dch is already higher this function returns None.
"""
+ epoch = cp.epoch if cp else None
+ cmp_version = cp.version if cp else '0~'
try:
version = repo.debian_version_from_upstream(upstream_tag_format,
upstream_branch,
- epoch=cp.epoch,
+ epoch=epoch,
debian_release=False)
gbp.log.debug("Found upstream version %s." % version)
- if compare_versions(version, cp.version) > 0:
+ if compare_versions(version, cmp_version) > 0:
return "%s-1" % version
except GitRepositoryError as e:
gbp.log.debug("No upstream tag found: %s" % e)