Merge lp:~jelmer/bzr-builddeb/distributionbranch-upstream-cleanup into lp:bzr-builddeb
- distributionbranch-upstream-cleanup
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | 571 |
Merged at revision: | 571 |
Proposed branch: | lp:~jelmer/bzr-builddeb/distributionbranch-upstream-cleanup |
Merge into: | lp:bzr-builddeb |
Diff against target: |
664 lines (+106/-112) 6 files modified
cmds.py (+4/-4) dh_make.py (+1/-1) import_dsc.py (+80/-86) merge_package.py (+2/-2) tests/blackbox/test_merge_upstream.py (+1/-1) tests/test_import_dsc.py (+18/-18) |
To merge this branch: | bzr merge lp:~jelmer/bzr-builddeb/distributionbranch-upstream-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Approve | ||
Review via email: mp+64685@code.launchpad.net |
Commit message
Description of the change
Clarify the meaning of upstream_branch and upstream_tree in DistributionBranch - these are the branches with the pristine upstream tar sources.
To post a comment you must log in.
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-06-14 14:04:53 +0000 |
3 | +++ cmds.py 2011-06-15 13:28:52 +0000 |
4 | @@ -557,7 +557,7 @@ |
5 | def _do_merge(self, tree, tarball_filenames, package, version, |
6 | current_version, upstream_branch, upstream_revision, merge_type, |
7 | force): |
8 | - db = DistributionBranch(tree.branch, None, tree=tree) |
9 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
10 | dbs = DistributionBranchSet() |
11 | dbs.add_branch(db) |
12 | if len(tarball_filenames) > 1: |
13 | @@ -860,7 +860,7 @@ |
14 | "yet supported.") |
15 | orig_dir = config.orig_dir or default_orig_dir |
16 | orig_target = os.path.join(tree.basedir, default_orig_dir) |
17 | - db = DistributionBranch(tree.branch, None, tree=tree) |
18 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
19 | dbs = DistributionBranchSet() |
20 | dbs.add_branch(db) |
21 | try: |
22 | @@ -945,8 +945,8 @@ |
23 | tempdir = tempfile.mkdtemp( |
24 | dir=branch.bzrdir.root_transport.clone('..').local_abspath('.')) |
25 | self.add_cleanup(shutil.rmtree, tempdir) |
26 | - db = DistributionBranch(branch, upstream_branch=upstream) |
27 | - if db.pristine_tar_source.has_version(None, version): |
28 | + db = DistributionBranch(branch, pristine_upstream_branch=branch) |
29 | + if db.pristine_upstream_source.has_version(None, version): |
30 | raise BzrCommandError("Version %s is already present." % version) |
31 | tagged_versions = {} |
32 | for tag_name, tag_revid in branch.tags.get_tag_dict().iteritems(): |
33 | |
34 | === modified file 'dh_make.py' |
35 | --- dh_make.py 2011-06-14 14:04:53 +0000 |
36 | +++ dh_make.py 2011-06-15 13:28:52 +0000 |
37 | @@ -84,7 +84,7 @@ |
38 | tarball_filenames = _get_tarballs(tree, tarball, |
39 | package_name, version, use_v3=use_v3) |
40 | db = import_dsc.DistributionBranch(tree.branch, tree.branch, tree=tree, |
41 | - upstream_tree=tree) |
42 | + pristine_upstream_tree=tree) |
43 | dbs = import_dsc.DistributionBranchSet() |
44 | dbs.add_branch(db) |
45 | if len(tarball_filenames) > 1: |
46 | |
47 | === modified file 'import_dsc.py' |
48 | --- import_dsc.py 2011-06-09 21:43:07 +0000 |
49 | +++ import_dsc.py 2011-06-15 13:28:52 +0000 |
50 | @@ -209,28 +209,28 @@ |
51 | have a total ordering with respect to these relationships. |
52 | """ |
53 | |
54 | - def __init__(self, branch, upstream_branch, tree=None, |
55 | - upstream_tree=None): |
56 | + def __init__(self, branch, pristine_upstream_branch, tree=None, |
57 | + pristine_upstream_tree=None): |
58 | """Create a distribution branch. |
59 | |
60 | You can only import packages on to the DistributionBranch |
61 | - if both tree and upstream_tree are provided. |
62 | + if both tree and pristine_upstream_tree are provided. |
63 | |
64 | :param branch: the Branch for the packaging part. |
65 | - :param upstream_branch: the Branch for the upstream part, if any. |
66 | + :param upstream_pristine_branch: the Branch for the pristine tar part, if any. |
67 | :param tree: an optional tree for the branch. |
68 | - :param upstream_tree: an optional upstream_tree for the |
69 | + :param pristine_upstream_tree: an optional tree for the |
70 | upstream_branch. |
71 | """ |
72 | self.branch = branch |
73 | self.tree = tree |
74 | - self.pristine_tar_source = PristineTarSource(branch=branch, tree=tree) |
75 | - self.upstream_branch = upstream_branch |
76 | - self.upstream_tree = upstream_tree |
77 | - if upstream_branch is not None: |
78 | - self.upstream_source = UpstreamBranchSource(self.upstream_branch) |
79 | + self.pristine_upstream_branch = pristine_upstream_branch |
80 | + self.pristine_upstream_tree = pristine_upstream_tree |
81 | + if pristine_upstream_branch is not None: |
82 | + self.pristine_upstream_source = PristineTarSource( |
83 | + branch=pristine_upstream_branch, tree=pristine_upstream_tree) |
84 | else: |
85 | - self.upstream_source = None |
86 | + self.pristine_upstream_source = None |
87 | self.get_lesser_branches = None |
88 | self.get_greater_branches = None |
89 | |
90 | @@ -341,8 +341,8 @@ |
91 | :return: True if the upstream branch contains the specified upstream |
92 | version of the package. False otherwise. |
93 | """ |
94 | - for tag_name in self.pristine_tar_source.possible_tag_names(version): |
95 | - if self._has_version(self.upstream_branch, tag_name, md5=md5): |
96 | + for tag_name in self.pristine_upstream_source.possible_tag_names(version): |
97 | + if self._has_version(self.pristine_upstream_branch, tag_name, md5=md5): |
98 | return True |
99 | return False |
100 | |
101 | @@ -442,11 +442,11 @@ |
102 | :return: the revision id corresponding to the upstream portion |
103 | of the version |
104 | """ |
105 | - for tag_name in self.pristine_tar_source.possible_tag_names(version): |
106 | - if self._has_version(self.upstream_branch, tag_name): |
107 | - return self.upstream_branch.tags.lookup_tag(tag_name) |
108 | - tag_name = self.pristine_tar_source.tag_name(version) |
109 | - return self.upstream_branch.tags.lookup_tag(tag_name) |
110 | + for tag_name in self.pristine_upstream_source.possible_tag_names(version): |
111 | + if self._has_version(self.pristine_upstream_branch, tag_name): |
112 | + return self.pristine_upstream_branch.tags.lookup_tag(tag_name) |
113 | + tag_name = self.pristine_upstream_source.tag_name(version) |
114 | + return self.pristine_upstream_branch.tags.lookup_tag(tag_name) |
115 | |
116 | def tag_version(self, version, revid=None): |
117 | """Tags the branch's last revision with the given version. |
118 | @@ -475,16 +475,16 @@ |
119 | :param version: the upstream part of the version number to derive the |
120 | tag name from. |
121 | :param revid: the revid to associate the tag with, or None for the |
122 | - tip of self.upstream_branch. |
123 | + tip of self.pristine_upstream_branch. |
124 | :return The tag name, revid of the added tag. |
125 | """ |
126 | assert isinstance(version, str) |
127 | - tag_name = self.pristine_tar_source.tag_name(version) |
128 | + tag_name = self.pristine_upstream_source.tag_name(version) |
129 | if revid is None: |
130 | - revid = self.upstream_branch.last_revision() |
131 | - self.upstream_branch.tags.set_tag(tag_name, revid) |
132 | + revid = self.pristine_upstream_branch.last_revision() |
133 | + self.pristine_upstream_branch.tags.set_tag(tag_name, revid) |
134 | try: |
135 | - self.branch.repository.fetch(self.upstream_branch.repository, |
136 | + self.branch.repository.fetch(self.pristine_upstream_branch.repository, |
137 | revision_id=revid) |
138 | except NoSuchRevision: |
139 | # See bug lp:574223 |
140 | @@ -612,13 +612,13 @@ |
141 | assert md5 is not None, \ |
142 | ("It's not a good idea to use branch_to_pull_upstream_from with " |
143 | "md5 == None, as you may pull the wrong revision.") |
144 | - up_branch = self.upstream_branch |
145 | + up_branch = self.pristine_upstream_branch |
146 | up_branch.lock_read() |
147 | try: |
148 | for branch in reversed(self.get_lesser_branches()): |
149 | if branch.has_upstream_version(version, md5=md5): |
150 | # Check that they haven't diverged |
151 | - other_up_branch = branch.upstream_branch |
152 | + other_up_branch = branch.pristine_upstream_branch |
153 | other_up_branch.lock_read() |
154 | try: |
155 | graph = other_up_branch.repository.get_graph( |
156 | @@ -631,7 +631,7 @@ |
157 | for branch in self.get_greater_branches(): |
158 | if branch.has_upstream_version(version, md5=md5): |
159 | # Check that they haven't diverged |
160 | - other_up_branch = branch.upstream_branch |
161 | + other_up_branch = branch.pristine_upstream_branch |
162 | other_up_branch.lock_read() |
163 | try: |
164 | graph = other_up_branch.repository.get_graph( |
165 | @@ -729,14 +729,14 @@ |
166 | pull_revision = pull_branch.revid_of_upstream_version(version) |
167 | mutter("Pulling upstream part of %s from revision %s" % \ |
168 | (version, pull_revision)) |
169 | - up_pull_branch = pull_branch.upstream_branch |
170 | - assert self.upstream_tree is not None, \ |
171 | + up_pull_branch = pull_branch.pristine_upstream_branch |
172 | + assert self.pristine_upstream_tree is not None, \ |
173 | "Can't pull upstream with no tree" |
174 | - self.upstream_tree.pull(up_pull_branch, |
175 | + self.pristine_upstream_tree.pull(up_pull_branch, |
176 | stop_revision=pull_revision) |
177 | self.tag_upstream_version(version, revid=pull_revision) |
178 | - self.branch.fetch(self.upstream_branch, last_revision=pull_revision) |
179 | - self.upstream_branch.tags.merge_to(self.branch.tags) |
180 | + self.branch.fetch(self.pristine_upstream_branch, last_revision=pull_revision) |
181 | + self.pristine_upstream_branch.tags.merge_to(self.branch.tags) |
182 | |
183 | def pull_version_from_branch(self, pull_branch, version, native=False): |
184 | """Pull a version from a particular branch. |
185 | @@ -772,12 +772,12 @@ |
186 | else: |
187 | assert False, ("Can't find the needed upstream part " |
188 | "for version %s" % version) |
189 | - if (native and self.upstream_branch.last_revision() == NULL_REVISION |
190 | - and pull_branch.upstream_branch.last_revision() != NULL_REVISION): |
191 | + if (native and self.pristine_upstream_branch.last_revision() == NULL_REVISION |
192 | + and pull_branch.pristine_upstream_branch.last_revision() != NULL_REVISION): |
193 | # in case the package wasn't native before then we pull |
194 | # the upstream. These checks may be a bit restrictive. |
195 | - self.upstream_tree.pull(pull_branch.upstream_branch) |
196 | - pull_branch.upstream_branch.tags.merge_to(self.upstream_branch.tags) |
197 | + self.pristine_upstream_tree.pull(pull_branch.pristine_upstream_branch) |
198 | + pull_branch.pristine_upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags) |
199 | elif native: |
200 | mutter("Not checking for upstream as it is a native package") |
201 | else: |
202 | @@ -834,8 +834,8 @@ |
203 | # Make sure we see any revisions added by the upstream branch |
204 | # since self.tree was locked. |
205 | self.branch.repository.refresh_data() |
206 | - self.branch.fetch(self.upstream_branch, last_revision=revid) |
207 | - self.upstream_branch.tags.merge_to(self.branch.tags) |
208 | + self.branch.fetch(self.pristine_upstream_branch, last_revision=revid) |
209 | + self.pristine_upstream_branch.tags.merge_to(self.branch.tags) |
210 | |
211 | def import_upstream(self, upstream_part, version, md5, upstream_parents, |
212 | upstream_tarball=None, upstream_branch=None, |
213 | @@ -863,28 +863,28 @@ |
214 | assert isinstance(version, str) |
215 | mutter("Importing upstream version %s from %s with parents %s" \ |
216 | % (version, upstream_part, str(upstream_parents))) |
217 | - assert self.upstream_tree is not None, \ |
218 | + assert self.pristine_upstream_tree is not None, \ |
219 | "Can't import upstream with no tree" |
220 | if len(upstream_parents) > 0: |
221 | parent_revid = upstream_parents[0] |
222 | else: |
223 | parent_revid = NULL_REVISION |
224 | - self.upstream_tree.pull(self.upstream_tree.branch, overwrite=True, |
225 | + self.pristine_upstream_tree.pull(self.pristine_upstream_tree.branch, overwrite=True, |
226 | stop_revision=parent_revid) |
227 | other_branches = self.get_other_branches() |
228 | def get_last_revision_tree(br): |
229 | return br.repository.revision_tree(br.last_revision()) |
230 | - upstream_trees = [get_last_revision_tree(o.upstream_branch) |
231 | + upstream_trees = [get_last_revision_tree(o.pristine_upstream_branch) |
232 | for o in other_branches] |
233 | target_tree = None |
234 | if upstream_branch is not None: |
235 | if upstream_revision is None: |
236 | upstream_revision = upstream_branch.last_revision() |
237 | - self.upstream_branch.fetch(upstream_branch, |
238 | + self.pristine_upstream_branch.fetch(upstream_branch, |
239 | last_revision=upstream_revision) |
240 | - upstream_branch.tags.merge_to(self.upstream_branch.tags) |
241 | + upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags) |
242 | upstream_parents.append(upstream_revision) |
243 | - target_tree = self.upstream_branch.repository.revision_tree( |
244 | + target_tree = self.pristine_upstream_branch.repository.revision_tree( |
245 | upstream_revision) |
246 | if file_ids_from is not None: |
247 | upstream_trees = file_ids_from + upstream_trees |
248 | @@ -895,16 +895,16 @@ |
249 | self_tree = self.get_branch_tip_revtree() |
250 | self_tree.lock_read() |
251 | try: |
252 | - import_dir(self.upstream_tree, upstream_part, |
253 | + import_dir(self.pristine_upstream_tree, upstream_part, |
254 | file_ids_from=[self_tree] + upstream_trees, |
255 | target_tree=target_tree) |
256 | finally: |
257 | self_tree.unlock() |
258 | - self.upstream_tree.set_parent_ids(upstream_parents) |
259 | + self.pristine_upstream_tree.set_parent_ids(upstream_parents) |
260 | revprops = {"deb-md5": md5} |
261 | if upstream_tarball is not None: |
262 | - delta_revprops = self.pristine_tar_source.create_delta_revprops( |
263 | - self.upstream_tree, upstream_tarball) |
264 | + delta_revprops = self.pristine_upstream_source.create_delta_revprops( |
265 | + self.pristine_upstream_tree, upstream_tarball) |
266 | revprops.update(delta_revprops) |
267 | if author is not None: |
268 | revprops['authors'] = author |
269 | @@ -912,7 +912,7 @@ |
270 | if timestamp is not None: |
271 | timezone = timestamp[1] |
272 | timestamp = timestamp[0] |
273 | - revid = self.upstream_tree.commit("Import upstream version %s" \ |
274 | + revid = self.pristine_upstream_tree.commit("Import upstream version %s" \ |
275 | % (version,), |
276 | revprops=revprops, timestamp=timestamp, timezone=timezone) |
277 | tag_name, _ = self.tag_upstream_version(version, revid=revid) |
278 | @@ -1090,7 +1090,7 @@ |
279 | importing the specified upstream version. |
280 | """ |
281 | parents = [] |
282 | - first_parent = self.upstream_branch.last_revision() |
283 | + first_parent = self.pristine_upstream_branch.last_revision() |
284 | if first_parent != NULL_REVISION: |
285 | parents = [first_parent] |
286 | last_contained_version = self.last_contained_version(versions) |
287 | @@ -1102,7 +1102,7 @@ |
288 | and not self.has_upstream_version(last_contained_version.upstream_version)): |
289 | revid = self.revid_of_version(last_contained_version) |
290 | parents.append(revid) |
291 | - self.upstream_branch.fetch(self.branch, |
292 | + self.pristine_upstream_branch.fetch(self.branch, |
293 | last_revision=revid) |
294 | pull_parents = self.get_parents(versions) |
295 | if ((first_parent == NULL_REVISION and len(pull_parents) > 0) |
296 | @@ -1119,11 +1119,11 @@ |
297 | mutter("Initialising upstream from %s, version %s" \ |
298 | % (str(pull_branch), str(pull_version))) |
299 | parents.append(pull_revid) |
300 | - self.upstream_branch.fetch( |
301 | - pull_branch.upstream_branch, |
302 | + self.pristine_upstream_branch.fetch( |
303 | + pull_branch.pristine_upstream_branch, |
304 | last_revision=pull_revid) |
305 | - pull_branch.upstream_branch.tags.merge_to( |
306 | - self.upstream_branch.tags) |
307 | + pull_branch.pristine_upstream_branch.tags.merge_to( |
308 | + self.pristine_upstream_branch.tags) |
309 | return parents |
310 | |
311 | def get_changelog_from_source(self, dir): |
312 | @@ -1150,7 +1150,7 @@ |
313 | # We need to import at least the diff, possibly upstream. |
314 | # Work out if we need the upstream part first. |
315 | imported_upstream = False |
316 | - if not self.has_upstream_version(version.upstream_version): |
317 | + if not self.pristine_upstream_source.has_version(None, version.upstream_version): |
318 | up_pull_branch = \ |
319 | self.branch_to_pull_upstream_from(version.upstream_version, |
320 | upstream_md5) |
321 | @@ -1195,9 +1195,9 @@ |
322 | branch.branch.tags.merge_to(self.branch.tags) |
323 | self.branch.fetch(branch.branch, |
324 | last_revision=revid) |
325 | - if self.upstream_branch.last_revision() == NULL_REVISION: |
326 | - self.upstream_tree.pull(branch.upstream_branch) |
327 | - branch.upstream_branch.tags.merge_to(self.upstream_branch.tags) |
328 | + if self.pristine_upstream_branch.last_revision() == NULL_REVISION: |
329 | + self.pristine_upstream_tree.pull(branch.pristine_upstream_branch) |
330 | + branch.pristine_upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags) |
331 | for branch in self.get_greater_branches(): |
332 | merged, missing_versions = \ |
333 | branch.contained_versions(missing_versions) |
334 | @@ -1208,9 +1208,9 @@ |
335 | branch.branch.tags.merge_to(self.branch.tags) |
336 | self.branch.fetch(branch.branch, |
337 | last_revision=revid) |
338 | - if self.upstream_branch.last_revision() == NULL_REVISION: |
339 | - self.upstream_tree.pull(branch.upstream_branch) |
340 | - branch.upstream_branch.tags.merge_to(self.upstream_branch.tags) |
341 | + if self.pristine_upstream_branch.last_revision() == NULL_REVISION: |
342 | + self.pristine_upstream_tree.pull(branch.pristine_upstream_branch) |
343 | + branch.pristine_upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags) |
344 | if (self.branch.last_revision() != NULL_REVISION |
345 | and not self.branch.last_revision() in parents): |
346 | parents.insert(0, self.branch.last_revision()) |
347 | @@ -1300,16 +1300,16 @@ |
348 | # TODO: remove the _extract_upstream_tree alias below. |
349 | to_location = os.path.join(basedir, "upstream") |
350 | # Use upstream_branch if it has been set, otherwise self.branch. |
351 | - source_branch = self.upstream_branch or self.branch |
352 | + source_branch = self.pristine_upstream_branch or self.branch |
353 | dir_to = source_branch.bzrdir.sprout(to_location, |
354 | revision_id=upstream_tip, |
355 | accelerator_tree=self.tree) |
356 | try: |
357 | - self.upstream_tree = dir_to.open_workingtree() |
358 | + self.pristine_upstream_tree = dir_to.open_workingtree() |
359 | except NoWorkingTree: |
360 | # Handle shared treeless repo's. |
361 | - self.upstream_tree = dir_to.create_workingtree() |
362 | - self.upstream_branch = self.upstream_tree.branch |
363 | + self.pristine_upstream_tree = dir_to.create_workingtree() |
364 | + self.pristine_upstream_branch = self.pristine_upstream_tree.branch |
365 | |
366 | _extract_upstream_tree = extract_upstream_tree |
367 | |
368 | @@ -1333,8 +1333,8 @@ |
369 | else: |
370 | branch = existing_bzrdir.create_branch() |
371 | existing_bzrdir.create_workingtree() |
372 | - self.upstream_branch = branch |
373 | - self.upstream_tree = branch.bzrdir.open_workingtree() |
374 | + self.pristine_upstream_branch = branch |
375 | + self.pristine_upstream_tree = branch.bzrdir.open_workingtree() |
376 | if self.tree: |
377 | root_id = self.tree.path2id('') |
378 | else: |
379 | @@ -1345,7 +1345,7 @@ |
380 | finally: |
381 | tip.unlock() |
382 | if root_id: |
383 | - self.upstream_tree.set_root_id(root_id) |
384 | + self.pristine_upstream_tree.set_root_id(root_id) |
385 | |
386 | def _extract_tarball_to_tempdir(self, tarball_filename): |
387 | tempdir = tempfile.mkdtemp() |
388 | @@ -1365,28 +1365,23 @@ |
389 | shutil.rmtree(tempdir) |
390 | raise |
391 | |
392 | - def _export_previous_upstream_tree(self, package, previous_version, tempdir, upstream_branch=None): |
393 | + def _export_previous_upstream_tree(self, package, previous_version, tempdir): |
394 | assert isinstance(previous_version, str), \ |
395 | "Should pass upstream version as str, not Version." |
396 | - if self.pristine_tar_source.has_version(package, previous_version): |
397 | - upstream_tip = self.pristine_tar_source.version_as_revision( |
398 | + if self.pristine_upstream_source.has_version(package, previous_version): |
399 | + upstream_tip = self.pristine_upstream_source.version_as_revision( |
400 | package, previous_version) |
401 | self.extract_upstream_tree(upstream_tip, tempdir) |
402 | - elif self.upstream_source is not None: |
403 | - upstream_tip = self.upstream_source.version_as_revision(package, previous_version) |
404 | - self.extract_upstream_tree(upstream_tip, tempdir) |
405 | else: |
406 | raise BzrCommandError("Unable to find the tag for the " |
407 | "previous upstream version, %s, in the branch: " |
408 | "%s" % ( |
409 | previous_version, |
410 | - self.pristine_tar_source.tag_name(previous_version))) |
411 | + self.pristine_upstream_source.tag_name(previous_version))) |
412 | |
413 | def merge_upstream(self, tarball_filename, package, version, previous_version, |
414 | upstream_branch=None, upstream_revision=None, merge_type=None, |
415 | force=False): |
416 | - assert self.upstream_branch is None, \ |
417 | - "Should use self.upstream_branch if set" |
418 | assert isinstance(version, str), \ |
419 | "Should pass version as str not %s" % str(type(version)) |
420 | assert isinstance(previous_version, str) or previous_version is None, \ |
421 | @@ -1395,11 +1390,10 @@ |
422 | tempdir = tempfile.mkdtemp(dir=os.path.join(self.tree.basedir, '..')) |
423 | try: |
424 | if previous_version is not None: |
425 | - self._export_previous_upstream_tree(package, previous_version, tempdir, |
426 | - upstream_branch) |
427 | + self._export_previous_upstream_tree(package, previous_version, tempdir) |
428 | else: |
429 | self._create_empty_upstream_tree(tempdir) |
430 | - if self.pristine_tar_source.has_version(package, version): |
431 | + if self.pristine_upstream_source.has_version(package, version): |
432 | raise UpstreamAlreadyImported(version) |
433 | if upstream_branch is not None: |
434 | upstream_branch.lock_read() |
435 | @@ -1418,8 +1412,8 @@ |
436 | try: |
437 | # FIXME: should use upstream_parents()? |
438 | parents = [] |
439 | - if self.upstream_branch.last_revision() != NULL_REVISION: |
440 | - parents = [self.upstream_branch.last_revision()] |
441 | + if self.pristine_upstream_branch.last_revision() != NULL_REVISION: |
442 | + parents = [self.pristine_upstream_branch.last_revision()] |
443 | _, new_revid = self.import_upstream(tarball_dir, |
444 | version, |
445 | md5sum, parents, upstream_tarball=tarball_filename, |
446 | @@ -1431,7 +1425,7 @@ |
447 | if self.branch.last_revision() != NULL_REVISION: |
448 | try: |
449 | conflicts = self.tree.merge_from_branch( |
450 | - self.upstream_branch, merge_type=merge_type) |
451 | + self.pristine_upstream_branch, merge_type=merge_type) |
452 | except UnrelatedBranches: |
453 | # Bug lp:515367 where the first upstream tarball is |
454 | # missing a proper history link and a criss-cross merge |
455 | @@ -1442,14 +1436,14 @@ |
456 | else: |
457 | from_revision = parents[0] |
458 | conflicts = self.tree.merge_from_branch( |
459 | - self.upstream_branch, merge_type=merge_type, |
460 | + self.pristine_upstream_branch, merge_type=merge_type, |
461 | from_revision=from_revision) |
462 | else: |
463 | # Pull so that merge-upstream allows you to start a branch |
464 | # from upstream tarball. |
465 | conflicts = 0 |
466 | - self.tree.pull(self.upstream_branch) |
467 | - self.upstream_branch.tags.merge_to(self.branch.tags) |
468 | + self.tree.pull(self.pristine_upstream_branch) |
469 | + self.pristine_upstream_branch.tags.merge_to(self.branch.tags) |
470 | return conflicts |
471 | finally: |
472 | if upstream_branch is not None: |
473 | |
474 | === modified file 'merge_package.py' |
475 | --- merge_package.py 2011-01-29 00:13:30 +0000 |
476 | +++ merge_package.py 2011-06-15 13:28:52 +0000 |
477 | @@ -60,7 +60,7 @@ |
478 | db = DistributionBranch(branch, branch) |
479 | uver = _latest_version(branch).upstream_version |
480 | results.append((Version(uver), |
481 | - db.pristine_tar_source.version_as_revision(None, uver))) |
482 | + db.pristine_upstream_source.version_as_revision(None, uver))) |
483 | |
484 | return results |
485 | |
486 | @@ -137,7 +137,7 @@ |
487 | # Extract the merge target's upstream tree into a temporary |
488 | # directory. |
489 | db.extract_upstream_tree(ut_revid, tempdir) |
490 | - tmp_target_utree = db.upstream_tree |
491 | + tmp_target_utree = db.pristine_upstream_tree |
492 | |
493 | # Merge upstream branch tips to obtain a shared upstream parent. |
494 | # This will add revision K (see graph above) to a temporary merge |
495 | |
496 | === modified file 'tests/blackbox/test_merge_upstream.py' |
497 | --- tests/blackbox/test_merge_upstream.py 2011-06-13 23:01:14 +0000 |
498 | +++ tests/blackbox/test_merge_upstream.py 2011-06-15 13:28:52 +0000 |
499 | @@ -88,7 +88,7 @@ |
500 | branchpath = test_case.getUniqueString() |
501 | tree = self.upstream.tree.bzrdir.sprout(branchpath).open_workingtree() |
502 | db = DistributionBranch(tree.branch, tree.branch, tree=tree, |
503 | - upstream_tree=tree) |
504 | + pristine_upstream_tree=tree) |
505 | dbs = DistributionBranchSet() |
506 | dbs.add_branch(db) |
507 | db.import_upstream_tarball(self.tar.tarball, str(self.tar.version), |
508 | |
509 | === modified file 'tests/test_import_dsc.py' |
510 | --- tests/test_import_dsc.py 2011-06-10 11:47:25 +0000 |
511 | +++ tests/test_import_dsc.py 2011-06-15 13:28:52 +0000 |
512 | @@ -82,28 +82,28 @@ |
513 | self.up_tree1.set_root_id(root_id) |
514 | self.db1 = DistributionBranch(self.tree1.branch, |
515 | self.up_tree1.branch, tree=self.tree1, |
516 | - upstream_tree=self.up_tree1) |
517 | + pristine_upstream_tree=self.up_tree1) |
518 | self.tree2 = self.make_branch_and_tree('experimental') |
519 | self.tree2.set_root_id(root_id) |
520 | self.up_tree2 = self.make_branch_and_tree('experimental-upstream') |
521 | self.up_tree2.set_root_id(root_id) |
522 | self.db2 = DistributionBranch(self.tree2.branch, |
523 | self.up_tree2.branch, tree=self.tree2, |
524 | - upstream_tree=self.up_tree2) |
525 | + pristine_upstream_tree=self.up_tree2) |
526 | self.tree3 = self.make_branch_and_tree('gutsy') |
527 | self.tree3.set_root_id(root_id) |
528 | self.up_tree3 = self.make_branch_and_tree('gutsy-upstream') |
529 | self.up_tree3.set_root_id(root_id) |
530 | self.db3 = DistributionBranch(self.tree3.branch, |
531 | self.up_tree3.branch, tree=self.tree3, |
532 | - upstream_tree=self.up_tree3) |
533 | + pristine_upstream_tree=self.up_tree3) |
534 | self.tree4 = self.make_branch_and_tree('hardy') |
535 | self.tree4.set_root_id(root_id) |
536 | self.up_tree4 = self.make_branch_and_tree('hardy-upstream') |
537 | self.up_tree4.set_root_id(root_id) |
538 | self.db4 = DistributionBranch(self.tree4.branch, |
539 | self.up_tree4.branch, tree=self.tree4, |
540 | - upstream_tree=self.up_tree4) |
541 | + pristine_upstream_tree=self.up_tree4) |
542 | self.set = DistributionBranchSet() |
543 | self.set.add_branch(self.db1) |
544 | self.set.add_branch(self.db2) |
545 | @@ -128,9 +128,9 @@ |
546 | db = self.db1 |
547 | self.assertNotEqual(db, None) |
548 | self.assertEqual(db.branch, self.tree1.branch) |
549 | - self.assertEqual(db.upstream_branch, self.up_tree1.branch) |
550 | + self.assertEqual(db.pristine_upstream_branch, self.up_tree1.branch) |
551 | self.assertEqual(db.tree, self.tree1) |
552 | - self.assertEqual(db.upstream_tree, self.up_tree1) |
553 | + self.assertEqual(db.pristine_upstream_tree, self.up_tree1) |
554 | |
555 | def test_tag_name(self): |
556 | db = self.db1 |
557 | @@ -153,7 +153,7 @@ |
558 | version = "0.1" |
559 | revid = tree.commit("one") |
560 | db.tag_upstream_version(version) |
561 | - tag_name = db.pristine_tar_source.tag_name(version) |
562 | + tag_name = db.pristine_upstream_source.tag_name(version) |
563 | self.assertEqual(tree.branch.tags.lookup_tag(tag_name), revid) |
564 | |
565 | def test_has_version(self): |
566 | @@ -888,7 +888,7 @@ |
567 | builder.add_default_control() |
568 | builder.build() |
569 | self.db1.import_package(builder.dsc_name()) |
570 | - self.db1.upstream_tree = None |
571 | + self.db1.pristine_upstream_tree = None |
572 | builder.new_version(version2) |
573 | builder.build() |
574 | self.db2.import_package(builder.dsc_name()) |
575 | @@ -903,7 +903,7 @@ |
576 | builder.add_default_control() |
577 | builder.build() |
578 | self.db2.import_package(builder.dsc_name()) |
579 | - self.db2.upstream_tree = None |
580 | + self.db2.pristine_upstream_tree = None |
581 | builder.new_version(version2) |
582 | builder.build() |
583 | self.db1.import_package(builder.dsc_name()) |
584 | @@ -1482,7 +1482,7 @@ |
585 | self.write_changelog(cl, 'work/debian/changelog') |
586 | tree.add(['debian/', 'debian/changelog']) |
587 | orig_debian_rev = tree.commit("two") |
588 | - db = DistributionBranch(tree.branch, None, tree=tree) |
589 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
590 | dbs = DistributionBranchSet() |
591 | dbs.add_branch(db) |
592 | tarball_filename = "package-0.2.tar.gz" |
593 | @@ -1519,7 +1519,7 @@ |
594 | self.addCleanup(tree.unlock) |
595 | upstream_tree.lock_read() |
596 | self.addCleanup(upstream_tree.unlock) |
597 | - db = DistributionBranch(tree.branch, None, tree=tree) |
598 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
599 | dbs = DistributionBranchSet() |
600 | dbs.add_branch(db) |
601 | tarball_filename = "package-0.2.tar.gz" |
602 | @@ -1559,7 +1559,7 @@ |
603 | self.addCleanup(tree.unlock) |
604 | upstream_tree.lock_read() |
605 | self.addCleanup(upstream_tree.unlock) |
606 | - db = DistributionBranch(tree.branch, None, tree=tree) |
607 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
608 | dbs = DistributionBranchSet() |
609 | dbs.add_branch(db) |
610 | tarball_filename = "package-0.2.tar.gz" |
611 | @@ -1597,7 +1597,7 @@ |
612 | packaging_upstream_tree = self.make_branch_and_tree( |
613 | "packaging-upstream") |
614 | db = DistributionBranch(tree.branch, packaging_upstream_tree.branch, |
615 | - tree=tree, upstream_tree=packaging_upstream_tree) |
616 | + tree=tree, pristine_upstream_tree=packaging_upstream_tree) |
617 | dbs = DistributionBranchSet() |
618 | dbs.add_branch(db) |
619 | db.import_package(builder.dsc_name()) |
620 | @@ -1609,7 +1609,7 @@ |
621 | upstream_tree.add(['a'], ['a-id']) |
622 | upstream_tree.commit("one") |
623 | upstream_rev = upstream_tree.branch.last_revision() |
624 | - db = DistributionBranch(tree.branch, None, tree=tree) |
625 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
626 | dbs = DistributionBranchSet() |
627 | dbs.add_branch(db) |
628 | tree.lock_write() |
629 | @@ -1639,7 +1639,7 @@ |
630 | self.write_changelog(cl, 'work/debian/changelog') |
631 | tree.add(['debian/', 'debian/changelog']) |
632 | orig_debian_rev = tree.commit("two") |
633 | - db = DistributionBranch(tree.branch, None, tree=tree) |
634 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
635 | dbs = DistributionBranchSet() |
636 | dbs.add_branch(db) |
637 | tarball_filename = "package-0.2.tar.gz" |
638 | @@ -1675,7 +1675,7 @@ |
639 | upstream_tree.add(['a'], ['a-id']) |
640 | upstream_rev1 = upstream_tree.commit("one") |
641 | tree = upstream_tree.bzrdir.sprout('packaging').open_workingtree() |
642 | - db = DistributionBranch(tree.branch, None, tree=tree) |
643 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
644 | dbs = DistributionBranchSet() |
645 | dbs.add_branch(db) |
646 | tree.lock_write() |
647 | @@ -1711,7 +1711,7 @@ |
648 | upstream_tree.add(['a', 'b'], ['a-id', 'b-id']) |
649 | upstream_rev1 = upstream_tree.commit("one") |
650 | tree = upstream_tree.bzrdir.sprout('packaging').open_workingtree() |
651 | - db = DistributionBranch(tree.branch, None, tree=tree) |
652 | + db = DistributionBranch(tree.branch, tree.branch, tree=tree) |
653 | dbs = DistributionBranchSet() |
654 | dbs.add_branch(db) |
655 | tree.lock_write() |
656 | @@ -1747,7 +1747,7 @@ |
657 | self.build_tree(['packaging/a']) |
658 | packaging_tree.add(['a'], ['a-id']) |
659 | upstream_rev1 = packaging_tree.commit("one") |
660 | - db = DistributionBranch(packaging_tree.branch, None, |
661 | + db = DistributionBranch(packaging_tree.branch, packaging_tree.branch, |
662 | tree=packaging_tree) |
663 | dbs = DistributionBranchSet() |
664 | dbs.add_branch(db) |