def test_gather_location_standalone(self): tree = self.make_branch_and_tree('tree') self.assertEqual([('branch root', tree.bzrdir.root_transport.base)], info.gather_location_info(tree.branch.repository, tree.branch, tree)) self.assertEqual([('branch root', tree.bzrdir.root_transport.base)], info.gather_location_info(tree.branch.repository, tree.branch)) return tree
def test_gather_location_repo(self): srepo = self.make_repository('shared', shared=True) self.assertEqual([('shared repository', srepo.bzrdir.root_transport.base)], info.gather_location_info(srepo)) urepo = self.make_repository('unshared') self.assertEqual([('repository', urepo.bzrdir.root_transport.base)], info.gather_location_info(urepo))
def test_gather_location_repo(self): srepo = self.make_repository('shared', shared=True) self.assertEqual( [('shared repository', srepo.bzrdir.root_transport.base)], info.gather_location_info(srepo, control=srepo.bzrdir)) urepo = self.make_repository('unshared') self.assertEqual( [('repository', urepo.bzrdir.root_transport.base)], info.gather_location_info(urepo, control=urepo.bzrdir))
def test_gather_location_standalone(self): tree = self.make_branch_and_tree('tree') self.assertEqual([('branch root', tree.bzrdir.root_transport.base)], info.gather_location_info( tree.branch.repository, tree.branch, tree, control=tree.bzrdir)) self.assertEqual([('branch root', tree.bzrdir.root_transport.base)], info.gather_location_info( tree.branch.repository, tree.branch, control=tree.bzrdir)) return tree
def test_gather_location_repo_branch(self): srepo = self.make_repository('shared', shared=True) self.assertEqual([('shared repository', srepo.bzrdir.root_transport.base)], info.gather_location_info(srepo)) tree = self.make_branch_and_tree('shared/tree') self.assertEqual([('shared repository', srepo.bzrdir.root_transport.base), ('repository branch', tree.branch.base)], info.gather_location_info(srepo, tree.branch, tree))
def test_gather_location_repo_branch(self): srepo = self.make_repository('shared', shared=True) self.assertEqual( [('shared repository', srepo.bzrdir.root_transport.base)], info.gather_location_info(srepo, control=srepo.bzrdir)) tree = self.make_branch_and_tree('shared/tree') self.assertEqual( [('shared repository', srepo.bzrdir.root_transport.base), ('repository branch', tree.branch.base)], info.gather_location_info(srepo, tree.branch, tree, srepo.bzrdir))
def test_gather_location_bound(self): branch = self.make_branch('branch') bound_branch = self.make_branch('bound_branch') bound_branch.bind(branch) self.assertEqual( [('branch root', bound_branch.bzrdir.root_transport.base), ('bound to branch', branch.bzrdir.root_transport.base)], info.gather_location_info(bound_branch.repository, bound_branch) )
def test_gather_location_bound(self): branch = self.make_branch('branch') bound_branch = self.make_branch('bound_branch') bound_branch.bind(branch) self.assertEqual( [('branch root', bound_branch.bzrdir.root_transport.base), ('bound to branch', branch.bzrdir.root_transport.base)], info.gather_location_info( bound_branch.repository, bound_branch, control=bound_branch.bzrdir) )
def test_gather_location_bound_in_repository(self): repo = self.make_repository('repo', shared=True) repo.set_make_working_trees(False) branch = self.make_branch('branch') bound_branch = controldir.ControlDir.create_branch_convenience( 'repo/bound_branch') bound_branch.bind(branch) self.assertEqual( [('shared repository', bound_branch.repository.bzrdir.user_url), ('repository branch', bound_branch.bzrdir.user_url), ('bound to branch', branch.bzrdir.user_url)], info.gather_location_info(bound_branch.repository, bound_branch))
def test_gather_location_bound_in_repository(self): repo = self.make_repository('repo', shared=True) repo.set_make_working_trees(False) branch = self.make_branch('branch') bound_branch = controldir.ControlDir.create_branch_convenience( 'repo/bound_branch') bound_branch.bind(branch) self.assertEqual( [('shared repository', bound_branch.repository.bzrdir.user_url), ('repository branch', bound_branch.bzrdir.user_url), ('bound to branch', branch.bzrdir.user_url)], info.gather_location_info(bound_branch.repository, bound_branch) )
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 gather_tree_location_info(self, tree): return info.gather_location_info(tree.branch.repository, tree.branch, tree)
def gather_tree_location_info(self, tree): return info.gather_location_info( tree.branch.repository, tree.branch, tree, tree.bzrdir)
def test_gather_location_controldir_only(self): bzrdir = self.make_bzrdir('.') self.assertEqual([('control directory', bzrdir.user_url)], info.gather_location_info(control=bzrdir))