Rev 2815: * Pushing, pulling and branching branches with subtree references was not in http://people.ubuntu.com/~robertc/baz2.0/nested-tree

Robert Collins robertc at robertcollins.net
Wed Sep 12 01:06:23 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/nested-tree

------------------------------------------------------------
revno: 2815
revision-id: 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:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
=== 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 00:05:48 +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
 
@@ -325,3 +330,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