You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/05/08 12:52:57 UTC

svn commit: r1100714 [3/3] - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_wc/adm_ops.c libsvn_wc/externals.c libsvn_wc/props.c

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1100714&r1=1100713&r2=1100714&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Sun May  8 10:52:56 2011
@@ -59,9 +59,6 @@
 
 #include "svn_private_config.h"
 
-/* #define TEST_DB_PROPS */
-
-
 /* Forward declaration.  */
 static const svn_string_t *
 message_from_skel(const svn_skel_t *skel,
@@ -2506,284 +2503,6 @@ svn_wc_get_prop_diffs2(apr_array_header_
                                     result_pool, scratch_pool));
 }
 
-
-
-/** Externals **/
-
-/*
- * Look for either
- *
- *   -r N
- *   -rN
- *
- * in the LINE_PARTS array and update the revision field in ITEM with
- * the revision if the revision is found.  Set REV_IDX to the index in
- * LINE_PARTS where the revision specification starts.  Remove from
- * LINE_PARTS the element(s) that specify the revision.
- * PARENT_DIRECTORY_DISPLAY and LINE are given to return a nice error
- * string.
- *
- * If this function returns successfully, then LINE_PARTS will have
- * only two elements in it.
- */
-static svn_error_t *
-find_and_remove_externals_revision(int *rev_idx,
-                                   const char **line_parts,
-                                   int num_line_parts,
-                                   svn_wc_external_item2_t *item,
-                                   const char *parent_directory_display,
-                                   const char *line,
-                                   apr_pool_t *pool)
-{
-  int i;
-
-  for (i = 0; i < 2; ++i)
-    {
-      const char *token = line_parts[i];
-
-      if (token[0] == '-' && token[1] == 'r')
-        {
-          svn_opt_revision_t end_revision = { svn_opt_revision_unspecified };
-          const char *digits_ptr;
-          int shift_count;
-          int j;
-
-          *rev_idx = i;
-
-          if (token[2] == '\0')
-            {
-              /* There must be a total of four elements in the line if
-                 -r N is used. */
-              if (num_line_parts != 4)
-                goto parse_error;
-
-              shift_count = 2;
-              digits_ptr = line_parts[i+1];
-            }
-          else
-            {
-              /* There must be a total of three elements in the line
-                 if -rN is used. */
-              if (num_line_parts != 3)
-                goto parse_error;
-
-              shift_count = 1;
-              digits_ptr = token+2;
-            }
-
-          if (svn_opt_parse_revision(&item->revision,
-                                     &end_revision,
-                                     digits_ptr, pool) != 0)
-            goto parse_error;
-          /* We want a single revision, not a range. */
-          if (end_revision.kind != svn_opt_revision_unspecified)
-            goto parse_error;
-          /* Allow only numbers and dates, not keywords. */
-          if (item->revision.kind != svn_opt_revision_number
-              && item->revision.kind != svn_opt_revision_date)
-            goto parse_error;
-
-          /* Shift any line elements past the revision specification
-             down over the revision specification. */
-          for (j = i; j < num_line_parts-shift_count; ++j)
-            line_parts[j] = line_parts[j+shift_count];
-          line_parts[num_line_parts-shift_count] = NULL;
-
-          /* Found the revision, so leave the function immediately, do
-           * not continue looking for additional revisions. */
-          return SVN_NO_ERROR;
-        }
-    }
-
-  /* No revision was found, so there must be exactly two items in the
-     line array. */
-  if (num_line_parts == 2)
-    return SVN_NO_ERROR;
-
- parse_error:
-  return svn_error_createf
-    (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-     _("Error parsing %s property on '%s': '%s'"),
-     SVN_PROP_EXTERNALS,
-     parent_directory_display,
-     line);
-}
-
-svn_error_t *
-svn_wc_parse_externals_description3(apr_array_header_t **externals_p,
-                                    const char *parent_directory,
-                                    const char *desc,
-                                    svn_boolean_t canonicalize_url,
-                                    apr_pool_t *pool)
-{
-  apr_array_header_t *lines = svn_cstring_split(desc, "\n\r", TRUE, pool);
-  int i;
-  const char *parent_directory_display = svn_path_is_url(parent_directory) ?
-    parent_directory : svn_dirent_local_style(parent_directory, pool);
-
-  if (externals_p)
-    *externals_p = apr_array_make(pool, 1, sizeof(svn_wc_external_item2_t *));
-
-  for (i = 0; i < lines->nelts; i++)
-    {
-      const char *line = APR_ARRAY_IDX(lines, i, const char *);
-      apr_status_t status;
-      char **line_parts;
-      int num_line_parts;
-      svn_wc_external_item2_t *item;
-      const char *token0;
-      const char *token1;
-      svn_boolean_t token0_is_url;
-      svn_boolean_t token1_is_url;
-
-      /* Index into line_parts where the revision specification
-         started. */
-      int rev_idx = -1;
-
-      if ((! line) || (line[0] == '#'))
-        continue;
-
-      /* else proceed */
-
-      status = apr_tokenize_to_argv(line, &line_parts, pool);
-      if (status)
-        return svn_error_wrap_apr(status,
-                                  _("Can't split line into components: '%s'"),
-                                  line);
-      /* Count the number of tokens. */
-      for (num_line_parts = 0; line_parts[num_line_parts]; num_line_parts++)
-        ;
-
-      SVN_ERR(svn_wc_external_item_create
-              ((const svn_wc_external_item2_t **) &item, pool));
-      item->revision.kind = svn_opt_revision_unspecified;
-      item->peg_revision.kind = svn_opt_revision_unspecified;
-
-      /*
-       * There are six different formats of externals:
-       *
-       * 1) DIR URL
-       * 2) DIR -r N URL
-       * 3) DIR -rN  URL
-       * 4) URL DIR
-       * 5) -r N URL DIR
-       * 6) -rN URL DIR
-       *
-       * The last three allow peg revisions in the URL.
-       *
-       * With relative URLs and no '-rN' or '-r N', there is no way to
-       * distinguish between 'DIR URL' and 'URL DIR' when URL is a
-       * relative URL like /svn/repos/trunk, so this case is taken as
-       * case 4).
-       */
-      if (num_line_parts < 2 || num_line_parts > 4)
-        return svn_error_createf
-          (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-           _("Error parsing %s property on '%s': '%s'"),
-           SVN_PROP_EXTERNALS,
-           parent_directory_display,
-           line);
-
-      /* To make it easy to check for the forms, find and remove -r N
-         or -rN from the line item array.  If it is found, rev_idx
-         contains the index into line_parts where '-r' was found and
-         set item->revision to the parsed revision. */
-      /* ### ugh. stupid cast. */
-      SVN_ERR(find_and_remove_externals_revision(&rev_idx,
-                                                 (const char **)line_parts,
-                                                 num_line_parts, item,
-                                                 parent_directory_display,
-                                                 line, pool));
-
-      token0 = line_parts[0];
-      token1 = line_parts[1];
-
-      token0_is_url = svn_path_is_url(token0);
-      token1_is_url = svn_path_is_url(token1);
-
-      if (token0_is_url && token1_is_url)
-        return svn_error_createf
-          (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-           _("Invalid %s property on '%s': "
-             "cannot use two absolute URLs ('%s' and '%s') in an external; "
-             "one must be a path where an absolute or relative URL is "
-             "checked out to"),
-           SVN_PROP_EXTERNALS, parent_directory_display, token0, token1);
-
-      if (0 == rev_idx && token1_is_url)
-        return svn_error_createf
-          (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-           _("Invalid %s property on '%s': "
-             "cannot use a URL '%s' as the target directory for an external "
-             "definition"),
-           SVN_PROP_EXTERNALS, parent_directory_display, token1);
-
-      if (1 == rev_idx && token0_is_url)
-        return svn_error_createf
-          (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-           _("Invalid %s property on '%s': "
-             "cannot use a URL '%s' as the target directory for an external "
-             "definition"),
-           SVN_PROP_EXTERNALS, parent_directory_display, token0);
-
-      /* The appearence of -r N or -rN forces the type of external.
-         If -r is at the beginning of the line or the first token is
-         an absolute URL or if the second token is not an absolute
-         URL, then the URL supports peg revisions. */
-      if (0 == rev_idx ||
-          (-1 == rev_idx && (token0_is_url || ! token1_is_url)))
-        {
-          /* The URL is passed to svn_opt_parse_path in
-             uncanonicalized form so that the scheme relative URL
-             //hostname/foo is not collapsed to a server root relative
-             URL /hostname/foo. */
-          SVN_ERR(svn_opt_parse_path(&item->peg_revision, &item->url,
-                                     token0, pool));
-          item->target_dir = token1;
-        }
-      else
-        {
-          item->target_dir = token0;
-          item->url = token1;
-          item->peg_revision = item->revision;
-        }
-
-      SVN_ERR(svn_opt_resolve_revisions(&item->peg_revision,
-                                        &item->revision, TRUE, FALSE,
-                                        pool));
-
-      item->target_dir = svn_dirent_internal_style(item->target_dir, pool);
-
-      if (item->target_dir[0] == '\0' || item->target_dir[0] == '/'
-          || svn_path_is_backpath_present(item->target_dir))
-        return svn_error_createf
-          (SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION, NULL,
-           _("Invalid %s property on '%s': "
-             "target '%s' is an absolute path or involves '..'"),
-           SVN_PROP_EXTERNALS,
-           parent_directory_display,
-           item->target_dir);
-
-      if (canonicalize_url)
-        {
-          /* Uh... this is stupid.  But it's consistent with what our
-             code did before we split up the relpath/dirent/uri APIs.
-             Still, given this, it's no wonder that our own libraries
-             don't ask this function to canonicalize the results.  */
-          if (svn_path_is_url(item->url))
-            item->url = svn_uri_canonicalize(item->url, pool);
-          else
-            item->url = svn_dirent_canonicalize(item->url, pool);
-        }
-
-      if (externals_p)
-        APR_ARRAY_PUSH(*externals_p, svn_wc_external_item2_t *) = item;
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 svn_boolean_t
 svn_wc__has_magic_property(const apr_array_header_t *properties)
 {