FreeBSD/contrib/subversion/subversion/libsvn_repos/dump.c
/* Compute the delta between OLDROOT/OLDPATH and NEWROOT/NEWPATH and
   store it into a new temporary file *TEMPFILE.  OLDROOT may be NULL,
   in which case the delta will be computed against an empty file, as
   per the svn_fs_get_file_delta_stream docstring.  Record the length
   of the temporary file in *LEN, and rewind the file before
   returning. */
Compute the delta between OLDROOT/OLDPATH and NEWROOT/NEWPATH and
store it into a new temporary file *TEMPFILE.  OLDROOT may be NULL,
in which case the delta will be computed against an empty file, as
per the svn_fs_get_file_delta_stream docstring.  Record the length
of the temporary file in *LEN, and rewind the file before
returning.
Compute the delta between OLDROOT / OLDPATH and NEWROOT / NEWPATH and store it into a new temporary file * TEMPFILE . OLDROOT may be NULL in which case the delta will be computed against an empty file as per the svn_fs_get_file_delta_stream docstring . Record the length of the temporary file in * LEN and rewind the file before returning .
static svn_error_t *
store_delta(apr_file_t **tempfile, svn_filesize_t *len,
            svn_fs_root_t *oldroot, const char *oldpath,
            svn_fs_root_t *newroot, const char *newpath, apr_pool_t *pool)
{
  svn_stream_t *temp_stream;
  apr_off_t offset = 0;
  svn_txdelta_stream_t *delta_stream;
  svn_txdelta_window_handler_t wh;
  void *whb;
  SVN_ERR(svn_io_open_unique_file3(tempfile, NULL, NULL,
                                   svn_io_file_del_on_pool_cleanup,
                                   pool, pool));
  temp_stream = svn_stream_from_aprfile2(*tempfile, TRUE, pool);
  SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream, oldroot, oldpath,
                                       newroot, newpath, pool));
  svn_txdelta_to_svndiff3(&wh, &whb, temp_stream, 0,
                          SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, pool);
  SVN_ERR(svn_txdelta_send_txstream(delta_stream, wh, whb, pool));
  SVN_ERR(svn_io_file_seek(*tempfile, APR_CUR, &offset, pool));
  *len = offset;
  offset = 0;
  return svn_io_file_seek(*tempfile, APR_SET, &offset, pool);
}
static svn_error_t * store_delta ( apr_file_t * * tempfile , svn_filesize_t * len , svn_fs_root_t * oldroot , const char * oldpath , svn_fs_root_t * newroot , const char * newpath , apr_pool_t * pool ) { svn_stream_t * temp_stream ; apr_off_t offset = 0 ; svn_txdelta_stream_t * delta_stream ; svn_txdelta_window_handler_t wh ; void * whb ; SVN_ERR ( svn_io_open_unique_file3 ( tempfile , NULL , NULL , svn_io_file_del_on_pool_cleanup , pool , pool ) ) ; temp_stream = svn_stream_from_aprfile2 ( * tempfile , TRUE , pool ) ; SVN_ERR ( svn_fs_get_file_delta_stream ( & delta_stream , oldroot , oldpath , newroot , newpath , pool ) ) ; svn_txdelta_to_svndiff3 ( & wh , & whb , temp_stream , 0 , SVN_DELTA_COMPRESSION_LEVEL_DEFAULT , pool ) ; SVN_ERR ( svn_txdelta_send_txstream ( delta_stream , wh , whb , pool ) ) ; SVN_ERR ( svn_io_file_seek ( * tempfile , APR_CUR , & offset , pool ) ) ; * len = offset ; offset = 0 ; return svn_io_file_seek ( * tempfile , APR_SET , & offset , pool ) ; }
Compute the delta between OLDROOT/OLDPATH and NEWROOT/NEWPATH and
store it into a new temporary file *TEMPFILE.
Compute the delta between OLDROOT / OLDPATH and NEWROOT / NEWPATH and store it into a new temporary file * TEMPFILE .
/* Create a temporary file and open a stream to it. Note that we need
     the file handle in order to rewind it. */ /* Compute the delta and send it to the temporary file. */ /* Get the length of the temporary file and rewind it. */