You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2013/02/12 11:12:21 UTC

svn commit: r1445083 - in /subversion/trunk/subversion: include/svn_dav.h libsvn_ra_serf/options.c mod_dav_svn/version.c

Author: ivan
Date: Tue Feb 12 10:12:20 2013
New Revision: 1445083

URL: http://svn.apache.org/r1445083
Log:
Report repository merge tracking capability using HTTPv2 like header 
'SVN-Repository-MergeInfo'.

* subversion/include/svn_dav.h
  (SVN_DAV_REPOSITORY_MERGEINFO): New.

* subversion/libsvn_ra_serf/options.c
  (capabilities_headers_iterator_callback): Set SVN_RA_CAPABILITY_MERGEINFO
   to CAPABILITY_SERVER_YES only if didn't receive explicit repository merge
   tracking capability. Handle new SVN_DAV_REPOSITORY_MERGEINFO header.
  (options_response_handler): Reset SVN_RA_CAPABILITY_MERGEINFO to NULL 
   before iterating headers. 

* subversion/mod_dav_svn/version.c
  (get_option): Report repository merge tracking capability using 
   SVN_DAV_REPOSITORY_MERGEINFO header.

Modified:
    subversion/trunk/subversion/include/svn_dav.h
    subversion/trunk/subversion/libsvn_ra_serf/options.c
    subversion/trunk/subversion/mod_dav_svn/version.c

Modified: subversion/trunk/subversion/include/svn_dav.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_dav.h?rev=1445083&r1=1445082&r2=1445083&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_dav.h (original)
+++ subversion/trunk/subversion/include/svn_dav.h Tue Feb 12 10:12:20 2013
@@ -198,6 +198,13 @@ extern "C" {
  * @since New in 1.8.   */
 #define SVN_DAV_ALLOW_BULK_UPDATES "SVN-Allow-Bulk-Updates"
 
+/** Assuming the OPTIONS was performed against a resource within a
+ * Subversion repository, then this header indicates the whether repository
+ * is capable to store merge tracking information ("yes") or it
+ * does not ("no").
+ * @since New in 1.8.  */
+#define SVN_DAV_REPOSITORY_MERGEINFO "SVN-Repository-MergeInfo"
+
 /**
  * @name Fulltext MD5 headers
  *

Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1445083&r1=1445082&r2=1445083&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Tue Feb 12 10:12:20 2013
@@ -177,8 +177,11 @@ capabilities_headers_iterator_callback(v
         {
           /* The server doesn't know what repository we're referring
              to, so it can't just say capability_yes. */
-          svn_hash_sets(session->capabilities,
-                        SVN_RA_CAPABILITY_MERGEINFO, capability_server_yes);
+          if (!svn_hash_gets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO))
+            {
+              svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO,
+                            capability_server_yes);
+            }
         }
       if (svn_cstring_match_list(SVN_DAV_NS_DAV_SVN_LOG_REVPROPS, vals))
         {
@@ -300,6 +303,19 @@ capabilities_headers_iterator_callback(v
               svn_hash_sets(session->supported_posts, post_val, (void *)1);
             }
         }
+      else if (svn_cstring_casecmp(key, SVN_DAV_REPOSITORY_MERGEINFO) == 0)
+        {
+          if (svn_cstring_casecmp(val, "yes") == 0)
+            {
+              svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO,
+                            capability_yes);
+            }
+          else if (svn_cstring_casecmp(val, "no") == 0)
+            {
+              svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO,
+                            capability_no);
+            }
+        }
     }
 
   return 0;
@@ -329,7 +345,7 @@ options_response_handler(serf_request_t 
       svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_DEPTH,
                     capability_no);
       svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO,
-                    capability_no);
+                    NULL);
       svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_LOG_REVPROPS,
                     capability_no);
       svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_ATOMIC_REVPROPS,
@@ -343,6 +359,12 @@ options_response_handler(serf_request_t 
       serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback,
                              opt_ctx);
 
+      /* Assume mergeinfo capability unsupported, if didn't recieve information
+         about server or repository mergeinfo capability. */
+      if (!svn_hash_gets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO))
+        svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_MERGEINFO,
+                      capability_no);
+
       opt_ctx->headers_processed = TRUE;
     }
 

Modified: subversion/trunk/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/version.c?rev=1445083&r1=1445082&r2=1445083&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/version.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/version.c Tue Feb 12 10:12:20 2013
@@ -242,6 +242,24 @@ get_option(const dav_resource *resource,
         }
     }
 
+  if (resource->info->repos->repos)
+    {
+        svn_error_t *serr;
+        svn_boolean_t has;
+
+        serr = svn_repos_has_capability(resource->info->repos->repos, &has,
+                                        SVN_REPOS_CAPABILITY_MERGEINFO,
+                                        r->pool);
+        if (serr)
+        return dav_svn__convert_err
+                    (serr, HTTP_INTERNAL_SERVER_ERROR,
+                    "Error fetching repository capabilities",
+                    resource->pool);
+
+        apr_table_set(r->headers_out, SVN_DAV_REPOSITORY_MERGEINFO,
+                    has ? "yes" : "no");
+    }
+
   /* Welcome to the 2nd generation of the svn HTTP protocol, now
      DeltaV-free!  If we're configured to advise this support, do so.  */
   if (resource->info->repos->v2_protocol)