You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2010/03/25 20:30:21 UTC
svn commit: r927553 - in /subversion/branches/1.6.x-issue3020: ./ CHANGES
subversion/libsvn_repos/load.c subversion/tests/cmdline/svnadmin_tests.py
Author: pburba
Date: Thu Mar 25 19:30:21 2010
New Revision: 927553
URL: http://svn.apache.org/viewvc?rev=927553&view=rev
Log:
Merge r927243 from subversion/trunk to subversion/branches/1.6.x-issue3020.
Resolve minor conflict due to r879947 not being backported to 1.6.x.
Modified:
subversion/branches/1.6.x-issue3020/ (props changed)
subversion/branches/1.6.x-issue3020/CHANGES (props changed)
subversion/branches/1.6.x-issue3020/subversion/libsvn_repos/load.c
subversion/branches/1.6.x-issue3020/subversion/tests/cmdline/svnadmin_tests.py
Propchange: subversion/branches/1.6.x-issue3020/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 25 19:30:21 2010
@@ -64,4 +64,4 @@
/subversion/branches/tc_url_rev:870696-870828
/subversion/branches/tree-conflicts:864636-869499
/subversion/branches/tree-conflicts-notify:870271-870353
-/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,876862,877203,877595,877597,877665,878216,878269,878321,878341,878343,878399,878423,878426,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,892050,892085,895514,895653,896522,896915,898963,899826,899828,900797,901752,904301,904394,904594,905303,905326,906256,906305,917640,918211,921453,922516,927184
+/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,876862,877203,877595,877597,877665,878216,878269,878321,878341,878343,878399,878423,878426,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,892050,892085,895514,895653,896522,896915,898963,899826,899828,900797,901752,904301,904394,904594,905303,905326,906256,906305,917640,918211,921453,922516,927184,927243
Propchange: subversion/branches/1.6.x-issue3020/CHANGES
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 25 19:30:21 2010
@@ -63,4 +63,4 @@
/subversion/branches/tc_url_rev/CHANGES:870696-870828
/subversion/branches/tree-conflicts/CHANGES:864636-869499
/subversion/branches/tree-conflicts-notify/CHANGES:870271-870353
-/subversion/trunk/CHANGES:875962-901365,901752,904301,904394,904594,905303,905326,917640,918211,921453,922516,927184
+/subversion/trunk/CHANGES:875962-901365,901752,904301,904394,904594,905303,905326,917640,918211,921453,922516,927184,927243
Modified: subversion/branches/1.6.x-issue3020/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue3020/subversion/libsvn_repos/load.c?rev=927553&r1=927552&r2=927553&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue3020/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/1.6.x-issue3020/subversion/libsvn_repos/load.c Thu Mar 25 19:30:21 2010
@@ -50,7 +50,18 @@ struct parse_baton
enum svn_repos_load_uuid uuid_action;
const char *parent_dir;
apr_pool_t *pool;
+
+ /* A hash mapping copy-from revisions and mergeinfo range revisions
+ (svn_revnum_t *) in the dump stream to their corresponding revisions
+ (svn_revnum_t *) in the loaded repository. The hash and its
+ contents are allocated in POOL. */
apr_hash_t *rev_map;
+
+ /* The oldest and youngest old revisions loaded so far from the dump
+ stream. If no revisions have been loaded yet, then both are set to
+ SVN_INVALID_REVNUM. */
+ svn_revnum_t oldest_old_rev;
+ svn_revnum_t youngest_old_rev;
};
struct revision_baton
@@ -249,9 +260,10 @@ prefix_mergeinfo_paths(svn_string_t **me
}
-/* Examine the mergeinfo in INITIAL_VAL, renumber revisions in rangelists
- as appropriate, and return the (possibly new) mergeinfo in *FINAL_VAL
- (allocated from POOL). */
+/* Examine the mergeinfo in INITIAL_VAL, if necessary remove revisions that
+ refer to history outside of the dump stream and renumber mergeinfo
+ rangelists to point to the appropriate revisions in the loaded repository.
+ Return the (possibly new) mergeinfo in *FINAL_VAL (allocated from POOL). */
static svn_error_t *
renumber_mergeinfo_revs(svn_string_t **final_val,
const svn_string_t *initial_val,
@@ -264,6 +276,15 @@ renumber_mergeinfo_revs(svn_string_t **f
apr_hash_index_t *hi;
SVN_ERR(svn_mergeinfo_parse(&mergeinfo, initial_val->data, subpool));
+
+ /* Issue #3020: If the dump stream represents only part of a repository,
+ then mergeinfo in the stream may refer to revisions outside of the
+ stream. Remove any such invalid ranges before renumbering. */
+ SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
+ &mergeinfo, mergeinfo,
+ rb->pb->youngest_old_rev, rb->pb->oldest_old_rev - 1,
+ subpool));
+
for (hi = apr_hash_first(NULL, mergeinfo); hi; hi = apr_hash_next(hi))
{
const char *merge_source;
@@ -286,7 +307,28 @@ renumber_mergeinfo_revs(svn_string_t **f
rev_from_map = apr_hash_get(pb->rev_map, &range->start,
sizeof(svn_revnum_t));
if (rev_from_map && SVN_IS_VALID_REVNUM(*rev_from_map))
+ {
range->start = *rev_from_map;
+ }
+ else if (range->start == pb->oldest_old_rev - 1)
+ {
+ /* Since the start revision of svn_merge_range_t are not
+ inclusive there is one possible valid start revision that
+ won't be found in the PB->REV_MAP mapping of load stream
+ revsions to loaded revisions: The revision immediately
+ preceeding the oldest revision from the load stream.
+ This is a valid revision for mergeinfo, but not a valid
+ copy from revision (which PB->REV_MAP also maps for) so it
+ will never be in the mapping.
+
+ If that is what we have here, then find the mapping for the
+ oldest rev from the load stream and subtract 1 to get the
+ renumbered, non-inclusive, start revision. */
+ rev_from_map = apr_hash_get(pb->rev_map, &pb->oldest_old_rev,
+ sizeof(svn_revnum_t));
+ if (rev_from_map && SVN_IS_VALID_REVNUM(*rev_from_map))
+ range->start = *rev_from_map - 1;
+ }
rev_from_map = apr_hash_get(pb->rev_map, &range->end,
sizeof(svn_revnum_t));
@@ -1201,19 +1243,31 @@ set_node_property(void *baton,
if (strcmp(name, SVN_PROP_MERGEINFO) == 0)
{
- /* Renumber mergeinfo as appropriate. */
- svn_string_t *renumbered_mergeinfo;
- SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value, rb,
- nb->pool));
- value = renumbered_mergeinfo;
- if (parent_dir)
+ /* If we haven't yet committed any revisions then *any* mergeinfo
+ will refer to the wrong revisions or revisions that don't exist.
+ Either way none of this mergeinfo can be valid, so remove it all. */
+ if (apr_hash_count(rb->pb->rev_map) == 0)
{
- /* Prefix the merge source paths with PARENT_DIR. */
- /* ASSUMPTION: All source paths are included in the dump stream. */
- svn_string_t *mergeinfo_val;
- SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value, parent_dir,
- nb->pool));
- value = mergeinfo_val;
+ value = NULL;
+ }
+ else
+ {
+ /* Renumber mergeinfo as appropriate. */
+ svn_string_t *renumbered_mergeinfo;
+
+ SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value, rb,
+ nb->pool));
+ value = renumbered_mergeinfo;
+ if (parent_dir)
+ {
+ /* Prefix the merge source paths with PARENT_DIR. */
+ /* ASSUMPTION: All source paths are included in the dump
+ stream. */
+ svn_string_t *mergeinfo_val;
+ SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value,
+ parent_dir, nb->pool));
+ value = mergeinfo_val;
+ }
}
}
@@ -1349,6 +1403,13 @@ close_revision(void *baton)
return err;
}
+ /* Update the youngest revision committed from the load stream (or both
+ if this is the first revision committed). */
+ if (SVN_IS_VALID_REVNUM(pb->youngest_old_rev))
+ pb->youngest_old_rev = *old_rev;
+ else
+ pb->oldest_old_rev = pb->youngest_old_rev = *old_rev;
+
/* Run post-commit hook, if so commanded. */
if (pb->use_post_commit_hook)
{
@@ -1430,6 +1491,7 @@ svn_repos_get_fs_build_parser2(const svn
pb->parent_dir = parent_dir;
pb->pool = pool;
pb->rev_map = apr_hash_make(pool);
+ pb->youngest_old_rev = pb->oldest_old_rev = SVN_INVALID_REVNUM;
*callbacks = parser;
*parse_baton = pb;
Modified: subversion/branches/1.6.x-issue3020/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue3020/subversion/tests/cmdline/svnadmin_tests.py?rev=927553&r1=927552&r2=927553&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue3020/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/1.6.x-issue3020/subversion/tests/cmdline/svnadmin_tests.py Thu Mar 25 19:30:21 2010
@@ -805,9 +805,6 @@ def reflect_dropped_renumbered_revs(sbox
'/toplevel')
# Verify the svn:mergeinfo properties
- # Currently this test is set as XFail because the original fix for
- # issue #3020 didn't have the correct expecations, see
- # http://svn.haxx.se/dev/archive-2010-03/0244.shtml.
svntest.actions.run_and_verify_svn(None, ["/trunk:2-4\n"],
[], 'propget', 'svn:mergeinfo',
sbox.repo_url + '/branch2')
@@ -1044,41 +1041,24 @@ def drop_mergeinfo_outside_of_dump_strea
# /trunk:4
#
# But here we will load it into the existing skeleton repository in the
- # projects/Project-X directory. Since we are loading the dump into a
+ # Projects/Project-X directory. Since we are loading the dump into a
# subtree, all the merge sources should be prefixed with the path to
- # that subtree, i.e. 'projects/Project-X', compared to the mergeinfo above.
+ # that subtree, i.e. 'Projects/Project-X', compared to the mergeinfo above.
# In addition, since the skeleton repos already has 6 revisions, we expect
# all the remaining revisions to be offset +6 from the above. That should
# result in this mergeinfo:
#
- # Properties on 'projects/Project-X/branches/B1':
+ # Properties on 'Projects/Project-X/branches/B1':
# svn:mergeinfo
- # /projects/Project-X/branches/B2:12-13
- # /projects/Project-X/trunk:7,10
- # Properties on 'projects/Project-X/branches/B1/B/E':
+ # /Projects/Project-X/branches/B2:12-13
+ # /Projects/Project-X/trunk:7,10
+ # Properties on 'Projects/Project-X/branches/B1/B/E':
# svn:mergeinfo
- # /projects/Project-X/branches/B2/B/E:12-13
- # /projects/Project-X/trunk/B/E:7,9-10
- # Properties on 'projects/Project-X/branches/B2':
+ # /Projects/Project-X/branches/B2/B/E:12-13
+ # /Projects/Project-X/trunk/B/E:7,9-10
+ # Properties on 'Projects/Project-X/branches/B2':
# svn:mergeinfo
- # /projects/Project-X/trunk:10
- #
- # ...Unfortunately this is currently the resulting mergeinfo
- # (and why this test is set to XFail):
- #
- # Properties on 'projects\Project-X\branches\B1':
- # svn:mergeinfo
- # /projects/Project-X/branches/B2:12-13
- # /projects/Project-X/trunk:6-7,10
- # ^
- # Properties on 'projects\Project-X\branches\B1\B\E':
- # svn:mergeinfo
- # /projects/Project-X/branches/B2/B/E:12-13
- # /projects/Project-X/trunk/B/E:5-7,9-10
- # ^^
- # Properties on 'projects\Project-X\branches\B2':
- # svn:mergeinfo
- # /projects/Project-X/trunk:10
+ # /Projects/Project-X/trunk:10
# Load the skeleton dump:
dumpfile1 = svntest.main.file_read(
@@ -1139,12 +1119,12 @@ test_list = [ None,
SkipUnless(recover_fsfs, svntest.main.is_fs_type_fsfs),
load_with_parent_dir,
set_uuid,
- XFail(reflect_dropped_renumbered_revs),
+ reflect_dropped_renumbered_revs,
SkipUnless(fsfs_recover_handle_missing_revs_or_revprops_file,
svntest.main.is_fs_type_fsfs),
create_in_repo_subdir,
verify_with_invalid_revprops,
- XFail(drop_mergeinfo_outside_of_dump_stream),
+ drop_mergeinfo_outside_of_dump_stream,
]
if __name__ == '__main__':