FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
/* For the in-transaction NODEREV within FS, write the sha1->rep mapping
 * file in the respective transaction, if rep sharing has been enabled etc.
 * Use SCATCH_POOL for temporary allocations.
 */
For the in-transaction NODEREV within FS, write the sha1->rep mapping
file in the respective transaction, if rep sharing has been enabled etc.
Use SCATCH_POOL for temporary allocations.
For the in - transaction NODEREV within FS write the sha1 - > rep mapping file in the respective transaction if rep sharing has been enabled etc . Use SCATCH_POOL for temporary allocations .
static svn_error_t *
store_sha1_rep_mapping(svn_fs_t *fs,
                       node_revision_t *noderev,
                       apr_pool_t *scratch_pool)
{
  fs_fs_data_t *ffd = fs->fsap_data;
  if (   ffd->rep_sharing_allowed
      && noderev->data_rep
      && noderev->data_rep->has_sha1)
    {
      apr_file_t *rep_file;
      const char *file_name = path_txn_sha1(fs,
                                            &noderev->data_rep->txn_id,
                                            noderev->data_rep->sha1_digest,
                                            scratch_pool);
      svn_stringbuf_t *rep_string
        = svn_fs_fs__unparse_representation(noderev->data_rep,
                                            ffd->format,
                                            (noderev->kind == svn_node_dir),
                                            scratch_pool, scratch_pool);
      SVN_ERR(svn_io_file_open(&rep_file, file_name,
                               APR_WRITE | APR_CREATE | APR_TRUNCATE
                               | APR_BUFFERED, APR_OS_DEFAULT, scratch_pool));
      SVN_ERR(svn_io_file_write_full(rep_file, rep_string->data,
                                     rep_string->len, NULL, scratch_pool));
      SVN_ERR(svn_io_file_close(rep_file, scratch_pool));
    }
  return SVN_NO_ERROR;
}
static svn_error_t * store_sha1_rep_mapping ( svn_fs_t * fs , node_revision_t * noderev , apr_pool_t * scratch_pool ) { fs_fs_data_t * ffd = fs -> fsap_data ; if ( ffd -> rep_sharing_allowed && noderev -> data_rep && noderev -> data_rep -> has_sha1 ) { apr_file_t * rep_file ; const char * file_name = path_txn_sha1 ( fs , & noderev -> data_rep -> txn_id , noderev -> data_rep -> sha1_digest , scratch_pool ) ; svn_stringbuf_t * rep_string = svn_fs_fs__unparse_representation ( noderev -> data_rep , ffd -> format , ( noderev -> kind == svn_node_dir ) , scratch_pool , scratch_pool ) ; SVN_ERR ( svn_io_file_open ( & rep_file , file_name , APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED , APR_OS_DEFAULT , scratch_pool ) ) ; SVN_ERR ( svn_io_file_write_full ( rep_file , rep_string -> data , rep_string -> len , NULL , scratch_pool ) ) ; SVN_ERR ( svn_io_file_close ( rep_file , scratch_pool ) ) ; } return SVN_NO_ERROR ; }
For the in-transaction NODEREV within FS, write the sha1->rep mapping
 file in the respective transaction, if rep sharing has been enabled etc.
For the in - transaction NODEREV within FS write the sha1 - > rep mapping file in the respective transaction if rep sharing has been enabled etc .
/* if rep sharing has been enabled and the noderev has a data rep and
   * its SHA-1 is known, store the rep struct under its SHA1. */