def test_create_branch_directory_services(self): branch = self.make_branch('branch') tree = branch.create_checkout('tree', lightweight=True) class FooLookup(object): def look_up(self, name, url, purpose=None): return 'foo-' + name directories.register('foo:', FooLookup, 'Create branches named foo-') self.addCleanup(directories.remove, 'foo:') self.run_bzr('switch -b foo:branch2', working_dir='tree') tree = WorkingTree.open('tree') self.assertEndsWith(tree.branch.base, 'foo-branch2/')
def test_pull_from_directory_service(self): source = self.make_branch_and_tree('source') source.commit('commit 1') target = source.controldir.sprout('target').open_workingtree() source_last = source.commit('commit 2') class FooService(object): """A directory service that always returns source""" def look_up(self, name, url, purpose=None): return 'source' directories.register('foo:', FooService, 'Testing directory service') self.addCleanup(directories.remove, 'foo:') self.run_bzr('pull foo:bar -d target') self.assertEqual(source_last, target.last_revision())