591
591
self.failUnlessExists('repo/tree2/subtree')
592
592
self.failIfExists('repo/tree2/subtree/file')
594
def make_foo_bar_baz(self):
595
foo = self.make_branch('foo').bzrdir
596
bar = self.make_branch('foo/bar').bzrdir
597
baz = self.make_branch('baz').bzrdir
600
def test_find_bzrdirs(self):
601
foo, bar, baz = self.make_foo_bar_baz()
602
transport = get_transport(self.get_url())
603
self.assertEqualBzrdirs([baz, foo, bar],
604
bzrdir.BzrDir.find_bzrdirs(transport))
606
def test_find_bzrdirs_list_current(self):
607
def list_current(transport):
608
return [s for s in transport.list_dir('') if s != 'baz']
610
foo, bar, baz = self.make_foo_bar_baz()
611
transport = get_transport(self.get_url())
612
self.assertEqualBzrdirs([foo, bar],
613
bzrdir.BzrDir.find_bzrdirs(transport,
614
list_current=list_current))
617
def test_find_bzrdirs_evaluate(self):
618
def evaluate(bzrdir):
620
repo = bzrdir.open_repository()
621
except NoRepositoryPresent:
622
return True, bzrdir.root_transport.base
624
return False, bzrdir.root_transport.base
626
foo, bar, baz = self.make_foo_bar_baz()
627
transport = get_transport(self.get_url())
628
self.assertEqual([baz.root_transport.base, foo.root_transport.base],
629
list(bzrdir.BzrDir.find_bzrdirs(transport,
632
def assertEqualBzrdirs(self, first, second):
634
second = list(second)
635
self.assertEqual(len(first), len(second))
636
for x, y in zip(first, second):
637
self.assertEqual(x.root_transport.base, y.root_transport.base)
595
640
class TestMeta1DirFormat(TestCaseWithTransport):
596
641
"""Tests specific to the meta1 dir format."""