diff options
author | Daniel Gollub <dgollub@brocade.com> | 2015-03-17 08:12:53 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-04-25 09:19:56 +0200 |
commit | aa8548d526397a3c4353b7212f3f848ab1f1e283 (patch) | |
tree | 1a5d0ee3741167bbf471b1fb04ba1797aa01a935 /gbp/deb/git.py | |
parent | 4a53c0f5c5819fb26cd02d746f08d6d4f4ba18f0 (diff) |
Guess upstream-tag based on merge-base
In some unfortunate cases you might have something like this:
$ git tag
v1.0
vyatta/1.0-0something1
... where later tag is closer to describe current HEAD.
With upstream-tag set to v%(version)s find_tag() is going to propose
something based on vyatta/1.0-0something1 which is not expected.
The problem is that find_tag() returns tags, which match the
upstream-tag format, but which are not on the upstream-branch at all.
To fix this find_tag()/git-describe should not be used to determine
the closest upstream-tag.
Closes: gh#7
Diffstat (limited to 'gbp/deb/git.py')
-rw-r--r-- | gbp/deb/git.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py index 87df84eb..28177eb3 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -63,7 +63,8 @@ class DebianGitRepository(GitRepository): return None return None - def debian_version_from_upstream(self, upstream_tag_format, commit='HEAD', + def debian_version_from_upstream(self, upstream_tag_format, + upstream_branch, commit='HEAD', epoch=None): """ Build the Debian version that a package based on upstream commit @@ -71,13 +72,15 @@ class DebianGitRepository(GitRepository): @param upstream_tag_format: the tag format on the upstream branch @type upstream_tag_format: C{str} + @param upstream_branch: the upstream branch + @type upstream_branch: C{str} @param commit: the commit to search for the latest upstream version @param epoch: an epoch to use @returns: a new debian version @raises GitRepositoryError: if no upstream tag was found """ pattern = upstream_tag_format % dict(version='*') - tag = self.find_tag(commit, pattern=pattern) + tag = self.find_branch_tag(commit, upstream_branch, pattern=pattern) version = self.tag_to_version(tag, upstream_tag_format) version += "-1" |