launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19370
[Merge] lp:~cjwatson/launchpad/git-getRequestedReviews into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/git-getRequestedReviews into lp:launchpad.
Commit message:
Also return Git-based merge proposals from IHasRequestedReviews.getRequestedReviews.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-getRequestedReviews/+merge/271136
Also return Git-based merge proposals from IHasRequestedReviews.getRequestedReviews.
I made similar changes to nearby code in https://code.launchpad.net/~cjwatson/launchpad/git-activereviews/+merge/258910, but apparently missed the existence of getRequestedReviews.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-getRequestedReviews into lp:launchpad.
=== modified file 'lib/lp/code/model/hasbranches.py'
--- lib/lp/code/model/hasbranches.py 2015-05-12 17:30:40 +0000
+++ lib/lp/code/model/hasbranches.py 2015-09-15 14:34:38 +0000
@@ -84,9 +84,14 @@
if not status:
status = (BranchMergeProposalStatus.NEEDS_REVIEW,)
- visible_branches = getUtility(IAllBranches).visibleByUser(
- visible_by_user)
- return visible_branches.getMergeProposalsForReviewer(self, status)
+ def _getProposals(collection):
+ collection = collection.visibleByUser(visible_by_user)
+ return collection.getMergeProposalsForReviewer(self, status)
+
+ bzr_collection = removeSecurityProxy(getUtility(IAllBranches))
+ git_collection = removeSecurityProxy(getUtility(IAllGitRepositories))
+ return _getProposals(bzr_collection).union(
+ _getProposals(git_collection))
def getOwnedAndRequestedReviews(self, status=None, visible_by_user=None,
project=None, eager_load=False):
=== modified file 'lib/lp/code/stories/webservice/xx-branchmergeproposal.txt'
--- lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2015-04-22 14:52:10 +0000
+++ lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2015-09-15 14:34:38 +0000
@@ -470,6 +470,29 @@
... registrant=target_owner, source_branch=target_branch)
>>> proposal.nominateReviewer(branch_owner, target_owner)
<CodeReviewVoteReference at ...>
+
+Create a similar pair of proposals for Git.
+
+ >>> [source_ref] = factory.makeGitRefs(
+ ... owner=branch_owner, target=blob, name=u"foo",
+ ... paths=[u"refs/heads/master"])
+ >>> [target_ref] = factory.makeGitRefs(
+ ... owner=target_owner, target=blob, name=u"bar",
+ ... paths=[u"refs/heads/fix"])
+ >>> proposal = factory.makeBranchMergeProposalForGit(
+ ... target_ref=target_ref,
+ ... set_state=BranchMergeProposalStatus.NEEDS_REVIEW,
+ ... registrant=branch_owner, source_ref=source_ref)
+ >>> proposal.nominateReviewer(target_owner, branch_owner)
+ <CodeReviewVoteReference at ...>
+
+ >>> proposal = factory.makeBranchMergeProposalForGit(
+ ... target_ref=source_ref,
+ ... set_state=BranchMergeProposalStatus.NEEDS_REVIEW,
+ ... registrant=target_owner, source_ref=target_ref)
+ >>> proposal.nominateReviewer(branch_owner, target_owner)
+ <CodeReviewVoteReference at ...>
+
>>> logout()
>>> proposals = webservice.named_get('/~target', 'getRequestedReviews'
@@ -477,4 +500,4 @@
>>> for proposal in proposals['entries']:
... print_proposal(proposal)
http://.../~source/blob/foo/+merge/4 - Needs review
-
+ http://.../~source/blob/+git/foo/+merge/6 - Needs review
Follow ups