subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1476641 - in /subversion/trunk/subversion: include/private/svn_ra_svn_private.h libsvn_ra_svn/marshal.c svnserve/serve.c
Date Sat, 27 Apr 2013 17:37:35 GMT
Author: danielsh
Date: Sat Apr 27 17:37:34 2013
New Revision: 1476641

URL: http://svn.apache.org/r1476641
Log:
Allow ra_svn protocol parsing to use svn_tristate_t instead of
a non-robust combination of TRUE, FALSE, and a custom macro.

* subversion/include/private/svn_ra_svn_private.h
  (svn_ra_svn__parse_tuple): Add '3' format code, like 'B'.
    Deprecate 'B'.

* subversion/libsvn_ra_svn/marshal.c
  (svn_ra_svn__parse_tuple): Ditto.

* subversion/svnserve/serve.c
  (update, switch_cmd): Use '3' (svn_tristate_t) instead of 'B'.

Modified:
    subversion/trunk/subversion/include/private/svn_ra_svn_private.h
    subversion/trunk/subversion/libsvn_ra_svn/marshal.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/include/private/svn_ra_svn_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_ra_svn_private.h?rev=1476641&r1=1476640&r2=1476641&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_ra_svn_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_ra_svn_private.h Sat Apr 27 17:37:34 2013
@@ -186,6 +186,7 @@ svn_ra_svn__skip_leading_garbage(svn_ra_
      w     const char **          Word
      b     svn_boolean_t *        Word ("true" or "false")
      B     apr_uint64_t *         Word ("true" or "false")
+     3     svn_tristate_t *       Word ("true" or "false")
      l     apr_array_header_t **  List
      (                            Begin tuple
      )                            End tuple
@@ -196,14 +197,18 @@ svn_ra_svn__skip_leading_garbage(svn_ra_
  * the end of the specification.  So if @a fmt is "c?cc" and @a list
  * contains two elements, an error will result.
  *
- * 'B' is similar to 'b', but may be used in the optional tuple specification.
- * It returns TRUE, FALSE, or SVN_RA_SVN_UNSPECIFIED_NUMBER.
+ * '3' is similar to 'b', but may be used in the optional tuple specification.
+ * It returns #svn_tristate_true, #svn_tristate_false or #svn_tristate_unknown.
+ *
+ * 'B' is similar to '3', but it returns @c TRUE, @c FALSE, or
+ * #SVN_RA_SVN_UNSPECIFIED_NUMBER.  'B' is deprecated; new code should
+ * use '3' instead.
  *
  * If an optional part of a tuple contains no data, 'r' values will be
- * set to @c SVN_INVALID_REVNUM, 'n' and 'B' values will be set to
- * SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values
- * will be set to @c NULL.  'b' may not appear inside an optional
- * tuple specification; use 'B' instead.
+ * set to @c SVN_INVALID_REVNUM; 'n' and 'B' values will be set to
+ * #SVN_RA_SVN_UNSPECIFIED_NUMBER; 's', 'c', 'w', and 'l' values
+ * will be set to @c NULL; and '3' values will be set to #svn_tristate_unknown
+ * 'b' may not appear inside an optional tuple specification; use '3' instead.
  */
 svn_error_t *
 svn_ra_svn__parse_tuple(const apr_array_header_t *list,

Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1476641&r1=1476640&r2=1476641&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Sat Apr 27 17:37:34 2013
@@ -1230,6 +1230,15 @@ static svn_error_t *vparse_tuple(const a
           else
             break;
         }
+      else if (**fmt == '3' && elt->kind == SVN_RA_SVN_WORD)
+        {
+          if (strcmp(elt->u.word, "true") == 0)
+            *va_arg(*ap, svn_tristate_t *) = svn_tristate_true;
+          else if (strcmp(elt->u.word, "false") == 0)
+            *va_arg(*ap, svn_tristate_t *) = svn_tristate_false;
+          else
+            break;
+        }
       else if (**fmt == 'l' && elt->kind == SVN_RA_SVN_LIST)
         *va_arg(*ap, apr_array_header_t **) = elt->u.list;
       else if (**fmt == '(' && elt->kind == SVN_RA_SVN_LIST)
@@ -1268,6 +1277,9 @@ static svn_error_t *vparse_tuple(const a
             case 'n':
               *va_arg(*ap, apr_uint64_t *) = SVN_RA_SVN_UNSPECIFIED_NUMBER;
               break;
+            case '3':
+              *va_arg(*ap, svn_tristate_t *) = svn_tristate_unknown;
+              break;
             case '(':
               nesting_level++;
               break;

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1476641&r1=1476640&r2=1476641&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Sat Apr 27 17:37:34 2013
@@ -1815,15 +1815,15 @@ static svn_error_t *update(svn_ra_svn_co
   svn_revnum_t rev;
   const char *target, *full_path, *depth_word;
   svn_boolean_t recurse;
-  apr_uint64_t send_copyfrom_args; /* Optional; default FALSE */
-  apr_uint64_t ignore_ancestry; /* Optional; default FALSE */
+  svn_tristate_t send_copyfrom_args; /* Optional; default FALSE */
+  svn_tristate_t ignore_ancestry; /* Optional; default FALSE */
   /* Default to unknown.  Old clients won't send depth, but we'll
      handle that by converting recurse if necessary. */
   svn_depth_t depth = svn_depth_unknown;
   svn_boolean_t is_checkout;
 
   /* Parse the arguments. */
-  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cb?wB?B", &rev, &target,
+  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cb?w3?3", &rev, &target,
                                   &recurse, &depth_word,
                                   &send_copyfrom_args, &ignore_ancestry));
   target = svn_relpath_canonicalize(target, pool);
@@ -1843,8 +1843,8 @@ static svn_error_t *update(svn_ra_svn_co
   SVN_ERR(accept_report(&is_checkout, NULL,
                         conn, pool, b, rev, target, NULL, TRUE,
                         depth,
-                        (send_copyfrom_args == TRUE) /* send_copyfrom_args */,
-                        (ignore_ancestry == TRUE) /* ignore_ancestry */));
+                        (send_copyfrom_args == svn_tristate_true),
+                        (ignore_ancestry == svn_tristate_true)));
   if (is_checkout)
     {
       SVN_ERR(log_command(b, conn, pool, "%s",
@@ -1855,7 +1855,9 @@ static svn_error_t *update(svn_ra_svn_co
     {
       SVN_ERR(log_command(b, conn, pool, "%s",
                           svn_log__update(full_path, rev, depth,
-                                          send_copyfrom_args, pool)));
+                                          (send_copyfrom_args
+                                           == svn_tristate_true),
+                                          pool)));
     }
 
   return SVN_NO_ERROR;
@@ -1872,11 +1874,11 @@ static svn_error_t *switch_cmd(svn_ra_sv
   /* Default to unknown.  Old clients won't send depth, but we'll
      handle that by converting recurse if necessary. */
   svn_depth_t depth = svn_depth_unknown;
-  apr_uint64_t send_copyfrom_args; /* Optional; default FALSE */
-  apr_uint64_t ignore_ancestry; /* Optional; default TRUE */
+  svn_tristate_t send_copyfrom_args; /* Optional; default FALSE */
+  svn_tristate_t ignore_ancestry; /* Optional; default TRUE */
 
   /* Parse the arguments. */
-  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cbc?w?BB", &rev, &target,
+  SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cbc?w?33", &rev, &target,
                                   &recurse, &switch_url, &depth_word,
                                   &send_copyfrom_args, &ignore_ancestry));
   target = svn_relpath_canonicalize(target, pool);
@@ -1905,8 +1907,8 @@ static svn_error_t *switch_cmd(svn_ra_sv
   return accept_report(NULL, NULL,
                        conn, pool, b, rev, target, switch_path, TRUE,
                        depth,
-                       (send_copyfrom_args == TRUE) /* send_copyfrom_args */,
-                       (ignore_ancestry != FALSE) /* ignore_ancestry */);
+                       (send_copyfrom_args == svn_tristate_true),
+                       (ignore_ancestry != svn_tristate_false));
 }
 
 static svn_error_t *status(svn_ra_svn_conn_t *conn, apr_pool_t *pool,



Mime
View raw message