Logo Search packages:      
Sourcecode: hgsubversion version File versions  Download package

def hgsubversion::svnwrap::svn_swig_wrapper::SubversionRepo::get_file (   self,
  path,
  revision 
)
Return content and mode of file at given path and revision.

"link " prefix is dropped from symlink content. Mode is 'x' if
file is executable, 'l' if a symlink, the empty string
otherwise. If the file does not exist at this revision, raise
IOError.

Definition at line 475 of file svn_swig_wrapper.py.

                                      :
        """Return content and mode of file at given path and revision.

        "link " prefix is dropped from symlink content. Mode is 'x' if
        file is executable, 'l' if a symlink, the empty string
        otherwise. If the file does not exist at this revision, raise
        IOError.
        """
        assert not path.startswith('/')
        mode = ''
        try:
            out = cStringIO.StringIO()
            info = ra.get_file(self.ra, path, revision, out)
            data = out.getvalue()
            out.close()
            if isinstance(info, list):
                info = info[-1]
            mode = ("svn:executable" in info) and 'x' or ''
            mode = ("svn:special" in info) and 'l' or mode
        except SubversionException, e:
            notfound = (core.SVN_ERR_FS_NOT_FOUND,
                        core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
            if e.args[1] in notfound: # File not found
                raise IOError(errno.ENOENT, e.args[0])
            raise
        if mode  == 'l':
            linkprefix = "link "
            if data.startswith(linkprefix):
                data = data[len(linkprefix):]
        return data, mode


Generated by  Doxygen 1.6.0   Back to index