~ubuntu-branches/debian/experimental/subversion/experimental

« back to all changes in this revision

Viewing changes to subversion/libsvn_fs_fs/pack.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-07-16 19:39:54 UTC
  • mfrom: (0.1.13)
  • Revision ID: package-import@ubuntu.com-20150716193954-6ueu2w62h4h556xh
Tags: 1.9.0~rc3-1
* New upstream pre-release.
* Point the Vcs-* URLs at the right directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
  SVN_ERR(svn_io_remove_file2(proto_l2p_index_path, FALSE, pool));
385
385
  SVN_ERR(svn_io_remove_file2(proto_p2l_index_path, FALSE, pool));
386
386
 
 
387
  /* Ensure that packed file is written to disk.*/
 
388
  SVN_ERR(svn_io_file_flush_to_disk(context->pack_file, pool));
387
389
  SVN_ERR(svn_io_file_close(context->pack_file, pool));
388
390
 
389
391
  return SVN_NO_ERROR;
1656
1658
                    apr_pool_t *pool)
1657
1659
{
1658
1660
  const char *pack_file_path, *manifest_file_path;
1659
 
  svn_stream_t *pack_stream, *manifest_stream;
 
1661
  apr_file_t *pack_file;
 
1662
  apr_file_t *manifest_file;
 
1663
  svn_stream_t *manifest_stream;
1660
1664
  svn_revnum_t end_rev, rev;
1661
1665
  apr_off_t next_offset;
1662
1666
  apr_pool_t *iterpool;
1665
1669
  pack_file_path = svn_dirent_join(pack_file_dir, PATH_PACKED, pool);
1666
1670
  manifest_file_path = svn_dirent_join(pack_file_dir, PATH_MANIFEST, pool);
1667
1671
 
1668
 
  /* Create the new directory and pack file. */
1669
 
  SVN_ERR(svn_stream_open_writable(&pack_stream, pack_file_path, pool,
1670
 
                                    pool));
 
1672
  /* Create the new directory and pack file.
 
1673
   * Use unbuffered apr_file_t since we're going to write using 16kb
 
1674
   * chunks. */
 
1675
  SVN_ERR(svn_io_file_open(&pack_file, pack_file_path,
 
1676
                           APR_WRITE | APR_CREATE | APR_EXCL,
 
1677
                           APR_OS_DEFAULT, pool));
1671
1678
 
1672
1679
  /* Create the manifest file. */
1673
 
  SVN_ERR(svn_stream_open_writable(&manifest_stream, manifest_file_path,
1674
 
                                   pool, pool));
 
1680
  SVN_ERR(svn_io_file_open(&manifest_file, manifest_file_path,
 
1681
                           APR_WRITE | APR_BUFFERED | APR_CREATE | APR_EXCL,
 
1682
                           APR_OS_DEFAULT, pool));
 
1683
  manifest_stream = svn_stream_from_aprfile2(manifest_file, TRUE, pool);
1675
1684
 
1676
1685
  end_rev = start_rev + max_files_per_dir - 1;
1677
1686
  next_offset = 0;
1698
1707
 
1699
1708
      /* Copy all the bits from the rev file to the end of the pack file. */
1700
1709
      SVN_ERR(svn_stream_open_readonly(&rev_stream, path, iterpool, iterpool));
1701
 
      SVN_ERR(svn_stream_copy3(rev_stream, svn_stream_disown(pack_stream,
1702
 
                                                             iterpool),
 
1710
      SVN_ERR(svn_stream_copy3(rev_stream,
 
1711
                               svn_stream_from_aprfile2(pack_file, TRUE, pool),
1703
1712
                               cancel_func, cancel_baton, iterpool));
1704
1713
    }
1705
1714
 
 
1715
  /* Close stream over APR file. */
 
1716
  SVN_ERR(svn_stream_close(manifest_stream));
 
1717
 
 
1718
  /* Ensure that pack file is written to disk. */
 
1719
  SVN_ERR(svn_io_file_flush_to_disk(manifest_file, pool));
 
1720
  SVN_ERR(svn_io_file_close(manifest_file, pool));
 
1721
 
1706
1722
  /* disallow write access to the manifest file */
1707
 
  SVN_ERR(svn_stream_close(manifest_stream));
1708
1723
  SVN_ERR(svn_io_set_file_read_only(manifest_file_path, FALSE, iterpool));
1709
1724
 
1710
 
  SVN_ERR(svn_stream_close(pack_stream));
 
1725
  /* Ensure that pack file is written to disk. */
 
1726
  SVN_ERR(svn_io_file_flush_to_disk(pack_file, pool));
 
1727
  SVN_ERR(svn_io_file_close(pack_file, pool));
1711
1728
 
1712
1729
  svn_pool_destroy(iterpool);
1713
1730