Пример #1
0
 def alloc_empty_repo(self, suffix=""):
     """Create an empty repository. Returns a tuple of its handle, path and
    file: URI in canonical internal form."""
     temp_path = tempfile.mkdtemp(suffix)
     repo_path = core.svn_dirent_internal_style(temp_path)
     repo_uri = core.svn_uri_canonicalize(file_uri_for_path(temp_path))
     handle = repos.create(repo_path, None, None, None, None)
     self._cleanup_list.append((repo_path, repos.svn_repos_delete))
     return (handle, repo_path, repo_uri)
Пример #2
0
 def alloc_empty_repo(self, suffix = ""):
   """Create an empty repository. Returns a tuple of its handle, path and
      file: URI in canonical internal form."""
   temp_path = tempfile.mkdtemp(suffix)
   repo_path = core.svn_dirent_internal_style(temp_path)
   repo_uri = core.svn_uri_canonicalize(file_uri_for_path(temp_path))
   handle = repos.create(repo_path, None, None, None, None)
   self._cleanup_list.append((repo_path, repos.svn_repos_delete))
   return (handle, repo_path, repo_uri)
Пример #3
0
 def path2url(self, path):
     """Build svn URL for path, URL-escaping path.
     """
     if not path or path == '.':
         return self.svn_url
     assert path[0] != '/', path
     path = path.rstrip('/')
     try:
         # new in svn 1.7
         return core.svn_uri_canonicalize(self.svn_url + '/' + path)
     except AttributeError:
         return self.svn_url + '/' + urllib.quote(path)
Пример #4
0
 def path2url(self, path):
     """Build svn URL for path, URL-escaping path.
     """
     if not path or path == '.':
         return self.svn_url
     assert path[0] != '/', path
     path = path.rstrip('/')
     try:
         # new in svn 1.7
         return core.svn_uri_canonicalize(self.svn_url + '/' + path)
     except AttributeError:
         return self.svn_url + '/' + urllib.quote(path)
Пример #5
0
temp_path = tempfile.mktemp("-trac-svnrepos")
REPOS_PATH = core.svn_dirent_internal_style(temp_path)
REPOS_URL = pathname2url(temp_path)
del temp_path

if REPOS_URL.startswith("///"):
    # Don't add extra slashes if they're already present.
    # (This is important for Windows compatibility).
    REPOS_URL = "file:" + REPOS_URL
else:
    # If the URL simply starts with '/', we need to add two
    # extra slashes to make it a valid 'file://' URL
    REPOS_URL = "file://" + REPOS_URL

REPOS_URL = core.svn_uri_canonicalize(REPOS_URL)


class SubversionRepositoryTestSetup(TestSetup):
    def setUp(self):
        dumpfile = open(
            os.path.join(os.path.split(__file__)[0], 'svnrepos.dump'), 'rb')

        # Remove the trac-svnrepos directory, so that we can
        # ensure a fresh start.
        self.tearDown()

        r = repos.svn_repos_create(REPOS_PATH, '', '', None, None)
        repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                 repos.svn_repos_load_uuid_ignore, '', 0, 0,
                                 None)
Пример #6
0
temp_path = tempfile.mktemp("-trac-svnrepos")
REPOS_PATH = core.svn_dirent_internal_style(temp_path)
REPOS_URL = pathname2url(temp_path)
del temp_path

if REPOS_URL.startswith("///"):
  # Don't add extra slashes if they're already present.
  # (This is important for Windows compatibility).
  REPOS_URL = "file:" + REPOS_URL
else:
  # If the URL simply starts with '/', we need to add two
  # extra slashes to make it a valid 'file://' URL
  REPOS_URL = "file://" + REPOS_URL

REPOS_URL = core.svn_uri_canonicalize(REPOS_URL)

class SubversionRepositoryTestSetup(TestSetup):

    def setUp(self):
        dumpfile = open(os.path.join(os.path.split(__file__)[0],
                                     'svnrepos.dump'), 'rb')

        # Remove the trac-svnrepos directory, so that we can
        # ensure a fresh start.
        self.tearDown()

        r = repos.svn_repos_create(REPOS_PATH, '', '', None, None)
        repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                repos.svn_repos_load_uuid_ignore, '',
                                0, 0, None)