Rev 5414: (jelmer) Add ControlDirFormat.supports_workingtrees cvar. (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 9 01:12:15 BST 2010


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

------------------------------------------------------------
revno: 5414 [merge]
revision-id: pqm at pqm.ubuntu.com-20100909001213-vfvobl4h09btm7mt
parent: pqm at pqm.ubuntu.com-20100908225236-xeoi280xsalha219
parent: jelmer at samba.org-20100908224226-pyn8zp3okuo4hblj
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-09-09 01:12:13 +0100
message:
  (jelmer) Add ControlDirFormat.supports_workingtrees cvar. (Jelmer Vernooij)
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/controldir.py           controldir.py-20100802102926-hvtvh0uae5epuibp-1
  bzrlib/tests/per_controldir/test_controldir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2010-08-25 02:16:31 +0000
+++ b/bzrlib/bzrdir.py	2010-09-09 00:12:13 +0000
@@ -2703,6 +2703,8 @@
 class RemoteBzrDirFormat(BzrDirMetaFormat1):
     """Format representing bzrdirs accessed via a smart server"""
 
+    supports_workingtrees = False
+
     def __init__(self):
         BzrDirMetaFormat1.__init__(self)
         # XXX: It's a bit ugly that the network name is here, because we'd

=== modified file 'bzrlib/controldir.py'
--- a/bzrlib/controldir.py	2010-08-21 21:33:57 +0000
+++ b/bzrlib/controldir.py	2010-09-08 22:42:26 +0000
@@ -562,6 +562,8 @@
     object will be created every system load.
 
     :cvar colocated_branches: Whether this formats supports colocated branches.
+    :cvar supports_workingtrees: This control directory can co-exist with a
+        working tree.
     """
 
     _default_format = None
@@ -589,6 +591,8 @@
     """Whether co-located branches are supported for this control dir format.
     """
 
+    supports_workingtrees = True
+
     def get_format_description(self):
         """Return the short description for this format."""
         raise NotImplementedError(self.get_format_description)

=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
--- a/bzrlib/tests/per_controldir/test_controldir.py	2010-08-23 20:37:18 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py	2010-08-29 13:14:35 +0000
@@ -16,7 +16,6 @@
 
 """Tests for bzrdir implementations - tests a bzrdir format."""
 
-from cStringIO import StringIO
 import errno
 from itertools import izip
 import os
@@ -722,9 +721,8 @@
         try:
             target.open_workingtree()
         except errors.NoWorkingTree:
-            # bzrdir's that never have working trees are allowed to pass;
-            # whitelist them for now.
-            self.assertIsInstance(target, RemoteBzrDir)
+            # Some bzrdirs can never have working trees.
+            self.assertFalse(target._format.supports_workingtrees)
 
     def test_sprout_bzrdir_empty_under_shared_repo_force_new(self):
         # the force_new_repo parameter should force use of a new repo in an empty
@@ -843,7 +841,7 @@
         self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
         branch = target.open_branch()
         self.assertTrue(branch.repository.has_revision('1'))
-        if not isinstance(branch.bzrdir, RemoteBzrDir):
+        if branch.bzrdir._format.supports_workingtrees:
             self.assertTrue(branch.repository.make_working_trees())
         self.assertFalse(branch.repository.is_shared())
 




More information about the bazaar-commits mailing list