Rev 5819: (jelmer) Don't load working tree implementations during 'bzr serve'. (Jelmer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed May 4 09:41:32 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5819 [merge]
revision-id: pqm at pqm.ubuntu.com-20110504094129-zodvq0croxdzf86w
parent: pqm at pqm.ubuntu.com-20110504022916-5kjvsleivsy53zox
parent: jelmer at samba.org-20110504084915-05bjgkllosui58o9
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-05-04 09:41:29 +0000
message:
(jelmer) Don't load working tree implementations during 'bzr serve'. (Jelmer
Vernooij)
modified:
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/tests/test_import_tariff.py test_import_tariff.p-20100207155145-ff9infp7goncs7zh-1
bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2011-05-03 22:53:39 +0000
+++ b/bzrlib/bzrdir.py 2011-05-03 23:16:56 +0000
@@ -1252,15 +1252,12 @@
def has_workingtree(self):
"""Tell if this bzrdir contains a working tree.
- This will still raise an exception if the bzrdir has a workingtree that
- is remote & inaccessible.
-
Note: if you're going to open the working tree, you should just go
ahead and try, and not ask permission first.
"""
from bzrlib.workingtree import WorkingTreeFormat
try:
- WorkingTreeFormat.find_format(self)
+ WorkingTreeFormat.find_format_string(self)
except errors.NoWorkingTree:
return False
return True
=== modified file 'bzrlib/tests/test_import_tariff.py'
--- a/bzrlib/tests/test_import_tariff.py 2011-05-03 22:22:59 +0000
+++ b/bzrlib/tests/test_import_tariff.py 2011-05-03 23:16:56 +0000
@@ -206,6 +206,9 @@
'bzrlib.bugtracker',
'bzrlib.bundle.commands',
'bzrlib.cmd_version_info',
+ 'bzrlib.dirstate',
+ 'bzrlib._dirstate_helpers_py',
+ 'bzrlib._dirstate_helpers_pyx',
'bzrlib.externalcommand',
'bzrlib.filters',
# foreign branch plugins import the foreign_vcs_registry from
@@ -223,6 +226,7 @@
'bzrlib.smart.client',
'bzrlib.transform',
'bzrlib.version_info_formats.format_rio',
+ 'bzrlib.workingtree_4',
'getpass',
'kerberos',
'smtplib',
=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py 2011-05-03 22:53:39 +0000
+++ b/bzrlib/tests/test_workingtree.py 2011-05-03 23:16:56 +0000
@@ -166,6 +166,19 @@
class TestWorkingTreeFormat(TestCaseWithTransport):
"""Tests for the WorkingTreeFormat facility."""
+ def test_find_format_string(self):
+ # is the right format object found for a working tree?
+ branch = self.make_branch('branch')
+ self.assertRaises(errors.NoWorkingTree,
+ workingtree.WorkingTreeFormat.find_format_string, branch.bzrdir)
+ transport = branch.bzrdir.get_workingtree_transport(None)
+ transport.mkdir('.')
+ transport.put_bytes("format", "some format name")
+ # The format does not have to be known by Bazaar,
+ # find_format_string just retrieves the name
+ self.assertEquals("some format name",
+ workingtree.WorkingTreeFormat.find_format_string(branch.bzrdir))
+
def test_find_format(self):
# is the right format object found for a working tree?
# create a branch with a few known format objects.
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2011-05-04 00:03:41 +0000
+++ b/bzrlib/workingtree.py 2011-05-04 08:49:15 +0000
@@ -3021,14 +3021,20 @@
"""If this format supports missing parent conflicts."""
@classmethod
+ def find_format_string(klass, a_bzrdir):
+ """Return format name for the working tree object in a_bzrdir."""
+ try:
+ transport = a_bzrdir.get_workingtree_transport(None)
+ return transport.get_bytes("format")
+ except errors.NoSuchFile:
+ raise errors.NoWorkingTree(base=transport.base)
+
+ @classmethod
def find_format(klass, a_bzrdir):
"""Return the format for the working tree object in a_bzrdir."""
try:
- transport = a_bzrdir.get_workingtree_transport(None)
- format_string = transport.get_bytes("format")
+ format_string = klass.find_format_string(a_bzrdir)
return format_registry.get(format_string)
- except errors.NoSuchFile:
- raise errors.NoWorkingTree(base=transport.base)
except KeyError:
raise errors.UnknownFormatError(format=format_string,
kind="working tree")
More information about the bazaar-commits
mailing list