예제 #1
0
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
예제 #2
0
파일: svn_ra.py 프로젝트: yudaka/viewvc
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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)
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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)