← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/code-delete-no-recipe-preload into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/code-delete-no-recipe-preload into lp:launchpad.

Commit message:
Don't preload recipe data when deleting recipes associated with branches or repositories.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1793266 in Launchpad itself: "Unable to delete repository"
  https://bugs.launchpad.net/launchpad/+bug/1793266

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/code-delete-no-recipe-preload/+merge/364890
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/code-delete-no-recipe-preload into lp:launchpad.
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py	2019-02-01 14:08:34 +0000
+++ lib/lp/code/model/branch.py	2019-03-21 12:39:48 +0000
@@ -919,7 +919,7 @@
         deletion_operations.extend(
             DeletionCallable(
                 recipe, _('This recipe uses this branch.'), recipe.destroySelf)
-            for recipe in self.recipes)
+            for recipe in self._recipes)
         if not getUtility(ISnapSet).findByBranch(self).is_empty():
             alteration_operations.append(DeletionCallable(
                 None, _('Some snap packages build from this branch.'),

=== modified file 'lib/lp/code/model/gitrepository.py'
--- lib/lp/code/model/gitrepository.py	2019-02-11 12:31:06 +0000
+++ lib/lp/code/model/gitrepository.py	2019-03-21 12:39:48 +0000
@@ -1463,7 +1463,7 @@
             DeletionCallable(
                 recipe, msg("This recipe uses this repository."),
                 recipe.destroySelf)
-            for recipe in self.recipes)
+            for recipe in self._getRecipes())
         if not getUtility(ISnapSet).findByGitRepository(self).is_empty():
             alteration_operations.append(DeletionCallable(
                 None, msg("Some snap packages build from this repository."),


Follow ups