You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/09/23 00:10:54 UTC

svn commit: r1525460 - in /subversion/trunk/subversion: include/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_serf/ libsvn_ra_svn/ mod_dav_svn/ mod_dav_svn/reports/ svnserve/

Author: stefan2
Date: Sun Sep 22 22:10:53 2013
New Revision: 1525460

URL: http://svn.apache.org/r1525460
Log:
Support the MOVes in the RA log API:
Bump svn_ra_get_log to support the move_behavior option.

For ra_serf, we add an optional move-behavior element to the LOG report.
If not given, it defaults to 1.8 behavior reporting all moves as adds.

For ra_svn, we append an optional integer parameter determining the
move-behavior option.  Same default behavior as above.

For ra_local, we simply call the new repos layer API directly.

* subversion/include/svn_ra.h
  (svn_ra_get_log3): declare bumped API
  (svn_ra_get_log2): deprecate

* subversion/libsvn_ra/deprecated.c
  (svn_ra_get_log2): implement in terms of svn_ra_get_log3

* subversion/libsvn_ra/ra_loader.h
  (svn_ra__vtable_t): add move_behavior parameter to get_log

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_get_log2): replaced by ...
  (svn_ra_get_log3): ... this; pass new paramter through to vtable

* subversion/libsvn_ra_local/ra_plugin.c
  (svn_ra_local__get_log): update to use new repos layer API

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__get_log): update declaration to match vtable.get_log

* subversion/libsvn_ra_serf/log.c
  (log_context_t): add move_behavior parameter
  (create_log_body): send it unless we want 1.8 behavior ("no moves")
  (svn_ra_serf__get_log): pass new parameter through

* subversion/mod_dav_svn/merge.c
  (do_resources): add move_behavior in case we want to call this function
                  from places other than dav_svn__merge_response;
                  handle the new change types
  (dav_svn__merge_response): report commit result as recorded

* subversion/libsvn_ra_svn/protocol
  (log): update protocol description

* subversion/mod_dav_svn/reports/log.c
  (dav_svn__log_report): parse new "move-behavior" element, if present;
                         call the latest repos layer log API

* subversion/libsvn_ra_svn/client.c
  (perform_ra_svn_log,
   ra_svn_log): append move_behavior option in log command request

* subversion/svnserve/serve.c
  (log_cmd): test for & get the new, optional move_behavior parameter;
             call the latest repos layer log API

* subversion/libsvn_ra/wrapper_template.h
  (compat_get_log): request 1.8 / "no moves" behavior

Modified:
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/libsvn_ra/deprecated.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.h
    subversion/trunk/subversion/libsvn_ra/wrapper_template.h
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
    subversion/trunk/subversion/libsvn_ra_serf/log.c
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_svn/client.c
    subversion/trunk/subversion/libsvn_ra_svn/protocol
    subversion/trunk/subversion/mod_dav_svn/merge.c
    subversion/trunk/subversion/mod_dav_svn/reports/log.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Sun Sep 22 22:10:53 2013
@@ -1481,6 +1481,9 @@ svn_ra_do_diff(svn_ra_session_t *session
  * If @a include_merged_revisions is set, log information for revisions
  * which have been merged to @a targets will also be returned.
  *
+ * @a move_behavior defines which changes are being reported as moves.
+ * See #svn_move_behavior_t for the various options.
+ *
  * If @a revprops is NULL, retrieve all revision properties; else, retrieve
  * only the revision properties named by the (const char *) array elements
  * (i.e. retrieve none if the array is empty).
@@ -1508,10 +1511,33 @@ svn_ra_do_diff(svn_ra_session_t *session
  * revprops is NULL or contains a revprop other than svn:author, svn:date,
  * or svn:log, an @c SVN_ERR_RA_NOT_IMPLEMENTED error is returned.
  *
- * @since New in 1.5.
+ * @since New in 1.9.
  */
 
 svn_error_t *
+svn_ra_get_log3(svn_ra_session_t *session,
+                const apr_array_header_t *paths,
+                svn_revnum_t start,
+                svn_revnum_t end,
+                int limit,
+                svn_boolean_t discover_changed_paths,
+                svn_boolean_t strict_node_history,
+                svn_boolean_t include_merged_revisions,
+                svn_move_behavior_t move_behavior,
+                const apr_array_header_t *revprops,
+                svn_log_entry_receiver_t receiver,
+                void *receiver_baton,
+                apr_pool_t *pool);
+
+/**
+ * Similar to svn_ra_get_log3(), but with @a move_behavior being set to
+ * #svn_fs_move_behavior_no_moves.
+ *
+ * @since New in 1.5.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
 svn_ra_get_log2(svn_ra_session_t *session,
                 const apr_array_header_t *paths,
                 svn_revnum_t start,

Modified: subversion/trunk/subversion/libsvn_ra/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/deprecated.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_ra/deprecated.c Sun Sep 22 22:10:53 2013
@@ -292,6 +292,25 @@ svn_error_t *svn_ra_do_diff(svn_ra_sessi
                          versus_url, diff_editor, diff_baton, pool);
 }
 
+svn_error_t *svn_ra_get_log2(svn_ra_session_t *session,
+                             const apr_array_header_t *paths,
+                             svn_revnum_t start,
+                             svn_revnum_t end,
+                             int limit,
+                             svn_boolean_t discover_changed_paths,
+                             svn_boolean_t strict_node_history,
+                             svn_boolean_t include_merged_revisions,
+                             const apr_array_header_t *revprops,
+                             svn_log_entry_receiver_t receiver,
+                             void *receiver_baton,
+                             apr_pool_t *pool)
+{
+  return svn_ra_get_log3(session, paths, start, end, limit,
+                         discover_changed_paths, strict_node_history,
+                         include_merged_revisions, svn_move_behavior_no_moves,
+                         revprops, receiver, receiver_baton, pool);
+}
+
 svn_error_t *svn_ra_get_log(svn_ra_session_t *session,
                             const apr_array_header_t *paths,
                             svn_revnum_t start,

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Sun Sep 22 22:10:53 2013
@@ -877,7 +877,7 @@ svn_error_t *svn_ra_do_diff3(svn_ra_sess
                                   diff_baton, pool);
 }
 
-svn_error_t *svn_ra_get_log2(svn_ra_session_t *session,
+svn_error_t *svn_ra_get_log3(svn_ra_session_t *session,
                              const apr_array_header_t *paths,
                              svn_revnum_t start,
                              svn_revnum_t end,
@@ -885,6 +885,7 @@ svn_error_t *svn_ra_get_log2(svn_ra_sess
                              svn_boolean_t discover_changed_paths,
                              svn_boolean_t strict_node_history,
                              svn_boolean_t include_merged_revisions,
+                             svn_move_behavior_t move_behavior,
                              const apr_array_header_t *revprops,
                              svn_log_entry_receiver_t receiver,
                              void *receiver_baton,
@@ -905,8 +906,8 @@ svn_error_t *svn_ra_get_log2(svn_ra_sess
 
   return session->vtable->get_log(session, paths, start, end, limit,
                                   discover_changed_paths, strict_node_history,
-                                  include_merged_revisions, revprops,
-                                  receiver, receiver_baton, pool);
+                                  include_merged_revisions, move_behavior,
+                                  revprops, receiver, receiver_baton, pool);
 }
 
 svn_error_t *svn_ra_check_path(svn_ra_session_t *session,

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.h?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.h Sun Sep 22 22:10:53 2013
@@ -194,6 +194,7 @@ typedef struct svn_ra__vtable_t {
                           svn_boolean_t discover_changed_paths,
                           svn_boolean_t strict_node_history,
                           svn_boolean_t include_merged_revisions,
+                          svn_move_behavior_t move_behavior,
                           const apr_array_header_t *revprops,
                           svn_log_entry_receiver_t receiver,
                           void *receiver_baton,

Modified: subversion/trunk/subversion/libsvn_ra/wrapper_template.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/wrapper_template.h?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/wrapper_template.h (original)
+++ subversion/trunk/subversion/libsvn_ra/wrapper_template.h Sun Sep 22 22:10:53 2013
@@ -395,6 +395,7 @@ static svn_error_t *compat_get_log(void 
   return VTBL.get_log(session_baton, paths, start, end, 0, /* limit */
                       discover_changed_paths, strict_node_history,
                       FALSE, /* include_merged_revisions */
+                      svn_move_behavior_no_moves,
                       svn_compat_log_revprops_in(pool), /* revprops */
                       receiver2, receiver2_baton, pool);
 }

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Sun Sep 22 22:10:53 2013
@@ -989,6 +989,7 @@ svn_ra_local__get_log(svn_ra_session_t *
                       svn_boolean_t discover_changed_paths,
                       svn_boolean_t strict_node_history,
                       svn_boolean_t include_merged_revisions,
+                      svn_move_behavior_t move_behavior,
                       const apr_array_header_t *revprops,
                       svn_log_entry_receiver_t receiver,
                       void *receiver_baton,
@@ -1017,7 +1018,7 @@ svn_ra_local__get_log(svn_ra_session_t *
   receiver = log_receiver_wrapper;
   receiver_baton = &lb;
 
-  return svn_repos_get_logs4(sess->repos,
+  return svn_repos_get_logs5(sess->repos,
                              abs_paths,
                              start,
                              end,
@@ -1025,6 +1026,7 @@ svn_ra_local__get_log(svn_ra_session_t *
                              discover_changed_paths,
                              strict_node_history,
                              include_merged_revisions,
+                             move_behavior,
                              revprops,
                              NULL, NULL,
                              receiver,

Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Sun Sep 22 22:10:53 2013
@@ -76,6 +76,7 @@ typedef struct log_context_t {
   svn_boolean_t changed_paths;
   svn_boolean_t strict_node_history;
   svn_boolean_t include_merged_revisions;
+  svn_move_behavior_t move_behavior;
   const apr_array_header_t *revprops;
   int nest_level; /* used to track mergeinfo nesting levels */
   int count; /* only incremented when nest_level == 0 */
@@ -451,6 +452,14 @@ create_log_body(serf_bucket_t **body_bkt
                                    alloc);
     }
 
+  if (log_ctx->move_behavior != svn_move_behavior_no_moves)
+    {
+      svn_ra_serf__add_tag_buckets(buckets,
+                                   "S:move-behavior",
+                                   apr_ltoa(pool, log_ctx->move_behavior),
+                                   alloc);
+    }
+
   if (log_ctx->revprops)
     {
       int i;
@@ -507,6 +516,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
                      svn_boolean_t discover_changed_paths,
                      svn_boolean_t strict_node_history,
                      svn_boolean_t include_merged_revisions,
+                     svn_move_behavior_t move_behavior,
                      const apr_array_header_t *revprops,
                      svn_log_entry_receiver_t receiver,
                      void *receiver_baton,
@@ -532,6 +542,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
   log_ctx->changed_paths = discover_changed_paths;
   log_ctx->strict_node_history = strict_node_history;
   log_ctx->include_merged_revisions = include_merged_revisions;
+  log_ctx->move_behavior = move_behavior;
   log_ctx->revprops = revprops;
   log_ctx->nest_level = 0;
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Sun Sep 22 22:10:53 2013
@@ -1498,6 +1498,7 @@ svn_ra_serf__get_log(svn_ra_session_t *s
                      svn_boolean_t discover_changed_paths,
                      svn_boolean_t strict_node_history,
                      svn_boolean_t include_merged_revisions,
+                     svn_move_behavior_t move_behavior,
                      const apr_array_header_t *revprops,
                      svn_log_entry_receiver_t receiver,
                      void *receiver_baton,

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Sun Sep 22 22:10:53 2013
@@ -1487,6 +1487,7 @@ perform_ra_svn_log(svn_error_t **outer_e
                    svn_boolean_t discover_changed_paths,
                    svn_boolean_t strict_node_history,
                    svn_boolean_t include_merged_revisions,
+                   svn_move_behavior_t move_behavior,
                    const apr_array_header_t *revprops,
                    svn_log_entry_receiver_t receiver,
                    void *receiver_baton,
@@ -1536,11 +1537,13 @@ perform_ra_svn_log(svn_error_t **outer_e
           else
             want_custom_revprops = TRUE;
         }
-      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
+      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)n)",
+                                      (apr_uint64_t) move_behavior));
     }
   else
     {
-      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!w())", "all-revprops"));
+      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!w()n)", "all-revprops",
+                                      (apr_uint64_t) move_behavior));
 
       want_author = TRUE;
       want_date = TRUE;
@@ -1712,6 +1715,7 @@ ra_svn_log(svn_ra_session_t *session,
            svn_boolean_t discover_changed_paths,
            svn_boolean_t strict_node_history,
            svn_boolean_t include_merged_revisions,
+           svn_move_behavior_t move_behavior,
            const apr_array_header_t *revprops,
            svn_log_entry_receiver_t receiver,
            void *receiver_baton, apr_pool_t *pool)
@@ -1726,7 +1730,7 @@ ra_svn_log(svn_ra_session_t *session,
                                            discover_changed_paths,
                                            strict_node_history,
                                            include_merged_revisions,
-                                           revprops,
+                                           move_behavior, revprops,
                                            receiver, receiver_baton,
                                            pool));
   return svn_error_trace(

Modified: subversion/trunk/subversion/libsvn_ra_svn/protocol
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/protocol?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/protocol (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/protocol Sun Sep 22 22:10:53 2013
@@ -382,11 +382,13 @@ second place for auth-request point as n
                 [ end-rev:number ] changed-paths:bool strict-node:bool
                 ? limit:number
                 ? include-merged-revisions:bool
-                all-revprops | revprops ( revprop:string ... ) )
+                all-revprops | revprops ( revprop:string ... )
+                ? move-behavior:number )
     Before sending response, server sends log entries, ending with "done".
     If a client does not want to specify a limit, it should send 0 as the
     limit parameter.  rev-props excludes author, date, and log; they are
     sent separately for backwards-compatibility.
+    Move-behavior is encoded like enum svn_move_behavior_t.
     log-entry: ( ( change:changed-path-entry ... ) rev:number
                  [ author:string ] [ date:string ] [ message:string ]
                  ? has-children:bool invalid-revnum:bool

Modified: subversion/trunk/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/merge.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/merge.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/merge.c Sun Sep 22 22:10:53 2013
@@ -115,6 +115,7 @@ static svn_error_t *
 do_resources(const dav_svn_repos *repos,
              svn_fs_root_t *root,
              svn_revnum_t revision,
+             svn_move_behavior_t move_behavior,
              ap_filter_t *output,
              apr_bucket_brigade *bb,
              apr_pool_t *pool)
@@ -129,7 +130,7 @@ do_resources(const dav_svn_repos *repos,
      and deleted things.  Also, note that deleted things don't merit
      responses of their own -- they are considered modifications to
      their parent.  */
-  SVN_ERR(svn_fs_paths_changed2(&changes, root, pool));
+  SVN_ERR(svn_fs_paths_changed3(&changes, root, move_behavior, pool));
 
   for (hi = apr_hash_first(pool, changes); hi; hi = apr_hash_next(hi))
     {
@@ -155,6 +156,8 @@ do_resources(const dav_svn_repos *repos,
 
         case svn_fs_path_change_add:
         case svn_fs_path_change_replace:
+        case svn_fs_path_change_move:
+        case svn_fs_path_change_movereplace:
           send_self = TRUE;
           send_parent = TRUE;
           break;
@@ -360,7 +363,10 @@ dav_svn__merge_response(ap_filter_t *out
          ### we can pass back the new version URL */
 
       /* and go make me proud, boy! */
-      serr = do_resources(repos, root, new_rev, output, bb, pool);
+      serr = do_resources(repos, root, new_rev,
+                          /* report changes with no further interpretation */
+                          svn_move_behavior_explicit_moves,
+                          output, bb, pool);
       if (serr != NULL)
         {
           return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,

Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Sun Sep 22 22:10:53 2013
@@ -301,6 +301,9 @@ dav_svn__log_report(const dav_resource *
   svn_boolean_t discover_changed_paths = FALSE;      /* off by default */
   svn_boolean_t strict_node_history = FALSE;         /* off by default */
   svn_boolean_t include_merged_revisions = FALSE;    /* off by default */
+  svn_move_behavior_t move_behavior = svn_move_behavior_no_moves;
+                                             /* no moves by default */
+  
   apr_array_header_t *revprops = apr_array_make(resource->pool, 3,
                                                 sizeof(const char *));
   apr_array_header_t *paths
@@ -395,6 +398,24 @@ dav_svn__log_report(const dav_resource *
                                     resource->pool);
           APR_ARRAY_PUSH(paths, const char *) = target;
         }
+      else if (strcmp(child->name, "move-behavior") == 0)
+        {
+          int move_behavior_param;
+          serr = svn_cstring_atoi(&move_behavior_param,
+                                  dav_xml_get_cdata(child, resource->pool, 1));
+          if (serr)
+            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+                                        "Malformed CDATA in element "
+                                        "\"move-behavior\"", resource->pool);
+
+          if (   move_behavior_param < 0
+              || move_behavior_param > svn_move_behavior_auto_moves)
+            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+                                        "Invalid CDATA in element "
+                                        "\"move-behavior\"", resource->pool);
+
+          move_behavior = (svn_move_behavior_t) move_behavior_param;
+        }
       /* else unknown element; skip it */
     }
 
@@ -424,7 +445,7 @@ dav_svn__log_report(const dav_resource *
      flag in our log_receiver_baton structure). */
 
   /* Send zero or more log items. */
-  serr = svn_repos_get_logs4(repos->repos,
+  serr = svn_repos_get_logs5(repos->repos,
                              paths,
                              start,
                              end,
@@ -432,6 +453,7 @@ dav_svn__log_report(const dav_resource *
                              discover_changed_paths,
                              strict_node_history,
                              include_merged_revisions,
+                             move_behavior,
                              revprops,
                              dav_svn__authz_read_func(&arb),
                              &arb,

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1525460&r1=1525459&r2=1525460&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Sun Sep 22 22:10:53 2013
@@ -2207,18 +2207,20 @@ static svn_error_t *log_cmd(svn_ra_svn_c
   char *revprop_word;
   svn_ra_svn_item_t *elt;
   int i;
-  apr_uint64_t limit, include_merged_revs_param;
+  apr_uint64_t limit, include_merged_revs_param, move_behavior_param;
+  svn_move_behavior_t move_behavior;
   log_baton_t lb;
   authz_baton_t ab;
 
   ab.server = b;
   ab.conn = conn;
 
-  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "l(?r)(?r)bb?n?Bwl", &paths,
+  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "l(?r)(?r)bb?n?Bwl?n", &paths,
                                   &start_rev, &end_rev, &send_changed_paths,
                                   &strict_node, &limit,
                                   &include_merged_revs_param,
-                                  &revprop_word, &revprop_items));
+                                  &revprop_word, &revprop_items,
+                                  &move_behavior_param));
 
   if (include_merged_revs_param == SVN_RA_SVN_UNSPECIFIED_NUMBER)
     include_merged_revisions = FALSE;
@@ -2250,6 +2252,16 @@ static svn_error_t *log_cmd(svn_ra_svn_c
                              _("Unknown revprop word '%s' in log command"),
                              revprop_word);
 
+  if (move_behavior_param == SVN_RA_SVN_UNSPECIFIED_NUMBER)
+    move_behavior = svn_move_behavior_no_moves;
+  else if (move_behavior_param <= svn_move_behavior_auto_moves)
+    move_behavior = (svn_move_behavior_t) move_behavior_param;
+  else
+    return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
+                             _("Invalid move_behavior value %"
+                               APR_UINT64_T_FMT " in log command"),
+                             move_behavior_param);
+
   /* If we got an unspecified number then the user didn't send us anything,
      so we assume no limit.  If it's larger than INT_MAX then someone is
      messing with us, since we know the svn client libraries will never send
@@ -2280,11 +2292,11 @@ static svn_error_t *log_cmd(svn_ra_svn_c
   lb.fs_path = b->fs_path->data;
   lb.conn = conn;
   lb.stack_depth = 0;
-  err = svn_repos_get_logs4(b->repos, full_paths, start_rev, end_rev,
+  err = svn_repos_get_logs5(b->repos, full_paths, start_rev, end_rev,
                             (int) limit, send_changed_paths, strict_node,
-                            include_merged_revisions, revprops,
-                            authz_check_access_cb_func(b), &ab, log_receiver,
-                            &lb, pool);
+                            include_merged_revisions, move_behavior,
+                            revprops, authz_check_access_cb_func(b),
+                            &ab, log_receiver, &lb, pool);
 
   write_err = svn_ra_svn__write_word(conn, pool, "done");
   if (write_err)



Re: svn commit: r1525460 - in /subversion/trunk/subversion: include/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_serf/ libsvn_ra_svn/ mod_dav_svn/ mod_dav_svn/reports/ svnserve/

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On 27 February 2014 15:35, Stefan Fuhrmann <st...@wandisco.com> wrote:
> On Mon, Feb 24, 2014 at 2:45 PM, Ivan Zhakov <iv...@visualsvn.com> wrote:
>>
>> On 23 September 2013 02:10,  <st...@apache.org> wrote:
>> > Author: stefan2
>> > Date: Sun Sep 22 22:10:53 2013
>> > New Revision: 1525460
>> >
>> > URL: http://svn.apache.org/r1525460
>> > Log:
>> > Support the MOVes in the RA log API:
>> > Bump svn_ra_get_log to support the move_behavior option.
>> >
>> Hi Stefan, see my comments inline.
>>
>> > For ra_serf, we add an optional move-behavior element to the LOG report.
>> > If not given, it defaults to 1.8 behavior reporting all moves as adds.
>> >
>> > For ra_svn, we append an optional integer parameter determining the
>> > move-behavior option.  Same default behavior as above.
>> >
>> mod_dav_svn change is not mention in log message btw.
>
>
> Hm. I see:
>
>
>> * subversion/mod_dav_svn/merge.c
>>   (do_resources): add move_behavior in case we want to call this function
>>                   from places other than dav_svn__merge_response;
>>                   handle the new change types
>>   (dav_svn__merge_response): report commit result as recorded
>
>
> What part is missing?
>
Oops, I missed it. Sorry.

>> >
>> > Modified: subversion/trunk/subversion/libsvn_ra_svn/protocol
>> > URL:
>> > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/protocol?rev=1525460&r1=1525459&r2=1525460&view=diff
>> >
>> > ==============================================================================
>> > --- subversion/trunk/subversion/libsvn_ra_svn/protocol (original)
>> > +++ subversion/trunk/subversion/libsvn_ra_svn/protocol Sun Sep 22
>> > 22:10:53 2013
>> > @@ -382,11 +382,13 @@ second place for auth-request point as n
>> >                  [ end-rev:number ] changed-paths:bool strict-node:bool
>> >                  ? limit:number
>> >                  ? include-merged-revisions:bool
>> > -                all-revprops | revprops ( revprop:string ... ) )
>> > +                all-revprops | revprops ( revprop:string ... )
>> > +                ? move-behavior:number )
>> >      Before sending response, server sends log entries, ending with
>> > "done".
>> >      If a client does not want to specify a limit, it should send 0 as
>> > the
>> >      limit parameter.  rev-props excludes author, date, and log; they
>> > are
>> >      sent separately for backwards-compatibility.
>> > +    Move-behavior is encoded like enum svn_move_behavior_t.
>> >      log-entry: ( ( change:changed-path-entry ... ) rev:number
>> >                   [ author:string ] [ date:string ] [ message:string ]
>> >                   ? has-children:bool invalid-revnum:bool
>> >
>> Currently Subversion uses symbolic names to marshal enums over the
>> wire. See svn_depth_t for example. I don't see reason why
>> svn_move_behavior_t should be different.
>
>
> Fair point. That should be modeled similarly to e.g. svn_depth_t.
> The code actually gets simpler using the string encoding.
>
> Mainly quick coding followed by a mere oversight.
> Both protocols have been updated in r1572044.
>

Great! Thanks!


-- 
Ivan Zhakov
CTO | VisualSVN | http://www.visualsvn.com

Re: svn commit: r1525460 - in /subversion/trunk/subversion: include/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_serf/ libsvn_ra_svn/ mod_dav_svn/ mod_dav_svn/reports/ svnserve/

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Mon, Feb 24, 2014 at 2:45 PM, Ivan Zhakov <iv...@visualsvn.com> wrote:

> On 23 September 2013 02:10,  <st...@apache.org> wrote:
> > Author: stefan2
> > Date: Sun Sep 22 22:10:53 2013
> > New Revision: 1525460
> >
> > URL: http://svn.apache.org/r1525460
> > Log:
> > Support the MOVes in the RA log API:
> > Bump svn_ra_get_log to support the move_behavior option.
> >
> Hi Stefan, see my comments inline.
>
> > For ra_serf, we add an optional move-behavior element to the LOG report.
> > If not given, it defaults to 1.8 behavior reporting all moves as adds.
> >
> > For ra_svn, we append an optional integer parameter determining the
> > move-behavior option.  Same default behavior as above.
> >
> mod_dav_svn change is not mention in log message btw.
>

Hm. I see:

* subversion/mod_dav_svn/merge.c
>   (do_resources): add move_behavior in case we want to call this function
>                   from places other than dav_svn__merge_response;
>                   handle the new change types
>   (dav_svn__merge_response): report commit result as recorded
>

What part is missing?


>
> >
> > Modified: subversion/trunk/subversion/libsvn_ra_svn/protocol
> > URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/protocol?rev=1525460&r1=1525459&r2=1525460&view=diff
> >
> ==============================================================================
> > --- subversion/trunk/subversion/libsvn_ra_svn/protocol (original)
> > +++ subversion/trunk/subversion/libsvn_ra_svn/protocol Sun Sep 22
> 22:10:53 2013
> > @@ -382,11 +382,13 @@ second place for auth-request point as n
> >                  [ end-rev:number ] changed-paths:bool strict-node:bool
> >                  ? limit:number
> >                  ? include-merged-revisions:bool
> > -                all-revprops | revprops ( revprop:string ... ) )
> > +                all-revprops | revprops ( revprop:string ... )
> > +                ? move-behavior:number )
> >      Before sending response, server sends log entries, ending with
> "done".
> >      If a client does not want to specify a limit, it should send 0 as
> the
> >      limit parameter.  rev-props excludes author, date, and log; they are
> >      sent separately for backwards-compatibility.
> > +    Move-behavior is encoded like enum svn_move_behavior_t.
> >      log-entry: ( ( change:changed-path-entry ... ) rev:number
> >                   [ author:string ] [ date:string ] [ message:string ]
> >                   ? has-children:bool invalid-revnum:bool
> >
> Currently Subversion uses symbolic names to marshal enums over the
> wire. See svn_depth_t for example. I don't see reason why
> svn_move_behavior_t should be different.
>

Fair point. That should be modeled similarly to e.g. svn_depth_t.
The code actually gets simpler using the string encoding.


> > Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
> > URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1525460&r1=1525459&r2=1525460&view=diff
> >
> ==============================================================================
> > --- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
> > +++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Sun Sep 22
> 22:10:53 2013
> > @@ -395,6 +398,24 @@ dav_svn__log_report(const dav_resource *
> >                                      resource->pool);
> >            APR_ARRAY_PUSH(paths, const char *) = target;
> >          }
> > +      else if (strcmp(child->name, "move-behavior") == 0)
> > +        {
> > +          int move_behavior_param;
> > +          serr = svn_cstring_atoi(&move_behavior_param,
> > +                                  dav_xml_get_cdata(child,
> resource->pool, 1));
> > +          if (serr)
> > +            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
> > +                                        "Malformed CDATA in element "
> > +                                        "\"move-behavior\"",
> resource->pool);
> > +
> > +          if (   move_behavior_param < 0
> > +              || move_behavior_param > svn_move_behavior_auto_moves)
> > +            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
> > +                                        "Invalid CDATA in element "
> > +                                        "\"move-behavior\"",
> resource->pool);
> > +
> > +          move_behavior = (svn_move_behavior_t) move_behavior_param;
> > +        }
> Same is here: why use numbers to encode svn_move_behavior_t instead of
> symbolic name?
>

Mainly quick coding followed by a mere oversight.
Both protocols have been updated in r1572044.

Thanks for the review!

-- Stefan^2.

Re: svn commit: r1525460 - in /subversion/trunk/subversion: include/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_serf/ libsvn_ra_svn/ mod_dav_svn/ mod_dav_svn/reports/ svnserve/

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On 23 September 2013 02:10,  <st...@apache.org> wrote:
> Author: stefan2
> Date: Sun Sep 22 22:10:53 2013
> New Revision: 1525460
>
> URL: http://svn.apache.org/r1525460
> Log:
> Support the MOVes in the RA log API:
> Bump svn_ra_get_log to support the move_behavior option.
>
Hi Stefan, see my comments inline.

> For ra_serf, we add an optional move-behavior element to the LOG report.
> If not given, it defaults to 1.8 behavior reporting all moves as adds.
>
> For ra_svn, we append an optional integer parameter determining the
> move-behavior option.  Same default behavior as above.
>
mod_dav_svn change is not mention in log message btw.

>
> Modified: subversion/trunk/subversion/libsvn_ra_svn/protocol
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/protocol?rev=1525460&r1=1525459&r2=1525460&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_ra_svn/protocol (original)
> +++ subversion/trunk/subversion/libsvn_ra_svn/protocol Sun Sep 22 22:10:53 2013
> @@ -382,11 +382,13 @@ second place for auth-request point as n
>                  [ end-rev:number ] changed-paths:bool strict-node:bool
>                  ? limit:number
>                  ? include-merged-revisions:bool
> -                all-revprops | revprops ( revprop:string ... ) )
> +                all-revprops | revprops ( revprop:string ... )
> +                ? move-behavior:number )
>      Before sending response, server sends log entries, ending with "done".
>      If a client does not want to specify a limit, it should send 0 as the
>      limit parameter.  rev-props excludes author, date, and log; they are
>      sent separately for backwards-compatibility.
> +    Move-behavior is encoded like enum svn_move_behavior_t.
>      log-entry: ( ( change:changed-path-entry ... ) rev:number
>                   [ author:string ] [ date:string ] [ message:string ]
>                   ? has-children:bool invalid-revnum:bool
>
Currently Subversion uses symbolic names to marshal enums over the
wire. See svn_depth_t for example. I don't see reason why
svn_move_behavior_t should be different.

> Modified: subversion/trunk/subversion/mod_dav_svn/merge.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/merge.c?rev=1525460&r1=1525459&r2=1525460&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/mod_dav_svn/merge.c (original)
> +++ subversion/trunk/subversion/mod_dav_svn/merge.c Sun Sep 22 22:10:53 2013
> @@ -115,6 +115,7 @@ static svn_error_t *
>  do_resources(const dav_svn_repos *repos,
>               svn_fs_root_t *root,
>               svn_revnum_t revision,
> +             svn_move_behavior_t move_behavior,
>               ap_filter_t *output,
>               apr_bucket_brigade *bb,
>               apr_pool_t *pool)
> @@ -129,7 +130,7 @@ do_resources(const dav_svn_repos *repos,
>       and deleted things.  Also, note that deleted things don't merit
>       responses of their own -- they are considered modifications to
>       their parent.  */
> -  SVN_ERR(svn_fs_paths_changed2(&changes, root, pool));
> +  SVN_ERR(svn_fs_paths_changed3(&changes, root, move_behavior, pool));
>
>    for (hi = apr_hash_first(pool, changes); hi; hi = apr_hash_next(hi))
>      {
> @@ -155,6 +156,8 @@ do_resources(const dav_svn_repos *repos,
>
>          case svn_fs_path_change_add:
>          case svn_fs_path_change_replace:
> +        case svn_fs_path_change_move:
> +        case svn_fs_path_change_movereplace:
>            send_self = TRUE;
>            send_parent = TRUE;
>            break;
> @@ -360,7 +363,10 @@ dav_svn__merge_response(ap_filter_t *out
>           ### we can pass back the new version URL */
>
>        /* and go make me proud, boy! */
> -      serr = do_resources(repos, root, new_rev, output, bb, pool);
> +      serr = do_resources(repos, root, new_rev,
> +                          /* report changes with no further interpretation */
> +                          svn_move_behavior_explicit_moves,
> +                          output, bb, pool);
>        if (serr != NULL)
>          {
>            return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
>
> Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1525460&r1=1525459&r2=1525460&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
> +++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Sun Sep 22 22:10:53 2013
> @@ -301,6 +301,9 @@ dav_svn__log_report(const dav_resource *
>    svn_boolean_t discover_changed_paths = FALSE;      /* off by default */
>    svn_boolean_t strict_node_history = FALSE;         /* off by default */
>    svn_boolean_t include_merged_revisions = FALSE;    /* off by default */
> +  svn_move_behavior_t move_behavior = svn_move_behavior_no_moves;
> +                                             /* no moves by default */
> +
>    apr_array_header_t *revprops = apr_array_make(resource->pool, 3,
>                                                  sizeof(const char *));
>    apr_array_header_t *paths
> @@ -395,6 +398,24 @@ dav_svn__log_report(const dav_resource *
>                                      resource->pool);
>            APR_ARRAY_PUSH(paths, const char *) = target;
>          }
> +      else if (strcmp(child->name, "move-behavior") == 0)
> +        {
> +          int move_behavior_param;
> +          serr = svn_cstring_atoi(&move_behavior_param,
> +                                  dav_xml_get_cdata(child, resource->pool, 1));
> +          if (serr)
> +            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
> +                                        "Malformed CDATA in element "
> +                                        "\"move-behavior\"", resource->pool);
> +
> +          if (   move_behavior_param < 0
> +              || move_behavior_param > svn_move_behavior_auto_moves)
> +            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
> +                                        "Invalid CDATA in element "
> +                                        "\"move-behavior\"", resource->pool);
> +
> +          move_behavior = (svn_move_behavior_t) move_behavior_param;
> +        }
Same is here: why use numbers to encode svn_move_behavior_t instead of
symbolic name?

-- 
Ivan Zhakov
CTO | VisualSVN | http://www.visualsvn.com