[MERGE] Make some tests use test suite transport rather than local
Andrew Bennetts
andrew at canonical.com
Thu Aug 17 05:06:49 BST 2006
On Thu, Aug 10, 2006 at 07:07:57PM +1000, Robert Collins wrote:
> On Thu, 2006-08-10 at 18:56 +1000, Andrew Bennetts wrote:
[...]
> > > +1 with a comment : the try: block seems rather large. Wouldn't it be
> > > fine with just the made_tree line inside the try ?
> > >
> > > (remember - NotLocalUrl is only raised from the tree related calls, no
> > > branch/repo or control.)
> >
> > That's what I tried initially, but the made_control line also raised that
> > exception.
>
> That would be a bug in the legacy all-in-one format I guess.
>
> What format raised it ?
Excellent question. I can't reproduce the problem now, so I've narrowed the
try-block back down to just the create_workingtree line, and everything's happy.
I guess it was a bug in something else I was doing at the time.
I've attached the updated patch.
-Andrew.
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2006-08-16 07:49:38 +0000
+++ bzrlib/bzrdir.py 2006-08-17 03:59:53 +0000
@@ -1218,8 +1218,13 @@
result = (super(BzrDirFormat5, self).initialize_on_transport(transport))
RepositoryFormat5().initialize(result, _internal=True)
if not _cloning:
- BzrBranchFormat4().initialize(result)
- WorkingTreeFormat2().initialize(result)
+ branch = BzrBranchFormat4().initialize(result)
+ try:
+ WorkingTreeFormat2().initialize(result)
+ except errors.NotLocalUrl:
+ # Even though we can't access the working tree, we need to
+ # create its control files.
+ WorkingTreeFormat2().stub_initialize_remote(branch.control_files)
return result
def _open(self, transport):
@@ -1272,13 +1277,13 @@
result = super(BzrDirFormat6, self).initialize_on_transport(transport)
RepositoryFormat6().initialize(result, _internal=True)
if not _cloning:
- BzrBranchFormat4().initialize(result)
+ branch = BzrBranchFormat4().initialize(result)
try:
WorkingTreeFormat2().initialize(result)
except errors.NotLocalUrl:
- # emulate pre-check behaviour for working tree and silently
- # fail.
- pass
+ # Even though we can't access the working tree, we need to
+ # create its control files.
+ WorkingTreeFormat2().stub_initialize_remote(branch.control_files)
return result
def _open(self, transport):
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2006-08-16 07:49:38 +0000
+++ bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2006-08-17 04:00:02 +0000
@@ -1050,26 +1050,33 @@
# because the default open will not open them and
# they may not be initializable.
return
- # this has to be tested with local access as we still support creating
- # format 6 bzrdirs
- t = get_transport('.')
+ t = self.get_transport()
made_control = self.bzrdir_format.initialize(t.base)
made_repo = made_control.create_repository()
made_branch = made_control.create_branch()
- made_tree = made_control.create_workingtree()
+ try:
+ made_tree = made_control.create_workingtree()
+ except errors.NotLocalUrl:
+ raise TestSkipped("Can't initialize %r on transport %r"
+ % (self.bzrdir_format, t))
self.failUnless(isinstance(made_tree, workingtree.WorkingTree))
self.assertEqual(made_control, made_tree.bzrdir)
def test_create_workingtree_revision(self):
# a bzrdir can construct a working tree for itself @ a specific revision.
+ t = self.get_transport()
source = self.make_branch_and_tree('source')
source.commit('a', rev_id='a', allow_pointless=True)
source.commit('b', rev_id='b', allow_pointless=True)
self.build_tree(['new/'])
- made_control = self.bzrdir_format.initialize('new')
+ t_new = t.clone('new')
+ made_control = self.bzrdir_format.initialize_on_transport(t_new)
source.branch.repository.clone(made_control)
source.branch.clone(made_control)
- made_tree = made_control.create_workingtree(revision_id='a')
+ try:
+ made_tree = made_control.create_workingtree(revision_id='a')
+ except errors.NotLocalUrl:
+ raise TestSkipped("Can't make working tree on transport %r" % t)
self.assertEqual('a', made_tree.last_revision())
def test_open_workingtree(self):
More information about the bazaar
mailing list