def root(self): """ Root of the transaction. """ if self._root is None: self._root = svn_fs_txn_root(self.txn) return self._root
def save(self, req, text, comment): """ Save the specified text into this document. """ if not isinstance(self.node.repos, SubversionRepository): raise TracError("The '%s' repository is not supported" % type(self.node.repos)) from svn import core as _core from svn import fs as _fs from svn import repos as _repos repos = self.node.repos.repos #.repos revnum = self.node._requested_rev author = req.authname message = 'Edited %s' % self.base[1:] if comment: message += ' (%s)' % comment pool = _core.Pool() fs_txn = _repos.fs_begin_txn_for_commit(repos, revnum, author, message, pool) fs_root = _fs.svn_fs_txn_root(fs_txn, pool) if hasattr(self.node, '_scoped_svn_path'): fs_path = self.node._scoped_svn_path else: fs_path = self.node._scoped_path_utf8 stream = _fs.svn_fs_apply_text(fs_root, fs_path, None, pool) _core.svn_stream_write(stream, text) _core.svn_stream_close(stream) return _repos.fs_commit_txn(repos, fs_txn, pool)
def __init__(self, repos_path, txn_name): # these are for SVNLOOK/changed self.rpath = repos_path self.tname = txn_name self.repos_path = core.svn_path_canonicalize(repos_path) self.fs = repos.svn_repos_fs(repos.svn_repos_open(repos_path)) self.txn = fs.svn_fs_open_txn(self.fs, txn_name) self.txn_root = fs.svn_fs_txn_root(self.txn)