subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1143726 - in /subversion/trunk/subversion: include/private/svn_wc_private.h include/svn_client.h libsvn_client/deprecated.c libsvn_client/info.c libsvn_wc/info.c svn/info-cmd.c
Date Thu, 07 Jul 2011 09:29:49 GMT
Author: rhuijben
Date: Thu Jul  7 09:29:48 2011
New Revision: 1143726

URL: http://svn.apache.org/viewvc?rev=1143726&view=rev
Log:
Make the 'info' apis capable of returning excluded paths. Do this by
adding two boolean arguments for api users to make the retrieval of
actual only (tree conflicts) and excluded nodes optional.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_info): Add two arguments and order arguments following the
    wc standard argument ordering.

* subversion/include/svn_client.h
  (svn_client_info3): Add two arguments. Order arguments following the new
    standard.

* subversion/libsvn_client/deprecated.c
  (svn_client_info2): Filter excluded nodes.

* subversion/libsvn_client/info.c
  (svn_client_info3): Update caller.

* subversion/libsvn_wc/info.c
  (build_info_for_entry): Rename to ...
  (build_info_for_node): ... this. Return a NULL info for server excluded and
    not-present nodes, to avoid breaking out of the loop.
    Remove two unneeded db calls for calling info on a deleted node.
  (found_entry_baton): Add two booleans and a result pool for the hash table.
  (info_found_node_callback): Make actual only check optional and fix
    pool usage. (Paths were stored in an iterpool). Skip
  (svn_wc__get_info): Update caller. Pass the right kind to depth_includes.

* subversion/svn/info-cmd.c
  (svn_cl__info): Update caller.

Partially based on a few patches from Noorul Islam.
(I'll commit his new testcase in a separate commit)

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_client/info.c
    subversion/trunk/subversion/libsvn_wc/info.c
    subversion/trunk/subversion/svn/info-cmd.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=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Thu Jul  7 09:29:48 2011
@@ -1077,14 +1077,19 @@ typedef svn_error_t *(*svn_wc__info_rece
 
 /* Walk the children of LOCAL_ABSPATH and push svn_wc__info2_t's through
    RECEIVER/RECEIVER_BATON.  Honor DEPTH while crawling children, and
-   filter the pushed items against CHANGELISTS.  */
+   filter the pushed items against CHANGELISTS.
+
+   If FETCH_EXCLUDED is TRUE, also fetch excluded nodes.
+   If FETCH_ACTUAL_ONLY is TRUE, also fetch actual-only nodes. */
 svn_error_t *
 svn_wc__get_info(svn_wc_context_t *wc_ctx,
                  const char *local_abspath,
                  svn_depth_t depth,
+                 svn_boolean_t fetch_excluded,
+                 svn_boolean_t fetch_actual_only,
+                 const apr_array_header_t *changelists,
                  svn_wc__info_receiver2_t receiver,
                  void *receiver_baton,
-                 const apr_array_header_t *changelists,
                  svn_cancel_func_t cancel_func,
                  void *cancel_baton,
                  apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Jul  7 09:29:48 2011
@@ -5451,6 +5451,11 @@ typedef svn_error_t *(*svn_client_info_r
  * recurse fully, invoking @a receiver on @a abspath_or_url and
  * everything beneath it.
  *
+ * If @a fetch_excluded is TRUE, also also send excluded nodes in the working
+ * copy to @a receiver, otherwise these are skipped. If @a fetch_actual_only
+ * is TRUE also send nodes that don't exist as versioned but are still
+ * tree conflicted.
+ *
  * @a changelists is an array of <tt>const char *</tt> changelist
  * names, used as a restrictive filter on items whose info is
  * reported; that is, don't report info about any item unless
@@ -5463,10 +5468,12 @@ svn_error_t *
 svn_client_info3(const char *abspath_or_url,
                  const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *revision,
-                 svn_client_info_receiver2_t receiver,
-                 void *receiver_baton,
                  svn_depth_t depth,
+                 svn_boolean_t fetch_excluded,
+                 svn_boolean_t fetch_actual_only,
                  const apr_array_header_t *changelists,
+                 svn_client_info_receiver2_t receiver,
+                 void *receiver_baton,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Thu Jul  7 09:29:48 2011
@@ -2302,10 +2302,11 @@ svn_client_info2(const char *path_or_url
   SVN_ERR(svn_client_info3(abspath_or_url,
                            peg_revision,
                            revision,
-                           info_receiver_relpath_wrapper,
-                           &rb,
                            depth,
+                           FALSE, TRUE,
                            changelists,
+                           info_receiver_relpath_wrapper,
+                           &rb,
                            ctx,
                            pool));
 

Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Thu Jul  7 09:29:48 2011
@@ -262,10 +262,12 @@ svn_error_t *
 svn_client_info3(const char *abspath_or_url,
                  const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *revision,
-                 svn_client_info_receiver2_t receiver,
-                 void *receiver_baton,
                  svn_depth_t depth,
+                 svn_boolean_t fetch_excluded,
+                 svn_boolean_t fetch_actual_only,
                  const apr_array_header_t *changelists,
+                 svn_client_info_receiver2_t receiver,
+                 void *receiver_baton,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
 {
@@ -294,7 +296,8 @@ svn_client_info3(const char *abspath_or_
       wc_info_receiver_baton_t b = { receiver, receiver_baton };
       return svn_error_trace(
         svn_wc__get_info(ctx->wc_ctx, abspath_or_url, depth,
-                         wc_info_receiver, &b, changelists,
+                        fetch_excluded, fetch_actual_only, changelists,
+                         wc_info_receiver, &b,
                          ctx->cancel_func, ctx->cancel_baton, pool));
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Thu Jul  7 09:29:48 2011
@@ -71,7 +71,7 @@ svn_wc_info_dup(const svn_wc_info_t *inf
    metadata of LOCAL_ABSPATH.  Pointer fields are copied by reference, not
    dup'd. */
 static svn_error_t *
-build_info_for_entry(svn_wc__info2_t **info,
+build_info_for_node(svn_wc__info2_t **info,
                      svn_wc__db_t *db,
                      const char *local_abspath,
                      svn_node_kind_t kind,
@@ -196,17 +196,10 @@ build_info_for_entry(svn_wc__info2_t **i
                                             db, local_abspath,
                                             result_pool, scratch_pool));
 
-      SVN_ERR(svn_wc__internal_get_repos_info(&tmpinfo->repos_root_URL,
-                                              &tmpinfo->repos_UUID,
-                                              db, local_abspath,
-                                              result_pool, scratch_pool));
-
-      SVN_ERR(svn_wc__db_read_url(&tmpinfo->URL, db, local_abspath,
-                                result_pool, scratch_pool));
-
-      /* And now fetch the revision of what will be deleted */
+      /* And now fetch the url and revision of what will be deleted */
       {
         const char *work_del_abspath;
+        const char *repos_relpath;
 
         SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
                                          &work_del_abspath,
@@ -216,31 +209,48 @@ build_info_for_entry(svn_wc__info2_t **i
           {
             /* This is a deletion within a copied subtree. Get the copied-from
              * revision. */
-            SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL,
+            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,
-                                             svn_dirent_dirname(
-                                                  work_del_abspath,
-                                                  scratch_pool),
+                                             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,
-                                           NULL, NULL, NULL, NULL, NULL, NULL,
-                                           NULL, NULL, NULL, NULL, NULL, NULL,
-                                           db, local_abspath,
-                                           result_pool, scratch_pool));
+          {
+            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,
+                                             db, local_abspath,
+                                             result_pool, scratch_pool));
+
+            tmpinfo->URL = svn_path_url_add_component2(tmpinfo->repos_root_URL,
+                                                       repos_relpath,
+                                                       result_pool);
+          }
       }
       wc_info->schedule = svn_wc_schedule_delete;
     }
   else if (status == svn_wc__db_status_not_present
            || status == svn_wc__db_status_server_excluded)
     {
-      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
-                               _("The node '%s' was not found."),
-                               svn_dirent_local_style(local_abspath,
-                                                      scratch_pool));
+      *info = NULL;
+      return SVN_NO_ERROR;
     }
   else
     {
@@ -316,9 +326,11 @@ struct found_entry_baton
   svn_wc__info_receiver2_t receiver;
   void *receiver_baton;
   svn_wc__db_t *db;
+  svn_boolean_t actual_only;
   /* The set of tree conflicts that have been found but not (yet) visited by
    * the tree walker.  Map of abspath -> svn_wc_conflict_description2_t. */
   apr_hash_t *tree_conflicts;
+  apr_pool_t *pool;
 };
 
 /* Call WALK_BATON->receiver with WALK_BATON->receiver_baton, passing to it
@@ -328,37 +340,41 @@ static svn_error_t *
 info_found_node_callback(const char *local_abspath,
                          svn_node_kind_t kind,
                          void *walk_baton,
-                         apr_pool_t *pool)
+                         apr_pool_t *scratch_pool)
 {
   struct found_entry_baton *fe_baton = walk_baton;
   svn_wc__info2_t *info;
 
-  SVN_ERR(build_info_for_entry(&info, fe_baton->db, local_abspath,
-                               kind, pool, pool));
+  SVN_ERR(build_info_for_node(&info, fe_baton->db, local_abspath,
+                               kind, scratch_pool, scratch_pool));
+
+  if (info == NULL)
+    return SVN_NO_ERROR; /* not present or server excluded node */
 
-  SVN_ERR_ASSERT(info != NULL && info->wc_info != NULL);
+  SVN_ERR_ASSERT(info->wc_info != NULL);
   SVN_ERR(fe_baton->receiver(fe_baton->receiver_baton, local_abspath,
-                             info, pool));
+                             info, scratch_pool));
 
   /* If this node is a versioned directory, make a note of any tree conflicts
    * on all immediate children.  Some of these may be visited later in this
    * walk, at which point they will be removed from the list, while any that
    * are not visited will remain in the list. */
-  if (kind == svn_node_dir)
+  if (fe_baton->actual_only && kind == svn_node_dir)
     {
       apr_hash_t *conflicts;
       apr_hash_index_t *hi;
 
       SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(
                 &conflicts, fe_baton->db, local_abspath,
-                apr_hash_pool_get(fe_baton->tree_conflicts), pool));
-      for (hi = apr_hash_first(pool, conflicts); hi;
+                fe_baton->pool, scratch_pool));
+      for (hi = apr_hash_first(scratch_pool, conflicts); hi;
            hi = apr_hash_next(hi))
         {
           const char *this_basename = svn__apr_hash_index_key(hi);
 
           apr_hash_set(fe_baton->tree_conflicts,
-                       svn_dirent_join(local_abspath, this_basename, pool),
+                       svn_dirent_join(local_abspath, this_basename,
+                                       fe_baton->pool),
                        APR_HASH_KEY_STRING, svn__apr_hash_index_val(hi));
         }
     }
@@ -396,9 +412,11 @@ svn_error_t *
 svn_wc__get_info(svn_wc_context_t *wc_ctx,
                  const char *local_abspath,
                  svn_depth_t depth,
+                 svn_boolean_t fetch_excluded,
+                 svn_boolean_t fetch_actual_only,
+                 const apr_array_header_t *changelist_filter,
                  svn_wc__info_receiver2_t receiver,
                  void *receiver_baton,
-                 const apr_array_header_t *changelist_filter,
                  svn_cancel_func_t cancel_func,
                  void *cancel_baton,
                  apr_pool_t *scratch_pool)
@@ -412,19 +430,26 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
   fe_baton.receiver = receiver;
   fe_baton.receiver_baton = receiver_baton;
   fe_baton.db = wc_ctx->db;
+  fe_baton.actual_only = fetch_actual_only;
   fe_baton.tree_conflicts = apr_hash_make(scratch_pool);
+  fe_baton.pool = scratch_pool;
 
-  SVN_ERR(svn_wc__db_op_read_tree_conflict(&root_tree_conflict,
-                                           wc_ctx->db, local_abspath,
-                                           scratch_pool, scratch_pool));
-  if (root_tree_conflict)
+  if (fetch_actual_only)
     {
-      apr_hash_set(fe_baton.tree_conflicts, local_abspath, APR_HASH_KEY_STRING,
-                   root_tree_conflict);
+      SVN_ERR(svn_wc__db_op_read_tree_conflict(&root_tree_conflict,
+                                               wc_ctx->db, local_abspath,
+                                               scratch_pool, scratch_pool));
+      if (root_tree_conflict)
+        {
+          apr_hash_set(fe_baton.tree_conflicts, local_abspath,
+                       APR_HASH_KEY_STRING, root_tree_conflict);
+        }
     }
+  else
+    root_tree_conflict = FALSE;
 
   err = svn_wc__internal_walk_children(wc_ctx->db, local_abspath,
-                                       FALSE /* show_hidden */,
+                                       fetch_excluded,
                                        changelist_filter,
                                        info_found_node_callback,
                                        &fe_baton, depth,
@@ -452,7 +477,7 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
       svn_pool_clear(iterpool);
 
       if (depth_includes(local_abspath, depth, tree_conflict->local_abspath,
-                         tree_conflict->kind, iterpool))
+                         tree_conflict->node_kind, iterpool))
         {
           apr_array_header_t *conflicts = apr_array_make(iterpool,
             1, sizeof(const svn_wc_conflict_description2_t *));

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1143726&r1=1143725&r2=1143726&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Thu Jul  7 09:29:48 2011
@@ -589,8 +589,10 @@ svn_cl__info(apr_getopt_t *os,
 
       err = svn_client_info3(truepath,
                              &peg_revision, &(opt_state->start_revision),
-                             receiver, (void *) path_prefix, opt_state->depth,
-                             opt_state->changelists, ctx, subpool);
+                             opt_state->depth, TRUE, TRUE,
+                             opt_state->changelists,
+                             receiver, (void *) path_prefix,
+                             ctx, subpool);
 
       if (err)
         {



Mime
View raw message