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

Proposed by Jelmer Vernooij on 2019-02-01
Status: Merged
Approved by: Jelmer Vernooij on 2019-02-02
Approved revision: 7255
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 2019-02-01 Approve on 2019-02-02
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.
Martin Packman (gz) wrote :

No content in this branch.

Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/remote.py'
2--- breezy/git/remote.py 2019-01-19 15:46:15 +0000
3+++ breezy/git/remote.py 2019-02-02 11:29:27 +0000
4@@ -828,6 +828,8 @@
5
6 class RemoteGitRepository(GitRepository):
7
8+ supports_random_access = False
9+
10 @property
11 def user_url(self):
12 return self.control_url
13
14=== modified file 'breezy/repository.py'
15--- breezy/repository.py 2019-01-01 23:40:59 +0000
16+++ breezy/repository.py 2019-02-02 11:29:27 +0000
17@@ -256,6 +256,10 @@
18 base class for most Bazaar repositories.
19 """
20
21+ # Does this repository implementation support random access to
22+ # items in the tree, or just bulk fetching/pushing of data?
23+ supports_random_access = True
24+
25 def abort_write_group(self, suppress_errors=False):
26 """Commit the contents accrued within the current write group.
27
28
29=== modified file 'breezy/tests/per_repository/test_repository.py'
30--- breezy/tests/per_repository/test_repository.py 2018-11-21 03:20:30 +0000
31+++ breezy/tests/per_repository/test_repository.py 2019-02-02 11:29:27 +0000
32@@ -73,6 +73,11 @@
33 repo = self.make_repository('repo')
34 self.assertIn(getattr(repo._format, attribute), allowed_values)
35
36+ def assertRepositoryAttribute(self, attribute, allowed_values):
37+ """Assert that the repo has an attribute 'attribute'."""
38+ repo = self.make_repository('repo')
39+ self.assertIn(getattr(repo, attribute), allowed_values)
40+
41 def test_attribute_fast_deltas(self):
42 """Test the format.fast_deltas attribute."""
43 self.assertFormatAttribute('fast_deltas', (True, False))
44@@ -117,6 +122,9 @@
45 self.assertFormatAttribute('revision_graph_can_have_wrong_parents',
46 (True, False))
47
48+ def test_attribute_format_supports_random_access(self):
49+ self.assertRepositoryAttribute('supports_random_access', (True, False))
50+
51 def test_attribute_format_supports_setting_revision_ids(self):
52 self.assertFormatAttribute('supports_setting_revision_ids',
53 (True, False))

Subscribers

People subscribed via source and target branches