Merge lp:~mbp/bzr/715000-stacking into lp:bzr/2.2

Proposed by Martin Pool
Status: Merged
Approved by: Martin Pool
Approved revision: no longer in the source branch.
Merged at revision: 5125
Proposed branch: lp:~mbp/bzr/715000-stacking
Merge into: lp:bzr/2.2
Diff against target: 132 lines (+66/-3)
6 files modified
NEWS (+4/-0)
bzrlib/groupcompress.py (+2/-2)
bzrlib/knit.py (+1/-1)
bzrlib/tests/per_repository_reference/__init__.py (+1/-0)
bzrlib/tests/per_repository_reference/test_graph.py (+45/-0)
bzrlib/versionedfile.py (+13/-0)
To merge this branch: bzr merge lp:~mbp/bzr/715000-stacking
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+49015@code.launchpad.net

Commit message

handle doubly-stacked repositories in get_known_graph_ancestry (bug 715000)

Description of the change

Per discussion in https://code.launchpad.net/~mbp/bzr/715000-stacking/+merge/48886 I think this is safe to merge to lp:bzr/2.2.

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2011-02-04 14:04:18 +0000
+++ NEWS 2011-02-09 04:22:11 +0000
@@ -20,6 +20,10 @@
20Bug Fixes20Bug Fixes
21*********21*********
2222
23* Correctly handle ``bzr log`` and `get_known_graph_ancestry` on a
24 doubly-stacked branch.
25 (James Westby, Martin Pool, #715000)
26
23Improvements27Improvements
24************28************
2529
2630
=== modified file 'bzrlib/groupcompress.py'
--- bzrlib/groupcompress.py 2010-05-20 02:57:52 +0000
+++ bzrlib/groupcompress.py 2011-02-09 04:22:11 +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
@@ -1293,7 +1293,7 @@
1293 # KnitVersionedFiles.get_known_graph_ancestry, but they don't share1293 # KnitVersionedFiles.get_known_graph_ancestry, but they don't share
1294 # ancestry.1294 # ancestry.
1295 parent_map, missing_keys = self._index.find_ancestry(keys)1295 parent_map, missing_keys = self._index.find_ancestry(keys)
1296 for fallback in self._fallback_vfs:1296 for fallback in self._transitive_fallbacks():
1297 if not missing_keys:1297 if not missing_keys:
1298 break1298 break
1299 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(1299 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
13001300
=== modified file 'bzrlib/knit.py'
--- bzrlib/knit.py 2010-06-04 03:09:35 +0000
+++ bzrlib/knit.py 2011-02-09 04:22:11 +0000
@@ -1195,7 +1195,7 @@
1195 def get_known_graph_ancestry(self, keys):1195 def get_known_graph_ancestry(self, keys):
1196 """Get a KnownGraph instance with the ancestry of keys."""1196 """Get a KnownGraph instance with the ancestry of keys."""
1197 parent_map, missing_keys = self._index.find_ancestry(keys)1197 parent_map, missing_keys = self._index.find_ancestry(keys)
1198 for fallback in self._fallback_vfs:1198 for fallback in self._transitive_fallbacks():
1199 if not missing_keys:1199 if not missing_keys:
1200 break1200 break
1201 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(1201 (f_parent_map, f_missing_keys) = fallback._index.find_ancestry(
12021202
=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- bzrlib/tests/per_repository_reference/__init__.py 2010-05-20 02:57:52 +0000
+++ bzrlib/tests/per_repository_reference/__init__.py 2011-02-09 04:22:11 +0000
@@ -117,6 +117,7 @@
117 'bzrlib.tests.per_repository_reference.test_fetch',117 'bzrlib.tests.per_repository_reference.test_fetch',
118 'bzrlib.tests.per_repository_reference.test_get_record_stream',118 'bzrlib.tests.per_repository_reference.test_get_record_stream',
119 'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno',119 'bzrlib.tests.per_repository_reference.test_get_rev_id_for_revno',
120 'bzrlib.tests.per_repository_reference.test_graph',
120 'bzrlib.tests.per_repository_reference.test_initialize',121 'bzrlib.tests.per_repository_reference.test_initialize',
121 'bzrlib.tests.per_repository_reference.test_unlock',122 'bzrlib.tests.per_repository_reference.test_unlock',
122 ]123 ]
123124
=== 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 04:22:11 +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_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-05-14 12:55:13 +0000
+++ bzrlib/versionedfile.py 2011-02-09 04:22:11 +0000
@@ -1090,6 +1090,19 @@
1090 def _extract_blocks(self, version_id, source, target):1090 def _extract_blocks(self, version_id, source, target):
1091 return None1091 return None
10921092
1093 def _transitive_fallbacks(self):
1094 """Return the whole stack of fallback versionedfiles.
1095
1096 This VersionedFiles may have a list of fallbacks, but it doesn't
1097 necessarily know about the whole stack going down, and it can't know
1098 at open time because they may change after the objects are opened.
1099 """
1100 all_fallbacks = []
1101 for a_vfs in self._fallback_vfs:
1102 all_fallbacks.append(a_vfs)
1103 all_fallbacks.extend(a_vfs._transitive_fallbacks())
1104 return all_fallbacks
1105
10931106
1094class ThunkedVersionedFiles(VersionedFiles):1107class ThunkedVersionedFiles(VersionedFiles):
1095 """Storage for many versioned files thunked onto a 'VersionedFile' class.1108 """Storage for many versioned files thunked onto a 'VersionedFile' class.

Subscribers

People subscribed via source and target branches