Port the "no sharing of dir reps" patch (r1785053) from FSFS to FSX.
Lots of text conflicts needed to be resolved while the overall code
churn is quite low.
@@ -2754,11 +2754,14 @@ write_directory_to_stream(svn_stream_t *stream,
/* Write out the COLLECTION pertaining to the NODEREV in FS as a deltified
text representation to file FILE using WRITER. In the process, record the
total size and the md5 digest in REP and add the representation of type
- ITEM_TYPE to the indexes if necessary. If rep sharing has been enabled and
- REPS_HASH is not NULL, it will be used in addition to the on-disk cache to
- find earlier reps with the same content. When such existing reps can be
- found, we will truncate the one just written from the file and return the
- existing rep.
+ ITEM_TYPE to the indexes if necessary.
+
+ If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless
+ of any other option and rep-sharing settings. If rep sharing has been
+ enabled and REPS_HASH is not NULL, it will be used in addition to the
+ on-disk cache to find earlier reps with the same content. If such
+ existing reps can be found, we will truncate the one just written from
+ the file and return the existing rep.
If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume
that we want to a props representation as the base for our delta.
@@ -2775,6 +2778,7 @@ write_container_delta_rep(svn_fs_x__representation_t *rep,
svn_fs_x__txn_id_t txn_id,
svn_fs_x__noderev_t *noderev,
apr_hash_t *reps_hash,
+ svn_boolean_t allow_rep_sharing,
apr_uint32_t item_type,
svn_revnum_t final_revision,
apr_pool_t *scratch_pool)
@@ -2786,7 +2790,7 @@ write_container_delta_rep(svn_fs_x__representation_t *rep,
svn_stream_t *file_stream;
svn_stream_t *stream;
svn_fs_x__representation_t *base_rep;
- svn_fs_x__representation_t *old_rep;
+ svn_fs_x__representation_t *old_rep = NULL;
svn_fs_x__p2l_entry_t entry;
svn_stream_t *source;
svn_fs_x__rep_header_t header = { 0 };
@@ -2856,6 +2860,7 @@ write_container_delta_rep(svn_fs_x__representation_t *rep,
/* Check and see if we already have a representation somewhere that's
identical to the one we just wrote out. */
+ if (allow_rep_sharing)
SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool,
scratch_pool));
@@ -3076,7 +3081,7 @@ write_final_rev(svn_fs_x__id_t *new_id_p,
SVN_ERR(write_container_delta_rep(noderev->data_rep, file,
entries,
write_directory_to_stream,
- fs, txn_id, noderev, NULL,
+ fs, txn_id, noderev, NULL, FALSE,
SVN_FS_X__ITEM_TYPE_DIR_REP,
rev, scratch_pool));
@@ -3128,8 +3133,8 @@ write_final_rev(svn_fs_x__id_t *new_id_p,
SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist,
write_hash_to_stream, fs, txn_id,
- noderev, reps_hash, item_type, rev,
- scratch_pool));
+ noderev, reps_hash, TRUE, item_type,
+ rev, scratch_pool));
}
/* Convert our temporary ID into a permanent revision one. */
