Merge lp:~mbp/bzr/715000-more-fallbacks into lp:bzr

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
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.

Description of the change

follow-through from bug 715000: rename _fallback_vfs to _immediate_fallbacks to make it clear it's not the whole stack.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/9/2011 2:08 AM, Martin Pool wrote:
> 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://code.launchpad.net/~mbp/bzr/715000-more-fallbacks/+merge/49025
>
> follow-through from bug 715000: rename _fallback_vfs to _immediate_fallbacks to make it clear it's not the whole stack.

I'm ok with the change, but I would make it "_immediate_fallback_vfs" to
distinguish it from "_immediate_fallback_repositories".
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
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1St0oACgkQJdeBCYSNAAOLHQCg0Yj/BsMKAzL4Sr5OhGQbxBoZ
9FMAnj/yOfdMjxhNnjLFiYvdnY9+ansx
=LcsQ
-----END PGP SIGNATURE-----

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/groupcompress.py'
--- bzrlib/groupcompress.py 2010-09-26 20:45:28 +0000
+++ bzrlib/groupcompress.py 2011-02-09 08:12:01 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2008, 2009, 2010 Canonical Ltd1# Copyright (C) 2008-2011 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -1186,7 +1186,7 @@
1186 _unadded_refs = {}1186 _unadded_refs = {}
1187 self._unadded_refs = _unadded_refs1187 self._unadded_refs = _unadded_refs
1188 self._group_cache = LRUSizeCache(max_size=50*1024*1024)1188 self._group_cache = LRUSizeCache(max_size=50*1024*1024)
1189 self._fallback_vfs = []1189 self._immediate_fallbacks = []
11901190
1191 def without_fallbacks(self):1191 def without_fallbacks(self):
1192 """Return a clone of this object without any fallbacks configured."""1192 """Return a clone of this object without any fallbacks configured."""
@@ -1266,7 +1266,7 @@
12661266
1267 :param a_versioned_files: A VersionedFiles object.1267 :param a_versioned_files: A VersionedFiles object.
1268 """1268 """
1269 self._fallback_vfs.append(a_versioned_files)1269 self._immediate_fallbacks.append(a_versioned_files)
12701270
1271 def annotate(self, key):1271 def annotate(self, key):
1272 """See VersionedFiles.annotate."""1272 """See VersionedFiles.annotate."""
@@ -1312,7 +1312,7 @@
1312 # KnitVersionedFiles.get_known_graph_ancestry, but they don't share1312 # KnitVersionedFiles.get_known_graph_ancestry, but they don't share
1313 # ancestry.1313 # ancestry.
1314 parent_map, missing_keys = self._index.find_ancestry(keys)1314 parent_map, missing_keys = self._index.find_ancestry(keys)
1315 for fallback in self._fallback_vfs:1315 for fallback in self._transitive_fallbacks():
1316 if not missing_keys:1316 if not missing_keys:
1317 break1317 break
1318 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(1318 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
@@ -1342,7 +1342,7 @@
1342 and so on.1342 and so on.
1343 """1343 """
1344 result = {}1344 result = {}
1345 sources = [self._index] + self._fallback_vfs1345 sources = [self._index] + self._immediate_fallbacks
1346 source_results = []1346 source_results = []
1347 missing = set(keys)1347 missing = set(keys)
1348 for source in sources:1348 for source in sources:
@@ -1449,7 +1449,7 @@
1449 parent_map = {}1449 parent_map = {}
1450 key_to_source_map = {}1450 key_to_source_map = {}
1451 source_results = []1451 source_results = []
1452 for source in self._fallback_vfs:1452 for source in self._immediate_fallbacks:
1453 if not missing:1453 if not missing:
1454 break1454 break
1455 source_parents = source.get_parent_map(missing)1455 source_parents = source.get_parent_map(missing)
@@ -1832,7 +1832,7 @@
1832 """See VersionedFiles.keys."""1832 """See VersionedFiles.keys."""
1833 if 'evil' in debug.debug_flags:1833 if 'evil' in debug.debug_flags:
1834 trace.mutter_callsite(2, "keys scales with size of history")1834 trace.mutter_callsite(2, "keys scales with size of history")
1835 sources = [self._index] + self._fallback_vfs1835 sources = [self._index] + self._immediate_fallbacks
1836 result = set()1836 result = set()
1837 for source in sources:1837 for source in sources:
1838 result.update(source.keys())1838 result.update(source.keys())
18391839
=== modified file 'bzrlib/knit.py'
--- bzrlib/knit.py 2011-01-11 20:42:36 +0000
+++ bzrlib/knit.py 2011-02-09 08:12:01 +0000
@@ -883,7 +883,7 @@
883 self._factory = KnitAnnotateFactory()883 self._factory = KnitAnnotateFactory()
884 else:884 else:
885 self._factory = KnitPlainFactory()885 self._factory = KnitPlainFactory()
886 self._fallback_vfs = []886 self._immediate_fallbacks = []
887 self._reload_func = reload_func887 self._reload_func = reload_func
888888
889 def __repr__(self):889 def __repr__(self):
@@ -897,7 +897,7 @@
897897
898 :param a_versioned_files: A VersionedFiles object.898 :param a_versioned_files: A VersionedFiles object.
899 """899 """
900 self._fallback_vfs.append(a_versioned_files)900 self._immediate_fallbacks.append(a_versioned_files)
901901
902 def add_lines(self, key, parents, lines, parent_texts=None,902 def add_lines(self, key, parents, lines, parent_texts=None,
903 left_matching_blocks=None, nostore_sha=None, random_id=False,903 left_matching_blocks=None, nostore_sha=None, random_id=False,
@@ -1070,7 +1070,7 @@
1070 raise errors.KnitCorrupt(self,1070 raise errors.KnitCorrupt(self,
1071 "Missing basis parent %s for %s" % (1071 "Missing basis parent %s for %s" % (
1072 compression_parent, key))1072 compression_parent, key))
1073 for fallback_vfs in self._fallback_vfs:1073 for fallback_vfs in self._immediate_fallbacks:
1074 fallback_vfs.check()1074 fallback_vfs.check()
10751075
1076 def _check_add(self, key, lines, random_id, check_content):1076 def _check_add(self, key, lines, random_id, check_content):
@@ -1196,7 +1196,7 @@
1196 def get_known_graph_ancestry(self, keys):1196 def get_known_graph_ancestry(self, keys):
1197 """Get a KnownGraph instance with the ancestry of keys."""1197 """Get a KnownGraph instance with the ancestry of keys."""
1198 parent_map, missing_keys = self._index.find_ancestry(keys)1198 parent_map, missing_keys = self._index.find_ancestry(keys)
1199 for fallback in self._fallback_vfs:1199 for fallback in self._transitive_fallbacks():
1200 if not missing_keys:1200 if not missing_keys:
1201 break1201 break
1202 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(1202 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
@@ -1226,7 +1226,7 @@
1226 and so on.1226 and so on.
1227 """1227 """
1228 result = {}1228 result = {}
1229 sources = [self._index] + self._fallback_vfs1229 sources = [self._index] + self._immediate_fallbacks
1230 source_results = []1230 source_results = []
1231 missing = set(keys)1231 missing = set(keys)
1232 for source in sources:1232 for source in sources:
@@ -1526,7 +1526,7 @@
1526 yield KnitContentFactory(key, global_map[key],1526 yield KnitContentFactory(key, global_map[key],
1527 record_details, None, raw_data, self._factory.annotated, None)1527 record_details, None, raw_data, self._factory.annotated, None)
1528 else:1528 else:
1529 vf = self._fallback_vfs[parent_maps.index(source) - 1]1529 vf = self._immediate_fallbacks[parent_maps.index(source) - 1]
1530 for record in vf.get_record_stream(keys, ordering,1530 for record in vf.get_record_stream(keys, ordering,
1531 include_delta_closure):1531 include_delta_closure):
1532 yield record1532 yield record
@@ -1542,7 +1542,7 @@
1542 # record entry 2 is the 'digest'.1542 # record entry 2 is the 'digest'.
1543 result[key] = details[2]1543 result[key] = details[2]
1544 missing.difference_update(set(result))1544 missing.difference_update(set(result))
1545 for source in self._fallback_vfs:1545 for source in self._immediate_fallbacks:
1546 if not missing:1546 if not missing:
1547 break1547 break
1548 new_result = source.get_sha1s(missing)1548 new_result = source.get_sha1s(missing)
@@ -1619,7 +1619,7 @@
1619 raise RevisionNotPresent([record.key], self)1619 raise RevisionNotPresent([record.key], self)
1620 elif ((record.storage_kind in knit_types)1620 elif ((record.storage_kind in knit_types)
1621 and (compression_parent is None1621 and (compression_parent is None
1622 or not self._fallback_vfs1622 or not self._immediate_fallbacks
1623 or self._index.has_key(compression_parent)1623 or self._index.has_key(compression_parent)
1624 or not self.has_key(compression_parent))):1624 or not self.has_key(compression_parent))):
1625 # we can insert the knit record literally if either it has no1625 # we can insert the knit record literally if either it has no
@@ -1797,11 +1797,11 @@
1797 # vfs, and hope to find them there. Note that if the keys are found1797 # vfs, and hope to find them there. Note that if the keys are found
1798 # but had no changes or no content, the fallback may not return1798 # but had no changes or no content, the fallback may not return
1799 # anything.1799 # anything.
1800 if keys and not self._fallback_vfs:1800 if keys and not self._immediate_fallbacks:
1801 # XXX: strictly the second parameter is meant to be the file id1801 # XXX: strictly the second parameter is meant to be the file id
1802 # but it's not easily accessible here.1802 # but it's not easily accessible here.
1803 raise RevisionNotPresent(keys, repr(self))1803 raise RevisionNotPresent(keys, repr(self))
1804 for source in self._fallback_vfs:1804 for source in self._immediate_fallbacks:
1805 if not keys:1805 if not keys:
1806 break1806 break
1807 source_keys = set()1807 source_keys = set()
@@ -2016,7 +2016,7 @@
2016 """See VersionedFiles.keys."""2016 """See VersionedFiles.keys."""
2017 if 'evil' in debug.debug_flags:2017 if 'evil' in debug.debug_flags:
2018 trace.mutter_callsite(2, "keys scales with size of history")2018 trace.mutter_callsite(2, "keys scales with size of history")
2019 sources = [self._index] + self._fallback_vfs2019 sources = [self._index] + self._immediate_fallbacks
2020 result = set()2020 result = set()
2021 for source in sources:2021 for source in sources:
2022 result.update(source.keys())2022 result.update(source.keys())
@@ -2062,7 +2062,7 @@
20622062
2063 missing_keys = set(nonlocal_keys)2063 missing_keys = set(nonlocal_keys)
2064 # Read from remote versioned file instances and provide to our caller.2064 # Read from remote versioned file instances and provide to our caller.
2065 for source in self.vf._fallback_vfs:2065 for source in self.vf._immediate_fallbacks:
2066 if not missing_keys:2066 if not missing_keys:
2067 break2067 break
2068 # Loop over fallback repositories asking them for texts - ignore2068 # Loop over fallback repositories asking them for texts - ignore
@@ -3521,8 +3521,8 @@
3521 return records, ann_keys3521 return records, ann_keys
35223522
3523 def _get_needed_texts(self, key, pb=None):3523 def _get_needed_texts(self, key, pb=None):
3524 # if True or len(self._vf._fallback_vfs) > 0:3524 # if True or len(self._vf._immediate_fallbacks) > 0:
3525 if len(self._vf._fallback_vfs) > 0:3525 if len(self._vf._immediate_fallbacks) > 0:
3526 # If we have fallbacks, go to the generic path3526 # If we have fallbacks, go to the generic path
3527 for v in annotate.Annotator._get_needed_texts(self, key, pb=pb):3527 for v in annotate.Annotator._get_needed_texts(self, key, pb=pb):
3528 yield v3528 yield v
35293529
=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- bzrlib/tests/per_repository_reference/__init__.py 2011-01-10 22:47:59 +0000
+++ bzrlib/tests/per_repository_reference/__init__.py 2011-02-09 08:12:01 +0000
@@ -105,6 +105,7 @@
105 'bzrlib.tests.per_repository_reference.test_fetch',105 'bzrlib.tests.per_repository_reference.test_fetch',
106 'bzrlib.tests.per_repository_reference.test_get_record_stream',106 'bzrlib.tests.per_repository_reference.test_get_record_stream',
107 'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno',107 'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno',
108 'bzrlib.tests.per_repository_reference.test_graph',
108 'bzrlib.tests.per_repository_reference.test_initialize',109 'bzrlib.tests.per_repository_reference.test_initialize',
109 'bzrlib.tests.per_repository_reference.test_unlock',110 'bzrlib.tests.per_repository_reference.test_unlock',
110 ]111 ]
111112
=== added file 'bzrlib/tests/per_repository_reference/test_graph.py'
--- bzrlib/tests/per_repository_reference/test_graph.py 1970-01-01 00:00:00 +0000
+++ bzrlib/tests/per_repository_reference/test_graph.py 2011-02-09 08:12:01 +0000
@@ -0,0 +1,45 @@
1# Copyright (C) 2011 Canonical Ltd
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17
18"""Tests for graph operations on stacked repositories."""
19
20
21from bzrlib.tests.per_repository import TestCaseWithRepository
22
23
24class TestGraph(TestCaseWithRepository):
25
26 def test_get_known_graph_ancestry_stacked(self):
27 """get_known_graph_ancestry works correctly on stacking.
28
29 See <https://bugs.launchpad.net/bugs/715000>.
30 """
31 branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches()
32 for br in [branch_a, branch_b, branch_c]:
33 self.assertEquals(
34 [revid_1],
35 br.repository.get_known_graph_ancestry([revid_1]).topo_sort())
36
37 def make_double_stacked_branches(self):
38 wt_a = self.make_branch_and_tree('a')
39 branch_a = wt_a.branch
40 branch_b = self.make_branch('b')
41 branch_b.set_stacked_on_url('../a')
42 branch_c = self.make_branch('c')
43 branch_c.set_stacked_on_url('../b')
44 revid_1 = wt_a.commit('first commit')
45 return branch_a, branch_b, branch_c, revid_1
046
=== modified file 'bzrlib/versionedfile.py'
--- bzrlib/versionedfile.py 2010-08-28 15:34:24 +0000
+++ bzrlib/versionedfile.py 2011-02-09 08:12:01 +0000
@@ -1,7 +1,4 @@
1# Copyright (C) 2006-2010 Canonical Ltd1# Copyright (C) 2006-2011 Canonical Ltd
2#
3# Authors:
4# Johan Rydberg <jrydberg@gnu.org>
5#2#
6# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -930,6 +927,10 @@
930927
931 The use of tuples allows a single code base to support several different928 The use of tuples allows a single code base to support several different
932 uses with only the mapping logic changing from instance to instance.929 uses with only the mapping logic changing from instance to instance.
930
931 :ivar _immediate_fallbacks: For subclasses that support stacking,
932 this is a list of other VersionedFiles immediately underneath this
933 one. They may in turn each have further fallbacks.
933 """934 """
934935
935 def add_lines(self, key, parents, lines, parent_texts=None,936 def add_lines(self, key, parents, lines, parent_texts=None,
@@ -1193,6 +1194,19 @@
1193 def _extract_blocks(self, version_id, source, target):1194 def _extract_blocks(self, version_id, source, target):
1194 return None1195 return None
11951196
1197 def _transitive_fallbacks(self):
1198 """Return the whole stack of fallback versionedfiles.
1199
1200 This VersionedFiles may have a list of fallbacks, but it doesn't
1201 necessarily know about the whole stack going down, and it can't know
1202 at open time because they may change after the objects are opened.
1203 """
1204 all_fallbacks = []
1205 for a_vfs in self._immediate_fallbacks:
1206 all_fallbacks.append(a_vfs)
1207 all_fallbacks.extend(a_vfs._transitive_fallbacks())
1208 return all_fallbacks
1209
11961210
1197class ThunkedVersionedFiles(VersionedFiles):1211class ThunkedVersionedFiles(VersionedFiles):
1198 """Storage for many versioned files thunked onto a 'VersionedFile' class.1212 """Storage for many versioned files thunked onto a 'VersionedFile' class.
11991213
=== modified file 'doc/en/release-notes/bzr-2.2.txt'
--- doc/en/release-notes/bzr-2.2.txt 2011-02-04 14:10:48 +0000
+++ doc/en/release-notes/bzr-2.2.txt 2011-02-09 08:12:01 +0000
@@ -2,9 +2,79 @@
2Bazaar Release Notes2Bazaar Release Notes
3####################3####################
44
5.. toctree::5.. contents:: List of Releases
6 :maxdepth: 16 :depth: 1
77
8bzr 2.2.5
9#########
10
11:Codename: Suggestions welcome
12:2.2.5: NOT RELEASED YET
13
14Compatibility Breaks
15********************
16
17New Features
18************
19
20Bug Fixes
21*********
22
23* Correctly handle ``bzr log`` and `get_known_graph_ancestry` on a
24 doubly-stacked branch.
25 (James Westby, Martin Pool, #715000)
26
27Improvements
28************
29
30Documentation
31*************
32
33API Changes
34***********
35
36Internals
37*********
38
39Testing
40*******
41
42
43bzr 2.2.4
44#########
45
46:2.2.4: 2011-02-04
47
48This is a bugfix release. Only one bug has been fixed, a regression from 2.2.3
49involving only certain operations with launchpad. Upgrading is recommended for
50all users on earlier 2.2 releases.
51
52Bug Fixes
53*********
54
55* Fix communications with the Launchpad web service when using
56 launchpadlib >= 1.5.5. This was a latent bug in bzr's communication
57 with Launchpad's production instance, which only became a problem when
58 the default instance was switched from edge to production in bzr 2.2.3.
59 (Max Bowsher, #707075)
60
61
62bzr 2.2.3
63#########
64
65:2.2.3: 2011-01-20
66
67This is a bugfix release. Upgrading is recommended for all users
68on earlier 2.2 releases.
69
70Compatibility Breaks
71********************
72
73* Launchpad has announced that the ``edge.launchpad.net`` instance is
74 deprecated and may be shut down in the future
75 <http://blog.launchpad.net/general/edge-is-deprecated>. Bazaar has therefore
76 been updated in this release to talk to the main (``launchpad.net``) servers,
77 rather than the ``edge`` ones. (Vincent Ladeuil, #583667)
8bzr 2.2.478bzr 2.2.4
9#########79#########
1080