Exemple #1
0
 def setupClass(cls):
     svn_fs._import_svn()
     core.apr_initialize()
     pool = core.svn_pool_create(None)
     dumpstream = None
     cls.repos_path = tempfile.mkdtemp(prefix='svn-tmp')
     shutil.rmtree(cls.repos_path)
     dumpfile = open(os.path.join(os.path.split(__file__)[0], 'svn.dump'))
     try:
         r = repos.svn_repos_create(cls.repos_path, '', '', None, None,
                                    pool)
         if hasattr(repos, 'svn_repos_load_fs2'):
             repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                      repos.svn_repos_load_uuid_default, '',
                                      0, 0, None, pool)
         else:
             dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
             repos.svn_repos_load_fs(r, dumpstream, None,
                                     repos.svn_repos_load_uuid_default, '',
                                     None, None, pool)
     finally:
         if dumpstream:
             core.svn_stream_close(dumpstream)
         core.svn_pool_destroy(pool)
         core.apr_terminate()
Exemple #2
0
    def setUp(self):
        dumpfile = open(os.path.join(os.path.split(__file__)[0],
                                     'svnrepos.dump'))

        svn_fs._import_svn()
        core.apr_initialize()
        pool = core.svn_pool_create(None)
        dumpstream = None
        try:
            if os.path.exists(REPOS_PATH):
                print 'trouble ahead with db/rep-cache.db... see #8278'
            r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
            if hasattr(repos, 'svn_repos_load_fs2'):
                repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                        repos.svn_repos_load_uuid_default, '',
                                        0, 0, None, pool)
            else:
                dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
                repos.svn_repos_load_fs(r, dumpstream, None,
                                        repos.svn_repos_load_uuid_default, '',
                                        None, None, pool)
        finally:
            if dumpstream:
                core.svn_stream_close(dumpstream)
            core.svn_pool_destroy(pool)
            core.apr_terminate()
 def _close(self):
   if self.pool:
     core.svn_pool_destroy(self.pool)
     self.pool = None
   if self.apr_init:
     core.apr_terminate()
     self.apr_init = 0
Exemple #4
0
 def _close(self):
     if self.pool:
         core.svn_pool_destroy(self.pool)
         self.pool = None
     if self.apr_init:
         core.apr_terminate()
         self.apr_init = 0
Exemple #5
0
    def setUp(self):
        dumpfile = open(
            os.path.join(os.path.split(__file__)[0], 'svnrepos.dump'))

        svn_fs._import_svn()
        core.apr_initialize()
        pool = core.svn_pool_create(None)
        dumpstream = None
        try:
            if os.path.exists(REPOS_PATH):
                print 'trouble ahead with db/rep-cache.db... see #8278'
            r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
            if hasattr(repos, 'svn_repos_load_fs2'):
                repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                         repos.svn_repos_load_uuid_default, '',
                                         0, 0, None, pool)
            else:
                dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
                repos.svn_repos_load_fs(r, dumpstream, None,
                                        repos.svn_repos_load_uuid_default, '',
                                        None, None, pool)
        finally:
            if dumpstream:
                core.svn_stream_close(dumpstream)
            core.svn_pool_destroy(pool)
            core.apr_terminate()
Exemple #6
0
def svn_uri(path):
    # init
    core.apr_initialize()
    pool = core.svn_pool_create(None)
    core.svn_config_ensure(None, pool)
    # get commit date
    uri = client.svn_client_url_from_path(path, pool)
    # cleanup
    core.svn_pool_destroy(pool)
    core.apr_terminate()
    return uri
Exemple #7
0
def svn_uri(path):
    # init
    core.apr_initialize()
    pool = core.svn_pool_create(None)
    core.svn_config_ensure(None, pool)
    # get commit date
    uri = client.svn_client_url_from_path(path, pool)
    # cleanup
    core.svn_pool_destroy(pool)
    core.apr_terminate()
    return uri
Exemple #8
0
    def setUp(self):
        dumpfile = open(os.path.join(os.path.split(__file__)[0],
                                     'svnrepos.dump'))

        core.apr_initialize()
        pool = core.svn_pool_create(None)
        dumpstream = None
        try:
            r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
            if hasattr(repos, 'svn_repos_load_fs2'):
                repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                        repos.svn_repos_load_uuid_default, '',
                                        0, 0, None, pool)
            else:
                dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
                repos.svn_repos_load_fs(r, dumpstream, None,
                                        repos.svn_repos_load_uuid_default, '',
                                        None, None, pool)
        finally:
            if dumpstream:
                core.svn_stream_close(dumpstream)
            core.svn_pool_destroy(pool)
            core.apr_terminate()
Exemple #9
0
    def setUp(self):
        dumpfile = open(
            os.path.join(os.path.split(__file__)[0], 'svnrepos.dump'))

        core.apr_initialize()
        pool = core.svn_pool_create(None)
        dumpstream = None
        try:
            r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
            if hasattr(repos, 'svn_repos_load_fs2'):
                repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                         repos.svn_repos_load_uuid_default, '',
                                         0, 0, None, pool)
            else:
                dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
                repos.svn_repos_load_fs(r, dumpstream, None,
                                        repos.svn_repos_load_uuid_default, '',
                                        None, None, pool)
        finally:
            if dumpstream:
                core.svn_stream_close(dumpstream)
            core.svn_pool_destroy(pool)
            core.apr_terminate()
 def setupClass(cls):
     svn_fs._import_svn()
     core.apr_initialize()
     pool = core.svn_pool_create(None)
     dumpstream = None
     cls.repos_path = tempfile.mkdtemp(prefix='svn-tmp')
     shutil.rmtree(cls.repos_path)
     dumpfile = open(os.path.join(os.path.split(__file__)[0], 'svn.dump'))
     try:
         r = repos.svn_repos_create(cls.repos_path, '', '', None, None, pool)
         if hasattr(repos, 'svn_repos_load_fs2'):
             repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
                                     repos.svn_repos_load_uuid_default, '',
                                     0, 0, None, pool)
         else:
             dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
             repos.svn_repos_load_fs(r, dumpstream, None,
                                     repos.svn_repos_load_uuid_default, '',
                                     None, None, pool)
     finally:
         if dumpstream:
             core.svn_stream_close(dumpstream)
         core.svn_pool_destroy(pool)
         core.apr_terminate()
Exemple #11
0
 def close(self):
   """Close the repository, aborting any uncommitted transactions"""
   core.svn_pool_destroy(self.pool)
   core.apr_terminate()
Exemple #12
0
 def __del__(self):
     core.svn_pool_destroy(self.pool)
     core.apr_terminate()
Exemple #13
0
 def __del__(self):
   core.svn_pool_destroy(self.pool)
   core.apr_terminate()
except OSError :
    cli_parser.error( "Can't create password file")

lchown(options.authdir + options.repo + '-passwdfile',0,apachegid)
chmod(options.authdir + options.repo + '-passwdfile',0640)

try:
    # we create the repository using the <rant> undocumented</rant> swig bindings.
    # took me a while to figure how to do this.
    # thanks to folks at #subversion-dev for give me some guidelines.
    core.apr_initialize()
    pool = core.svn_pool_create(None)
    repos.svn_repos_create(options.location + options.repo, '', '', None, {
        fs.SVN_FS_CONFIG_FS_TYPE: options.filesystem }, pool)
    core.svn_pool_destroy(pool)
    core.apr_terminate()

except OSError:
    cli_parser.error( "Failed to create the repository")
else:
    for dire in ['dav','db','locks']:
        lchown(options.location + options.repo + sep + dire, apacheuid, apachegid)
        for root, dirs, files in walk(options.location + options.repo + sep + dire ):
            for name in files :
                lchown(join(root, name) , apacheuid , apachegid)
            for name in dirs:
                lchown(join(root, name), apacheuid , apachegid)

    print "Reloading apache.."
     # there is no webserver.apache.reload() function yet :-)
     # have to use a system call here..