Beispiel #1
0
    def write(self, data, uname='', commitmsg='',istext=False):
        txn = repos.fs_begin_txn_for_commit(self._repo.repos_ptr, self.revno, uname, commitmsg)
        r = None
        try:
            txn_root = fs.txn_root(txn)

            kind = fs.check_path(txn_root, self.path)

            if kind == core.svn_node_none:
                if not _create_file(txn_root, self.path):
                    raise 'attempt to create file, but file creation error: %s'%path
                pass

            elif kind == core.svn_node_dir:
                raise 'attempt to create file, but directory already exists: %s'%self.path

            if istext:
                fs.change_node_prop(txn_root, self.path, 'svn:eol-style', 'native')
                pass


            handler, baton = fs.apply_textdelta(txn_root, self.path, None, None)
            delta.svn_txdelta_send_string(data, handler, baton)

            r = repos.fs_commit_txn(self._repo.repos_ptr, txn)
        except Exception, a:
            fs.abort_txn(txn)
            raise
Beispiel #2
0
 def rollback(self):
   fs.abort_txn(self.txnp, self.pool)