You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/06/24 23:30:01 UTC
svn commit: r1605201 [5/5] - in /subversion/branches/svn-auth-x509: ./
build/generator/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/tests/org/apache/subversion/javahl/ subve...
Modified: subversion/branches/svn-auth-x509/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/svnserve/svnserve.c?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/svnserve/svnserve.c (original)
+++ subversion/branches/svn-auth-x509/subversion/svnserve/svnserve.c Tue Jun 24 21:29:59 2014
@@ -209,6 +209,7 @@ void winservice_notify_stop(void)
#define SVNSERVE_OPT_VIRTUAL_HOST 270
#define SVNSERVE_OPT_MIN_THREADS 271
#define SVNSERVE_OPT_MAX_THREADS 272
+#define SVNSERVE_OPT_BLOCK_READ 273
static const apr_getopt_option_t svnserve__options[] =
{
@@ -301,6 +302,14 @@ static const apr_getopt_option_t svnserv
"ARG Mbit/s.\n"
" "
"Default is 0 (optimizations disabled).")},
+ {"block-read", SVNSERVE_OPT_BLOCK_READ, 1,
+ N_("Parse and cache all data found in block instead\n"
+ " "
+ "of just the requested item.\n"
+ " "
+ "Default is no.\n"
+ " "
+ "[used for FSFS repositories in 1.9 format only]")},
#ifdef CONNECTION_HAVE_THREAD_OPTION
/* ### Making the assumption here that WIN32 never has fork and so
* ### this option never exists when --service exists. */
@@ -671,6 +680,7 @@ sub_main(int *exit_code, int argc, const
svn_boolean_t cache_fulltexts = TRUE;
svn_boolean_t cache_txdeltas = TRUE;
svn_boolean_t cache_revprops = FALSE;
+ svn_boolean_t use_block_read = FALSE;
apr_uint16_t port = SVN_RA_SVN_PORT;
const char *host = NULL;
int family = APR_INET;
@@ -858,6 +868,10 @@ sub_main(int *exit_code, int argc, const
cache_revprops = svn_tristate__from_word(arg) == svn_tristate_true;
break;
+ case SVNSERVE_OPT_BLOCK_READ:
+ use_block_read = svn_tristate__from_word(arg) == svn_tristate_true;
+ break;
+
case SVNSERVE_OPT_CLIENT_SPEED:
{
apr_size_t bandwidth = (apr_size_t)apr_strtoi64(arg, NULL, 0);
@@ -966,6 +980,8 @@ sub_main(int *exit_code, int argc, const
cache_fulltexts ? "1" :"0");
svn_hash_sets(params.fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
cache_revprops ? "2" :"0");
+ svn_hash_sets(params.fs_config, SVN_FS_CONFIG_FSFS_BLOCK_READ,
+ use_block_read ? "1" :"0");
SVN_ERR(svn_repos__config_pool_create(¶ms.config_pool,
is_multi_threaded,
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/commit_tests.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/commit_tests.py Tue Jun 24 21:29:59 2014
@@ -2141,7 +2141,8 @@ def post_commit_hook_test(sbox):
# filesystem will report an absolute path because that's the way the
# filesystem is created by this test suite.
expected_output = [ "Sending "+ iota_path + "\n",
- "Transmitting file data .\n",
+ "Transmitting file data .done\n",
+ "Committing transaction...\n",
"Committed revision 2.\n",
"\n",
"Warning: " +
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/depth_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/depth_tests.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/depth_tests.py Tue Jun 24 21:29:59 2014
@@ -1135,6 +1135,7 @@ def commit_depth_immediates(sbox):
# Sending A/D/G/rho
# Sending iota
# Transmitting file data ..
+ # Committing transaction...
# Committed revision 2.
iota_path = sbox.ospath('iota')
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/diff_tests.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/diff_tests.py Tue Jun 24 21:29:59 2014
@@ -4675,6 +4675,59 @@ def diff_switched_file(sbox):
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '-r', '1', sbox.ospath(''))
+def diff_parent_dir(sbox):
+ "diff parent directory"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ svntest.actions.run_and_verify_svnmucc(None, None, [],
+ '-U', sbox.repo_url, '-m', 'Q',
+ 'mkdir', 'A/ZZZ',
+ 'propset', 'A', 'B', 'A/ZZZ')
+
+ was_cwd = os.getcwd()
+ os.chdir(os.path.join(wc_dir, 'A', 'B'))
+ try:
+ # This currently (1.8.9, 1.9.0 development) triggers an assertion failure
+ # as a non canonical relpath ".." is used as diff target
+
+ expected_output = [
+ 'Index: ../ZZZ\n',
+ '===================================================================\n',
+ '--- ../ZZZ (revision 2)\n',
+ '+++ ../ZZZ (nonexistent)\n',
+ '\n',
+ 'Property changes on: ../ZZZ\n',
+ '___________________________________________________________________\n',
+ 'Deleted: A\n',
+ '## -1 +0,0 ##\n',
+ '-B\n',
+ '\ No newline at end of property\n',
+ ]
+
+ svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'diff', '-r', '2', '..')
+
+ expected_output = [
+ 'Index: ../../A/ZZZ\n',
+ '===================================================================\n',
+ '--- ../../A/ZZZ (revision 2)\n',
+ '+++ ../../A/ZZZ (nonexistent)\n',
+ '\n',
+ 'Property changes on: ../../A/ZZZ\n',
+ '___________________________________________________________________\n',
+ 'Deleted: A\n',
+ '## -1 +0,0 ##\n',
+ '-B\n',
+ '\ No newline at end of property\n',
+ ]
+
+ svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'diff', '-r', '2', '../..')
+ finally:
+ os.chdir(was_cwd)
+
########################################################################
#Run the tests
@@ -4762,6 +4815,7 @@ test_list = [ None,
diff_repo_wc_file_props,
diff_repo_repo_added_file_mime_type,
diff_switched_file,
+ diff_parent_dir,
]
if __name__ == '__main__':
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout Tue Jun 24 21:29:59 2014
@@ -110,6 +110,7 @@ Valid options:
amount of white space
-w, --ignore-all-space: Ignore all white space
--ignore-eol-style: Ignore changes in EOL style
+ -U ARG, --context ARG: Show ARG lines of context
-p, --show-c-function: Show C function name
--search ARG : use ARG as search pattern (glob syntax)
--search-and ARG : combine ARG with the previous search pattern
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/svnadmin_tests.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/svnadmin_tests.py Tue Jun 24 21:29:59 2014
@@ -262,16 +262,9 @@ def load_dumpstream(sbox, dump, *varargs
return load_and_verify_dumpstream(sbox, None, None, None, False, dump,
*varargs)
-def read_l2p(sbox, revision, item):
- """ For the format 7+ repository in SBOX, return the physical offset
- of ITEM in REVISION. This code supports only small, nonpacked revs. """
-
- filename = fsfs_file(sbox.repo_dir, 'revs', str(revision) + ".l2p")
-
- fp = open(filename, 'rb')
- contents = fp.read()
- length = len(contents)
- fp.close()
+def read_l2p(contents, item):
+ """ For the format 7+ revision file CONTENTS, return the physical offset
+ of ITEM. This code supports only small, nonpacked revs. """
# decode numbers
numbers = []
@@ -320,10 +313,10 @@ def set_changed_path_list(sbox, revision
# read full file
fp = open(fsfs_file(sbox.repo_dir, 'revs', str(revision)), 'r+b')
contents = fp.read()
+ length = len(contents)
if repo_format(sbox) < 7:
# replace the changed paths list
- length = len(contents)
header = contents[contents.rfind('\n', length - 64, length - 1):]
body_len = long(header.split(' ')[1])
@@ -331,8 +324,24 @@ def set_changed_path_list(sbox, revision
# we will invalidate the l2p index but that's ok for the
# kind of tests we run here. The p2l index remains valid
# because the offset of the last item does not change
- body_len = read_l2p(sbox, revision, 1)
- header = '\n'
+
+ # read & parse revision file footer
+ footer_length = ord(contents[length-1]);
+ footer = contents[length - footer_length - 1:length-1]
+ l2p_offset = long(footer.split(' ')[0])
+ p2l_offset = long(footer.split(' ')[1])
+
+ # split file contents
+ body_len = read_l2p(contents[l2p_offset:], 1)
+ indexes = contents[l2p_offset:length - footer_length - 1]
+
+ # construct new footer, include indexes as are
+ file_len = body_len + len(changes) + 1
+ p2l_offset += file_len - l2p_offset
+
+ header = str(file_len) + ' ' + str(p2l_offset)
+ header += chr(len(header))
+ header = '\n' + indexes + header
contents = contents[:body_len] + changes + header
@@ -2021,31 +2030,25 @@ def verify_keep_going(sbox):
C_url)
r2 = fsfs_file(sbox.repo_dir, 'revs', '2')
- fp = open(r2, 'a')
+ fp = open(r2, 'r+b')
fp.write("""inserting junk to corrupt the rev""")
fp.close()
exit_code, output, errput = svntest.main.run_svnadmin("verify",
"--keep-going",
sbox.repo_dir)
- if svntest.main.is_fs_log_addressing():
- exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
- ".*Verified revision 1.",
- ".*Verified revision 2.",
- ".*Verified revision 3."])
- exp_err = svntest.verify.RegexListOutput(["svnadmin: E165011:.*"], False)
- else:
- exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
- ".*Verified revision 1.",
- ".*Error verifying revision 2.",
- ".*Error verifying revision 3.",
- ".*",
- ".*Summary.*",
- ".*r2: E160004:.*",
- ".*r3: E160004:.*",
- ".*r3: E160004:.*"])
- exp_err = svntest.verify.RegexListOutput(["svnadmin: E160004:.*",
- "svnadmin: E165011:.*"], False)
+ exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
+ ".*Verified revision 1.",
+ ".*Error verifying revision 2.",
+ ".*Error verifying revision 3.",
+ ".*",
+ ".*Summary.*",
+ ".*r2: E160004:.*",
+ ".*r2: E160004:.*",
+ ".*r3: E160004:.*",
+ ".*r3: E160004:.*"])
+ exp_err = svntest.verify.RegexListOutput(["svnadmin: E160004:.*",
+ "svnadmin: E165011:.*"], False)
if (svntest.main.fs_has_rep_sharing()):
exp_out.insert(0, ".*Verifying.*metadata.*")
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/svntest/wc.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/svntest/wc.py Tue Jun 24 21:29:59 2014
@@ -590,6 +590,9 @@ class State:
if line.startswith('DBG:') or line.startswith('Transmitting'):
continue
+ if line.startswith('Committing transaction'):
+ continue
+
match = _re_parse_commit_ext.search(line)
if match:
desc[to_relpath(match.group(4))] = StateItem(verb=match.group(1))
Modified: subversion/branches/svn-auth-x509/subversion/tests/cmdline/trans_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/cmdline/trans_tests.py?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/cmdline/trans_tests.py (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/cmdline/trans_tests.py Tue Jun 24 21:29:59 2014
@@ -584,7 +584,8 @@ def eol_change_is_text_mod(sbox):
# check 1: did new contents get transmitted?
expected_output = ["Sending " + foo_path + "\n",
- "Transmitting file data .\n",
+ "Transmitting file data .done\n",
+ "Committing transaction...\n",
"Committed revision 3.\n"]
svntest.actions.run_and_verify_svn(None, expected_output, [],
'ci', '-m', 'log msg', foo_path)
Modified: subversion/branches/svn-auth-x509/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Tue Jun 24 21:29:59 2014
@@ -347,26 +347,6 @@ pack_filesystem(const svn_test_opts_t *o
"Expected manifest file '%s' not found",
path);
}
- else
- {
- path = svn_dirent_join_many(pool, REPO_NAME, "revs",
- apr_psprintf(pool, "%d.pack", i / SHARD_SIZE),
- "pack.l2p", SVN_VA_NULL);
- SVN_ERR(svn_io_check_path(path, &kind, pool));
- if (kind != svn_node_file)
- return svn_error_createf(SVN_ERR_FS_GENERAL, NULL,
- "Expected log-to-phys index file '%s' not found",
- path);
-
- path = svn_dirent_join_many(pool, REPO_NAME, "revs",
- apr_psprintf(pool, "%d.pack", i / SHARD_SIZE),
- "pack.p2l", NULL);
- SVN_ERR(svn_io_check_path(path, &kind, pool));
- if (kind != svn_node_file)
- return svn_error_createf(SVN_ERR_FS_GENERAL, NULL,
- "Expected phys-to-log index file '%s' not found",
- path);
- }
/* This directory should not exist. */
path = svn_dirent_join_many(pool, REPO_NAME, "revs",
Modified: subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/dirent_uri-test.c Tue Jun 24 21:29:59 2014
@@ -1108,6 +1108,7 @@ test_relpath_is_canonical(apr_pool_t *po
static const testcase_is_canonical_t tests[] = {
{ "", TRUE },
{ ".", FALSE },
+ { "..", TRUE },
{ "/", FALSE },
{ "/.", FALSE },
{ "./", FALSE },
Modified: subversion/branches/svn-auth-x509/tools/dev/unix-build/Makefile.svn
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/tools/dev/unix-build/Makefile.svn?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/tools/dev/unix-build/Makefile.svn (original)
+++ subversion/branches/svn-auth-x509/tools/dev/unix-build/Makefile.svn Tue Jun 24 21:29:59 2014
@@ -74,7 +74,7 @@ GNU_ICONV_VER = 1.14
APR_UTIL_VER = 1.5.3
HTTPD_VER = 2.2.27
NEON_VER = 0.29.6
-SERF_VER = 1.3.4
+SERF_VER = 1.3.6
SERF_OLD_VER = 0.3.1
CYRUS_SASL_VER = 2.1.25
SQLITE_VER = 3080403
Modified: subversion/branches/svn-auth-x509/tools/server-side/svn-rep-sharing-stats.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/tools/server-side/svn-rep-sharing-stats.c?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/tools/server-side/svn-rep-sharing-stats.c (original)
+++ subversion/branches/svn-auth-x509/tools/server-side/svn-rep-sharing-stats.c Tue Jun 24 21:29:59 2014
@@ -304,7 +304,8 @@ process_one_revision(svn_fs_t *fs,
the_id = node_rev_id2;
/* Get the node_rev using the chosen node_rev_id. */
- SVN_ERR(svn_fs_fs__get_node_revision(&node_rev, fs, the_id, scratch_pool));
+ SVN_ERR(svn_fs_fs__get_node_revision(&node_rev, fs, the_id,
+ scratch_pool, scratch_pool));
/* Maybe record the sha1's. */
SVN_ERR(record(prop_reps, node_rev->prop_rep, result_pool));
Modified: subversion/branches/svn-auth-x509/tools/server-side/svnfsfs/load-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/tools/server-side/svnfsfs/load-index-cmd.c?rev=1605201&r1=1605200&r2=1605201&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/tools/server-side/svnfsfs/load-index-cmd.c (original)
+++ subversion/branches/svn-auth-x509/tools/server-side/svnfsfs/load-index-cmd.c Tue Jun 24 21:29:59 2014
@@ -28,6 +28,7 @@
#include "private/svn_sorts_private.h"
#include "../../../subversion/libsvn_fs_fs/index.h"
+#include "../../../subversion/libsvn_fs_fs/transaction.h"
#include "../../../subversion/libsvn_fs_fs/util.h"
#include "svn_private_config.h"
@@ -77,35 +78,33 @@ calc_fnv1(svn_fs_fs__p2l_entry_t *entry,
return SVN_NO_ERROR;
}
-/* In FS, (re-)write the P2L index for the revision file starting at
- * REVISION. All entries to write are of type svn_fs_fs__p2l_entry_t* and
- * given in ENTRIES. The FVN1 checksums are not taken from ENTRIES but are
- * begin calculated as we go. Use POOL for temporary allocations.
+/* For FS, create a new P2L auto-deleting proto index file in POOL and return
+ * its name in *INDEX_NAME. All entries to write are given in ENTRIES and
+ * of type svn_fs_fs__p2l_entry_t*. The FVN1 checksums are not taken from
+ * ENTRIES but are begin calculated from the current contents of REV_FILE
+ * as we go. Use POOL for allocations.
*/
static svn_error_t *
-write_p2l_index(svn_fs_t *fs,
- svn_revnum_t revision,
+write_p2l_index(const char **index_name,
+ svn_fs_t *fs,
+ svn_fs_fs__revision_file_t *rev_file,
apr_array_header_t *entries,
apr_pool_t *pool)
{
apr_file_t *proto_index;
- const char *protoname, *filename;
/* Use a subpool for immediate temp file cleanup at the end of this
* function. */
- apr_pool_t *subpool = svn_pool_create(pool);
apr_pool_t *iterpool = svn_pool_create(pool);
- svn_fs_fs__revision_file_t *rev_file;
int i;
/* Create a proto-index file. */
- SVN_ERR(svn_io_open_unique_file3(NULL, &protoname, NULL,
+ SVN_ERR(svn_io_open_unique_file3(NULL, index_name, NULL,
svn_io_file_del_on_pool_cleanup,
- subpool, subpool));
- SVN_ERR(svn_fs_fs__p2l_proto_index_open(&proto_index, protoname, subpool));
+ pool, iterpool));
+ SVN_ERR(svn_fs_fs__p2l_proto_index_open(&proto_index, *index_name, pool));
/* Write ENTRIES to proto-index file and calculate checksums as we go. */
- SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, revision, pool));
for (i = 0; i < entries->nelts; ++i)
{
svn_fs_fs__p2l_entry_t *entry
@@ -121,15 +120,10 @@ write_p2l_index(svn_fs_t *fs,
* Note that REV_FILE contains the start revision of the shard file if it
* has been packed while REVISION may be somewhere in the middle. For
* non-packed shards, they will have identical values. */
- SVN_ERR(svn_io_file_flush(proto_index, iterpool));
- filename = svn_fs_fs__path_p2l_index(fs, rev_file->start_revision,
- rev_file->is_packed, subpool);
- SVN_ERR(svn_fs_fs__p2l_index_create(fs, filename, protoname,
- rev_file->start_revision, subpool));
+ SVN_ERR(svn_io_file_close(proto_index, iterpool));
/* Temp file cleanup. */
svn_pool_destroy(iterpool);
- svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -151,22 +145,21 @@ compare_p2l_entry_revision(const void *l
return lhs_entry->item.revision == rhs_entry->item.revision ? 0 : 1;
}
-/* In FS, (re-)write the L2P index with all entries taken from ENTRIES.
- * The revisions found in ENTRIES define the index file to write. The
- * entries are given as svn_fs_fs__p2l_entry_t* (sic!) and the ENTRIES
- * array will be reordered. Use POOL for temporary allocations.
+/* For FS, create a new L2P auto-deleting proto index file in POOL and return
+ * its name in *INDEX_NAME. All entries to write are given in ENTRIES and
+ * entries are of type svn_fs_fs__p2l_entry_t* (sic!). The ENTRIES array
+ * will be reordered. Use POOL for allocations.
*/
static svn_error_t *
-write_l2p_index(svn_fs_t *fs,
+write_l2p_index(const char **index_name,
+ svn_fs_t *fs,
apr_array_header_t *entries,
apr_pool_t *pool)
{
apr_file_t *proto_index;
- const char *protoname, *filename;
/* Use a subpool for immediate temp file cleanup at the end of this
* function. */
- apr_pool_t *subpool = svn_pool_create(pool);
apr_pool_t *iterpool = svn_pool_create(pool);
int i;
svn_revnum_t last_revision = SVN_INVALID_REVNUM;
@@ -183,10 +176,11 @@ write_l2p_index(svn_fs_t *fs,
->item.revision;
/* Create the temporary proto-rev file. */
- SVN_ERR(svn_io_open_unique_file3(NULL, &protoname, NULL,
+ SVN_ERR(svn_io_open_unique_file3(NULL, index_name, NULL,
svn_io_file_del_on_pool_cleanup,
- subpool, subpool));
- SVN_ERR(svn_fs_fs__l2p_proto_index_open(&proto_index, protoname, subpool));
+ pool, iterpool));
+ SVN_ERR(svn_fs_fs__l2p_proto_index_open(&proto_index, *index_name,
+ iterpool));
/* Write all entries. */
for (i = 0; i < entries->nelts; ++i)
@@ -211,16 +205,10 @@ write_l2p_index(svn_fs_t *fs,
}
/* Convert proto-index into final index and move it into position. */
- SVN_ERR(svn_io_file_flush(proto_index, iterpool));
- filename = svn_fs_fs__path_l2p_index(fs, revision,
- svn_fs_fs__is_packed_rev(fs, revision),
- subpool);
- SVN_ERR(svn_fs_fs__l2p_index_create(fs, filename, protoname, revision,
- subpool));
+ SVN_ERR(svn_io_file_close(proto_index, iterpool));
/* Temp file cleanup. */
svn_pool_destroy(iterpool);
- svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -371,8 +359,26 @@ load_index(const char *path,
/* Treat an empty array as a no-op instead error. */
if (entries->nelts != 0)
{
- SVN_ERR(write_p2l_index(fs, revision, entries, pool));
- SVN_ERR(write_l2p_index(fs, entries, pool));
+ const char *l2p_proto_index;
+ const char *p2l_proto_index;
+ svn_fs_fs__revision_file_t *rev_file;
+
+ /* Open rev / pack file & trim indexes + footer off it. */
+ SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, revision,
+ iterpool));
+ SVN_ERR(svn_fs_fs__auto_read_footer(rev_file));
+ SVN_ERR(svn_io_file_trunc(rev_file->file, rev_file->l2p_offset,
+ iterpool));
+
+ /* Create proto index files for the new index data
+ * (will be cleaned up automatically with iterpool). */
+ SVN_ERR(write_p2l_index(&p2l_proto_index, fs, rev_file, entries,
+ iterpool));
+ SVN_ERR(write_l2p_index(&l2p_proto_index, fs, entries, iterpool));
+
+ /* Combine rev data with new index data. */
+ SVN_ERR(svn_fs_fs__add_index_data(fs, rev_file->file, l2p_proto_index,
+ p2l_proto_index, revision, iterpool));
}
svn_pool_destroy(iterpool);