You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/26 21:40:23 UTC

svn commit: r1096868 - in /subversion/trunk/subversion: include/svn_client.h include/svn_types.h include/svn_wc.h libsvn_client/changelist.c libsvn_wc/adm_ops.c

Author: hwright
Date: Tue Apr 26 19:40:22 2011
New Revision: 1096868

URL: http://svn.apache.org/viewvc?rev=1096868&view=rev
Log:
Move the get-changelist node walking loop to libsvn_wc.  This allows us to
better optimize it within the library in the future, should we feel the need.

* subversion/include/svn_types.h
  (svn_changelist_receiver_t): Move here...

* subversion/include/svn_client.h
  (svn_changelist_receiver_t): ...here.  We can do this since svn_client.h
    includes svn_types.h, so this is a backward compatible change.

* subversion/include/svn_wc.h
  (svn_wc_get_changelists): New.

* subversion/libsvn_wc/adm_ops.c
  (get_cl_fn_baton, get_node_changelist, svn_wc_get_changelists): New.

* subversion/libsvn_client/changelist.c
  (get_cl_fn_baton, get_node_changelist): Remove.
  (svn_client_get_changelists): Just pass parameters down to libsvn_wc.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/changelist.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1096868&r1=1096867&r2=1096868&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Tue Apr 26 19:40:22 2011
@@ -5009,18 +5009,6 @@ svn_client_remove_from_changelists(const
                                    svn_client_ctx_t *ctx,
                                    apr_pool_t *pool);
 
-/**
- * The callback type used by svn_client_get_changelists().
- *
- * On each invocation, @a path is a newly discovered member of the
- * changelist, and @a baton is a private function closure.
- *
- * @since New in 1.5.
- */
-typedef svn_error_t *(*svn_changelist_receiver_t) (void *baton,
-                                                   const char *path,
-                                                   const char *changelist,
-                                                   apr_pool_t *pool);
 
 /**
  * Beginning at @a path, crawl to @a depth to discover every path in

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1096868&r1=1096867&r2=1096868&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Tue Apr 26 19:40:22 2011
@@ -1200,6 +1200,20 @@ typedef unsigned long svn_linenum_t;
 /** @} */
 
 
+/**
+ * The callback type used by svn_client_get_changelists().
+ *
+ * On each invocation, @a path is a newly discovered member of the
+ * changelist, and @a baton is a private function closure.
+ *
+ * @since New in 1.5.
+ */
+typedef svn_error_t *(*svn_changelist_receiver_t) (void *baton,
+                                                   const char *path,
+                                                   const char *changelist,
+                                                   apr_pool_t *pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1096868&r1=1096867&r2=1096868&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Apr 26 19:40:22 2011
@@ -7530,6 +7530,19 @@ svn_wc_set_changelist(const char *path,
                       void *notify_baton,
                       apr_pool_t *pool);
 
+/* @since New in 1.7.
+ */
+svn_error_t *
+svn_wc_get_changelists(svn_wc_context_t *wc_ctx,
+                       const char *local_abspath,
+                       svn_depth_t depth,
+                       const apr_array_header_t *changelists,
+                       svn_changelist_receiver_t callback_func,
+                       void *callback_baton,
+                       svn_cancel_func_t cancel_func,
+                       void *cancel_baton,
+                       apr_pool_t *scratch_pool);
+
 /** Crop @a local_abspath according to @a depth.
  *
  * Remove any item that exceeds the boundary of @a depth (relative to

Modified: subversion/trunk/subversion/libsvn_client/changelist.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/changelist.c?rev=1096868&r1=1096867&r2=1096868&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/changelist.c (original)
+++ subversion/trunk/subversion/libsvn_client/changelist.c Tue Apr 26 19:40:22 2011
@@ -124,41 +124,6 @@ svn_client_remove_from_changelists(const
 }
 
 
-
-/* Entry-walker callback for svn_client_get_changelist() below. */
-struct get_cl_fn_baton
-{
-  svn_changelist_receiver_t callback_func;
-  void *callback_baton;
-  svn_wc_context_t *wc_ctx;
-  apr_pool_t *pool;
-};
-
-
-static svn_error_t *
-get_node_changelist(const char *local_abspath,
-                    svn_node_kind_t kind,
-                    void *baton,
-                    apr_pool_t *pool)
-{
-  struct get_cl_fn_baton *b = (struct get_cl_fn_baton *)baton;
-  const char *changelist;
-
-  SVN_ERR(svn_wc__node_get_changelist(&changelist, b->wc_ctx,
-                                      local_abspath, pool, pool));
-
-  if (((kind == svn_node_file) || (kind == svn_node_dir)))
-    {
-
-      /* ...then call the callback function. */
-      SVN_ERR(b->callback_func(b->callback_baton, local_abspath,
-                               changelist, pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 svn_error_t *
 svn_client_get_changelists(const char *path,
                            const apr_array_header_t *changelists,
@@ -168,18 +133,12 @@ svn_client_get_changelists(const char *p
                            svn_client_ctx_t *ctx,
                            apr_pool_t *pool)
 {
-  struct get_cl_fn_baton gnb;
   const char *local_abspath;
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
-  gnb.callback_func = callback_func;
-  gnb.callback_baton = callback_baton;
-  gnb.wc_ctx = ctx->wc_ctx;
-  gnb.pool = pool;
-
-  return svn_error_return(
-    svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE, changelists,
-                               get_node_changelist, &gnb, depth,
-                               ctx->cancel_func, ctx->cancel_baton, pool));
+  SVN_ERR(svn_wc_get_changelists(ctx->wc_ctx, local_abspath, depth, changelists,
+                                 callback_func, callback_baton,
+                                 ctx->cancel_func, ctx->cancel_baton, pool));
+  return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1096868&r1=1096867&r2=1096868&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Apr 26 19:40:22 2011
@@ -2312,6 +2312,57 @@ svn_wc__set_file_external_location(svn_w
 }
 
 
+struct get_cl_fn_baton
+{
+  svn_wc__db_t *db;
+  svn_changelist_receiver_t callback_func;
+  void *callback_baton;
+};
+
+static svn_error_t *
+get_node_changelist(const char *local_abspath,
+                    svn_node_kind_t kind,
+                    void *baton,
+                    apr_pool_t *scratch_pool)
+{
+  struct get_cl_fn_baton *b = baton;
+  const char *changelist;
+
+  SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, &changelist,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               b->db, local_abspath,
+                               scratch_pool, scratch_pool));
+
+  SVN_ERR(b->callback_func(b->callback_baton, local_abspath,
+                           changelist, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc_get_changelists(svn_wc_context_t *wc_ctx,
+                       const char *local_abspath,
+                       svn_depth_t depth,
+                       const apr_array_header_t *changelists,
+                       svn_changelist_receiver_t callback_func,
+                       void *callback_baton,
+                       svn_cancel_func_t cancel_func,
+                       void *cancel_baton,
+                       apr_pool_t *scratch_pool)
+{
+  struct get_cl_fn_baton gnb = { wc_ctx->db, callback_func, callback_baton };
+
+  return svn_error_return(
+    svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
+                                   changelists, get_node_changelist, &gnb,
+                                   depth, cancel_func, cancel_baton,
+                                   scratch_pool));
+
+}
+
+
 svn_boolean_t
 svn_wc__internal_changelist_match(svn_wc__db_t *db,
                                   const char *local_abspath,