Rev 3709: Branching from a shared repository on a smart server now preserves in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Sep 16 02:05:43 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3709
revision-id: pqm at pqm.ubuntu.com-20080916010540-7l7uexkq5aelzv5p
parent: pqm at pqm.ubuntu.com-20080912142101-kj49buaas8zsqf5x
parent: andrew.bennetts at canonical.com-20080916003525-j2g6u6zp3o96p30x
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-09-16 02:05:40 +0100
message:
  Branching from a shared repository on a smart server now preserves
  	repository format (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/per_repository/__init__.py __init__.py-20060131092037-9564957a7d4a841b
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 3705.2.3
    revision-id: andrew.bennetts at canonical.com-20080916003525-j2g6u6zp3o96p30x
    parent: andrew.bennetts at canonical.com-20080915234600-vhisfexl5nue1zwj
    parent: pqm at pqm.ubuntu.com-20080912142101-kj49buaas8zsqf5x
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: wrong-repo-format
    timestamp: Tue 2008-09-16 10:35:25 +1000
    message:
      Merge bzr.dev.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/__init__.py      changeset.py-20050513021216-b02ab57fb9738913
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/missing.py              missing.py-20050812153334-097f7097e2a8bcd1
      bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_missing.py   test_missing.py-20051212000028-694fa4f658a81f48
      doc/en/user-guide/http_smart_server.txt fastcgi.txt-20061005091552-rz8pva0olkxv0sd8-3
    ------------------------------------------------------------
    revno: 3705.2.2
    revision-id: andrew.bennetts at canonical.com-20080915234600-vhisfexl5nue1zwj
    parent: andrew.bennetts at canonical.com-20080912084746-zrkzygos0bt1l3im
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: wrong-repo-format
    timestamp: Tue 2008-09-16 09:46:00 +1000
    message:
      Add NEWS entry, and add test for preserving shared repository format when sprouting from a smart server.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/per_repository/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 3705.2.1
    revision-id: andrew.bennetts at canonical.com-20080912084746-zrkzygos0bt1l3im
    parent: pqm at pqm.ubuntu.com-20080912075746-kg3w6klh2bufrjd6
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: wrong-repo-format
    timestamp: Fri 2008-09-12 18:47:46 +1000
    message:
      Possible fix for bug 269214
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
=== modified file 'NEWS'
--- a/NEWS	2008-09-12 14:21:01 +0000
+++ b/NEWS	2008-09-16 00:35:25 +0000
@@ -15,6 +15,10 @@
 
   BUG FIXES:
 
+    * Branching from a shared repository on a smart server into a new
+      repository now preserves the repository format.
+      (Andrew Bennetts, #269214)
+
     * ``bzr missing`` now accepts an ``--include-merges`` option.
       (Vincent Ladeuil, #233817)
 

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-09-02 22:08:56 +0000
+++ b/bzrlib/bzrdir.py	2008-09-12 08:47:46 +0000
@@ -1007,8 +1007,10 @@
             # the fix recommended in bug # 103195 - to delegate this choice the
             # repository itself.
             repo_format = source_repository._format
-            if not isinstance(repo_format, remote.RemoteRepositoryFormat):
-                result_format.repository_format = repo_format
+            if isinstance(repo_format, remote.RemoteRepositoryFormat):
+                source_repository._ensure_real()
+                repo_format = source_repository._real_repository._format
+            result_format.repository_format = repo_format
         try:
             # TODO: Couldn't we just probe for the format in these cases,
             # rather than opening the whole tree?  It would be a little

=== modified file 'bzrlib/tests/per_repository/__init__.py'
--- a/bzrlib/tests/per_repository/__init__.py	2008-09-04 20:32:04 +0000
+++ b/bzrlib/tests/per_repository/__init__.py	2008-09-15 23:46:00 +0000
@@ -107,17 +107,18 @@
 
 class TestCaseWithRepository(TestCaseWithBzrDir):
 
-    def make_repository(self, relpath, format=None):
+    def make_repository(self, relpath, shared=False, format=None):
         if format is None:
             # Create a repository of the type we are trying to test.
             made_control = self.make_bzrdir(relpath)
-            repo = self.repository_format.initialize(made_control)
+            repo = self.repository_format.initialize(made_control,
+                    shared=shared)
             if getattr(self, "repository_to_test_repository", None):
                 repo = self.repository_to_test_repository(repo)
             return repo
         else:
             return super(TestCaseWithRepository, self).make_repository(
-                relpath, format=format)
+                relpath, shared=shared, format=format)
 
 
 class BrokenRepoScenario(object):

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2008-09-04 20:32:04 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2008-09-15 23:46:00 +0000
@@ -693,10 +693,10 @@
         self.assertEqual(signature, repo2.get_signature_text('A'))
 
     # XXX: this helper duplicated from tests.test_repository
-    def make_remote_repository(self, path):
+    def make_remote_repository(self, path, shared=False):
         """Make a RemoteRepository object backed by a real repository that will
         be created at the given path."""
-        repo = self.make_repository(path)
+        repo = self.make_repository(path, shared=shared)
         smart_server = server.SmartTCPServer_for_testing()
         smart_server.setUp(self.get_server())
         remote_transport = get_transport(smart_server.get_url()).clone(path)
@@ -741,6 +741,37 @@
             self.get_vfs_only_url('remote')).open_repository()
         self.assertEqual(remote_backing_repo._format, local_repo._format)
 
+    def test_sprout_branch_from_hpss_preserves_shared_repo_format(self):
+        """branch.sprout from a smart server preserves the repository format of
+        a branch from a shared repository.
+        """
+        weave_formats = [RepositoryFormat5(), RepositoryFormat6(),
+                         RepositoryFormat7()]
+        if self.repository_format in weave_formats:
+            raise TestNotApplicable(
+                "Cannot fetch weaves over smart protocol.")
+        # Make a shared repo
+        remote_repo = self.make_remote_repository('remote', shared=True)
+        remote_backing_repo = bzrdir.BzrDir.open(
+            self.get_vfs_only_url('remote')).open_repository()
+        # Make a branch in that repo in an old format that isn't the default
+        # branch format for the repo.
+        from bzrlib.branch import BzrBranchFormat5
+        format = remote_backing_repo.bzrdir.cloning_metadir()
+        format._branch_format = BzrBranchFormat5()
+        remote_transport = remote_repo.bzrdir.root_transport.clone('branch')
+        remote_backing_repo.bzrdir.create_branch_convenience(
+            remote_transport.base, force_new_repo=False, format=format)
+        remote_branch = bzrdir.BzrDir.open_from_transport(
+            remote_transport).open_branch()
+        try:
+            local_bzrdir = remote_branch.bzrdir.sprout('local')
+        except errors.TransportNotPossible:
+            raise TestNotApplicable(
+                "Cannot lock_read old formats like AllInOne over HPSS.")
+        local_repo = local_bzrdir.open_repository()
+        self.assertEqual(remote_backing_repo._format, local_repo._format)
+
     def test__make_parents_provider(self):
         """Repositories must have a _make_parents_provider method that returns
         an object with a get_parent_map method.




More information about the bazaar-commits mailing list