← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/git-cross-repository-newer-revisions into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/git-cross-repository-newer-revisions into lp:launchpad.

Commit message:
Request cross-repository logs in _getNewerRevisions too.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-cross-repository-newer-revisions/+merge/296436

Request cross-repository logs in _getNewerRevisions too.  This fixes https://oops.canonical.com/oops/?oopsid=OOPS-bdfdaec2cc5b22b87e32107f203b4393.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-cross-repository-newer-revisions into lp:launchpad.
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py	2016-05-19 01:04:56 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py	2016-06-03 14:16:47 +0000
@@ -23,8 +23,12 @@
     Tag,
     )
 from testtools.matchers import (
+    Equals,
+    Is,
+    MatchesDict,
     MatchesListwise,
     MatchesRegex,
+    MatchesSetwise,
     MatchesStructure,
     Not,
     )
@@ -1612,6 +1616,43 @@
         self.assertTextMatchesExpressionIgnoreWhitespace(
             'Prerequisite: ' + re.escape(identity), text)
 
+    def test_git_hosting_calls(self):
+        # Rendering a Git-based merge proposal makes the correct calls to
+        # the hosting service, including requesting cross-repository
+        # information.
+        bmp = self.factory.makeBranchMergeProposalForGit()
+        self.getMainText(bmp, '+index')
+        self.assertThat(self.hosting_client.getLog.calls, MatchesSetwise(
+            # _getNewerRevisions
+            MatchesListwise([
+                Equals((
+                    '%s:%s' % (
+                        bmp.target_git_repository.getInternalPath(),
+                        bmp.source_git_repository.getInternalPath()),
+                    bmp.source_git_commit_sha1,
+                    )),
+                MatchesDict({
+                    'stop': Equals(bmp.target_git_commit_sha1),
+                    'limit': Is(None),
+                    'logger': Is(None),
+                    }),
+                ]),
+            # getUnlandedSourceBranchRevisions
+            MatchesListwise([
+                Equals((
+                    '%s:%s' % (
+                        bmp.target_git_repository.getInternalPath(),
+                        bmp.source_git_repository.getInternalPath()),
+                    bmp.source_git_commit_sha1,
+                    )),
+                MatchesDict({
+                    'stop': Equals(bmp.target_git_commit_sha1),
+                    'limit': Equals(10),
+                    'logger': Is(None),
+                    }),
+                ]),
+            ))
+
 
 class TestBranchMergeProposalChangeStatusView(TestCaseWithFactory):
     """Test the +edit-status view."""

=== modified file 'lib/lp/code/model/branchmergeproposal.py'
--- lib/lp/code/model/branchmergeproposal.py	2016-05-24 06:59:39 +0000
+++ lib/lp/code/model/branchmergeproposal.py	2016-06-03 14:16:47 +0000
@@ -1054,6 +1054,7 @@
         else:
             commits = reversed(self.source_git_ref.getCommits(
                 self.source_git_commit_sha1, stop=self.target_git_commit_sha1,
+                union_repository=self.target_git_repository,
                 start_date=start_date, end_date=self.revision_end_date))
             return [
                 ((commit["author_date"], count), commit)


Follow ups