def cat_to_tempfile(svnrepos, path, rev): """Check out file revision to temporary file""" temp = tempfile.mktemp() stream = core.svn_stream_from_aprfile(temp) url = svnrepos._geturl(path) client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev), svnrepos.ctx) core.svn_stream_close(stream) return temp
def cat_to_tempfile(svnrepos, path, rev): """Check out file revision to temporary file""" fd, temp = tempfile.mkstemp() fp = os.fdopen(fd, 'wb') url = svnrepos._geturl(path) client.svn_client_cat(fp, url, _rev2optrev(rev), svnrepos.ctx) fp.close() return temp
def temp_checkout(svnrepos, path, rev, pool): """Check out file revision to temporary file""" temp = tempfile.mktemp() stream = core.svn_stream_from_aprfile(temp, pool) url = svnrepos.rootpath + (path and '/' + path) client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev), svnrepos.ctx, pool) core.svn_stream_close(stream) return temp
def openfile(self, path_parts, rev): path = self._getpath(path_parts) if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check raise vclib.Error("Path '%s' is not a file." % path) rev = self._getrev(rev) url = self._geturl(path) tmp_file = tempfile.mktemp() stream = core.svn_stream_from_aprfile(tmp_file) ### rev here should be the last history revision of the URL client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev), self.ctx) core.svn_stream_close(stream) return SelfCleanFP(tmp_file), self._get_last_history_rev(path_parts, rev)
def openfile(self, path_parts, rev): rev = self._getrev(rev) url = self.rootpath if len(path_parts): url = self.rootpath + '/' + self._getpath(path_parts) tmp_file = tempfile.mktemp() stream = core.svn_stream_from_aprfile(tmp_file, self.pool) ### rev here should be the last history revision of the URL client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev), self.ctx, self.pool) core.svn_stream_close(stream) return SelfCleanFP(tmp_file), rev
def openfile(self, path_parts, rev, options): path = self._getpath(path_parts) if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check raise vclib.Error("Path '%s' is not a file." % path) rev = self._getrev(rev) url = self._geturl(path) tmp_file = tempfile.mktemp() stream = core.svn_stream_from_aprfile(tmp_file) ### rev here should be the last history revision of the URL client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev), self.ctx) core.svn_stream_close(stream) return SelfCleanFP(tmp_file), self._get_last_history_rev( path_parts, rev)