Merge lp:~jelmer/brz/get-revisions-no-none into lp:brz

Proposed by Jelmer Vernooij on 2017-06-22
Status: Merged
Approved by: Jelmer Vernooij on 2017-06-22
Approved revision: 6716
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/get-revisions-no-none
Merge into: lp:brz
Diff against target: 90 lines (+14/-16)
5 files modified
breezy/bzr/groupcompress_repo.py (+1/-1)
breezy/bzr/remote.py (+4/-7)
breezy/bzr/vf_repository.py (+4/-7)
breezy/check.py (+2/-1)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/get-revisions-no-none
Reviewer Review Type Date Requested Status
Martin Packman 2017-06-22 Approve on 2017-06-22
Review via email: mp+326116@code.launchpad.net

Commit message

Disallow Repository.get_revisions(revision_ids=None)

Description of the change

Don't allow Repository.get_revision_ids(None) to return all revision objects.

There were no tests for this behaviour, and there are no benefits that I can see. All current implementations (including client side RemoteRepository) just set revision_ids to self.all_revision_ids().

The only current users are check and reconcile.

To post a comment you must log in.
Martin Packman (gz) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bzr/groupcompress_repo.py'
2--- breezy/bzr/groupcompress_repo.py 2017-06-11 13:48:12 +0000
3+++ breezy/bzr/groupcompress_repo.py 2017-06-22 00:34:27 +0000
4@@ -1136,7 +1136,7 @@
5 raise AssertionError()
6 vf = self.revisions
7 if revisions_iterator is None:
8- revisions_iterator = self._iter_revisions(None)
9+ revisions_iterator = self._iter_revisions(self.all_revision_ids())
10 for revid, revision in revisions_iterator:
11 if revision is None:
12 pass
13
14=== modified file 'breezy/bzr/remote.py'
15--- breezy/bzr/remote.py 2017-06-16 00:00:24 +0000
16+++ breezy/bzr/remote.py 2017-06-22 00:34:27 +0000
17@@ -2659,13 +2659,10 @@
18
19 @needs_read_lock
20 def get_revisions(self, revision_ids):
21- if revision_ids is None:
22- revision_ids = self.all_revision_ids()
23- else:
24- for rev_id in revision_ids:
25- if not rev_id or not isinstance(rev_id, bytes):
26- raise errors.InvalidRevisionId(
27- revision_id=rev_id, branch=self)
28+ for rev_id in revision_ids:
29+ if not rev_id or not isinstance(rev_id, bytes):
30+ raise errors.InvalidRevisionId(
31+ revision_id=rev_id, branch=self)
32 try:
33 missing = set(revision_ids)
34 revs = {}
35
36=== modified file 'breezy/bzr/vf_repository.py'
37--- breezy/bzr/vf_repository.py 2017-06-20 02:03:30 +0000
38+++ breezy/bzr/vf_repository.py 2017-06-22 00:34:27 +0000
39@@ -1133,12 +1133,9 @@
40 :return: An iterator of (revid, revision) tuples. Absent revisions (
41 those asked for but not available) are returned as (revid, None).
42 """
43- if revision_ids is None:
44- revision_ids = self.all_revision_ids()
45- else:
46- for rev_id in revision_ids:
47- if not rev_id or not isinstance(rev_id, bytes):
48- raise errors.InvalidRevisionId(revision_id=rev_id, branch=self)
49+ for rev_id in revision_ids:
50+ if not rev_id or not isinstance(rev_id, bytes):
51+ raise errors.InvalidRevisionId(revision_id=rev_id, branch=self)
52 keys = [(key,) for key in revision_ids]
53 stream = self.revisions.get_record_stream(keys, 'unordered', True)
54 for record in stream:
55@@ -1680,7 +1677,7 @@
56 raise AssertionError()
57 vf = self.revisions
58 if revisions_iterator is None:
59- revisions_iterator = self._iter_revisions(None)
60+ revisions_iterator = self._iter_revisions(self.all_revision_ids())
61 for revid, revision in revisions_iterator:
62 if revision is None:
63 pass
64
65=== modified file 'breezy/check.py'
66--- breezy/check.py 2017-06-10 00:52:08 +0000
67+++ breezy/check.py 2017-06-22 00:34:27 +0000
68@@ -181,7 +181,8 @@
69
70 def check_revisions(self):
71 """Scan revisions, checking data directly available as we go."""
72- revision_iterator = self.repository._iter_revisions(None)
73+ revision_iterator = self.repository._iter_revisions(
74+ self.repository.all_revision_ids())
75 revision_iterator = self._check_revisions(revision_iterator)
76 # We read the all revisions here:
77 # - doing this allows later code to depend on the revision index.
78
79=== modified file 'doc/en/release-notes/brz-3.0.txt'
80--- doc/en/release-notes/brz-3.0.txt 2017-06-20 22:54:06 +0000
81+++ doc/en/release-notes/brz-3.0.txt 2017-06-22 00:34:27 +0000
82@@ -148,6 +148,9 @@
83 * ``ControlDir.find_bzrdirs`` has been renamed to
84 ``ControlDir.find_controldirs``. (Jelmer Vernooń≥)
85
86+ * ``Repository.get_revisions`` no longer accepts ``None`` as
87+ argument. (Jelmer Vernooń≥)
88+
89 Internals
90 *********
91

Subscribers

People subscribed via source and target branches