def test_branch_standalone(self): shared_repo = self.make_repository('repo', shared=True) self.example_branch('source') self.run_bzr('branch --standalone source repo/target') b = branch.Branch.open('repo/target') expected_repo_path = os.path.abspath('repo/target/.bzr/repository') self.assertEqual(strip_trailing_slash(b.repository.base), strip_trailing_slash(local_path_to_url(expected_repo_path)))
def test_branch_standalone(self): shared_repo = self.make_repository('repo', shared=True) self.example_branch('source') self.run_bzr('branch --standalone source repo/target') b = branch.Branch.open('repo/target') expected_repo_path = os.path.abspath('repo/target/.bzr/repository') self.assertEqual(strip_trailing_slash(b.repository.base), strip_trailing_slash(local_path_to_url(expected_repo_path)))
def relpath(self, abspath): """Return the local path portion from a given absolute path. """ if abspath is None: abspath = u'.' return urlutils.file_relpath( urlutils.strip_trailing_slash(self.base), urlutils.strip_trailing_slash(abspath))
def symlink(self, source, link_name): """See Transport.symlink.""" abs_link_dirpath = urlutils.dirname(self.abspath(link_name)) source_rel = urlutils.file_relpath( urlutils.strip_trailing_slash(abs_link_dirpath), urlutils.strip_trailing_slash(self.abspath(source)) ) try: os.symlink(source_rel, self._abspath(link_name)) except (IOError, OSError), e: self._translate_error(e, source_rel)