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 2012/11/13 15:28:40 UTC

svn commit: r1408747 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c node.c wc.h

Author: rhuijben
Date: Tue Nov 13 14:28:39 2012
New Revision: 1408747

URL: http://svn.apache.org/viewvc?rev=1408747&view=rev
Log:
With the WC-NG dataformat completed since 1.7, we can simplify a condition
that just wants to check what we used to call the copyfrom location. As we
currently store this on every copied node, we can just fetch it in the
initial db transaction.

This is the notes/api-errata/1.7/wc002.txt workaround.

* subversion/libsvn_wc/adm_files.c
  (svn_wc__internal_ensure_adm): Fetch original_* and is_op_root use that
    instead of an ugly api that does the same thing.

* subversion/libsvn_wc/node.c
  (svn_wc__internal_get_copyfrom_info): Remove now unused internal api.

* subversion/libsvn_wc/wc.h
  (svn_wc__internal_get_copyfrom_info): Remove now unused internal api.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1408747&r1=1408746&r2=1408747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue Nov 13 14:28:39 2012
@@ -403,6 +403,9 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                             apr_pool_t *scratch_pool)
 {
   int format;
+  const char *original_repos_relpath;
+  const char *original_root_url;
+  svn_boolean_t is_op_root;
   const char *repos_relpath = svn_uri_skip_ancestor(repos_root_url, url,
                                                     scratch_pool);
   svn_wc__db_status_t status;
@@ -428,9 +431,10 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
   SVN_ERR(svn_wc__db_read_info(&status, NULL,
                                &db_revision, &db_repos_relpath,
                                &db_repos_root_url, &db_repos_uuid,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL,
+                               &original_repos_relpath, &original_root_url,
+                               NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, &is_op_root, NULL, NULL,
                                NULL, NULL, NULL,
                                db, local_abspath, scratch_pool, scratch_pool));
 
@@ -469,26 +473,17 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
 
       /* The caller gives us a URL which should match the entry. However,
          some callers compensate for an old problem in entry->url and pass
-         the copyfrom_url instead. See ^/notes/api-errata/wc002.txt. As
+         the copyfrom_url instead. See ^/notes/api-errata/1.7/wc002.txt. As
          a result, we allow the passed URL to match copyfrom_url if it
          does not match the entry's primary URL.  */
-      /* ### comparing URLs, should they be canonicalized first? */
       if (strcmp(db_repos_uuid, repos_uuid)
           || strcmp(db_repos_root_url, repos_root_url)
           || !svn_relpath_skip_ancestor(db_repos_relpath, repos_relpath))
         {
-          const char *copyfrom_root_url, *copyfrom_repos_relpath;
-
-          SVN_ERR(svn_wc__internal_get_copyfrom_info(&copyfrom_root_url,
-                                                     &copyfrom_repos_relpath,
-                                                     NULL, NULL, NULL,
-                                                     db, local_abspath,
-                                                     scratch_pool,
-                                                     scratch_pool));
-
-          if (copyfrom_root_url == NULL
-              || strcmp(copyfrom_root_url, repos_root_url)
-              || strcmp(copyfrom_repos_relpath, repos_relpath))
+          if (!is_op_root /* copy_from was set on op-roots only */
+              || original_root_url == NULL
+              || strcmp(original_root_url, repos_root_url)
+              || strcmp(original_repos_relpath, repos_relpath))
             return
               svn_error_createf(SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
                                 _("URL '%s' (uuid: '%s') doesn't match existing "

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1408747&r1=1408746&r2=1408747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Nov 13 14:28:39 2012
@@ -426,149 +426,6 @@ svn_wc__node_get_repos_relpath(const cha
                                                             scratch_pool));
 }
 
-svn_error_t *
-svn_wc__internal_get_copyfrom_info(const char **copyfrom_root_url,
-                                   const char **copyfrom_repos_relpath,
-                                   const char **copyfrom_url,
-                                   svn_revnum_t *copyfrom_rev,
-                                   svn_boolean_t *is_copy_target,
-                                   svn_wc__db_t *db,
-                                   const char *local_abspath,
-                                   apr_pool_t *result_pool,
-                                   apr_pool_t *scratch_pool)
-{
-  const char *original_root_url;
-  const char *original_repos_relpath;
-  svn_revnum_t original_revision;
-  svn_wc__db_status_t status;
-
-  if (copyfrom_root_url)
-    *copyfrom_root_url = NULL;
-  if (copyfrom_repos_relpath)
-    *copyfrom_repos_relpath = NULL;
-  if (copyfrom_url)
-    *copyfrom_url = NULL;
-  if (copyfrom_rev)
-    *copyfrom_rev = SVN_INVALID_REVNUM;
-  if (is_copy_target)
-    *is_copy_target = FALSE;
-
-  SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL,
-                               &original_repos_relpath,
-                               &original_root_url, NULL,
-                               &original_revision,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL,
-                               db, local_abspath, result_pool, scratch_pool));
-  if (original_root_url && original_repos_relpath)
-    {
-      /* If this was the root of the copy then the URL is immediately
-         available... */
-      const char *my_copyfrom_url;
-
-      if (copyfrom_url || is_copy_target)
-        my_copyfrom_url = svn_path_url_add_component2(original_root_url,
-                                                      original_repos_relpath,
-                                                      result_pool);
-
-      if (copyfrom_root_url)
-        *copyfrom_root_url = original_root_url;
-      if (copyfrom_repos_relpath)
-        *copyfrom_repos_relpath = original_repos_relpath;
-      if (copyfrom_url)
-        *copyfrom_url = my_copyfrom_url;
-
-      if (copyfrom_rev)
-        *copyfrom_rev = original_revision;
-
-      if (is_copy_target)
-        {
-          /* ### At this point we'd just set is_copy_target to TRUE, *but* we
-           * currently want to model wc-1 behaviour.  Particularly, this
-           * affects mixed-revision copies (e.g. wc-wc copy):
-           * - Wc-1 saw only the root of a mixed-revision copy as the copy's
-           *   root.
-           * - Wc-ng returns an explicit original_root_url,
-           *   original_repos_relpath pair for each subtree with mismatching
-           *   revision.
-           * We need to compensate for that: Find out if the parent of
-           * this node is also copied and has a matching copy_from URL. If so,
-           * nevermind the revision, just like wc-1 did, and say this was not
-           * a separate copy target. */
-          const char *parent_abspath;
-          const char *base_name;
-          const char *parent_copyfrom_url;
-
-          svn_dirent_split(&parent_abspath, &base_name, local_abspath,
-                           scratch_pool);
-
-          /* This is a copied node, so we should never fall off the top of a
-           * working copy here. */
-          SVN_ERR(svn_wc__internal_get_copyfrom_info(NULL, NULL,
-                                                     &parent_copyfrom_url,
-                                                     NULL, NULL,
-                                                     db, parent_abspath,
-                                                     scratch_pool,
-                                                     scratch_pool));
-
-          /* So, count this as a separate copy target only if the URLs
-           * don't match up, or if the parent isn't copied at all. */
-          if (parent_copyfrom_url == NULL
-              || strcmp(my_copyfrom_url,
-                        svn_path_url_add_component2(parent_copyfrom_url,
-                                                    base_name,
-                                                    scratch_pool)) != 0)
-            *is_copy_target = TRUE;
-        }
-    }
-  else if ((status == svn_wc__db_status_added)
-           && (copyfrom_rev || copyfrom_url || copyfrom_root_url
-               || copyfrom_repos_relpath))
-    {
-      /* ...But if this is merely the descendant of an explicitly
-         copied/moved directory, we need to do a bit more work to
-         determine copyfrom_url and copyfrom_rev. */
-      const char *op_root_abspath;
-
-      SVN_ERR(svn_wc__db_scan_addition(&status, &op_root_abspath, NULL, NULL,
-                                       NULL, &original_repos_relpath,
-                                       &original_root_url, NULL,
-                                       &original_revision, NULL, NULL, db,
-                                       local_abspath, result_pool, scratch_pool));
-      if (status == svn_wc__db_status_copied ||
-          status == svn_wc__db_status_moved_here)
-        {
-          const char *src_parent_url;
-          const char *src_relpath;
-
-          src_parent_url = svn_path_url_add_component2(original_root_url,
-                                                       original_repos_relpath,
-                                                       scratch_pool);
-          src_relpath = svn_dirent_is_child(op_root_abspath, local_abspath,
-                                            scratch_pool);
-          if (src_relpath)
-            {
-              if (copyfrom_root_url)
-                *copyfrom_root_url = original_root_url;
-              if (copyfrom_repos_relpath)
-                *copyfrom_repos_relpath = svn_relpath_join(
-                                            original_repos_relpath,
-                                            src_relpath, result_pool);
-              if (copyfrom_url)
-                *copyfrom_url = svn_path_url_add_component2(src_parent_url,
-                                                            src_relpath,
-                                                            result_pool);
-              if (copyfrom_rev)
-                *copyfrom_rev = original_revision;
-            }
-        }
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* A recursive node-walker, helper for svn_wc__internal_walk_children().
  *
  * Call WALK_CALLBACK with WALK_BATON on all children (recursively) of

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1408747&r1=1408746&r2=1408747&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Nov 13 14:28:39 2012
@@ -576,35 +576,6 @@ svn_wc__internal_node_get_schedule(svn_w
                                    const char *local_abspath,
                                    apr_pool_t *scratch_pool);
 
-/**
- * Set @a *copyfrom_url to the corresponding copy-from URL (allocated
- * from @a result_pool), and @a copyfrom_rev to the corresponding
- * copy-from revision, of @a local_abspath, using @a db.  Set @a
- * is_copy_target to TRUE iff @a local_abspath was the target of a
- * copy information (versus being a member of the subtree beneath such
- * a copy target).
- *
- * @a copyfrom_root_url and @a copyfrom_repos_relpath return the exact same
- * information as @a copyfrom_url, just still separated as root and relpath.
- *
- * If @a local_abspath is not copied, set @a *copyfrom_root_url,
- * @a *copyfrom_repos_relpath and @a copyfrom_url to NULL and
- * @a *copyfrom_rev to @c SVN_INVALID_REVNUM.
- *
- * Any out parameters may be NULL if the caller doesn't care about those
- * values.
- */
-svn_error_t *
-svn_wc__internal_get_copyfrom_info(const char **copyfrom_root_url,
-                                   const char **copyfrom_repos_relpath,
-                                   const char **copyfrom_url,
-                                   svn_revnum_t *copyfrom_rev,
-                                   svn_boolean_t *is_copy_target,
-                                   svn_wc__db_t *db,
-                                   const char *local_abspath,
-                                   apr_pool_t *result_pool,
-                                   apr_pool_t *scratch_pool);
-
 /* Internal version of svn_wc__node_get_origin() */
 svn_error_t *
 svn_wc__internal_get_origin(svn_boolean_t *is_copy,