Rev 2815: (robertc) Fix fetching of revisions referring to nested trees. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Sep 12 05:27:51 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2815
revision-id: pqm at pqm.ubuntu.com-20070912042748-qhmeoj3c8zk7zt01
parent: pqm at pqm.ubuntu.com-20070911055622-a3060rj7l0iy38l2
parent: robertc at robertcollins.net-20070912031604-lzy05h9u6dyfrfgb
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-09-12 05:27:48 +0100
message:
(robertc) Fix fetching of revisions referring to nested trees. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
------------------------------------------------------------
revno: 2814.1.2
merged: robertc at robertcollins.net-20070912031604-lzy05h9u6dyfrfgb
parent: robertc at robertcollins.net-20070912000548-b93ev6hxnfh202ks
committer: Robert Collins <robertc at robertcollins.net>
branch nick: nested-tree
timestamp: Wed 2007-09-12 13:16:04 +1000
message:
Fixup other interrepository tests failing due to the change to test subtrees.
------------------------------------------------------------
revno: 2814.1.1
merged: robertc at robertcollins.net-20070912000548-b93ev6hxnfh202ks
parent: pqm at pqm.ubuntu.com-20070911055622-a3060rj7l0iy38l2
committer: Robert Collins <robertc at robertcollins.net>
branch nick: nested-tree
timestamp: Wed 2007-09-12 10:05:48 +1000
message:
* Pushing, pulling and branching branches with subtree references was not
copying the subtree weave, preventing the file graph from being accessed
and causing errors in commits in clones. (Robert Collins)
=== modified file 'NEWS'
--- a/NEWS 2007-09-11 03:07:14 +0000
+++ b/NEWS 2007-09-12 00:05:48 +0000
@@ -57,6 +57,10 @@
* ``bzr plugins`` now lists the version number for each plugin in square
brackets after the path. (Robert Collins, #125421)
+ * Pushing, pulling and branching branches with subtree references was not
+ copying the subtree weave, preventing the file graph from being accessed
+ and causing errors in commits in clones. (Robert Collins)
+
* Suppress warning "integer argument expected, got float" from Paramiko,
which sometimes caused false test failures. (Martin Pool)
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-09-11 00:29:17 +0000
+++ b/bzrlib/repository.py 2007-09-12 00:05:48 +0000
@@ -78,7 +78,7 @@
_file_ids_altered_regex = lazy_regex.lazy_compile(
r'file_id="(?P<file_id>[^"]+)"'
- r'.*revision="(?P<revision_id>[^"]+)"'
+ r'.* revision="(?P<revision_id>[^"]+)"'
)
def abort_write_group(self):
@@ -1645,8 +1645,13 @@
@classmethod
def _get_repo_format_to_test(self):
- """Repository format for testing with."""
- return RepositoryFormat.get_default_format()
+ """Repository format for testing with.
+
+ InterSameData can pull from subtree to subtree and from non-subtree to
+ non-subtree, so we test this with the richest repository format.
+ """
+ from bzrlib.repofmt import knitrepo
+ return knitrepo.RepositoryFormatKnit3()
@staticmethod
def is_compatible(source, target):
=== modified file 'bzrlib/tests/interrepository_implementations/test_interrepository.py'
--- a/bzrlib/tests/interrepository_implementations/test_interrepository.py 2007-07-17 16:04:00 +0000
+++ b/bzrlib/tests/interrepository_implementations/test_interrepository.py 2007-09-12 03:16:04 +0000
@@ -32,7 +32,12 @@
import bzrlib.repofmt.weaverepo as weaverepo
import bzrlib.repository as repository
from bzrlib.revision import NULL_REVISION, Revision
-from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
+from bzrlib.tests import (
+ TestCase,
+ TestCaseWithTransport,
+ TestNotApplicable,
+ TestSkipped,
+ )
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
from bzrlib.transport import get_transport
@@ -289,18 +294,16 @@
# repository.
# 'ghost' is a ghost in missing_ghost and not in with_ghost_rev
- inv = Inventory(revision_id='ghost')
- inv.root.revision = 'ghost'
repo = self.make_repository('with_ghost_rev')
- sha1 = repo.add_inventory('ghost', inv, [])
- rev = bzrlib.revision.Revision(timestamp=0,
- timezone=None,
- committer="Foo Bar <foo at example.com>",
- message="Message",
- inventory_sha1=sha1,
- revision_id='ghost')
- rev.parent_ids = []
- repo.add_revision('ghost', rev)
+ repo.lock_write()
+ builder = repo.get_commit_builder(None, [], None,
+ committer="Foo Bar <foo at example.com>",
+ revision_id='ghost')
+ ie = bzrlib.inventory.InventoryDirectory('TREE_ROOT', '', None)
+ builder.record_entry_contents(ie, [], '', None)
+ builder.finish_inventory()
+ builder.commit("Message")
+ repo.unlock()
repo = self.make_to_repository('missing_ghost')
inv = Inventory(revision_id='with_ghost')
@@ -325,3 +328,27 @@
# rev must not be corrupt now
rev = repo.get_revision('with_ghost')
self.assertEqual([None, 'ghost', 'with_ghost'], repo.get_ancestry('with_ghost'))
+
+
+class TestFetchDependentData(TestCaseWithInterRepository):
+
+ def test_reference(self):
+ from_tree = self.make_branch_and_tree('tree')
+ to_repo = self.make_to_repository('to')
+ if (not from_tree.supports_tree_reference() or
+ not from_tree.branch.repository._format.supports_tree_reference or
+ not to_repo._format.supports_tree_reference):
+ raise TestNotApplicable("Need subtree support.")
+ subtree = self.make_branch_and_tree('tree/subtree')
+ subtree.commit('subrev 1')
+ from_tree.add_reference(subtree)
+ tree_rev = from_tree.commit('foo')
+ # now from_tree has a last-modified of subtree of the rev id of the
+ # commit for foo, and a reference revision of the rev id of the commit
+ # for subrev 1
+ to_repo.fetch(from_tree.branch.repository, tree_rev)
+ # to_repo should have a file_graph for from_tree.path2id('subtree') and
+ # revid tree_rev.
+ file_vf = to_repo.weave_store.get_weave(
+ from_tree.path2id('subtree'), to_repo.get_transaction())
+ self.assertEqual([tree_rev], file_vf.get_ancestry([tree_rev]))
More information about the bazaar-commits
mailing list