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

def hgsubversion::svnwrap::subvertpy_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 456 of file subvertpy_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.
        """
        mode = ''
        try:
            out = cStringIO.StringIO()
            rev, info = self.remote.get_file(path, out, revision)
            data = out.getvalue()
            out.close()
            if isinstance(info, list):
                info = info[-1]
            mode = (properties.PROP_EXECUTABLE in info) and 'x' or ''
            mode = (properties.PROP_SPECIAL in info) and 'l' or mode
        except SubversionException, e:
            if e.args[1] in (ERR_FS_NOT_FOUND, ERR_RA_DAV_PATH_NOT_FOUND):
                # 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