def getProposals(self): """Get the proposals for the view.""" collection = IBranchCollection(self.context) collection = collection.visibleByUser(self.user) proposals = collection.getMergeProposals( [BranchMergeProposalStatus.CODE_APPROVED, BranchMergeProposalStatus.NEEDS_REVIEW], eager_load=True ) return proposals
def getProposals(self): """Get the proposals for the view.""" collection = IBranchCollection(self.context) collection = collection.visibleByUser(self.user) proposals = collection.getMergeProposals([ BranchMergeProposalStatus.CODE_APPROVED, BranchMergeProposalStatus.NEEDS_REVIEW ], eager_load=True) return proposals
def getMergeProposals(self, status=None, visible_by_user=None, eager_load=False): """See `IHasMergeProposals`.""" if not status: status = ( BranchMergeProposalStatus.CODE_APPROVED, BranchMergeProposalStatus.NEEDS_REVIEW, BranchMergeProposalStatus.WORK_IN_PROGRESS) collection = IBranchCollection(self).visibleByUser(visible_by_user) return collection.getMergeProposals(status, eager_load=eager_load)
def getBranches(self, status=None, visible_by_user=None, modified_since=None, eager_load=False): """See `IHasBranches`.""" if status is None: status = DEFAULT_BRANCH_STATUS_IN_LISTING collection = IBranchCollection(self).visibleByUser(visible_by_user) collection = collection.withLifecycleStatus(*status) if modified_since is not None: collection = collection.modifiedSince(modified_since) return collection.getBranches(eager_load=eager_load)
def getMergeProposals(self, status=None, visible_by_user=None, eager_load=False): """See `IHasMergeProposals`.""" if not status: status = (BranchMergeProposalStatus.CODE_APPROVED, BranchMergeProposalStatus.NEEDS_REVIEW, BranchMergeProposalStatus.WORK_IN_PROGRESS) collection = IBranchCollection(self).visibleByUser(visible_by_user) return collection.getMergeProposals(status, eager_load=eager_load)
def getBranches(self, status=None, visible_by_user=None, modified_since=None, eager_load=False): """See `IHasBranches`.""" if status is None: status = DEFAULT_BRANCH_STATUS_IN_LISTING collection = IBranchCollection(self).visibleByUser(visible_by_user) collection = collection.withLifecycleStatus(*status) if modified_since is not None: collection = collection.modifiedSince(modified_since) return collection.getBranches(eager_load=eager_load)
def test_person_product(self): """A PersonProduct can be adapted to a collection. The collection will only find branches matching both the person and the product. """ product = self.factory.makeProduct() person = self.factory.makePerson() person_product = PersonProduct(person, product) self.factory.makeBranch() self.factory.makeProductBranch(product=product) self.factory.makeBranch(owner=person) person_product_branch = self.factory.makeProductBranch( owner=person, product=product) branches = IBranchCollection(person_product).getBranches() self.assertEqual([person_product_branch], [b for b in branches])
def _collection(self): """Return the branch collection for this context.""" collection = IBranchCollection(self.context).visibleByUser(self.user) collection = collection.withLifecycleStatus( *DEFAULT_BRANCH_STATUS_IN_LISTING) return collection
def _collection(self): """Return the branch collection for this context.""" collection = IBranchCollection(self.context).visibleByUser(self.user) collection = collection.withLifecycleStatus( *DEFAULT_BRANCH_STATUS_IN_LISTING) return collection
def show_bzr_link(self): collection = IBranchCollection(self.context) return not collection.visibleByUser(self.user).is_empty()