Rev 4339: (igc) reconfigure --standalone no longer raises in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 6 15:50:47 BST 2009


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

------------------------------------------------------------
revno: 4339
revision-id: pqm at pqm.ubuntu.com-20090506145040-n94tm9ju7m2cb4r6
parent: pqm at pqm.ubuntu.com-20090506094512-vta3no53wohda83x
parent: ian.clatworthy at canonical.com-20090506133136-bwpg6e20gtwk70n4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-05-06 15:50:40 +0100
message:
  (igc) reconfigure --standalone no longer raises
  	IncompatibleRepositories (Martin von Gagern)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
  bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
    ------------------------------------------------------------
    revno: 4338.1.1
    revision-id: ian.clatworthy at canonical.com-20090506133136-bwpg6e20gtwk70n4
    parent: pqm at pqm.ubuntu.com-20090506094512-vta3no53wohda83x
    parent: martin.vgagern at gmx.net-20090423142008-89nz0k1qazr3is7s
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: integration
    timestamp: Wed 2009-05-06 23:31:36 +1000
    message:
      (igc) reconfigure --standalone no longer raises IncompatibleRepositories (Martin von Gagern)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
    ------------------------------------------------------------
    revno: 4297.4.5
    revision-id: martin.vgagern at gmx.net-20090423142008-89nz0k1qazr3is7s
    parent: martin.vgagern at gmx.net-20090423140109-1gydcdfb1sllcdh9
    committer: Martin von Gagern <Martin.vGagern at gmx.net>
    branch nick: bug248932
    timestamp: Thu 2009-04-23 16:20:08 +0200
    message:
      Use repository format from exactly the same repository we want to fetch from.
                                                           
      Simply looking for all occurrences of repo.fetch() in this apply method
      shows that there are only two possible source repositories, one from
      local_branch and one from referenced_branch.  If we will later fetch from
      either of these, we also use the corresponding format.  If not, we fall back
      to default format.  I don't know if this ever happens.  The code is pretty
      verbose, making it easy to replace parts of the logic and keep other parts.
    modified:
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
    ------------------------------------------------------------
    revno: 4297.4.4
    revision-id: martin.vgagern at gmx.net-20090423140109-1gydcdfb1sllcdh9
    parent: martin.vgagern at gmx.net-20090423125715-9c994b52zkl6uqtj
    committer: Martin von Gagern <Martin.vGagern at gmx.net>
    branch nick: bug248932
    timestamp: Thu 2009-04-23 16:01:09 +0200
    message:
      Testcase exposing bug when creating a repository for a lightweight branch.
    modified:
      bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
    ------------------------------------------------------------
    revno: 4297.4.3
    revision-id: martin.vgagern at gmx.net-20090423125715-9c994b52zkl6uqtj
    parent: martin.vgagern at gmx.net-20090417110544-d7sk8o5f1ug0741r
    committer: Martin von Gagern <Martin.vGagern at gmx.net>
    branch nick: bug248932
    timestamp: Thu 2009-04-23 14:57:15 +0200
    message:
      Cleaner implementation of reconfigure.
      
      Thanks to lifeless for hints on IRC. Implementation still might fail for
      lightweight checkouts in cases where rich roots are required.  Would need a
      testcase for that first.
    modified:
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
    ------------------------------------------------------------
    revno: 4297.4.2
    revision-id: martin.vgagern at gmx.net-20090417110544-d7sk8o5f1ug0741r
    parent: martin.vgagern at gmx.net-20090417110502-f701vap7g2kan3dg
    committer: Martin von Gagern <Martin.vGagern at gmx.net>
    branch nick: bug248932
    timestamp: Fri 2009-04-17 13:05:44 +0200
    message:
      Hackish solution for bug #248932.
      
      Really ugly, as it uses lots of internal stuff, and simply continues quietly
      if the operation fails.  This really needs to be cleaned up, but this raw
      checkin can still serve to outline the basic direction of a fix.
    modified:
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
    ------------------------------------------------------------
    revno: 4297.4.1
    revision-id: martin.vgagern at gmx.net-20090417110502-f701vap7g2kan3dg
    parent: pqm at pqm.ubuntu.com-20090417084143-8ias85nrnap1hk9z
    committer: Martin von Gagern <Martin.vGagern at gmx.net>
    branch nick: bug248932
    timestamp: Fri 2009-04-17 13:05:02 +0200
    message:
      Added blackbox tests to expose LP bug #248932.
    modified:
      bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
=== modified file 'NEWS'
--- a/NEWS	2009-05-06 06:36:03 +0000
+++ b/NEWS	2009-05-06 13:31:36 +0000
@@ -50,6 +50,9 @@
 * ``bzr merge --weave`` will now generate a conflict if one side deletes a
   line, and the other side modifies the line. (John Arbash Meinel, #328171)
 
+* ``bzr reconfigure --standalone`` no longer raises IncompatibleRepositories.
+  (Martin von Gagern, #248932)
+
 * ``bzr send`` works to send emails again using MAPI.
   (Neil Martinsen-Burrell, #346998)
 

=== modified file 'bzrlib/reconfigure.py'
--- a/bzrlib/reconfigure.py	2009-05-02 12:05:37 +0000
+++ b/bzrlib/reconfigure.py	2009-05-06 13:31:36 +0000
@@ -269,7 +269,20 @@
         if not force:
             self._check()
         if self._create_repository:
-            repo = self.bzrdir.create_repository()
+            if self.local_branch and not self._destroy_branch:
+                old_repo = self.local_branch.repository
+            elif self._create_branch and self.referenced_branch is not None:
+                old_repo = self.referenced_branch.repository
+            else:
+                old_repo = None
+            if old_repo is not None:
+                repository_format = old_repo._format
+            else:
+                repository_format = None
+            if repository_format is not None:
+                repo = repository_format.initialize(self.bzrdir)
+            else:
+                repo = self.bzrdir.create_repository()
             if self.local_branch and not self._destroy_branch:
                 repo.fetch(self.local_branch.repository,
                            self.local_branch.last_revision())

=== modified file 'bzrlib/tests/blackbox/test_reconfigure.py'
--- a/bzrlib/tests/blackbox/test_reconfigure.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_reconfigure.py	2009-04-23 14:01:09 +0000
@@ -58,6 +58,11 @@
         checkout = branch.create_checkout('checkout', lightweight=True)
         self.run_bzr('reconfigure --checkout checkout')
 
+    def test_lightweight_checkout_to_tree(self):
+        branch = self.make_branch('branch')
+        checkout = branch.create_checkout('checkout', lightweight=True)
+        self.run_bzr('reconfigure --tree checkout')
+
     def test_no_args(self):
         branch = self.make_branch('branch')
         self.run_bzr_error(['No target configuration specified'],
@@ -127,3 +132,53 @@
             working_dir='repo/branch')
         self.failUnlessExists('repo/branch/foo')
         tree = workingtree.WorkingTree.open('repo/branch')
+
+    def test_shared_format_to_standalone(self, format=None):
+        repo = self.make_repository('repo', shared=True, format=format)
+        branch = bzrdir.BzrDir.create_branch_convenience('repo/tree')
+        self.assertNotEqual(branch.bzrdir.root_transport.base,
+            branch.repository.bzrdir.root_transport.base)
+        tree = workingtree.WorkingTree.open('repo/tree')
+        self.build_tree_contents([('repo/tree/file', 'foo\n')]);
+        tree.add(['file'])
+        tree.commit('added file')
+        self.run_bzr('reconfigure --standalone', working_dir='repo/tree')
+        tree = workingtree.WorkingTree.open('repo/tree')
+        self.build_tree_contents([('repo/tree/file', 'bar\n')]);
+        self.check_file_contents('repo/tree/file', 'bar\n')
+        self.run_bzr('revert', working_dir='repo/tree')
+        self.check_file_contents('repo/tree/file', 'foo\n')
+        self.assertEqual(tree.bzrdir.root_transport.base,
+            tree.branch.repository.bzrdir.root_transport.base)
+
+    def test_shared_knit_to_standalone(self):
+        self.test_shared_format_to_standalone('knit')
+
+    def test_shared_pack092_to_standalone(self):
+        self.test_shared_format_to_standalone('pack-0.92')
+
+    def test_shared_rich_root_pack_to_standalone(self):
+        self.test_shared_format_to_standalone('rich-root-pack')
+
+    def test_lightweight_format_checkout_to_tree(self, format=None):
+        branch = self.make_branch('branch', format=format)
+        checkout = branch.create_checkout('checkout', lightweight=True)
+        tree = workingtree.WorkingTree.open('checkout')
+        self.build_tree_contents([('checkout/file', 'foo\n')]);
+        tree.add(['file'])
+        tree.commit('added file')
+        self.run_bzr('reconfigure --tree', working_dir='checkout')
+        tree = workingtree.WorkingTree.open('checkout')
+        self.build_tree_contents([('checkout/file', 'bar\n')]);
+        self.check_file_contents('checkout/file', 'bar\n')
+        self.run_bzr('revert', working_dir='checkout')
+        self.check_file_contents('checkout/file', 'foo\n')
+
+    def test_lightweight_knit_checkout_to_tree(self, format=None):
+        self.test_lightweight_format_checkout_to_tree('knit')
+
+    def test_lightweight_pack092_checkout_to_tree(self, format=None):
+        self.test_lightweight_format_checkout_to_tree('pack-0.92')
+
+    def test_lightweight_rich_root_pack_checkout_to_tree(self, format=None):
+        self.test_lightweight_format_checkout_to_tree('rich-root-pack')




More information about the bazaar-commits mailing list