Merge lp:~jelmer/bzr-builddeb/deprecate-export-upstream into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 539
Merged at revision: 536
Proposed branch: lp:~jelmer/bzr-builddeb/deprecate-export-upstream
Merge into: lp:bzr-builddeb
Diff against target: 152 lines (+35/-37)
4 files modified
cmds.py (+26/-31)
debian/changelog (+5/-1)
doc/user_manual/configuration.rst (+3/-3)
upstream/branch.py (+1/-2)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/deprecate-export-upstream
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+52240@code.launchpad.net

Description of the change

Deprecate the 'export-upstream' configuration option in favour of 'upstream-branch'.

Fix the --export-upstream-revision argument for "bzr builddeb".

To post a comment you must log in.
539. By Jelmer Vernooij

Add bug #

Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmds.py'
2--- cmds.py 2011-02-27 16:15:50 +0000
3+++ cmds.py 2011-03-06 21:35:09 +0000
4@@ -2,7 +2,7 @@
5 # Copyright (C) 2005 Jamie Wilkinson <jaq@debian.org>
6 # 2006, 2007 James Westby <jw+debian@jameswestby.net>
7 # 2007 Reinhard Tartler <siretart@tauware.de>
8-# 2008 Canonical Ltd.
9+# 2008-2011 Canonical Ltd.
10 #
11 # This file is part of bzr-builddeb.
12 #
13@@ -47,6 +47,7 @@
14 NoWorkingTree,
15 )
16 from bzrlib.option import Option
17+from bzrlib.revisionspec import RevisionSpec
18 from bzrlib.tag import _merge_tags_if_possible
19 from bzrlib.trace import note, warning
20 from bzrlib.workingtree import WorkingTree
21@@ -63,7 +64,6 @@
22 from bzrlib.plugins.builddeb.config import (
23 BUILD_TYPE_MERGE,
24 BUILD_TYPE_NATIVE,
25- BUILD_TYPE_NORMAL,
26 BUILD_TYPE_SPLIT,
27 )
28 from bzrlib.plugins.builddeb.errors import (
29@@ -306,27 +306,19 @@
30 source = True
31 return branch, build_options, source
32
33- def _get_upstream_branch(self, build_type, export_upstream,
34- export_upstream_revision, config, version):
35- upstream_branch = None
36- upstream_revision = None
37- if build_type == BUILD_TYPE_MERGE:
38- if export_upstream is None:
39- export_upstream = config.export_upstream
40- if export_upstream:
41- upstream_branch = Branch.open(export_upstream)
42- upstream_branch.lock_read()
43- try:
44- upstream_source = UpstreamBranchSource(upstream_branch,
45- config=config)
46- if version is None:
47- upstream_revision = upstream_branch.last_revision()
48- else:
49- upstream_revision = upstream_source.version_as_revision(
50- None, version.upstream_version.encode("utf-8"))
51- finally:
52- upstream_branch.unlock()
53- return (upstream_branch, upstream_revision)
54+ def _get_upstream_branch(self, export_upstream, export_upstream_revision,
55+ config, version):
56+ upstream_branch = Branch.open(export_upstream)
57+ upstream_branch.lock_read()
58+ try:
59+ upstream_source = UpstreamBranchSource(upstream_branch, config=config)
60+ if export_upstream_revision:
61+ revspec = RevisionSpec.from_string(export_upstream_revision)
62+ revid = revspec.as_revision_id(upstream_branch)
63+ upstream_source.upstream_revision_map[version.encode("utf-8")] = revid
64+ finally:
65+ upstream_branch.unlock()
66+ return upstream_source
67
68 def run(self, branch_or_build_options_list=None, verbose=False,
69 working_tree=False,
70@@ -390,14 +382,17 @@
71 AptSource(),
72 ]
73 if build_type == BUILD_TYPE_MERGE:
74- upstream_branch, upstream_revision = self._get_upstream_branch(
75- build_type, export_upstream, export_upstream_revision, config,
76- changelog.version)
77- if upstream_branch is not None:
78- upstream_sources.append(UpstreamBranchSource(
79- upstream_branch,
80- {changelog.version.upstream_version:
81- upstream_revision}))
82+ if export_upstream is None and config.export_upstream:
83+ export_upstream = config.export_upstream
84+ warning("The 'export-upstream' configuration option is deprecated. "
85+ "Use 'upstream-branch' instead.")
86+ if export_upstream is None and config.upstream_branch:
87+ export_upstream = config.upstream_branch
88+ if export_upstream:
89+ upstream_branch_source = self._get_upstream_branch(
90+ export_upstream, export_upstream_revision, config,
91+ changelog.version.upstream_version)
92+ upstream_sources.append(upstream_branch_source)
93 elif not native and config.upstream_branch is not None:
94 upstream_branch = Branch.open(config.upstream_branch)
95 upstream_sources.append(UpstreamBranchSource(upstream_branch))
96
97=== modified file 'debian/changelog'
98--- debian/changelog 2011-03-01 12:17:01 +0000
99+++ debian/changelog 2011-03-06 21:35:09 +0000
100@@ -44,7 +44,11 @@
101
102 * Add devscripts to Build-Depends-Indep, the test suite runs dch.
103
104- -- Jelmer Vernooij <jelmer@debian.org> Sun, 27 Feb 2011 03:08:09 +0100
105+ [ Jelmer Vernooij ]
106+ * The 'export-upstream' configuration option is now deprecated in
107+ favour of 'upstream-branch'. LP: #730293
108+
109+ -- Jelmer Vernooij <jelmer@debian.org> Fri, 04 Mar 2011 19:30:01 +0100
110
111 bzr-builddeb (2.6) unstable; urgency=low
112
113
114=== modified file 'doc/user_manual/configuration.rst'
115--- doc/user_manual/configuration.rst 2009-03-02 22:06:20 +0000
116+++ doc/user_manual/configuration.rst 2011-03-06 21:35:09 +0000
117@@ -95,10 +95,10 @@
118
119 When the upstream source is in ``bazaar`` it is possible to have the
120 ``.orig.tar.gz`` created by exporting the upstream branch. To do this set
121-the ``export-upstream`` option. This only works only for merge mode. For
122+the ``upstream-branch`` option. This only works only for merge mode. For
123 normal mode use the ``merge-upstream`` command.
124
125- * ``export-upstream = path``
126+ * ``upstream-branch = path``
127
128 This option takes a path (remote or local) to a bzr branch that contains
129 the upstream code. If this is set then the plugin will export the code
130@@ -110,7 +110,7 @@
131 This sets the revision that the upstream code will be branched at. It takes
132 the same revision spec as the normal --revision parameter. Use it to
133 associate an upstream version number with a particular revision of the
134- upstream code. This has no effect if ``export-upstream`` is not set.
135+ upstream code. This has no effect if ``upstream-branch`` is not set.
136
137
138 Builders
139
140=== modified file 'upstream/branch.py'
141--- upstream/branch.py 2011-02-21 16:49:06 +0000
142+++ upstream/branch.py 2011-03-06 21:35:09 +0000
143@@ -228,8 +228,7 @@
144 assert isinstance(version, str)
145 if version in self.upstream_revision_map:
146 return self.upstream_revision_map[version]
147- revspec = get_export_upstream_revision(self.config,
148- version=version)
149+ revspec = get_export_upstream_revision(self.config, version=version)
150 if revspec is not None:
151 return RevisionSpec.from_string(
152 revspec).as_revision_id(self.upstream_branch)

Subscribers

People subscribed via source and target branches