Merge lp:~jelmer/brz/supports-random-access into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/supports-random-access
Merge into: lp:brz
Diff against target: 53 lines (+14/-0)
3 files modified
breezy/git/remote.py (+2/-0)
breezy/repository.py (+4/-0)
breezy/tests/per_repository/test_repository.py (+8/-0)
To merge this branch: bzr merge lp:~jelmer/brz/supports-random-access
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+362619@code.launchpad.net

Commit message

Add a supports_random_access attribute to repository.

Description of the change

Add a supports_random_access attribute to repository.

This indicates where the repository instance can be used for random access,
e.g. retrieving specific revisions. This is useful to skip such actions on e.g.
remote git repositories, which only support bulk fetching and pushing.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

No content in this branch.

Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/remote.py'
--- breezy/git/remote.py 2019-01-19 15:46:15 +0000
+++ breezy/git/remote.py 2019-02-02 11:29:27 +0000
@@ -828,6 +828,8 @@
828828
829class RemoteGitRepository(GitRepository):829class RemoteGitRepository(GitRepository):
830830
831 supports_random_access = False
832
831 @property833 @property
832 def user_url(self):834 def user_url(self):
833 return self.control_url835 return self.control_url
834836
=== modified file 'breezy/repository.py'
--- breezy/repository.py 2019-01-01 23:40:59 +0000
+++ breezy/repository.py 2019-02-02 11:29:27 +0000
@@ -256,6 +256,10 @@
256 base class for most Bazaar repositories.256 base class for most Bazaar repositories.
257 """257 """
258258
259 # Does this repository implementation support random access to
260 # items in the tree, or just bulk fetching/pushing of data?
261 supports_random_access = True
262
259 def abort_write_group(self, suppress_errors=False):263 def abort_write_group(self, suppress_errors=False):
260 """Commit the contents accrued within the current write group.264 """Commit the contents accrued within the current write group.
261265
262266
=== modified file 'breezy/tests/per_repository/test_repository.py'
--- breezy/tests/per_repository/test_repository.py 2018-11-21 03:20:30 +0000
+++ breezy/tests/per_repository/test_repository.py 2019-02-02 11:29:27 +0000
@@ -73,6 +73,11 @@
73 repo = self.make_repository('repo')73 repo = self.make_repository('repo')
74 self.assertIn(getattr(repo._format, attribute), allowed_values)74 self.assertIn(getattr(repo._format, attribute), allowed_values)
7575
76 def assertRepositoryAttribute(self, attribute, allowed_values):
77 """Assert that the repo has an attribute 'attribute'."""
78 repo = self.make_repository('repo')
79 self.assertIn(getattr(repo, attribute), allowed_values)
80
76 def test_attribute_fast_deltas(self):81 def test_attribute_fast_deltas(self):
77 """Test the format.fast_deltas attribute."""82 """Test the format.fast_deltas attribute."""
78 self.assertFormatAttribute('fast_deltas', (True, False))83 self.assertFormatAttribute('fast_deltas', (True, False))
@@ -117,6 +122,9 @@
117 self.assertFormatAttribute('revision_graph_can_have_wrong_parents',122 self.assertFormatAttribute('revision_graph_can_have_wrong_parents',
118 (True, False))123 (True, False))
119124
125 def test_attribute_format_supports_random_access(self):
126 self.assertRepositoryAttribute('supports_random_access', (True, False))
127
120 def test_attribute_format_supports_setting_revision_ids(self):128 def test_attribute_format_supports_setting_revision_ids(self):
121 self.assertFormatAttribute('supports_setting_revision_ids',129 self.assertFormatAttribute('supports_setting_revision_ids',
122 (True, False))130 (True, False))

Subscribers

People subscribed via source and target branches