subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1661476 - in /subversion/trunk/subversion: libsvn_wc/info.c libsvn_wc/node.c libsvn_wc/translate.c libsvn_wc/wc.h libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/cmdline/info_tests.py
Date Sun, 22 Feb 2015 14:08:44 GMT
Author: rhuijben
Date: Sun Feb 22 14:08:43 2015
New Revision: 1661476

URL: http://svn.apache.org/r1661476
Log:
Fix 'svn info'-s url calculation on a few status values where it previously
performed unneeded work (or could cause a segfault. See regression test).

To do this combine the db-operation to fetch the intended url and the
node function to fetch the intended commit location.

This saves a few more db queries in info and merge calculations, and
fixes a few corner cases. (E.g. repos_root_url could be null in keyword
expansion, while url wasn't)

* subversion/libsvn_wc/info.c
  (build_info_for_node): Remove intermediate calculations of url based
    on original_* as the values were ignored anyway. (Because this
    is an invalid approach)
    Use svn_wc__db_read_repos_info() read info to obtain a bit more than
    just the url, to avoid more db queries.
  (svn_wc__get_info): Update caller.

* subversion/libsvn_wc/node.c
  (svn_wc__internal_get_repos_info): Remove function. Use db variant.
  (svn_wc__node_get_repos_info): Update caller.
  (svn_wc__node_get_url): Update caller.

* subversion/libsvn_wc/translate.c
  (svn_wc__expand_keywords): Update caller.

* subversion/libsvn_wc/wc_db.c
  (read_url_txn): Rename to...
  (db_read_repos_info): ... this and return more detailed repository.
    information. Prefer working delete information over base delete
    to handle fetching revision, and to avoid being fooled by switches.
  (svn_wc__db_read_url): Rename to...
  (svn_wc__db_read_repos_info): ... this and provide more info.

* subversion/libsvn_wc/wc.h
  (svn_wc__internal_get_repos_info): Remove function.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_read_url): Rename to...
  (svn_wc__db_read_repos_info): ... this.

* subversion/tests/cmdline/info_tests.py
  (node_hidden_info): New test.
  (test_list): Add node_hidden_info.

Modified:
    subversion/trunk/subversion/libsvn_wc/info.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/translate.c
    subversion/trunk/subversion/libsvn_wc/wc.h
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/cmdline/info_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Sun Feb 22 14:08:43 2015
@@ -141,7 +141,6 @@ build_info_for_node(svn_wc__info2_t **in
         {
           /* Root or child of copy */
           tmpinfo->rev = original_revision;
-          repos_relpath = original_repos_relpath;
 
           if (op_root)
             {
@@ -167,34 +166,6 @@ build_info_for_node(svn_wc__info2_t **in
                 }
             }
         }
-      else if (op_root)
-        {
-          /* Local addition */
-          SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, &repos_relpath,
-                                           &tmpinfo->repos_root_URL,
-                                           &tmpinfo->repos_UUID,
-                                           NULL, NULL, NULL, NULL,
-                                           db, local_abspath,
-                                           result_pool, scratch_pool));
-
-          if (have_base)
-            SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, &tmpinfo->rev, NULL,
-                                             NULL, NULL, NULL, NULL, NULL,
-                                             NULL, NULL, NULL, NULL, NULL,
-                                             NULL, NULL,
-                                             db, local_abspath,
-                                             scratch_pool, scratch_pool));
-        }
-      else
-        {
-          /* Child of copy. ### Not WC-NG like */
-          SVN_ERR(svn_wc__internal_get_origin(NULL, &tmpinfo->rev,
-                                              &repos_relpath,
-                                              &tmpinfo->repos_root_URL,
-                                              &tmpinfo->repos_UUID, NULL, NULL,
-                                              db, local_abspath, TRUE,
-                                              result_pool, scratch_pool));
-        }
 
       /* ### We should be able to avoid both these calls with the information
          from read_info() in most cases */
@@ -222,14 +193,21 @@ build_info_for_node(svn_wc__info2_t **in
           else
             wc_info->schedule = svn_wc_schedule_add;
         }
-      SVN_ERR(svn_wc__db_read_url(&tmpinfo->URL, db, local_abspath,
-                                result_pool, scratch_pool));
+      SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath,
+                                         &tmpinfo->repos_root_URL,
+                                         &tmpinfo->repos_UUID,
+                                         db, local_abspath,
+                                         result_pool, scratch_pool));
+
+      tmpinfo->URL = svn_path_url_add_component2(tmpinfo->repos_root_URL,
+                                                 repos_relpath, result_pool);
     }
   else if (status == svn_wc__db_status_deleted)
     {
       const char *work_del_abspath;
+      svn_wc__db_status_t w_status;
 
-      SVN_ERR(svn_wc__db_read_pristine_info(NULL, NULL,
+      SVN_ERR(svn_wc__db_read_pristine_info(&w_status, &tmpinfo->kind,
                                             &tmpinfo->last_changed_rev,
                                             &tmpinfo->last_changed_date,
                                             &tmpinfo->last_changed_author,
@@ -239,51 +217,28 @@ build_info_for_node(svn_wc__info2_t **in
                                             db, local_abspath,
                                             result_pool, scratch_pool));
 
+      if (w_status == svn_wc__db_status_deleted)
+        {
+          /* We have a working not-present status... */
+          *info = NULL;
+          return SVN_NO_ERROR;
+        }
+
       /* And now fetch the url and revision of what will be deleted */
       SVN_ERR(svn_wc__db_scan_deletion(NULL, &wc_info->moved_to_abspath,
-                                       &work_del_abspath, NULL,
+                                       NULL, NULL,
                                        db, local_abspath,
                                        scratch_pool, scratch_pool));
-      if (work_del_abspath != NULL)
-        {
-          /* This is a deletion within a copied subtree. Get the copied-from
-           * revision. */
-          const char *added_abspath = svn_dirent_dirname(work_del_abspath,
-                                                         scratch_pool);
-
-          SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, &repos_relpath,
-                                           &tmpinfo->repos_root_URL,
-                                           &tmpinfo->repos_UUID,
-                                           NULL, NULL, NULL,
-                                           &tmpinfo->rev,
-                                           db, added_abspath,
-                                           result_pool, scratch_pool));
-
-          tmpinfo->URL = svn_path_url_add_component2(
-                              tmpinfo->repos_root_URL,
-                              svn_relpath_join(repos_relpath,
-                                    svn_dirent_skip_ancestor(added_abspath,
-                                                             local_abspath),
-                                    scratch_pool),
-                              result_pool);
-        }
-      else
-        {
-          SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, &tmpinfo->rev,
-                                           &repos_relpath,
-                                           &tmpinfo->repos_root_URL,
-                                           &tmpinfo->repos_UUID, NULL, NULL,
-                                           NULL, NULL, NULL, NULL,
-                                           NULL, NULL, NULL, NULL,
-                                           db, local_abspath,
-                                           result_pool, scratch_pool));
-
-          tmpinfo->URL = svn_path_url_add_component2(tmpinfo->repos_root_URL,
-                                                     repos_relpath,
-                                                     result_pool);
-        }
+
+      SVN_ERR(svn_wc__db_read_repos_info(&tmpinfo->rev, &repos_relpath,
+                                         &tmpinfo->repos_root_URL,
+                                         &tmpinfo->repos_UUID,
+                                         db, local_abspath,
+                                         result_pool, scratch_pool));
 
       wc_info->schedule = svn_wc_schedule_delete;
+      tmpinfo->URL = svn_path_url_add_component2(tmpinfo->repos_root_URL,
+                                                 repos_relpath, result_pool);
     }
   else if (status == svn_wc__db_status_not_present
            || status == svn_wc__db_status_server_excluded)
@@ -291,6 +246,21 @@ build_info_for_node(svn_wc__info2_t **in
       *info = NULL;
       return SVN_NO_ERROR;
     }
+  else if (status == svn_wc__db_status_excluded && !repos_relpath)
+    {
+      /* We have a WORKING exclude. Avoid segfault on no repos info */
+
+      SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath,
+                                         &tmpinfo->repos_root_URL,
+                                         &tmpinfo->repos_UUID,
+                                         db, local_abspath,
+                                         result_pool, scratch_pool));
+
+      wc_info->schedule = svn_wc_schedule_normal;
+      tmpinfo->URL = svn_path_url_add_component2(tmpinfo->repos_root_URL,
+                                                 repos_relpath, result_pool);
+      tmpinfo->wc_info->depth = svn_depth_exclude;
+    }
   else
     {
       /* Just a BASE node. We have all the info we need */
@@ -298,10 +268,10 @@ build_info_for_node(svn_wc__info2_t **in
                                                  repos_relpath,
                                                  result_pool);
       wc_info->schedule = svn_wc_schedule_normal;
-    }
 
-  if (status == svn_wc__db_status_excluded)
-    tmpinfo->wc_info->depth = svn_depth_exclude;
+      if (status == svn_wc__db_status_excluded)
+        wc_info->depth = svn_depth_exclude;
+    }
 
   /* A default */
   tmpinfo->size = SVN_INVALID_FILESIZE;
@@ -544,15 +514,14 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
 
       if (!repos_root_url)
         {
-          SVN_ERR(svn_wc__internal_get_repos_info(NULL, NULL,
-                                                  &repos_root_url,
-                                                  &repos_uuid,
-                                                  wc_ctx->db,
-                                                  svn_dirent_dirname(
+          SVN_ERR(svn_wc__db_read_repos_info(NULL, NULL,
+                                             &repos_root_url,
+                                             &repos_uuid,
+                                             wc_ctx->db,
+                                             svn_dirent_dirname(
                                                             this_abspath,
                                                             iterpool),
-                                                  scratch_pool,
-                                                  iterpool));
+                                             scratch_pool, iterpool));
         }
 
       info->repos_root_URL = repos_root_url;

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Sun Feb 22 14:08:43 2015
@@ -115,102 +115,6 @@ svn_wc__node_get_not_present_children(co
 
 
 svn_error_t *
-svn_wc__internal_get_repos_info(svn_revnum_t *revision,
-                                const char **repos_relpath,
-                                const char **repos_root_url,
-                                const char **repos_uuid,
-                                svn_wc__db_t *db,
-                                const char *local_abspath,
-                                apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool)
-{
-  svn_wc__db_status_t status;
-  svn_boolean_t have_work;
-
-  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, repos_relpath,
-                               repos_root_url, repos_uuid,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, &have_work,
-                               db, local_abspath,
-                               result_pool, scratch_pool));
-
-  if ((repos_relpath ? *repos_relpath != NULL : TRUE)
-      && (repos_root_url ? *repos_root_url  != NULL: TRUE)
-      && (repos_uuid ? *repos_uuid != NULL : TRUE))
-    return SVN_NO_ERROR; /* We got the requested information */
-
-  if (!have_work) /* not-present, (server-)excluded? */
-    {
-      return SVN_NO_ERROR; /* Can't fetch more */
-    }
-
-  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, NULL,
-                                       db, local_abspath,
-                                       scratch_pool, scratch_pool));
-
-      if (base_del_abspath)
-        {
-          SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, repos_relpath,
-                                           repos_root_url, repos_uuid, NULL,
-                                           NULL, NULL, NULL, NULL, NULL, NULL,
-                                           NULL, NULL, NULL,
-                                           db, base_del_abspath,
-                                           result_pool, scratch_pool));
-
-          /* If we have a repos_relpath, it is of the op-root */
-          if (repos_relpath)
-            *repos_relpath = svn_relpath_join(*repos_relpath,
-                                svn_dirent_skip_ancestor(base_del_abspath,
-                                                         local_abspath),
-                                              result_pool);
-          /* We keep revision as SVN_INVALID_REVNUM */
-        }
-      else if (wrk_del_abspath)
-        {
-          const char *op_root_abspath = NULL;
-
-          SVN_ERR(svn_wc__db_scan_addition(NULL, repos_relpath
-                                                    ? &op_root_abspath : NULL,
-                                           repos_relpath, repos_root_url,
-                                           repos_uuid, NULL, NULL, NULL, NULL,
-                                           db, svn_dirent_dirname(
-                                                   wrk_del_abspath,
-                                                   scratch_pool),
-                                           result_pool, scratch_pool));
-
-          /* If we have a repos_relpath, it is of the op-root */
-          if (repos_relpath)
-            *repos_relpath = svn_relpath_join(
-                                    *repos_relpath,
-                                    svn_dirent_skip_ancestor(op_root_abspath,
-                                                             local_abspath),
-                                    result_pool);
-        }
-    }
-  else /* added, or WORKING incomplete */
-    {
-      /* We have an addition. scan_addition() will find the intended
-         repository location by scanning up the tree.  */
-      SVN_ERR(svn_wc__db_scan_addition(NULL,  NULL,
-                                       repos_relpath, repos_root_url,
-                                       repos_uuid, NULL, NULL, NULL, NULL,
-                                       db, local_abspath,
-                                       result_pool, scratch_pool));
-    }
-
-  SVN_ERR_ASSERT(repos_root_url == NULL || *repos_root_url != NULL);
-  SVN_ERR_ASSERT(repos_uuid == NULL || *repos_uuid != NULL);
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_wc__node_get_repos_info(svn_revnum_t *revision,
                             const char **repos_relpath,
                             const char **repos_root_url,
@@ -221,12 +125,12 @@ svn_wc__node_get_repos_info(svn_revnum_t
                             apr_pool_t *scratch_pool)
 {
   return svn_error_trace(
-            svn_wc__internal_get_repos_info(revision,
-                                            repos_relpath,
-                                            repos_root_url,
-                                            repos_uuid,
-                                            wc_ctx->db, local_abspath,
-                                            result_pool, scratch_pool));
+            svn_wc__db_read_repos_info(revision,
+                                       repos_relpath,
+                                       repos_root_url,
+                                       repos_uuid,
+                                       wc_ctx->db, local_abspath,
+                                       result_pool, scratch_pool));
 }
 
 /* Convert DB_KIND into the appropriate NODE_KIND value.
@@ -320,8 +224,18 @@ svn_wc__node_get_url(const char **url,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
-  return svn_error_trace(svn_wc__db_read_url(url, wc_ctx->db, local_abspath,
-                                             result_pool, scratch_pool));
+  const char *repos_root_url;
+  const char *repos_relpath;
+
+  SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath, &repos_root_url,
+                                     NULL,
+                                     wc_ctx->db, local_abspath,
+                                     scratch_pool, scratch_pool));
+
+  *url = svn_path_url_add_component2(repos_root_url, repos_relpath,
+                                     result_pool);
+
+  return SVN_NO_ERROR;
 }
 
 /* A recursive node-walker, helper for svn_wc__internal_walk_children().

Modified: subversion/trunk/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.c?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.c (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.c Sun Feb 22 14:08:43 2015
@@ -316,12 +316,15 @@ svn_wc__expand_keywords(apr_hash_t **key
                                    db, local_abspath,
                                    scratch_pool, scratch_pool));
 
-      if (repos_relpath)
-        url = svn_path_url_add_component2(repos_root_url, repos_relpath,
-                                          scratch_pool);
-      else
-         SVN_ERR(svn_wc__db_read_url(&url, db, local_abspath, scratch_pool,
-                                     scratch_pool));
+      /* Handle special statuses (e.g. added) */
+      if (!repos_relpath)
+         SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath,
+                                            &repos_root_url, NULL,
+                                            db, local_abspath,
+                                            scratch_pool, scratch_pool));
+
+      url = svn_path_url_add_component2(repos_root_url, repos_relpath,
+                                        scratch_pool);
     }
   else
     {

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Sun Feb 22 14:08:43 2015
@@ -577,17 +577,6 @@ svn_wc__internal_get_origin(svn_boolean_
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 
-/* Internal version of svn_wc__node_get_repos_info() */
-svn_error_t *
-svn_wc__internal_get_repos_info(svn_revnum_t *revision,
-                                const char **repos_relpath,
-                                const char **repos_root_url,
-                                const char **repos_uuid,
-                                svn_wc__db_t *db,
-                                const char *local_abspath,
-                                apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool);
-
 /* Upgrade the wc sqlite database given in SDB for the wc located at
    WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
    After the upgrade is complete (to as far as the automatic upgrade will

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sun Feb 22 14:08:43 2015
@@ -9918,35 +9918,34 @@ svn_wc__db_read_node_install_info(const
 
 
 
-/* The body of svn_wc__db_read_url().
+/* The body of svn_wc__db_read_repos_info().
  */
 static svn_error_t *
-read_url_txn(const char **url,
-             svn_wc__db_wcroot_t *wcroot,
-             const char *local_relpath,
-             apr_pool_t *result_pool,
-             apr_pool_t *scratch_pool)
+db_read_repos_info(svn_revnum_t *revision,
+                   const char **repos_relpath,
+                   apr_int64_t *repos_id,
+                   svn_wc__db_wcroot_t *wcroot,
+                   const char *local_relpath,
+                   apr_pool_t *result_pool,
+                   apr_pool_t *scratch_pool)
 {
   svn_wc__db_status_t status;
-  const char *repos_relpath;
-  const char *repos_root_url;
-  apr_int64_t repos_id;
-  svn_boolean_t have_base;
 
-  SVN_ERR(read_info(&status, NULL, NULL, &repos_relpath, &repos_id, NULL,
+  SVN_ERR(read_info(&status, NULL, revision, repos_relpath, repos_id, NULL,
                     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                    &have_base, NULL, NULL,
-                    wcroot, local_relpath, scratch_pool, scratch_pool));
+                    NULL, NULL, NULL,
+                    wcroot, local_relpath, result_pool, scratch_pool));
 
-  if (repos_relpath == NULL)
+  if ((repos_relpath && !*repos_relpath)
+      || (repos_id && *repos_id == INVALID_REPOS_ID))
     {
       if (status == svn_wc__db_status_added)
         {
-          SVN_ERR(scan_addition(NULL, NULL, &repos_relpath, &repos_id, NULL,
+          SVN_ERR(scan_addition(NULL, NULL, repos_relpath, repos_id, NULL,
                                 NULL, NULL, NULL, NULL, NULL,
                                 wcroot, local_relpath,
-                                scratch_pool, scratch_pool));
+                                result_pool, scratch_pool));
         }
       else if (status == svn_wc__db_status_deleted)
         {
@@ -9960,26 +9959,7 @@ read_url_txn(const char **url,
                                     scratch_pool,
                                     scratch_pool));
 
-          if (base_del_relpath)
-            {
-              SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
-                                                        &repos_relpath,
-                                                        &repos_id,
-                                                        NULL, NULL, NULL,
-                                                        NULL, NULL, NULL,
-                                                        NULL, NULL, NULL, NULL,
-                                                        wcroot,
-                                                        base_del_relpath,
-                                                        scratch_pool,
-                                                        scratch_pool));
-
-              repos_relpath = svn_relpath_join(
-                                    repos_relpath,
-                                    svn_dirent_skip_ancestor(base_del_relpath,
-                                                             local_relpath),
-                                    scratch_pool);
-            }
-          else
+          if (work_del_relpath)
             {
               /* The parent of the WORKING delete, must be an addition */
               const char *work_relpath = NULL;
@@ -9992,34 +9972,57 @@ read_url_txn(const char **url,
               work_relpath = svn_relpath_dirname(work_del_relpath,
                                                  scratch_pool);
 
-              SVN_ERR(scan_addition(NULL, NULL, &repos_relpath, &repos_id,
+              SVN_ERR(scan_addition(NULL, NULL, repos_relpath, repos_id,
                                     NULL, NULL, NULL, NULL, NULL, NULL,
                                     wcroot, work_relpath,
                                     scratch_pool, scratch_pool));
 
-              repos_relpath = svn_relpath_join(
-                                    repos_relpath,
+              if (repos_relpath)
+                *repos_relpath = svn_relpath_join(
+                                    *repos_relpath,
                                     svn_dirent_skip_ancestor(work_relpath,
                                                              local_relpath),
-                                    scratch_pool);
+                                    result_pool);
+            }
+          else
+            {
+              SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, revision,
+                                                        repos_relpath,
+                                                        repos_id,
+                                                        NULL, NULL, NULL,
+                                                        NULL, NULL, NULL,
+                                                        NULL, NULL, NULL, NULL,
+                                                        wcroot,
+                                                        base_del_relpath,
+                                                        scratch_pool,
+                                                        scratch_pool));
+
+              if (repos_relpath)
+                *repos_relpath = svn_relpath_join(
+                                    *repos_relpath,
+                                    svn_dirent_skip_ancestor(base_del_relpath,
+                                                             local_relpath),
+                                    result_pool);
             }
         }
       else if (status == svn_wc__db_status_excluded)
         {
           const char *parent_relpath;
           const char *name;
-          const char *url2;
 
-          /* Set 'url' to the *full URL* of the parent WC dir,
-           * and 'name' to the *single path component* that is the
-           * basename of this WC directory, so that joining them will result
-           * in the correct full URL. */
+          /* A BASE excluded would have had repository information, so
+             we have a working exclude, which must be below an addition */
+
           svn_relpath_split(&parent_relpath, &name, local_relpath,
                             scratch_pool);
-          SVN_ERR(read_url_txn(&url2, wcroot, parent_relpath,
-                               scratch_pool, scratch_pool));
+          SVN_ERR(scan_addition(NULL, NULL, repos_relpath, repos_id, NULL,
+                                NULL, NULL, NULL, NULL, NULL,
+                                wcroot, parent_relpath,
+                                scratch_pool, scratch_pool));
 
-          *url = svn_path_url_add_component2(url2, name, result_pool);
+          if (repos_relpath)
+            *repos_relpath = svn_relpath_join(*repos_relpath, name,
+                                              result_pool);
 
           return SVN_NO_ERROR;
         }
@@ -10031,26 +10034,23 @@ read_url_txn(const char **url,
         }
     }
 
-  SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, NULL, wcroot,
-                                      repos_id, scratch_pool));
-
-  SVN_ERR_ASSERT(repos_root_url != NULL && repos_relpath != NULL);
-  *url = svn_path_url_add_component2(repos_root_url, repos_relpath,
-                                     result_pool);
-
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_wc__db_read_url(const char **url,
-                    svn_wc__db_t *db,
-                    const char *local_abspath,
-                    apr_pool_t *result_pool,
-                    apr_pool_t *scratch_pool)
+svn_wc__db_read_repos_info(svn_revnum_t *revision,
+                           const char **repos_relpath,
+                           const char **repos_root_url,
+                           const char **repos_uuid,
+                           svn_wc__db_t *db,
+                           const char *local_abspath,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
+  apr_int64_t repos_id = INVALID_REPOS_ID;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -10059,9 +10059,17 @@ svn_wc__db_read_url(const char **url,
                                                 scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_WC__DB_WITH_TXN(read_url_txn(url, wcroot, local_relpath,
-                                   result_pool, scratch_pool),
-                      wcroot);
+  SVN_WC__DB_WITH_TXN4(db_read_repos_info(revision, repos_relpath,
+                                          (repos_root_url || repos_uuid)
+                                            ? &repos_id : NULL,
+                                          wcroot, local_relpath,
+                                          result_pool, scratch_pool),
+                       svn_wc__db_fetch_repos_info(repos_root_url,
+                                                   repos_uuid,
+                                                   wcroot, repos_id,
+                                                   result_pool),
+                       SVN_NO_ERROR, SVN_NO_ERROR,
+                       wcroot);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sun Feb 22 14:08:43 2015
@@ -2137,15 +2137,26 @@ svn_wc__db_read_children_walker_info(apr
 
 
 /**
- * Set *URL to the corresponding url for LOCAL_ABSPATH.
- * If the node is added, return the url it will have in the repository.
+ * Set *revision, *repos_relpath, *repos_root_url, *repos_uuid to
+ * the intended/commit location of LOCAL_ABSPATH. These arguments may be
+ * NULL if they are not needed.
+ *
+ * If the node is deleted, return the url it would have in the repository
+ * if it wouldn't be deleted. If the node is added return the url it will
+ * have in the repository, once committed.
+ *
+ * If the node is not added and has an existing repository location, set
+ * revision to its existing revision, otherwise to SVN_INVALID_REVNUM.
  */
 svn_error_t *
-svn_wc__db_read_url(const char **url,
-                    svn_wc__db_t *db,
-                    const char *local_abspath,
-                    apr_pool_t *result_pool,
-                    apr_pool_t *scratch_pool);
+svn_wc__db_read_repos_info(svn_revnum_t *revision,
+                           const char **repos_relpath,
+                           const char **repos_root_url,
+                           const char **repos_uuid,
+                           svn_wc__db_t *db,
+                           const char *local_abspath,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool);
 
 
 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL

Modified: subversion/trunk/subversion/tests/cmdline/info_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/info_tests.py?rev=1661476&r1=1661475&r2=1661476&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/info_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/info_tests.py Sun Feb 22 14:08:43 2015
@@ -591,6 +591,45 @@ def relpath_escaping(sbox):
   svntest.actions.run_and_verify_update(wc_dir,
                                         expected_output, None, None)
 
+def node_hidden_info(sbox):
+  "fetch svn info on 'hidden' nodes"
+
+  sbox.build()
+
+  sbox.simple_rm('A/B/E/alpha')
+  sbox.simple_commit()
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'up', '--set-depth', 'exclude',
+                                     sbox.ospath('A/B/E/beta'))
+
+  sbox.simple_copy('A/B/E', 'E')
+
+  # Running info on BASE not-present fails
+  expected_err = '.*(E|W)155010: The node \'.*alpha\' was not found.*'
+  svntest.actions.run_and_verify_svn(None, expected_err,
+                                     'info', sbox.ospath('A/B/E/alpha'))
+
+  # Running info on WORKING not-present fails
+  expected_err = '.*(E|W)155010: The node \'.*alpha\' was not found.*'
+  svntest.actions.run_and_verify_svn(None, expected_err,
+                                     'info', sbox.ospath('E/alpha'))
+
+  expected_info = [
+    {
+        'Path': re.escape(sbox.ospath('A/B/E/beta')),
+        'Depth': 'exclude',
+    },
+    {
+        'Path': re.escape(sbox.ospath('E/beta')),
+        'Depth': 'exclude',
+    }
+  ]
+
+  svntest.actions.run_and_verify_info(expected_info,
+                                      sbox.ospath('A/B/E/beta'),
+                                      sbox.ospath('E/beta'))
+
+
 ########################################################################
 # Run the tests
 
@@ -606,6 +645,7 @@ test_list = [ None,
               info_show_exclude,
               binary_tree_conflict,
               relpath_escaping,
+              node_hidden_info,
              ]
 
 if __name__ == '__main__':



Mime
View raw message