← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-stormify-bugbranch into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-bugbranch into launchpad:master.

Commit message:
Temporarily avoid is_empty on bound ReferenceSets

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/380838

Now that linked_bugbranches is a ReferenceSet, .is_empty() doesn't work on it.  I've proposed https://code.launchpad.net/~cjwatson/storm/reference-set-is-empty/+merge/380837 to fix that, but work around it in the meantime.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-stormify-bugbranch into launchpad:master.
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index 22bb6c4..3625593 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -956,7 +956,10 @@ class BugTaskImageDisplayAPI(ObjectImageDisplayAPI):
 
     def _hasBugBranch(self):
         """Return whether the bug has a branch linked to it."""
-        return not self._context.bug.linked_bugbranches.is_empty()
+        # XXX cjwatson 2020-03-18: This should use the more efficient
+        # .is_empty(), but that doesn't work on `BoundReferenceSet`s.
+        #   https://code.launchpad.net/~cjwatson/storm/reference-set-is-empty/+merge/380837
+        return self._context.bug.linked_bugbranches.any() is None
 
     def _hasSpecification(self):
         """Return whether the bug is linked to a specification."""