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

Proposed by James Westby
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) Approve
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

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

Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'recipe.py'
--- recipe.py 2010-09-29 22:35:56 +0000
+++ recipe.py 2010-10-27 18:24:47 +0000
@@ -520,11 +520,16 @@
520520
521 def as_text(self):521 def as_text(self):
522 revid_part = self._get_revid_part()522 revid_part = self._get_revid_part()
523 if self.target_subdir is not None:523 if revid_part:
524 target_subdir = self.target_subdir
525 if target_subdir is None:
526 target_subdir = self.subpath
524 target_revid_part = " %s%s" % (527 target_revid_part = " %s%s" % (
525 self.target_subdir, revid_part)528 target_subdir, revid_part)
529 elif self.target_subdir is not None:
530 target_revid_part = " %s" % self.target_subdir
526 else:531 else:
527 target_revid_part = revid_part532 target_revid_part = ""
528 return "%s %s %s %s%s" % (533 return "%s %s %s %s%s" % (
529 NEST_PART_INSTRUCTION, self.recipe_branch.name,534 NEST_PART_INSTRUCTION, self.recipe_branch.name,
530 self.recipe_branch.url, self.subpath, target_revid_part)535 self.recipe_branch.url, self.subpath, target_revid_part)
531536
=== modified file 'tests/test_recipe.py'
--- tests/test_recipe.py 2010-09-29 22:35:56 +0000
+++ tests/test_recipe.py 2010-10-27 18:24:47 +0000
@@ -1087,6 +1087,29 @@
1087 "nest-part nested1 nested1_url foo bar tag:foo\n",1087 "nest-part nested1 nested1_url foo bar tag:foo\n",
1088 manifest)1088 manifest)
10891089
1090 def test_with_nest_part_with_no_target_dir(self):
1091 base_branch = BaseRecipeBranch("base_url", "1", 0.1)
1092 base_branch.revid = "base_revid"
1093 nested_branch1 = RecipeBranch("nested1", "nested1_url",
1094 revspec="tag:foo")
1095 base_branch.nest_part_branch(nested_branch1, "foo", None)
1096 manifest = base_branch.get_recipe_text()
1097 self.assertEqual("# bzr-builder format 0.1 deb-version 1\n"
1098 "base_url revid:base_revid\n"
1099 "nest-part nested1 nested1_url foo foo tag:foo\n",
1100 manifest)
1101
1102 def test_with_nest_part_with_no_target_dir_no_revspec(self):
1103 base_branch = BaseRecipeBranch("base_url", "1", 0.1)
1104 base_branch.revid = "base_revid"
1105 nested_branch1 = RecipeBranch("nested1", "nested1_url")
1106 base_branch.nest_part_branch(nested_branch1, "foo", None)
1107 manifest = base_branch.get_recipe_text()
1108 self.assertEqual("# bzr-builder format 0.1 deb-version 1\n"
1109 "base_url revid:base_revid\n"
1110 "nest-part nested1 nested1_url foo\n",
1111 manifest)
1112
10901113
1091class RecipeBranchTests(TestCaseInTempDir):1114class RecipeBranchTests(TestCaseInTempDir):
10921115

Subscribers

People subscribed via source and target branches