Author: philip
Date: Tue May 10 17:56:28 2011
New Revision: 1101567

URL: http://svn.apache.org/viewvc?rev=1101567&view=rev
Log:
Simplify the svn_wc__node_get_repos_info API and make the implementation
work in more cases.

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_repos_info): Remove scan parameters.
 
* subversion/libsvn_wc/wc.h
  (svn_wc__internal_get_repos_info): Remove scan parameters.

* subversion/libsvn_wc/node.c
  (svn_wc__internal_get_repos_info): Remove scan parameters, rework scan code.
  (svn_wc__node_get_repos_info): Remove scan parameters.

* subversion/libsvn_wc/update_editor.c
  (svn_wc_add_repos_file4): Switch to internal version.

* subversion/tests/libsvn_wc/entries-compat.c
  (test_access_baton_like_locking): Adjust call.

* subversion/libsvn_wc/info.c
  (build_info_for_entry, svn_wc__get_info): Adjust call.

* subversion/libsvn_client/externals.c
  (switch_dir_external, handle_externals_desc_change): Adjust call.

* subversion/libsvn_client/util.c
  (svn_client__get_repos_root): Adjust call.

* subversion/libsvn_client/merge.c
  (remove_noop_subtree_ranges, do_merge): Adjust call.

* subversion/libsvn_client/ra.c
  (svn_client__open_ra_session_internal, svn_client_uuid_from_path2): Adjust
   call.
 
* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo_catalog): Adjust call.

* subversion/libsvn_client/commit_util.c
  (svn_client__harvest_committables, harvest_copy_committables): Adjust call.

* subversion/tests/cmdline/copy_tests.py
  (def copy_url_shortcut): New.
  (test_list): Add new test.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_client/util.c
    subversion/trunk/subversion/libsvn_wc/info.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc.h
    subversion/trunk/subversion/tests/cmdline/copy_tests.py
    subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue May 10 
17:56:28 2011
@@ -246,14 +246,6 @@ svn_wc__node_get_children(const apr_arra
  * @a result_pool for result allocations. Note: the result may be NULL if the
  * given node has no repository root associated with it (e.g. locally added).
  *
- * If @a scan_added is TRUE, scan parents to find the intended repos root
- * and/or UUID of added nodes. Otherwise set @a *repos_root_url and
- * *repos_uuid to NULL for added nodes.
- *
- * If @a scan_deleted is TRUE, then scan the base information to find
- * the (former) repos root and/or UUID of deleted nodes. Otherwise set
- * @a *repos_root_url and *repos_uuid to NULL for deleted nodes.
- *
  * Either input value may be NULL, indicating no interest.
  */
 svn_error_t *
@@ -261,8 +253,6 @@ svn_wc__node_get_repos_info(const char *
                             const char **repos_uuid,
                             svn_wc_context_t *wc_ctx,
                             const char *local_abspath,
-                            svn_boolean_t scan_added,
-                            svn_boolean_t scan_deleted,
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue May 10 17:56:28 
2011
@@ -958,8 +958,8 @@ svn_client__harvest_committables(svn_cli
         }
 
       SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, NULL, wc_ctx,
-                                            target_abspath, TRUE, TRUE,
-                                            result_pool, iterpool));
+                                          target_abspath,
+                                          result_pool, iterpool));
 
       SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath, ctx->wc_ctx,
                                              target_abspath,
@@ -1058,7 +1058,7 @@ harvest_copy_committables(void *baton, v
   SVN_ERR_ASSERT(svn_dirent_is_absolute(pair->src_abspath_or_url));
 
   SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, NULL, btn->ctx->wc_ctx,
-                                      pair->src_abspath_or_url, TRUE, TRUE,
+                                      pair->src_abspath_or_url,
                                       pool, pool));
 
   commit_relpath = svn_path_uri_decode(svn_uri_skip_ancestor(

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Tue May 10 17:56:28 
2011
@@ -205,7 +205,7 @@ switch_dir_external(const char *local_ab
 
           SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, NULL,
                                               ctx->wc_ctx, local_abspath,
-                                              FALSE, FALSE, pool, subpool));
+                                              pool, subpool));
           if (repos_root_url)
             {
               /* URLs don't match.  Try to relocate (if necessary) and then
@@ -1170,7 +1170,7 @@ handle_externals_desc_change(const void 
   else
     SVN_ERR(svn_wc__node_get_repos_info(&ib.repos_root_url, NULL,
                                         cb->ctx->wc_ctx, local_abspath,
-                                        TRUE, FALSE, cb->pool, scratch_pool));
+                                        cb->pool, scratch_pool));
   ib.ctx               = cb->ctx;
   ib.is_export         = cb->is_export;
   ib.native_eol        = cb->native_eol;

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue May 10 17:56:28 2011
@@ -7902,7 +7902,7 @@ remove_noop_subtree_ranges(const char *u
 
   SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, NULL,
                                       merge_b->ctx->wc_ctx,
-                                      merge_b->target_abspath, FALSE, FALSE,
+                                      merge_b->target_abspath,
                                       scratch_pool, scratch_pool));
 
   /* Set up the log baton. */
@@ -8527,7 +8527,7 @@ do_merge(apr_hash_t **modified_subtrees,
   SVN_ERR(svn_wc__node_get_repos_info(&merge_cmd_baton.repos_root_url, NULL,
                                       ctx->wc_ctx,
                                       merge_cmd_baton.target_abspath,
-                                      TRUE, FALSE, pool, subpool));
+                                      pool, subpool));
   merge_cmd_baton.pool = subpool;
   merge_cmd_baton.merge_options = merge_options;
   merge_cmd_baton.diff3_cmd = diff3_cmd;

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Tue May 10 17:56:28 
2011
@@ -329,7 +329,7 @@ svn_client__get_wc_mergeinfo_catalog(svn
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   *mergeinfo_cat = NULL;
   SVN_ERR(svn_wc__node_get_repos_info(&repos_root, NULL,
-                                      ctx->wc_ctx, local_abspath, TRUE, FALSE,
+                                      ctx->wc_ctx, local_abspath,
                                       scratch_pool, scratch_pool));
   if (!repos_root)
     {

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Tue May 10 17:56:28 2011
@@ -289,8 +289,8 @@ svn_client__open_ra_session_internal(svn
   if (base_dir_abspath)
     {
       svn_error_t *err = svn_wc__node_get_repos_info(NULL, &uuid, ctx->wc_ctx,
-                                                     base_dir_abspath, FALSE,
-                                                     FALSE, pool, pool);
+                                                     base_dir_abspath,
+                                                     pool, pool);
 
       if (err && (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY
                   || err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
@@ -407,7 +407,7 @@ svn_client_uuid_from_path2(const char **
 {
   return svn_error_return(
     svn_wc__node_get_repos_info(NULL, uuid, ctx->wc_ctx, local_abspath,
-                                TRUE, TRUE, result_pool, scratch_pool));
+                                result_pool, scratch_pool));
 }
 
 

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Tue May 10 17:56:28 2011
@@ -194,7 +194,6 @@ svn_client__get_repos_root(const char **
     {
       SVN_ERR(svn_wc__node_get_repos_info(repos_root, NULL,
                                           ctx->wc_ctx, abspath_or_url,
-                                          TRUE, TRUE,
                                           result_pool, scratch_pool));
 
       return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Tue May 10 17:56:28 2011
@@ -90,8 +90,8 @@ build_info_for_entry(svn_info2_t **info,
     {
       SVN_ERR(svn_wc__internal_get_repos_info(&tmpinfo->repos_root_URL,
                                               &tmpinfo->repos_UUID,
-                                              db, local_abspath, TRUE,
-                                              TRUE, result_pool, 
scratch_pool));
+                                              db, local_abspath,
+                                              result_pool, scratch_pool));
     }
 
   if (repos_relpath)
@@ -413,7 +413,7 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
           SVN_ERR(svn_wc__internal_get_repos_info(&info->repos_root_URL,
                                                   &info->repos_UUID,
                                                   fe_baton.db,
-                                                  local_abspath, FALSE, FALSE,
+                                                  local_abspath,
                                                   iterpool, iterpool));
           APR_ARRAY_PUSH(conflicts, const svn_wc_conflict_description2_t *)
             = tree_conflict;

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue May 10 17:56:28 2011
@@ -143,8 +143,6 @@ svn_wc__internal_get_repos_info(const ch
                                 const char **repos_uuid,
                                 svn_wc__db_t *db,
                                 const char *local_abspath,
-                                svn_boolean_t scan_added,
-                                svn_boolean_t scan_deleted,
                                 apr_pool_t *result_pool,
                                 apr_pool_t *scratch_pool)
 {
@@ -157,51 +155,64 @@ svn_wc__internal_get_repos_info(const ch
                              NULL, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL,
-                             db, local_abspath, result_pool,
-                             scratch_pool);
+                             db, local_abspath,
+                             result_pool, scratch_pool);
   if (err)
     {
       if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
           && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
         return svn_error_return(err);
-
+ 
       /* This node is not versioned. Return NULL repos info.  */
       svn_error_clear(err);
-
+ 
       if (repos_root_url)
         *repos_root_url = NULL;
       if (repos_uuid)
         *repos_uuid = NULL;
       return SVN_NO_ERROR;
     }
-
-  if (scan_added && (status == svn_wc__db_status_added))
+ 
+  if (((repos_root_url && *repos_root_url) || !repos_root_url)
+      && ((repos_uuid && *repos_uuid) || !repos_uuid))
+    return SVN_NO_ERROR;
+ 
+  if (status == svn_wc__db_status_deleted)
+    {
+      const char *base_del_abspath, *wrk_del_abspath;
+ 
+      SVN_ERR(svn_wc__db_scan_deletion(&base_del_abspath, NULL,
+                                       &wrk_del_abspath,
+                                       db, local_abspath,
+                                       scratch_pool, scratch_pool));
+ 
+      if (base_del_abspath)
+        SVN_ERR(svn_wc__db_scan_base_repos(NULL,repos_root_url,
+                                           repos_uuid, db, base_del_abspath,
+                                           result_pool, scratch_pool));
+      else if (wrk_del_abspath)
+        SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
+                                         repos_root_url, repos_uuid,
+                                         NULL, NULL, NULL, NULL,
+                                         db, svn_dirent_dirname(
+                                                   wrk_del_abspath,
+                                                   scratch_pool),
+                                         result_pool, scratch_pool));
+    }
+  else if (status == svn_wc__db_status_added)
     {
       /* We have an addition. scan_addition() will find the intended
          repository location by scanning up the tree.  */
-      return svn_error_return(svn_wc__db_scan_addition(
-                                &status, NULL,
-                                NULL, repos_root_url, repos_uuid,
-                                NULL, NULL, NULL, NULL,
-                                db, local_abspath,
-                                result_pool, scratch_pool));
-    }
-
-  /* If we didn't get repository information, and the status means we are
-     looking at an unchanged BASE node, then scan upwards for repos info.  */
-  if (((repos_root_url != NULL && *repos_root_url == NULL)
-       || (repos_uuid != NULL && *repos_uuid == NULL))
-      && (status == svn_wc__db_status_normal
-          || status == svn_wc__db_status_absent
-          || status == svn_wc__db_status_excluded
-          || status == svn_wc__db_status_not_present
-          || (scan_deleted && (status == svn_wc__db_status_deleted))))
-    {
-      SVN_ERR(svn_wc__db_scan_base_repos(NULL, repos_root_url, repos_uuid,
-                                         db, local_abspath,
-                                         result_pool, scratch_pool));
+      SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
+                                       repos_root_url, repos_uuid,
+                                       NULL, NULL, NULL, NULL,
+                                       db, local_abspath,
+                                       result_pool, scratch_pool));
     }
-  /* else maybe a deletion, or an addition w/ SCAN_ADDED==FALSE.  */
+  else
+    SVN_ERR(svn_wc__db_scan_base_repos(NULL, repos_root_url, repos_uuid,
+                                       db, local_abspath,
+                                       result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -211,14 +222,12 @@ svn_wc__node_get_repos_info(const char *
                             const char **repos_uuid,
                             svn_wc_context_t *wc_ctx,
                             const char *local_abspath,
-                            svn_boolean_t scan_added,
-                            svn_boolean_t scan_deleted,
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool)
 {
   return svn_error_return(svn_wc__internal_get_repos_info(
-            repos_root_url, repos_uuid, wc_ctx->db, local_abspath, scan_added,
-            scan_deleted, result_pool, scratch_pool));
+            repos_root_url, repos_uuid, wc_ctx->db, local_abspath,
+            result_pool, scratch_pool));
 }
 
 /* Convert DB_KIND into the appropriate NODE_KIND value.

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue May 10 17:56:28 
2011
@@ -4789,13 +4789,11 @@ svn_wc_add_repos_file4(svn_wc_context_t 
     {
       /* Find the repository_root via the parent directory, which
          is always versioned before this function is called */
-      SVN_ERR(svn_wc__node_get_repos_info(&original_root_url,
-                                          &original_uuid,
-                                          wc_ctx,
-                                          dir_abspath,
-                                          TRUE /* scan_added */,
-                                          FALSE /* scan_deleted */,
-                                          pool, pool));
+      SVN_ERR(svn_wc__internal_get_repos_info(&original_root_url,
+                                              &original_uuid,
+                                              wc_ctx->db,
+                                              dir_abspath,
+                                              pool, pool));
 
       if (!svn_uri_is_ancestor(original_root_url, copyfrom_url))
         return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue May 10 17:56:28 2011
@@ -678,8 +678,6 @@ svn_wc__internal_get_repos_info(const ch
                                 const char **repos_uuid,
                                 svn_wc__db_t *db,
                                 const char *local_abspath,
-                                svn_boolean_t scan_added,
-                                svn_boolean_t scan_deleted,
                                 apr_pool_t *result_pool,
                                 apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Tue May 10 17:56:28 
2011
@@ -5083,6 +5083,41 @@ def copy_wc_url_with_absent(sbox):
                                         expected_status)
 
 
+def copy_url_shortcut(sbox):
+  "copy using URL shortcut source"
+
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+
+  # Can't use ^/A/D/G shortcut here because wc/X is unversioned.
+  svntest.actions.run_and_verify_svn(None, None, [], 'copy',
+                                     sbox.ospath('A/D/G'), sbox.ospath('X'))
+
+  svntest.actions.run_and_verify_svn(None, None, [], 'rm',
+                                     sbox.ospath('X/pi'))
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+    'X'     : Item(status='A ', copied='+', wc_rev='-'),
+    'X/pi'  : Item(status='D ', copied='+', wc_rev='-'),
+    'X/rho' : Item(status='  ', copied='+', wc_rev='-'),
+    'X/tau' : Item(status='  ', copied='+', wc_rev='-'),
+    })
+  svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
+  # Can use ^/A/D/G even though X/pi is a delete within a copy.
+  svntest.actions.run_and_verify_svn(None, None, [], 'copy',
+                                     '^/A/D/G/pi', sbox.ospath('X/pi'))
+  
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+    'X'     : Item(status='A ', copied='+', wc_rev='-'),
+    'X/pi'  : Item(status='R ', copied='+', wc_rev='-', entry_status='  '),
+    'X/rho' : Item(status='  ', copied='+', wc_rev='-'),
+    'X/tau' : Item(status='  ', copied='+', wc_rev='-'),
+    })
+
+  svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 ########################################################################
 # Run the tests
@@ -5188,6 +5223,7 @@ test_list = [ None,
               copy_wc_over_deleted_other_kind,
               move_wc_and_repo_dir_to_itself,
               copy_wc_url_with_absent,
+              copy_url_shortcut,
              ]
 
 if __name__ == '__main__':

Modified: subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c?rev=1101567&r1=1101566&r2=1101567&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c Tue May 10 
17:56:28 2011
@@ -648,7 +648,7 @@ test_access_baton_like_locking(apr_pool_
     svn_boolean_t is_root;
     SVN_ERR(svn_wc__node_get_url(&url, wc_ctx, local_abspath, pool, pool));
     SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, &repos_uuid,
-                                        wc_ctx, local_abspath, FALSE, FALSE,
+                                        wc_ctx, local_abspath,
                                         pool, pool));
 
     SVN_ERR(svn_io_make_dir_recursively(subdir, pool));


Reply via email to