Rev 4635: Fix regression in upgrade introduced with the change to upgrade in rev 4622. in http://bazaar.launchpad.net/~lifeless/bzr/upgrade

Robert Collins robertc at robertcollins.net
Fri Aug 21 03:09:47 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/upgrade

------------------------------------------------------------
revno: 4635
revision-id: robertc at robertcollins.net-20090821020943-uxp6bofw8hhzwjq7
parent: pqm at pqm.ubuntu.com-20090820135727-pz56lf0l0tj6rbrn
committer: Robert Collins <robertc at robertcollins.net>
branch nick: upgrade
timestamp: Fri 2009-08-21 12:09:43 +1000
message:
  Fix regression in upgrade introduced with the change to upgrade in rev 4622.
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-08-18 05:18:52 +0000
+++ b/bzrlib/bzrdir.py	2009-08-21 02:09:43 +0000
@@ -129,8 +129,16 @@
         return True
 
     def check_conversion_target(self, target_format):
+        """Check that a bzrdir as a whole can be converted to a new format."""
+        # The only current restriction is that the repository content can be 
+        # fetched compatibly with the target.
         target_repo_format = target_format.repository_format
-        self.open_repository()._format.check_conversion_target(target_repo_format)
+        try:
+            self.open_repository()._format.check_conversion_target(
+                target_repo_format)
+        except errors.NoRepositoryPresent:
+            # No repo, no problem.
+            pass
 
     @staticmethod
     def _check_supported(format, allow_unsupported,

=== modified file 'bzrlib/lockdir.py'
--- a/bzrlib/lockdir.py	2009-07-27 05:24:02 +0000
+++ b/bzrlib/lockdir.py	2009-08-21 02:09:43 +0000
@@ -245,6 +245,7 @@
         if info['nonce'] != self.nonce:
             self._trace("rename succeeded, "
                 "but lock is still held by someone else")
+            raise error.BzrError("we know its broken now")
             raise LockContention(self)
         self._lock_held = True
         self._trace("... lock succeeded after %dms",
@@ -328,6 +329,12 @@
                                      old_nonce)
             for hook in self.hooks['lock_released']:
                 hook(result)
+            info = self.peek()
+            self._trace("after unlocking, info=%r", info)
+            if info is not None and info['nonce'] == old_nonce:
+                self._trace("rename and delete succeeded, "
+                    "but lock is still held by us")
+                raise error.BzrError("epic unlock fail")
 
     def break_lock(self):
         """Break a lock not held by this instance of LockDir.

=== modified file 'bzrlib/tests/blackbox/test_upgrade.py'
--- a/bzrlib/tests/blackbox/test_upgrade.py	2009-08-14 08:57:57 +0000
+++ b/bzrlib/tests/blackbox/test_upgrade.py	2009-08-21 02:09:43 +0000
@@ -184,7 +184,7 @@
         self.assertEqual('', err)
 
 
-class UpgradeRecommendedTests(TestCaseInTempDir):
+class UpgradeRecommendedTests(TestCaseWithTransport):
 
     def test_recommend_upgrade_wt4(self):
         # using a deprecated format gives a warning
@@ -200,3 +200,9 @@
         out, err = self.run_bzr('revno a')
         if err.find('upgrade') > -1:
             self.fail("message shouldn't suggest upgrade:\n%s" % err)
+
+    def test_upgrade_shared_repo(self):
+        repo = self.make_repository('repo', format='2a', shared=True)
+        branch = self.make_branch_and_tree('repo/branch', format="pack-0.92")
+        self.get_transport('repo/branch/.bzr/repository').delete_tree('.')
+        out, err = self.run_bzr(['upgrade'], working_dir='repo/branch')

=== modified file 'bzrlib/transport/log.py'
--- a/bzrlib/transport/log.py	2009-07-01 07:29:37 +0000
+++ b/bzrlib/transport/log.py	2009-08-21 02:09:43 +0000
@@ -143,6 +143,7 @@
         return return_result
 
     def _shorten(self, x):
+        return x
         if len(x) > 70:
             x = x[:67] + '...'
         return x




More information about the bazaar-commits mailing list