launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22719
[Merge] lp:~cjwatson/launchpad/fix-snap-initial-name-bzr into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/fix-snap-initial-name-bzr into lp:launchpad.
Commit message:
Fix Branch.getBlob to call the hosting client with branch IDs rather than unique names.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/fix-snap-initial-name-bzr/+merge/349170
During review of https://code.launchpad.net/~cjwatson/launchpad/branch-hosting-client/+merge/345704, I changed BranchHostingClient to take branch IDs rather than unique names, but I forgot to update https://code.launchpad.net/~cjwatson/launchpad/snap-initial-name-bzr/+merge/345757 to match. This fixes that up.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/fix-snap-initial-name-bzr into lp:launchpad.
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2018-07-04 08:56:37 +0000
+++ lib/lp/code/model/branch.py 2018-07-09 09:40:24 +0000
@@ -829,7 +829,7 @@
if file_list is unset:
try:
inventory = hosting_client.getInventory(
- self.unique_name, dirname, rev=revision_id)
+ self.id, dirname, rev=revision_id)
file_list = {
entry['filename']: entry['file_id']
for entry in inventory['filelist']}
@@ -843,8 +843,7 @@
if file_id is None:
raise BranchFileNotFound(
self.unique_name, filename=filename, rev=revision_id)
- return hosting_client.getBlob(
- self.unique_name, file_id, rev=revision_id)
+ return hosting_client.getBlob(self.id, file_id, rev=revision_id)
def getDiff(self, new, old=None):
"""See `IBranch`."""
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2018-05-17 14:10:29 +0000
+++ lib/lp/code/model/tests/test_branch.py 2018-07-09 09:40:24 +0000
@@ -3311,10 +3311,10 @@
blob = branch.getBlob('src/README.txt')
self.assertEqual('Some text', blob)
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': None})],
+ [((branch.id, 'src'), {'rev': None})],
hosting_fixture.getInventory.calls)
self.assertEqual(
- [((branch.unique_name, 'some-file-id'), {'rev': None})],
+ [((branch.id, 'some-file-id'), {'rev': None})],
hosting_fixture.getBlob.calls)
self.assertEqual({}, getUtility(IMemcacheClient)._cache)
@@ -3326,10 +3326,10 @@
blob = branch.getBlob('src/README.txt')
self.assertEqual('Some text', blob)
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': 'scanned-id'})],
+ [((branch.id, 'src'), {'rev': 'scanned-id'})],
hosting_fixture.getInventory.calls)
self.assertEqual(
- [((branch.unique_name, 'some-file-id'), {'rev': 'scanned-id'})],
+ [((branch.id, 'some-file-id'), {'rev': 'scanned-id'})],
hosting_fixture.getBlob.calls)
key = (
'bazaar.launchpad.dev:bzr-file-list:%s:scanned-id:src' % branch.id)
@@ -3344,10 +3344,10 @@
blob = branch.getBlob('src/README.txt', revision_id='some-rev')
self.assertEqual('Some text', blob)
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': 'some-rev'})],
+ [((branch.id, 'src'), {'rev': 'some-rev'})],
hosting_fixture.getInventory.calls)
self.assertEqual(
- [((branch.unique_name, 'some-file-id'), {'rev': 'some-rev'})],
+ [((branch.id, 'some-file-id'), {'rev': 'some-rev'})],
hosting_fixture.getBlob.calls)
key = 'bazaar.launchpad.dev:bzr-file-list:%s:some-rev:src' % branch.id
self.assertEqual(
@@ -3365,7 +3365,7 @@
self.assertEqual('Some text', blob)
self.assertEqual([], hosting_fixture.getInventory.calls)
self.assertEqual(
- [((branch.unique_name, 'some-file-id'), {'rev': 'some-rev'})],
+ [((branch.id, 'some-file-id'), {'rev': 'some-rev'})],
hosting_fixture.getBlob.calls)
def test_disable_memcache(self):
@@ -3379,7 +3379,7 @@
blob = branch.getBlob('src/README.txt', revision_id='some-rev')
self.assertEqual('Some text', blob)
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': 'some-rev'})],
+ [((branch.id, 'src'), {'rev': 'some-rev'})],
hosting_fixture.getInventory.calls)
self.assertEqual(
'{}', getUtility(IMemcacheClient).get(key.encode('UTF-8')))
@@ -3391,10 +3391,10 @@
blob = branch.getBlob('README.txt', revision_id='some-rev')
self.assertEqual('Some text', blob)
self.assertEqual(
- [((branch.unique_name, ''), {'rev': 'some-rev'})],
+ [((branch.id, ''), {'rev': 'some-rev'})],
hosting_fixture.getInventory.calls)
self.assertEqual(
- [((branch.unique_name, 'some-file-id'), {'rev': 'some-rev'})],
+ [((branch.id, 'some-file-id'), {'rev': 'some-rev'})],
hosting_fixture.getBlob.calls)
key = 'bazaar.launchpad.dev:bzr-file-list:%s:some-rev:' % branch.id
self.assertEqual(
@@ -3408,7 +3408,7 @@
BranchFileNotFound, branch.getBlob,
'src/README.txt', revision_id='some-rev')
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': 'some-rev'})],
+ [((branch.id, 'src'), {'rev': 'some-rev'})],
hosting_fixture.getInventory.calls)
self.assertEqual([], hosting_fixture.getBlob.calls)
key = 'bazaar.launchpad.dev:bzr-file-list:%s:some-rev:src' % branch.id
@@ -3425,7 +3425,7 @@
BranchFileNotFound, branch.getBlob,
'src/README.txt', revision_id='some-rev')
self.assertEqual(
- [((branch.unique_name, 'src'), {'rev': 'some-rev'})],
+ [((branch.id, 'src'), {'rev': 'some-rev'})],
hosting_fixture.getInventory.calls)
self.assertEqual([], hosting_fixture.getBlob.calls)
key = 'bazaar.launchpad.dev:bzr-file-list:%s:some-rev:src' % branch.id
Follow ups