Merge lp:~james-w/bzr-builder/fix-nest-part-manifest into lp:bzr-builder

Proposed by James Westby on 2010-10-27
Status: Merged
Merged at revision: 109
Proposed branch: lp:~james-w/bzr-builder/fix-nest-part-manifest
Merge into: lp:bzr-builder
Diff against target: 56 lines (+31/-3)
2 files modified
recipe.py (+8/-3)
tests/test_recipe.py (+23/-0)
To merge this branch: bzr merge lp:~james-w/bzr-builder/fix-nest-part-manifest
Reviewer Review Type Date Requested Status
Aaron Bentley (community) 2010-10-27 Approve on 2010-10-27
Review via email: mp+39466@code.launchpad.net

Description of the Change

Hi,

This fixes the bug that you just found.

Thanks,

James

To post a comment you must log in.
110. By James Westby on 2010-10-27

Also fix the case where there is no revspec and no target path. Thanks Aaron.

Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'recipe.py'
2--- recipe.py 2010-09-29 22:35:56 +0000
3+++ recipe.py 2010-10-27 18:24:47 +0000
4@@ -520,11 +520,16 @@
5
6 def as_text(self):
7 revid_part = self._get_revid_part()
8- if self.target_subdir is not None:
9+ if revid_part:
10+ target_subdir = self.target_subdir
11+ if target_subdir is None:
12+ target_subdir = self.subpath
13 target_revid_part = " %s%s" % (
14- self.target_subdir, revid_part)
15+ target_subdir, revid_part)
16+ elif self.target_subdir is not None:
17+ target_revid_part = " %s" % self.target_subdir
18 else:
19- target_revid_part = revid_part
20+ target_revid_part = ""
21 return "%s %s %s %s%s" % (
22 NEST_PART_INSTRUCTION, self.recipe_branch.name,
23 self.recipe_branch.url, self.subpath, target_revid_part)
24
25=== modified file 'tests/test_recipe.py'
26--- tests/test_recipe.py 2010-09-29 22:35:56 +0000
27+++ tests/test_recipe.py 2010-10-27 18:24:47 +0000
28@@ -1087,6 +1087,29 @@
29 "nest-part nested1 nested1_url foo bar tag:foo\n",
30 manifest)
31
32+ def test_with_nest_part_with_no_target_dir(self):
33+ base_branch = BaseRecipeBranch("base_url", "1", 0.1)
34+ base_branch.revid = "base_revid"
35+ nested_branch1 = RecipeBranch("nested1", "nested1_url",
36+ revspec="tag:foo")
37+ base_branch.nest_part_branch(nested_branch1, "foo", None)
38+ manifest = base_branch.get_recipe_text()
39+ self.assertEqual("# bzr-builder format 0.1 deb-version 1\n"
40+ "base_url revid:base_revid\n"
41+ "nest-part nested1 nested1_url foo foo tag:foo\n",
42+ manifest)
43+
44+ def test_with_nest_part_with_no_target_dir_no_revspec(self):
45+ base_branch = BaseRecipeBranch("base_url", "1", 0.1)
46+ base_branch.revid = "base_revid"
47+ nested_branch1 = RecipeBranch("nested1", "nested1_url")
48+ base_branch.nest_part_branch(nested_branch1, "foo", None)
49+ manifest = base_branch.get_recipe_text()
50+ self.assertEqual("# bzr-builder format 0.1 deb-version 1\n"
51+ "base_url revid:base_revid\n"
52+ "nest-part nested1 nested1_url foo\n",
53+ manifest)
54+
55
56 class RecipeBranchTests(TestCaseInTempDir):
57

Subscribers

People subscribed via source and target branches