Rev 5125: (mbp) handle doubly-stacked repositories in get_known_graph_ancestry (bug in file:///home/pqm/archives/thelove/bzr/2.2/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Feb 9 05:57:03 UTC 2011
At file:///home/pqm/archives/thelove/bzr/2.2/
------------------------------------------------------------
revno: 5125 [merge]
revision-id: pqm at pqm.ubuntu.com-20110209055700-dspebroykbj4sfl5
parent: pqm at pqm.ubuntu.com-20110204152258-42fvoqaixf7b3a72
parent: mbp at canonical.com-20110209041655-ukb5cdgpnoyhv7sq
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Wed 2011-02-09 05:57:00 +0000
message:
(mbp) handle doubly-stacked repositories in get_known_graph_ancestry (bug
715000) (Martin Pool)
added:
bzrlib/tests/per_repository_reference/test_graph.py test_graph.py-20110208074011-b92ci87urjayd2q7-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
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
=== modified file 'NEWS'
--- a/NEWS 2011-02-04 14:04:18 +0000
+++ b/NEWS 2011-02-09 04:16:55 +0000
@@ -20,6 +20,10 @@
Bug Fixes
*********
+* Correctly handle ``bzr log`` and `get_known_graph_ancestry` on a
+ doubly-stacked branch.
+ (James Westby, Martin Pool, #715000)
+
Improvements
************
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2010-05-20 02:57:52 +0000
+++ b/bzrlib/groupcompress.py 2011-02-08 08:40:47 +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
@@ -1293,7 +1293,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 2010-06-04 03:09:35 +0000
+++ b/bzrlib/knit.py 2011-02-08 08:40:47 +0000
@@ -1195,7 +1195,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 2010-05-20 02:57:52 +0000
+++ b/bzrlib/tests/per_repository_reference/__init__.py 2011-02-08 08:01:40 +0000
@@ -117,6 +117,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-05-14 12:55:13 +0000
+++ b/bzrlib/versionedfile.py 2011-02-08 08:40:47 +0000
@@ -1090,6 +1090,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