launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06335
[Merge] lp:~wgrant/launchpad/bug-929938 into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/bug-929938 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #929938 in Launchpad itself: "deleting revno from main branch does not work as expected"
https://bugs.launchpad.net/launchpad/+bug/929938
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-929938/+merge/92610
Fix SourcePackageRecipeData.setRecipe to unset revspec if given None. Previously it would set it to a non-None value, but there was no way to unset it.
--
https://code.launchpad.net/~wgrant/launchpad/bug-929938/+merge/92610
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-929938 into lp:launchpad.
=== modified file 'lib/lp/code/model/sourcepackagerecipedata.py'
--- lib/lp/code/model/sourcepackagerecipedata.py 2012-01-03 01:40:09 +0000
+++ lib/lp/code/model/sourcepackagerecipedata.py 2012-02-11 07:11:20 +0000
@@ -303,6 +303,8 @@
raise PrivateBranchRecipe(base_branch)
if builder_recipe.revspec is not None:
self.revspec = unicode(builder_recipe.revspec)
+ else:
+ self.revspec = None
self._recordInstructions(
builder_recipe, parent_insn=None, branch_map=branch_map)
self.base_branch = base_branch
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-01-03 01:40:09 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-02-11 07:11:20 +0000
@@ -759,7 +759,7 @@
registrant=registrant, owner=owner, distroseries=[distroseries],
name=name, description=description, recipe=recipe_text)
transaction.commit()
- return recipe.builder_recipe
+ return recipe
def check_base_recipe_branch(self, branch, url, revspec=None,
num_child_branches=0, revid=None, deb_version=None):
@@ -780,7 +780,7 @@
# bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity,
deb_version='0.1-{revno}')
@@ -791,7 +791,7 @@
%(base)s
merge bar %(merged)s
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=1,
deb_version='0.1-{revno}')
@@ -806,7 +806,7 @@
%(base)s
nest bar %(nested)s baz
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=1,
deb_version='0.1-{revno}')
@@ -822,7 +822,7 @@
nest bar %(nested)s baz
merge zam %(merged)s
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=2,
deb_version='0.1-{revno}')
@@ -842,7 +842,7 @@
merge zam %(merged)s
nest bar %(nested)s baz
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=2,
deb_version='0.1-{revno}')
@@ -862,7 +862,7 @@
nest bar %(nested)s baz
merge zam %(merged)s
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=1,
deb_version='0.1-{revno}')
@@ -885,7 +885,7 @@
nest bar %(nested)s baz
nest zam %(nested2)s zoo
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=1,
deb_version='0.1-{revno}')
@@ -905,7 +905,7 @@
nest bar %(nested)s baz tag:b
merge zam %(merged)s 2
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=2,
revspec="revid:a", deb_version='0.1-{revno}')
@@ -921,13 +921,34 @@
self.check_recipe_branch(
child_branch, "zam", self.merged_branch.bzr_identity, revspec="2")
+ def test_unsets_revspecs(self):
+ # Changing a recipe's text to no longer include revspecs unsets
+ # them from the stored copy.
+ revspec_text = '''\
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
+ %(base)s revid:a
+ nest bar %(nested)s baz tag:b
+ merge zam %(merged)s 2
+ ''' % self.branch_identities
+ no_revspec_text = '''\
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
+ %(base)s
+ nest bar %(nested)s baz
+ merge zam %(merged)s
+ ''' % self.branch_identities
+ recipe = self.get_recipe(revspec_text)
+ self.assertEqual(textwrap.dedent(revspec_text), recipe.recipe_text)
+ with person_logged_in(recipe.owner):
+ recipe.setRecipeText(textwrap.dedent(no_revspec_text))
+ self.assertEqual(textwrap.dedent(no_revspec_text), recipe.recipe_text)
+
def test_builds_recipe_without_debversion(self):
recipe_text = '''\
# bzr-builder format 0.4
%(base)s
nest bar %(nested)s baz
''' % self.branch_identities
- base_branch = self.get_recipe(recipe_text)
+ base_branch = self.get_recipe(recipe_text).builder_recipe
self.check_base_recipe_branch(
base_branch, self.base_branch.bzr_identity, num_child_branches=1,
deb_version=None)