def test_describe_standalone_layout(self): tree = self.make_branch_and_tree('tree') self.assertEqual('Empty control directory', info.describe_layout()) self.assertEqual( 'Unshared repository with trees and colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) tree.branch.repository.set_make_working_trees(False) self.assertEqual('Unshared repository with colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) self.assertEqual('Standalone branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual('Standalone branchless tree', info.describe_layout(tree.branch.repository, None, tree, control=tree.bzrdir)) self.assertEqual('Standalone tree', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) tree.branch.bind(tree.branch) self.assertEqual('Bound branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual('Checkout', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) checkout = tree.branch.create_checkout('checkout', lightweight=True) self.assertEqual('Lightweight checkout', info.describe_layout(checkout.branch.repository, checkout.branch, checkout, control=tree.bzrdir))
def test_describe_repository_layout(self): repository = self.make_repository('.', shared=True) tree = controldir.ControlDir.create_branch_convenience('tree', force_new_tree=True).bzrdir.open_workingtree() self.assertEqual('Shared repository with trees and colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) repository.set_make_working_trees(False) self.assertEqual('Shared repository with colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) self.assertEqual('Repository branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual('Repository branchless tree', info.describe_layout(tree.branch.repository, None, tree, control=tree.bzrdir)) self.assertEqual('Repository tree', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) tree.branch.bind(tree.branch) self.assertEqual('Repository checkout', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) checkout = tree.branch.create_checkout('checkout', lightweight=True) self.assertEqual('Lightweight checkout', info.describe_layout(checkout.branch.repository, checkout.branch, checkout, control=tree.bzrdir))
def test_describe_standalone_layout(self): tree = self.make_branch_and_tree('tree') self.assertEqual('Empty control directory', info.describe_layout()) self.assertEqual( 'Unshared repository with trees and colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) tree.branch.repository.set_make_working_trees(False) self.assertEqual( 'Unshared repository with colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) self.assertEqual( 'Standalone branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual( 'Standalone branchless tree', info.describe_layout(tree.branch.repository, None, tree, control=tree.bzrdir)) self.assertEqual( 'Standalone tree', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) tree.branch.bind(tree.branch) self.assertEqual( 'Bound branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual( 'Checkout', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) checkout = tree.branch.create_checkout('checkout', lightweight=True) self.assertEqual( 'Lightweight checkout', info.describe_layout(checkout.branch.repository, checkout.branch, checkout, control=tree.bzrdir))
def show_component_info_xml(control, repository, branch=None, working=None, verbose=1, outfile=None): """Write info about all bzrdir components to stdout""" if outfile is None: outfile = sys.stdout if verbose is False: verbose = 1 if verbose is True: verbose = 2 layout = info.describe_layout(repository, branch, working, control) formats = info.describe_format(control, repository, branch, working).split(' or ') outfile.write('<layout>%s</layout>' % layout) outfile.write('<formats>') if len(formats) > 1: for format in formats: outfile.write('<format>%s</format>' % format) else: outfile.write('<format>%s</format>' % formats[0]) outfile.write('</formats>') _show_location_info_xml(info.gather_location_info(repository, branch, working), outfile) if branch is not None: _show_related_info_xml(branch, outfile) if verbose == 0: return _show_format_info_xml(control, repository, branch, working, outfile) _show_locking_info_xml(repository, branch, working, outfile) if branch is not None: _show_missing_revisions_branch_xml(branch, outfile) if working is not None: _show_working_stats_xml(working, outfile) elif branch is not None: _show_missing_revisions_branch_xml(branch, outfile) if branch is not None: stats = _show_branch_stats_xml(branch, verbose==2, outfile) else: stats = repository.gather_stats() if branch is None and working is None: _show_repository_info_xml(repository, outfile) _show_repository_stats_xml(stats, outfile)
def test_describe_repository_layout(self): repository = self.make_repository('.', shared=True) tree = controldir.ControlDir.create_branch_convenience( 'tree', force_new_tree=True).bzrdir.open_workingtree() self.assertEqual( 'Shared repository with trees and colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) repository.set_make_working_trees(False) self.assertEqual( 'Shared repository with colocated branches', info.describe_layout(tree.branch.repository, control=tree.bzrdir)) self.assertEqual( 'Repository branch', info.describe_layout(tree.branch.repository, tree.branch, control=tree.bzrdir)) self.assertEqual( 'Repository branchless tree', info.describe_layout(tree.branch.repository, None, tree, control=tree.bzrdir)) self.assertEqual( 'Repository tree', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) tree.branch.bind(tree.branch) self.assertEqual( 'Repository checkout', info.describe_layout(tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) checkout = tree.branch.create_checkout('checkout', lightweight=True) self.assertEqual( 'Lightweight checkout', info.describe_layout(checkout.branch.repository, checkout.branch, checkout, control=tree.bzrdir))