예제 #1
0
 def get_content(self):
     if self.isdir:
         return None
     s = core.Stream(fs.file_contents(self.root, self._scoped_path_utf8,
                                      self.pool()))
     # Make sure the stream object references the pool to make sure the pool
     # is not destroyed before the stream object.
     s._pool = self.pool
     return s
예제 #2
0
 def get_content(self):
     """Retrieve raw content as a "read()"able object."""
     if self.isdir:
         return None
     s = core.Stream(
         fs.file_contents(self.root, self._scoped_path_utf8, self.pool()))
     # The stream object needs to reference the pool to make sure the pool
     # is not destroyed before the former.
     s._pool = self.pool
     return s
예제 #3
0
 def __init__(self, node, keyword_substitution=None, eol=None):
     self.translated = ''
     self.buffer = ''
     self.repos = node.repos
     self.node = node
     self.fs_ptr = node.fs_ptr
     self.pool = Pool()
     # Note: we _must_ use a detached pool here, as the lifetime of
     # this object can exceed those of the node or even the repository
     if keyword_substitution:
         keywords = (node._get_prop(core.SVN_PROP_KEYWORDS) or '').split()
         self.keywords = self._get_keyword_values(
             set(keywords) & set(self.KEYWORDS))
         self.keywords_re = self._build_keywords_re(self.keywords)
     if self.NEWLINES.get(eol, '\n') != '\n' and \
        node._get_prop(core.SVN_PROP_EOL_STYLE) == 'native':
         self.native_eol = True
         self.newline = self.NEWLINES[eol]
     self.stream = core.Stream(
         fs.file_contents(node.root, node._scoped_path_utf8, self.pool()))