subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r896226 - in /subversion/branches/issue-3242-dev: ./ subversion/include/private/svn_mergeinfo_private.h subversion/libsvn_client/merge.c subversion/libsvn_subr/mergeinfo.c subversion/libsvn_wc/props.c subversion/tests/cmdline/authz_tests.py
Date Tue, 05 Jan 2010 21:27:21 GMT
Author: cmpilato
Date: Tue Jan  5 21:27:21 2010
New Revision: 896226

URL: http://svn.apache.org/viewvc?rev=896226&view=rev
Log:
Sync the 'issue-3242-dev' branch up with the trunk.
(Merged /subversion/trunk:r896091-896219)

Modified:
    subversion/branches/issue-3242-dev/   (props changed)
    subversion/branches/issue-3242-dev/subversion/include/private/svn_mergeinfo_private.h
    subversion/branches/issue-3242-dev/subversion/libsvn_client/merge.c
    subversion/branches/issue-3242-dev/subversion/libsvn_subr/mergeinfo.c
    subversion/branches/issue-3242-dev/subversion/libsvn_wc/props.c
    subversion/branches/issue-3242-dev/subversion/tests/cmdline/authz_tests.py

Propchange: subversion/branches/issue-3242-dev/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan  5 21:27:21 2010
@@ -32,4 +32,4 @@
 /subversion/branches/tc_url_rev:874351-874483
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:879653-896090
+/subversion/trunk:879653-896219

Modified: subversion/branches/issue-3242-dev/subversion/include/private/svn_mergeinfo_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/include/private/svn_mergeinfo_private.h?rev=896226&r1=896225&r2=896226&view=diff
==============================================================================
--- subversion/branches/issue-3242-dev/subversion/include/private/svn_mergeinfo_private.h
(original)
+++ subversion/branches/issue-3242-dev/subversion/include/private/svn_mergeinfo_private.h
Tue Jan  5 21:27:21 2010
@@ -176,6 +176,20 @@
   svn_revnum_t oldest_rev,
   apr_pool_t *pool);
 
+/* If MERGEINFO is non-inheritable return TRUE, return FALSE otherwise.
+   MERGEINFO may be NULL or empty. */
+svn_boolean_t
+svn_mergeinfo__is_noninheritable(svn_mergeinfo_t mergeinfo,
+                                 apr_pool_t *scratch_pool);
+
+/* If MERGEINFO_STR is a string representation of non-inheritable mergeinfo
+   set *IS_NONINHERITABLE to TRUE, set it to FALSE otherwise.  MERGEINFO_STR
+   may be NULL or empty.  If MERGEINFO_STR cannot be parsed return
+   SVN_ERR_MERGEINFO_PARSE_ERROR. */
+svn_error_t *
+svn_mergeinfo__string_has_noninheritable(svn_boolean_t *is_noninheritable,
+                                         const char *mergeinfo_str,
+                                         apr_pool_t *scratch_pool);
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/issue-3242-dev/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/libsvn_client/merge.c?rev=896226&r1=896225&r2=896226&view=diff
==============================================================================
--- subversion/branches/issue-3242-dev/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/issue-3242-dev/subversion/libsvn_client/merge.c Tue Jan  5 21:27:21
2010
@@ -5245,9 +5245,10 @@
       child->switched = switched;
       child->absent = absent;
       child->scheduled_for_deletion = deleted;
-      if (propval
-          && strstr(propval->data, SVN_MERGEINFO_NONINHERITABLE_STR))
-        child->has_noninheritable = TRUE;
+
+      if (propval)
+        SVN_ERR(svn_mergeinfo__string_has_noninheritable(
+          &(child->has_noninheritable), propval->data, scratch_pool));
 
       /* A little trickery: If PATH doesn't have any mergeinfo or has
          only inheritable mergeinfo, we still describe it as having
@@ -7069,25 +7070,21 @@
     {
       const char *added_abspath = svn_apr_hash_index_key(hi);
       const char *dir_abspath;
-      const svn_string_t *added_path_parent_propval;
+      svn_mergeinfo_t parent_mergeinfo;
+      svn_boolean_t inherited;
 
       apr_pool_clear(iterpool);
       dir_abspath = svn_dirent_dirname(added_abspath, iterpool);
 
-      /* Rather than using svn_client__get_wc_mergeinfo() and analyzing the
-         mergeinfo it returns to determine if ADDED_PATH's parent has
-         non-inheritable mergeinfo, it is much simpler to just get the
-         svn_string_t representation of the svn:mergeinfo prop and look for
-         the '*' non-inheritable marker. */
-      SVN_ERR(svn_wc_prop_get2(&added_path_parent_propval,
-                               merge_b->ctx->wc_ctx, dir_abspath,
-                               SVN_PROP_MERGEINFO, iterpool, iterpool));
-      if (added_path_parent_propval
-          && strstr(added_path_parent_propval->data,
-                    SVN_MERGEINFO_NONINHERITABLE_STR))
+      /* Does ADDED_ABSPATH's immediate parent have non-inheritable
+         mergeinfo? */
+      SVN_ERR(svn_client__get_wc_mergeinfo(&parent_mergeinfo, &inherited,
+                                           svn_mergeinfo_explicit,
+                                           dir_abspath, NULL, NULL,
+                                           merge_b->ctx,
+                                           iterpool, iterpool));
+      if (svn_mergeinfo__is_noninheritable(parent_mergeinfo, iterpool))
         {
-          /* ADDED_PATH's immediate parent has non-inheritable
-             mergeinfo. */
           svn_client__merge_path_t *target_merge_path =
             APR_ARRAY_IDX(notify_b->children_with_mergeinfo, 0,
                           svn_client__merge_path_t *);

Modified: subversion/branches/issue-3242-dev/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/libsvn_subr/mergeinfo.c?rev=896226&r1=896225&r2=896226&view=diff
==============================================================================
--- subversion/branches/issue-3242-dev/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/issue-3242-dev/subversion/libsvn_subr/mergeinfo.c Tue Jan  5 21:27:21
2010
@@ -2003,3 +2003,49 @@
     }
   return SVN_NO_ERROR;
 }
+
+svn_boolean_t
+svn_mergeinfo__is_noninheritable(svn_mergeinfo_t mergeinfo,
+                                 apr_pool_t *scratch_pool)
+{
+  if (mergeinfo)
+    {
+      apr_hash_index_t *hi;
+
+      for (hi = apr_hash_first(scratch_pool, mergeinfo);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+          int i;
+
+          for (i = 0; i < rangelist->nelts; i++)
+            {
+              svn_merge_range_t *range = APR_ARRAY_IDX(rangelist, i,
+                                                       svn_merge_range_t *);
+              if (!range->inheritable)
+                return TRUE;
+            }
+        }
+    }
+  return FALSE;
+}
+
+svn_error_t *
+svn_mergeinfo__string_has_noninheritable(svn_boolean_t *is_noninheritable,
+                                         const char *mergeinfo_str,
+                                         apr_pool_t *scratch_pool)
+{
+  *is_noninheritable = FALSE;
+
+  if (mergeinfo_str)
+    {
+      svn_mergeinfo_t mergeinfo;
+
+      SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str, scratch_pool));
+      *is_noninheritable = svn_mergeinfo__is_noninheritable(mergeinfo,
+                                                            scratch_pool);
+    }
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/issue-3242-dev/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/libsvn_wc/props.c?rev=896226&r1=896225&r2=896226&view=diff
==============================================================================
--- subversion/branches/issue-3242-dev/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/issue-3242-dev/subversion/libsvn_wc/props.c Tue Jan  5 21:27:21 2010
@@ -2444,16 +2444,16 @@
       apr_hash_t *mergeinfo;
       svn_string_t *new_value_str;
 
+      SVN_ERR(svn_mergeinfo_parse(&mergeinfo, propval->data, pool));
 
       /* Non-inheritable mergeinfo is only valid on directories. */
       if (kind != svn_node_dir
-          && strstr(propval->data, SVN_MERGEINFO_NONINHERITABLE_STR))
+          && svn_mergeinfo__is_noninheritable(mergeinfo, pool))
         return svn_error_createf(
           SVN_ERR_MERGEINFO_PARSE_ERROR, NULL,
           _("Cannot set non-inheritable mergeinfo on a non-directory ('%s')"),
           svn_dirent_local_style(path, pool));
 
-      SVN_ERR(svn_mergeinfo_parse(&mergeinfo, propval->data, pool));
       SVN_ERR(svn_mergeinfo_to_string(&new_value_str, mergeinfo, pool));
       new_value = svn_stringbuf_create_from_string(new_value_str, pool);
     }

Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/authz_tests.py?rev=896226&r1=896225&r2=896226&view=diff
==============================================================================
--- subversion/branches/issue-3242-dev/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/authz_tests.py Tue Jan  5
21:27:21 2010
@@ -39,6 +39,7 @@
 XFail = svntest.testcase.XFail
 Skip = svntest.testcase.Skip
 SkipUnless = svntest.testcase.SkipUnless
+Wimp = svntest.testcase.Wimp
 
 ######################################################################
 # Tests
@@ -866,54 +867,42 @@
   "authz issue #3242 - access required at repo root"
 
   sbox.build(create_wc = False)
+  root_url = sbox.repo_url
+
+  # Create a copy-level copy of A, just so we have something to work with.
+  svntest.main.run_svn(None, 'cp', '-m', 'logmsg',
+                       root_url + '/A',
+                       root_url + '/A-copy')
 
+  # Now we get all restrictive.
   write_authz_file(sbox, {'/': '* =',
                           '/A': 'jrandom = rw',
                           '/A-copy': 'jrandom = rw'})
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
-  root_url = sbox.repo_url
-
-  # Do some copies and moves where the common parents of the single
-  # source and single destination is an unreadable root.
+  # Do some copies and moves where the common parents of the source(s)
+  # and destination(s) are unreadable.  All we currently hope to support
+  # is the case where the sources are individually (and recursively)
+  # readable, and the destination tree is writable.
 
-  svntest.main.run_svn(None, 'cp', '-m', 'logmsg',
-                       root_url + '/A',
-                       root_url + '/A-copy')
-  svntest.main.run_svn(None, 'cp', '-m', 'logmsg',
+  svntest.main.run_svn(None, 'cp',
+                       '-m', 'copy in readable space',
                        root_url + '/A/B',
                        root_url + '/A/B-copy')
-  svntest.main.run_svn(None, 'mv', '-m', 'logmsg',
+  svntest.main.run_svn(None, 'cp',
+                       '-m', 'copy across disjoint readable spaces',
                        root_url + '/A/B',
                        root_url + '/A-copy/B-copy')
-  svntest.main.run_svn(None, 'mv', '-m', 'logmsg',
-                       root_url + '/A-copy/B-copy',
-                       root_url + '/A/B')
-  svntest.main.run_svn(None, 'rm', '-m', 'logmsg',
-                       root_url + '/A-copy',
-                       root_url + '/A/B-copy')
-
-  # Move the high-water-mark of readability down a level, and repeat.
-
-  write_authz_file(sbox, {'/': '* =',
-                          '/A/B': 'jrandom = rw',
-                          '/A/B-copy': 'jrandom = rw'})
-  
-  svntest.main.run_svn(None, 'cp', '-m', 'logmsg',
+  svntest.main.run_svn(None, 'cp',
+                       '-m', 'multi-copy across disjoint readable spaces',
                        root_url + '/A/B',
-                       root_url + '/A/B-copy')
-  svntest.main.run_svn(None, 'cp', '-m', 'logmsg',
-                       root_url + '/A/B/E',
-                       root_url + '/A/B/E-copy')
-  svntest.main.run_svn(None, 'mv', '-m', 'logmsg',
-                       root_url + '/A/B/E',
-                       root_url + '/A/B-copy/E-copy')
-  svntest.main.run_svn(None, 'mv', '-m', 'logmsg',
-                       root_url + '/A/B-copy/E-copy',
-                       root_url + '/A/B/E')
-  svntest.main.run_svn(None, 'rm', '-m', 'logmsg',
-                       root_url + '/A/B-copy',
-                       root_url + '/A/B/E-copy')
+                       root_url + '/A/mu',
+                       root_url + '/A-copy/C')
+  svntest.main.run_svn(None, 'cp',
+                       '-m', 'copy from disjoint readable spaces',
+                       root_url + '/A/B/E/alpha',
+                       root_url + '/A-copy/B/E/beta',
+                       root_url + '/A-copy/C')
 
 ########################################################################
 # Run the tests
@@ -938,7 +927,8 @@
                                svntest.main.is_ra_type_svn)),
               XFail(Skip(authz_switch_to_directory,
                          svntest.main.is_ra_type_file)),
-              Skip(authz_access_required_at_repo_root,
+              Skip(XFail(authz_access_required_at_repo_root,
+                         svntest.main.is_ra_type_dav),
                    svntest.main.is_ra_type_file),
              ]
 



Mime
View raw message