Merge lp:~jelmer/bzr-builddeb/auto-tag into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jelmer/bzr-builddeb/auto-tag
Merge into: lp:bzr-builddeb
Diff against target: 49 lines (+32/-0)
1 file modified
__init__.py (+32/-0)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/auto-tag
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+21854@code.launchpad.net

Description of the change

Implement a 'automatic_tag_name' hook that provides tag names based on the debian version.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

On Mon, 22 Mar 2010 14:03:21 -0000, Jelmer Vernooij <email address hidden> wrote:
> Jelmer Vernooij has proposed merging lp:~jelmer/bzr-builddeb/auto-tag into lp:bzr-builddeb.
>
> Requested reviews:
> Bzr-builddeb-hackers (bzr-builddeb-hackers)
>
>
> Implement a 'automatic_tag_name' hook that provides tag names based on the debian version.

Great.

Can we have the existing cmd_mark_uploaded command use this same code?

Thanks,

James

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I looked at that, but it seems like we'd end up with a more complex common function. The mark-uploaded code handles --force itself, allows more parameters and does the tag setting itself.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '__init__.py'
--- __init__.py 2010-02-12 19:45:37 +0000
+++ __init__.py 2010-03-22 14:03:20 +0000
@@ -27,6 +27,8 @@
2727
28import bzrlib28import bzrlib
29from bzrlib import (29from bzrlib import (
30 branch as _mod_branch,
31 errors,
30 merge,32 merge,
31 msgeditor,33 msgeditor,
32 )34 )
@@ -129,6 +131,36 @@
129 "the commit message")131 "the commit message")
130132
131133
134def debian_tag_name(branch, revid):
135 from bzrlib.plugins.builddeb.errors import MissingChangelogError
136 from bzrlib.plugins.builddeb.import_dsc import (DistributionBranch,
137 DistributionBranchSet)
138 from bzrlib.plugins.builddeb.util import (debuild_config, find_changelog)
139 t = branch.repository.revision_tree(revid)
140 config = debuild_config(t, False, False)
141 try:
142 (changelog, larstiq) = find_changelog(t, config.merge)
143 except MissingChangelogError:
144 # Not a debian package
145 return None
146 if changelog.distributions == 'UNRELEASED':
147 # The changelog still targets 'UNRELEASED', so apparently hasn't been
148 # uploaded. XXX: Give a warning of some sort here?
149 return None
150 db = DistributionBranch(branch, None)
151 dbs = DistributionBranchSet()
152 dbs.add_branch(db)
153 return db.tag_name(changelog.version)
154
155
156try:
157 _mod_branch.Branch.hooks.install_named_hook("automatic_tag_name",
158 debian_tag_name,
159 "Automatically determine tag names from Debian version")
160except errors.UnknownHook:
161 pass # bzr < 2.2 doesn't have this hook.
162
163
132try:164try:
133 from bzrlib.revisionspec import revspec_registry165 from bzrlib.revisionspec import revspec_registry
134 revspec_registry.register_lazy("package:",166 revspec_registry.register_lazy("package:",

Subscribers

People subscribed via source and target branches