Rev 5621: Merge wip for bug #715000 into 2.3 in file:///home/vila/src/bzr/reviews/2.3-715000-stacking/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Feb 8 11:06:05 UTC 2011
At file:///home/vila/src/bzr/reviews/2.3-715000-stacking/
------------------------------------------------------------
revno: 5621 [merge]
revision-id: v.ladeuil+lp at free.fr-20110208110603-3phb1mz27iljnss2
parent: pqm at pqm.ubuntu.com-20110207223840-h0gc81bslkoe6z76
parent: mbp at canonical.com-20110208084047-ppf796e9q5hfxqtr
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 2.3-715000-stacking
timestamp: Tue 2011-02-08 12:06:03 +0100
message:
Merge wip for bug #715000 into 2.3
added:
bzrlib/tests/per_repository_reference/test_graph.py test_graph.py-20110208074011-b92ci87urjayd2q7-1
modified:
bzrlib/groupcompress.py groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/per_repository_reference/__init__.py __init__.py-20080220025549-nnm2s80it1lvcwnc-2
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2010-09-26 20:45:28 +0000
+++ b/bzrlib/groupcompress.py 2011-02-08 11:06:03 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
+# Copyright (C) 2008-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1312,7 +1312,7 @@
# KnitVersionedFiles.get_known_graph_ancestry, but they don't share
# ancestry.
parent_map, missing_keys = self._index.find_ancestry(keys)
- for fallback in self._fallback_vfs:
+ for fallback in self._transitive_fallbacks():
if not missing_keys:
break
(f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2011-01-11 20:42:36 +0000
+++ b/bzrlib/knit.py 2011-02-08 11:06:03 +0000
@@ -1196,7 +1196,7 @@
def get_known_graph_ancestry(self, keys):
"""Get a KnownGraph instance with the ancestry of keys."""
parent_map, missing_keys = self._index.find_ancestry(keys)
- for fallback in self._fallback_vfs:
+ for fallback in self._transitive_fallbacks():
if not missing_keys:
break
(f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- a/bzrlib/tests/per_repository_reference/__init__.py 2011-01-10 22:47:59 +0000
+++ b/bzrlib/tests/per_repository_reference/__init__.py 2011-02-08 11:06:03 +0000
@@ -105,6 +105,7 @@
'bzrlib.tests.per_repository_reference.test_fetch',
'bzrlib.tests.per_repository_reference.test_get_record_stream',
'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno',
+ 'bzrlib.tests.per_repository_reference.test_graph',
'bzrlib.tests.per_repository_reference.test_initialize',
'bzrlib.tests.per_repository_reference.test_unlock',
]
=== added file 'bzrlib/tests/per_repository_reference/test_graph.py'
--- a/bzrlib/tests/per_repository_reference/test_graph.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/per_repository_reference/test_graph.py 2011-02-08 08:01:40 +0000
@@ -0,0 +1,45 @@
+# Copyright (C) 2011 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+"""Tests for graph operations on stacked repositories."""
+
+
+from bzrlib.tests.per_repository import TestCaseWithRepository
+
+
+class TestGraph(TestCaseWithRepository):
+
+ def test_get_known_graph_ancestry_stacked(self):
+ """get_known_graph_ancestry works correctly on stacking.
+
+ See <https://bugs.launchpad.net/bugs/715000>.
+ """
+ branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches()
+ for br in [branch_c]:
+ self.assertEquals(
+ [revid_1],
+ br.repository.get_known_graph_ancestry([revid_1]).topo_sort())
+
+ def make_double_stacked_branches(self):
+ wt_a = self.make_branch_and_tree('a')
+ branch_a = wt_a.branch
+ branch_b = self.make_branch('b')
+ branch_b.set_stacked_on_url('../a')
+ branch_c = self.make_branch('c')
+ branch_c.set_stacked_on_url('../b')
+ revid_1 = wt_a.commit('first commit')
+ return branch_a, branch_b, branch_c, revid_1
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py 2010-08-28 15:34:24 +0000
+++ b/bzrlib/versionedfile.py 2011-02-08 11:06:03 +0000
@@ -1193,6 +1193,19 @@
def _extract_blocks(self, version_id, source, target):
return None
+ def _transitive_fallbacks(self):
+ """Return the whole stack of fallback versionedfiles.
+
+ This VersionedFiles may have a list of fallbacks, but it doesn't
+ necessarily know about the whole stack going down, and it can't know
+ at open time because they may change after the objects are opened.
+ """
+ all_fallbacks = []
+ for a_vfs in self._fallback_vfs:
+ all_fallbacks.append(a_vfs)
+ all_fallbacks.extend(a_vfs._transitive_fallbacks())
+ return all_fallbacks
+
class ThunkedVersionedFiles(VersionedFiles):
"""Storage for many versioned files thunked onto a 'VersionedFile' class.
More information about the bazaar-commits
mailing list