Ejemplo n.º 1
0
 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)))
Ejemplo n.º 2
0
 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)))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
        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)