subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r941491 - in /subversion/trunk/subversion: libsvn_repos/load.c tests/cmdline/svndumpfilter_tests.py
Date Wed, 05 May 2010 21:12:24 GMT
Author: pburba
Date: Wed May  5 21:12:24 2010
New Revision: 941491

URL: http://svn.apache.org/viewvc?rev=941491&view=rev
Log:
Fix svndumpfilter_tests.py 5 'filter mergeinfo revs outside of dump stream'.

This change reapplies part of r927243 which was reverted in r936387
and is part of the issue #3020 group of fixes.

* subversion/libsvn_repos/load.c

  (parse_baton): New member oldest_old_rev.

  (renumber_mergeinfo_revs): Account for the fact that svn_merge_range_t's
   start_rev member is not inclusive when renumbering merge source revs.

  (close_revision): Set oldest_old_rev.

  (svn_repos_get_fs_build_parser2): Initialize oldest_old_rev.

* subversion/tests/cmdline/svndumpfilter_tests.py

  (filter_mergeinfo_revs_outside_of_dump_stream): Remove comment about
   XFail.

  (test_list): Remove XFail from
   filter_mergeinfo_revs_outside_of_dump_stream.

Modified:
    subversion/trunk/subversion/libsvn_repos/load.c
    subversion/trunk/subversion/tests/cmdline/svndumpfilter_tests.py

Modified: subversion/trunk/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/load.c?rev=941491&r1=941490&r2=941491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/load.c (original)
+++ subversion/trunk/subversion/libsvn_repos/load.c Wed May  5 21:12:24 2010
@@ -61,6 +61,10 @@ struct parse_baton
      (svn_revnum_t *) in the loaded repository.  The hash and its
      contents are allocated in POOL. */
   apr_hash_t *rev_map;
+
+  /* The oldest old revision loaded from the dump stream.  If no revisions
+     have been loaded yet, this is set to SVN_INVALID_REVNUM. */
+  svn_revnum_t oldest_old_rev;
 };
 
 struct revision_baton
@@ -295,18 +299,41 @@ renumber_mergeinfo_revs(svn_string_t **f
                                                    svn_merge_range_t *);
           rev_from_map = apr_hash_get(pb->rev_map, &range->start,
                                       sizeof(svn_revnum_t));
-          /* If we can't remap the start revision then don't even bother
-             trying to remap the end revision.  It's possible we might
-             actually succeed at the latter, which can result in invalid
-             mergeinfo with a start rev > end red.  If that gets into the
-             repository then a world of bustage breaks loose anytime that
-             bogus mergeinfo is parsed.  See
-             http://subversion.tigris.org/issues/show_bug.cgi?id=3020#desc16.
-             */
           if (rev_from_map && SVN_IS_VALID_REVNUM(*rev_from_map))
-            range->start = *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;
+            }
           else
-            continue;
+            {
+              /* If we can't remap the start revision then don't even bother
+                 trying to remap the end revision.  It's possible we might
+                 actually succeed at the latter, which can result in invalid
+                 mergeinfo with a start rev > end rev.  If that gets into the
+                 repository then a world of bustage breaks loose anytime that
+                 bogus mergeinfo is parsed.  See
+                 http://subversion.tigris.org/issues/show_bug.cgi?id=3020#desc16.
+                 */
+              continue;
+            }
 
           rev_from_map = apr_hash_get(pb->rev_map, &range->end,
                                       sizeof(svn_revnum_t));
@@ -1379,6 +1406,10 @@ close_revision(void *baton)
         return svn_error_return(err);
     }
 
+  /* Stash the oldest "old" revision committed from the load stream. */
+  if (!SVN_IS_VALID_REVNUM(pb->oldest_old_rev))
+    pb->oldest_old_rev = *old_rev;
+
   /* Run post-commit hook, if so commanded.  */
   if (pb->use_post_commit_hook)
     {
@@ -1460,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->oldest_old_rev = SVN_INVALID_REVNUM;
 
   *callbacks = parser;
   *parse_baton = pb;

Modified: subversion/trunk/subversion/tests/cmdline/svndumpfilter_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svndumpfilter_tests.py?rev=941491&r1=941490&r2=941491&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svndumpfilter_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svndumpfilter_tests.py Wed May  5 21:12:24 2010
@@ -338,20 +338,6 @@ def filter_mergeinfo_revs_outside_of_dum
   load_and_verify_dumpstream(sbox, [], [], None, filtered_dumpfile2,
                              '--ignore-uuid')
   # Check the resulting mergeinfo.
-  #
-  # Currently this fails with this mergeinfo:
-  #
-  #  Properties on 'branches\B1':
-  #    svn:mergeinfo
-  #      /branches/B2:6-7
-  #      /trunk:4,6 <-- r6 should be mapped to r1 and then removed.
-  #  Properties on 'branches\B2':
-  #    svn:mergeinfo
-  #      /trunk:4
-  #  Properties on 'branches\B1\B\E':
-  #    svn:mergeinfo
-  #      /branches/B2/B/E:6-7
-  #      /trunk/B/E:3-4,6 <-- r6 should be mapped to r1 and then removed.
   url = sbox.repo_url + "/branches"
   expected_output = svntest.verify.UnorderedOutput([
     url + "/B1 - /branches/B2:6-7\n",
@@ -373,7 +359,7 @@ test_list = [ None,
               svndumpfilter_loses_mergeinfo,
               dumpfilter_with_targets,
               dumpfilter_with_patterns,
-              XFail(filter_mergeinfo_revs_outside_of_dump_stream),
+              filter_mergeinfo_revs_outside_of_dump_stream,
               ]
 
 if __name__ == '__main__':



Mime
View raw message