Exemple #1
0
 def delete(self, repos_paths, commit_msg):
     log = self.log
     svn_repos = self._get_libsvn_handle()
     repos_paths_utf8 = [core.svn_path_canonicalize(rp.encode('utf-8')) 
                         for rp in repos_paths]
     commit_msg_utf8 = commit_msg.encode('utf-8')
     username_utf8 = self.username.encode('utf-8')
     rev = self.repos.get_youngest_rev()
     
     pool = core.Pool()
     
     log.debug('btfc')
     fs_txn = repos.fs_begin_txn_for_commit(svn_repos, rev, username_utf8,
                                            commit_msg_utf8, pool)
     log.debug('tr')
     fs_root = fs.txn_root(fs_txn, pool)
         
     log.debug('cp')
     for repos_path_utf8 in repos_paths_utf8:
         kind = fs.check_path(fs_root, repos_path_utf8, pool)
     
         if kind == core.svn_node_none:
             raise TracError('Delete', repos_path_utf8)
     
     for repos_path_utf8 in repos_paths_utf8:
         fs.delete(fs_root, repos_path_utf8)
      
     log.debug('ct')                                     
     new_rev = repos.fs_commit_txn(svn_repos, fs_txn, pool)
     
     return new_rev
Exemple #2
0
 def make_dir(self, repos_path, commit_msg):
     log = self.log
     svn_repos = self._get_libsvn_handle()
     repos_path_utf8 = core.svn_path_canonicalize(
                                 repos_path.encode('utf-8'))
     commit_msg_utf8 = commit_msg.encode('utf-8')
     username_utf8 = self.username.encode('utf-8')
     rev = self.repos.get_youngest_rev()
     
     pool = core.Pool()
     
     log.debug('btfc')
     fs_txn = repos.fs_begin_txn_for_commit(svn_repos, rev, username_utf8,
                                            commit_msg_utf8, pool)
     log.debug('tr')
     fs_root = fs.txn_root(fs_txn, pool)
         
     log.debug('cp')
     kind = fs.check_path(fs_root, repos_path_utf8, pool)
     
     if kind != core.svn_node_none:
         raise TracError('Make directory: %s already exists' % repos_path)
     else:
         fs.make_dir(fs_root, repos_path_utf8)
      
     log.debug('ct')
     new_rev = repos.fs_commit_txn(svn_repos, fs_txn, pool)
    
     return new_rev
Exemple #3
0
 def put_content(self, repos_path, content, commit_msg):
     log=self.log
     
     svn_repos = self._get_libsvn_handle()
             
     fs_path_utf8 = core.svn_path_canonicalize(repos_path.encode('utf-8'))
     username_utf8 = self.username.encode('utf-8')
     commit_msg_utf8 = commit_msg.encode('utf-8')
     rev = self.repos.get_youngest_rev()
     log.debug('%s %s', svn_repos, rev)
     
     pool = core.Pool()
             
     log.debug('btfc')
     fs_txn = repos.fs_begin_txn_for_commit(svn_repos, rev, username_utf8,
                                            commit_msg_utf8, pool)
     log.debug('tr')
     fs_root = fs.txn_root(fs_txn, pool)
         
     log.debug('cp')
     kind = fs.check_path(fs_root, fs_path_utf8, pool)
     
     if kind == core.svn_node_none:
         log.debug('mkf')                                       
         fs.make_file(fs_root, fs_path_utf8)
     elif kind == core.svn_node_file:
         pass
     else:
         raise TracError(fs_path_utf8, rev)
     
     log.debug('fat')                                       
     stream = fs.svn_fs_apply_text(fs_root, fs_path_utf8, None, pool)
     log.debug('sw')                                       
     core.svn_stream_write(stream, content)
     log.debug('sc')                                       
     core.svn_stream_close(stream) 
     log.debug('ct')                                       
     new_rev = repos.fs_commit_txn(svn_repos, fs_txn, pool)
     
     return new_rev