Merge lp:~mbp/bzr/715000-more-fallbacks into lp:bzr
- 715000-more-fallbacks
- Merge into bzr.dev
Proposed by
Martin Pool
Status: | Superseded |
---|---|
Proposed branch: | lp:~mbp/bzr/715000-more-fallbacks |
Merge into: | lp:bzr |
Diff against target: |
374 lines (+158/-28) 6 files modified
bzrlib/groupcompress.py (+7/-7) bzrlib/knit.py (+14/-14) bzrlib/tests/per_repository_reference/__init__.py (+1/-0) bzrlib/tests/per_repository_reference/test_graph.py (+45/-0) bzrlib/versionedfile.py (+18/-4) doc/en/release-notes/bzr-2.2.txt (+73/-3) |
To merge this branch: | bzr merge lp:~mbp/bzr/715000-more-fallbacks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
bzr-core | Pending | ||
Review via email: mp+49025@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-02-09.
Commit message
Description of the change
follow-through from bug 715000: rename _fallback_vfs to _immediate_
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bzrlib/groupcompress.py' |
2 | --- bzrlib/groupcompress.py 2010-09-26 20:45:28 +0000 |
3 | +++ bzrlib/groupcompress.py 2011-02-09 08:12:01 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -# Copyright (C) 2008, 2009, 2010 Canonical Ltd |
6 | +# Copyright (C) 2008-2011 Canonical Ltd |
7 | # |
8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by |
10 | @@ -1186,7 +1186,7 @@ |
11 | _unadded_refs = {} |
12 | self._unadded_refs = _unadded_refs |
13 | self._group_cache = LRUSizeCache(max_size=50*1024*1024) |
14 | - self._fallback_vfs = [] |
15 | + self._immediate_fallbacks = [] |
16 | |
17 | def without_fallbacks(self): |
18 | """Return a clone of this object without any fallbacks configured.""" |
19 | @@ -1266,7 +1266,7 @@ |
20 | |
21 | :param a_versioned_files: A VersionedFiles object. |
22 | """ |
23 | - self._fallback_vfs.append(a_versioned_files) |
24 | + self._immediate_fallbacks.append(a_versioned_files) |
25 | |
26 | def annotate(self, key): |
27 | """See VersionedFiles.annotate.""" |
28 | @@ -1312,7 +1312,7 @@ |
29 | # KnitVersionedFiles.get_known_graph_ancestry, but they don't share |
30 | # ancestry. |
31 | parent_map, missing_keys = self._index.find_ancestry(keys) |
32 | - for fallback in self._fallback_vfs: |
33 | + for fallback in self._transitive_fallbacks(): |
34 | if not missing_keys: |
35 | break |
36 | (f_parent_map, f_missing_keys) = fallback._index.find_ancestry( |
37 | @@ -1342,7 +1342,7 @@ |
38 | and so on. |
39 | """ |
40 | result = {} |
41 | - sources = [self._index] + self._fallback_vfs |
42 | + sources = [self._index] + self._immediate_fallbacks |
43 | source_results = [] |
44 | missing = set(keys) |
45 | for source in sources: |
46 | @@ -1449,7 +1449,7 @@ |
47 | parent_map = {} |
48 | key_to_source_map = {} |
49 | source_results = [] |
50 | - for source in self._fallback_vfs: |
51 | + for source in self._immediate_fallbacks: |
52 | if not missing: |
53 | break |
54 | source_parents = source.get_parent_map(missing) |
55 | @@ -1832,7 +1832,7 @@ |
56 | """See VersionedFiles.keys.""" |
57 | if 'evil' in debug.debug_flags: |
58 | trace.mutter_callsite(2, "keys scales with size of history") |
59 | - sources = [self._index] + self._fallback_vfs |
60 | + sources = [self._index] + self._immediate_fallbacks |
61 | result = set() |
62 | for source in sources: |
63 | result.update(source.keys()) |
64 | |
65 | === modified file 'bzrlib/knit.py' |
66 | --- bzrlib/knit.py 2011-01-11 20:42:36 +0000 |
67 | +++ bzrlib/knit.py 2011-02-09 08:12:01 +0000 |
68 | @@ -883,7 +883,7 @@ |
69 | self._factory = KnitAnnotateFactory() |
70 | else: |
71 | self._factory = KnitPlainFactory() |
72 | - self._fallback_vfs = [] |
73 | + self._immediate_fallbacks = [] |
74 | self._reload_func = reload_func |
75 | |
76 | def __repr__(self): |
77 | @@ -897,7 +897,7 @@ |
78 | |
79 | :param a_versioned_files: A VersionedFiles object. |
80 | """ |
81 | - self._fallback_vfs.append(a_versioned_files) |
82 | + self._immediate_fallbacks.append(a_versioned_files) |
83 | |
84 | def add_lines(self, key, parents, lines, parent_texts=None, |
85 | left_matching_blocks=None, nostore_sha=None, random_id=False, |
86 | @@ -1070,7 +1070,7 @@ |
87 | raise errors.KnitCorrupt(self, |
88 | "Missing basis parent %s for %s" % ( |
89 | compression_parent, key)) |
90 | - for fallback_vfs in self._fallback_vfs: |
91 | + for fallback_vfs in self._immediate_fallbacks: |
92 | fallback_vfs.check() |
93 | |
94 | def _check_add(self, key, lines, random_id, check_content): |
95 | @@ -1196,7 +1196,7 @@ |
96 | def get_known_graph_ancestry(self, keys): |
97 | """Get a KnownGraph instance with the ancestry of keys.""" |
98 | parent_map, missing_keys = self._index.find_ancestry(keys) |
99 | - for fallback in self._fallback_vfs: |
100 | + for fallback in self._transitive_fallbacks(): |
101 | if not missing_keys: |
102 | break |
103 | (f_parent_map, f_missing_keys) = fallback._index.find_ancestry( |
104 | @@ -1226,7 +1226,7 @@ |
105 | and so on. |
106 | """ |
107 | result = {} |
108 | - sources = [self._index] + self._fallback_vfs |
109 | + sources = [self._index] + self._immediate_fallbacks |
110 | source_results = [] |
111 | missing = set(keys) |
112 | for source in sources: |
113 | @@ -1526,7 +1526,7 @@ |
114 | yield KnitContentFactory(key, global_map[key], |
115 | record_details, None, raw_data, self._factory.annotated, None) |
116 | else: |
117 | - vf = self._fallback_vfs[parent_maps.index(source) - 1] |
118 | + vf = self._immediate_fallbacks[parent_maps.index(source) - 1] |
119 | for record in vf.get_record_stream(keys, ordering, |
120 | include_delta_closure): |
121 | yield record |
122 | @@ -1542,7 +1542,7 @@ |
123 | # record entry 2 is the 'digest'. |
124 | result[key] = details[2] |
125 | missing.difference_update(set(result)) |
126 | - for source in self._fallback_vfs: |
127 | + for source in self._immediate_fallbacks: |
128 | if not missing: |
129 | break |
130 | new_result = source.get_sha1s(missing) |
131 | @@ -1619,7 +1619,7 @@ |
132 | raise RevisionNotPresent([record.key], self) |
133 | elif ((record.storage_kind in knit_types) |
134 | and (compression_parent is None |
135 | - or not self._fallback_vfs |
136 | + or not self._immediate_fallbacks |
137 | or self._index.has_key(compression_parent) |
138 | or not self.has_key(compression_parent))): |
139 | # we can insert the knit record literally if either it has no |
140 | @@ -1797,11 +1797,11 @@ |
141 | # vfs, and hope to find them there. Note that if the keys are found |
142 | # but had no changes or no content, the fallback may not return |
143 | # anything. |
144 | - if keys and not self._fallback_vfs: |
145 | + if keys and not self._immediate_fallbacks: |
146 | # XXX: strictly the second parameter is meant to be the file id |
147 | # but it's not easily accessible here. |
148 | raise RevisionNotPresent(keys, repr(self)) |
149 | - for source in self._fallback_vfs: |
150 | + for source in self._immediate_fallbacks: |
151 | if not keys: |
152 | break |
153 | source_keys = set() |
154 | @@ -2016,7 +2016,7 @@ |
155 | """See VersionedFiles.keys.""" |
156 | if 'evil' in debug.debug_flags: |
157 | trace.mutter_callsite(2, "keys scales with size of history") |
158 | - sources = [self._index] + self._fallback_vfs |
159 | + sources = [self._index] + self._immediate_fallbacks |
160 | result = set() |
161 | for source in sources: |
162 | result.update(source.keys()) |
163 | @@ -2062,7 +2062,7 @@ |
164 | |
165 | missing_keys = set(nonlocal_keys) |
166 | # Read from remote versioned file instances and provide to our caller. |
167 | - for source in self.vf._fallback_vfs: |
168 | + for source in self.vf._immediate_fallbacks: |
169 | if not missing_keys: |
170 | break |
171 | # Loop over fallback repositories asking them for texts - ignore |
172 | @@ -3521,8 +3521,8 @@ |
173 | return records, ann_keys |
174 | |
175 | def _get_needed_texts(self, key, pb=None): |
176 | - # if True or len(self._vf._fallback_vfs) > 0: |
177 | - if len(self._vf._fallback_vfs) > 0: |
178 | + # if True or len(self._vf._immediate_fallbacks) > 0: |
179 | + if len(self._vf._immediate_fallbacks) > 0: |
180 | # If we have fallbacks, go to the generic path |
181 | for v in annotate.Annotator._get_needed_texts(self, key, pb=pb): |
182 | yield v |
183 | |
184 | === modified file 'bzrlib/tests/per_repository_reference/__init__.py' |
185 | --- bzrlib/tests/per_repository_reference/__init__.py 2011-01-10 22:47:59 +0000 |
186 | +++ bzrlib/tests/per_repository_reference/__init__.py 2011-02-09 08:12:01 +0000 |
187 | @@ -105,6 +105,7 @@ |
188 | 'bzrlib.tests.per_repository_reference.test_fetch', |
189 | 'bzrlib.tests.per_repository_reference.test_get_record_stream', |
190 | 'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno', |
191 | + 'bzrlib.tests.per_repository_reference.test_graph', |
192 | 'bzrlib.tests.per_repository_reference.test_initialize', |
193 | 'bzrlib.tests.per_repository_reference.test_unlock', |
194 | ] |
195 | |
196 | === added file 'bzrlib/tests/per_repository_reference/test_graph.py' |
197 | --- bzrlib/tests/per_repository_reference/test_graph.py 1970-01-01 00:00:00 +0000 |
198 | +++ bzrlib/tests/per_repository_reference/test_graph.py 2011-02-09 08:12:01 +0000 |
199 | @@ -0,0 +1,45 @@ |
200 | +# Copyright (C) 2011 Canonical Ltd |
201 | +# |
202 | +# This program is free software; you can redistribute it and/or modify |
203 | +# it under the terms of the GNU General Public License as published by |
204 | +# the Free Software Foundation; either version 2 of the License, or |
205 | +# (at your option) any later version. |
206 | +# |
207 | +# This program is distributed in the hope that it will be useful, |
208 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
209 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
210 | +# GNU General Public License for more details. |
211 | +# |
212 | +# You should have received a copy of the GNU General Public License |
213 | +# along with this program; if not, write to the Free Software |
214 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
215 | + |
216 | + |
217 | +"""Tests for graph operations on stacked repositories.""" |
218 | + |
219 | + |
220 | +from bzrlib.tests.per_repository import TestCaseWithRepository |
221 | + |
222 | + |
223 | +class TestGraph(TestCaseWithRepository): |
224 | + |
225 | + def test_get_known_graph_ancestry_stacked(self): |
226 | + """get_known_graph_ancestry works correctly on stacking. |
227 | + |
228 | + See <https://bugs.launchpad.net/bugs/715000>. |
229 | + """ |
230 | + branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches() |
231 | + for br in [branch_a, branch_b, branch_c]: |
232 | + self.assertEquals( |
233 | + [revid_1], |
234 | + br.repository.get_known_graph_ancestry([revid_1]).topo_sort()) |
235 | + |
236 | + def make_double_stacked_branches(self): |
237 | + wt_a = self.make_branch_and_tree('a') |
238 | + branch_a = wt_a.branch |
239 | + branch_b = self.make_branch('b') |
240 | + branch_b.set_stacked_on_url('../a') |
241 | + branch_c = self.make_branch('c') |
242 | + branch_c.set_stacked_on_url('../b') |
243 | + revid_1 = wt_a.commit('first commit') |
244 | + return branch_a, branch_b, branch_c, revid_1 |
245 | |
246 | === modified file 'bzrlib/versionedfile.py' |
247 | --- bzrlib/versionedfile.py 2010-08-28 15:34:24 +0000 |
248 | +++ bzrlib/versionedfile.py 2011-02-09 08:12:01 +0000 |
249 | @@ -1,7 +1,4 @@ |
250 | -# Copyright (C) 2006-2010 Canonical Ltd |
251 | -# |
252 | -# Authors: |
253 | -# Johan Rydberg <jrydberg@gnu.org> |
254 | +# Copyright (C) 2006-2011 Canonical Ltd |
255 | # |
256 | # This program is free software; you can redistribute it and/or modify |
257 | # it under the terms of the GNU General Public License as published by |
258 | @@ -930,6 +927,10 @@ |
259 | |
260 | The use of tuples allows a single code base to support several different |
261 | uses with only the mapping logic changing from instance to instance. |
262 | + |
263 | + :ivar _immediate_fallbacks: For subclasses that support stacking, |
264 | + this is a list of other VersionedFiles immediately underneath this |
265 | + one. They may in turn each have further fallbacks. |
266 | """ |
267 | |
268 | def add_lines(self, key, parents, lines, parent_texts=None, |
269 | @@ -1193,6 +1194,19 @@ |
270 | def _extract_blocks(self, version_id, source, target): |
271 | return None |
272 | |
273 | + def _transitive_fallbacks(self): |
274 | + """Return the whole stack of fallback versionedfiles. |
275 | + |
276 | + This VersionedFiles may have a list of fallbacks, but it doesn't |
277 | + necessarily know about the whole stack going down, and it can't know |
278 | + at open time because they may change after the objects are opened. |
279 | + """ |
280 | + all_fallbacks = [] |
281 | + for a_vfs in self._immediate_fallbacks: |
282 | + all_fallbacks.append(a_vfs) |
283 | + all_fallbacks.extend(a_vfs._transitive_fallbacks()) |
284 | + return all_fallbacks |
285 | + |
286 | |
287 | class ThunkedVersionedFiles(VersionedFiles): |
288 | """Storage for many versioned files thunked onto a 'VersionedFile' class. |
289 | |
290 | === modified file 'doc/en/release-notes/bzr-2.2.txt' |
291 | --- doc/en/release-notes/bzr-2.2.txt 2011-02-04 14:10:48 +0000 |
292 | +++ doc/en/release-notes/bzr-2.2.txt 2011-02-09 08:12:01 +0000 |
293 | @@ -2,9 +2,79 @@ |
294 | Bazaar Release Notes |
295 | #################### |
296 | |
297 | -.. toctree:: |
298 | - :maxdepth: 1 |
299 | - |
300 | +.. contents:: List of Releases |
301 | + :depth: 1 |
302 | + |
303 | +bzr 2.2.5 |
304 | +######### |
305 | + |
306 | +:Codename: Suggestions welcome |
307 | +:2.2.5: NOT RELEASED YET |
308 | + |
309 | +Compatibility Breaks |
310 | +******************** |
311 | + |
312 | +New Features |
313 | +************ |
314 | + |
315 | +Bug Fixes |
316 | +********* |
317 | + |
318 | +* Correctly handle ``bzr log`` and `get_known_graph_ancestry` on a |
319 | + doubly-stacked branch. |
320 | + (James Westby, Martin Pool, #715000) |
321 | + |
322 | +Improvements |
323 | +************ |
324 | + |
325 | +Documentation |
326 | +************* |
327 | + |
328 | +API Changes |
329 | +*********** |
330 | + |
331 | +Internals |
332 | +********* |
333 | + |
334 | +Testing |
335 | +******* |
336 | + |
337 | + |
338 | +bzr 2.2.4 |
339 | +######### |
340 | + |
341 | +:2.2.4: 2011-02-04 |
342 | + |
343 | +This is a bugfix release. Only one bug has been fixed, a regression from 2.2.3 |
344 | +involving only certain operations with launchpad. Upgrading is recommended for |
345 | +all users on earlier 2.2 releases. |
346 | + |
347 | +Bug Fixes |
348 | +********* |
349 | + |
350 | +* Fix communications with the Launchpad web service when using |
351 | + launchpadlib >= 1.5.5. This was a latent bug in bzr's communication |
352 | + with Launchpad's production instance, which only became a problem when |
353 | + the default instance was switched from edge to production in bzr 2.2.3. |
354 | + (Max Bowsher, #707075) |
355 | + |
356 | + |
357 | +bzr 2.2.3 |
358 | +######### |
359 | + |
360 | +:2.2.3: 2011-01-20 |
361 | + |
362 | +This is a bugfix release. Upgrading is recommended for all users |
363 | +on earlier 2.2 releases. |
364 | + |
365 | +Compatibility Breaks |
366 | +******************** |
367 | + |
368 | +* Launchpad has announced that the ``edge.launchpad.net`` instance is |
369 | + deprecated and may be shut down in the future |
370 | + <http://blog.launchpad.net/general/edge-is-deprecated>. Bazaar has therefore |
371 | + been updated in this release to talk to the main (``launchpad.net``) servers, |
372 | + rather than the ``edge`` ones. (Vincent Ladeuil, #583667) |
373 | bzr 2.2.4 |
374 | ######### |
375 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2/9/2011 2:08 AM, Martin Pool wrote: /code.launchpad .net/~mbp/ bzr/715000- more-fallbacks/ +merge/ 49025 fallbacks to make it clear it's not the whole stack.
> Martin Pool has proposed merging lp:~mbp/bzr/715000-more-fallbacks into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> For more details, see:
> https:/
>
> follow-through from bug 715000: rename _fallback_vfs to _immediate_
I'm ok with the change, but I would make it "_immediate_ fallback_ vfs" to fallback_ repositories" .
distinguish it from "_immediate_
Mostly to be easily greppable.
I don't personally find it better, mostly because the added length
doesn't add much. It seems a simple
:ivar _fallback_vfs: Immediate fallbacks, note this is not transitive
Could be a better way to go.
John enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk1 St0oACgkQJdeBCY SNAAOLHQCg0Yj/ BsMKAzL4Sr5OhGQ bxBoZ yOfdMjxhNnjLFiY vdnY9+ansx
9FMAnj/
=LcsQ
-----END PGP SIGNATURE-----