subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1656501 - in /subversion/branches/reuse-ra-session: ./ subversion/include/ subversion/libsvn_client/
Date Mon, 02 Feb 2015 15:58:18 GMT
Author: brane
Date: Mon Feb  2 15:58:18 2015
New Revision: 1656501

URL: http://svn.apache.org/r1656501
Log:
On the reuse-ra-session branch: Sync with trunk up to r1656489,
and resolve the conflicts that were caused by r1656488.

* subversion/libsvn_client/client.h
  (client_ra_cache_t): Movede here from ra_cache.h.
  (client_ctx_t): Added member ra_cache.
* subversion/libsvn_client/ra_cache.h
  (client_ra_cache_t): Moved to client.h
  (client_ctx_t): Removed; superseded by the version in client.h.
  (CLIENT_CTX_MAGIC): Likewise.
* subversion/libsvn_client/ra_cache.c
  (verify_client_context): Removed; all callers updated.
  (get_private_ra_cache): Uses svn_client__get_private_ctx.

Modified:
    subversion/branches/reuse-ra-session/   (props changed)
    subversion/branches/reuse-ra-session/subversion/include/svn_client.h
    subversion/branches/reuse-ra-session/subversion/libsvn_client/client.h
    subversion/branches/reuse-ra-session/subversion/libsvn_client/ctx.c
    subversion/branches/reuse-ra-session/subversion/libsvn_client/ra.c
    subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.c
    subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.h

Propchange: subversion/branches/reuse-ra-session/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb  2 15:58:18 2015
@@ -86,4 +86,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1501802-1656372
+/subversion/trunk:1501802-1656489

Modified: subversion/branches/reuse-ra-session/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/include/svn_client.h?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/include/svn_client.h (original)
+++ subversion/branches/reuse-ra-session/subversion/include/svn_client.h Mon Feb  2 15:58:18
2015
@@ -1020,11 +1020,6 @@ typedef struct svn_client_ctx_t
    * @since New in 1.7.  */
   svn_wc_context_t *wc_ctx;
 
-  /** Total number of bytes transferred over network.
-   *
-   * @since New in 1.9. */
-  apr_off_t progress;
-
   /** Check-tunnel callback
    *
    * If not @c NULL, and open_tunnel_func is also not @c NULL, this

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_client/client.h?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_client/client.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_client/client.h Mon Feb  2 15:58:18
2015
@@ -45,6 +45,52 @@
 extern "C" {
 #endif /* __cplusplus */
 
+
+/* RA session cache */
+typedef struct client_ra_cache_t
+{
+  /* Hashtable of cached RA sessions. Keys are RA_SESSION_T and values
+   * are CLIENT_RA_SESION_T pointers. */
+  apr_hash_t *cached_session;
+  apr_pool_t *pool;
+  apr_hash_t *config;
+
+  /* Next ID for RA sessions. Used only for diagnostics purpose. */
+  int next_id;
+} client_ra_cache_t;
+
+
+/* Private client context.
+ *
+ * This is what is actually allocated by svn_client_create_context2(),
+ * which then returns the address of the public_ctx member. */
+typedef struct client_ctx_t
+{
+  /* Reserved field, always zero, to detect misuse of the private
+     context as a public client context. */
+  apr_uint64_t magic_null;
+
+  /* Reserved field, always set to a known magic number, to identify
+     this struct as the private client context. */
+  apr_uint64_t magic_id;
+
+  /* Total number of bytes transferred over network across all RA sessions. */
+  apr_off_t total_progress;
+
+  /* The RA session cache. */
+  client_ra_cache_t ra_cache;
+
+  /* The public context. */
+  svn_client_ctx_t public_ctx;
+} client_ctx_t;
+
+
+/* Given a public client context CTX, return the private context
+   within which it is allocated. */
+client_ctx_t *
+svn_client__get_private_ctx(svn_client_ctx_t *ctx);
+
+
 /* Set *REVNUM to the revision number identified by REVISION.
 
    If REVISION->kind is svn_opt_revision_number, just use

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_client/ctx.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_client/ctx.c?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_client/ctx.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_client/ctx.c Mon Feb  2 15:58:18
2015
@@ -27,12 +27,14 @@
 
 /*** Includes. ***/
 
+#include <stddef.h>
 #include <apr_pools.h>
 #include "svn_hash.h"
 #include "svn_client.h"
 #include "svn_error.h"
 
 #include "private/svn_wc_private.h"
+#include "client.h"
 #include "ra_cache.h"
 
 
@@ -77,6 +79,20 @@ call_conflict_func(svn_wc_conflict_resul
   return SVN_NO_ERROR;
 }
 
+/* The magic number in client_ctx_t.magic_id. */
+#define CLIENT_CTX_MAGIC APR_UINT64_C(0xDEADBEEF600DF00D)
+
+client_ctx_t *
+svn_client__get_private_ctx(svn_client_ctx_t *ctx)
+{
+  client_ctx_t *const private_ctx =
+    (void*)((char *)ctx - offsetof(client_ctx_t, public_ctx));
+  SVN_ERR_ASSERT_NO_RETURN(&private_ctx->public_ctx == ctx);
+  SVN_ERR_ASSERT_NO_RETURN(0 == private_ctx->magic_null);
+  SVN_ERR_ASSERT_NO_RETURN(CLIENT_CTX_MAGIC == private_ctx->magic_id);
+  return private_ctx;
+}
+
 svn_error_t *
 svn_client_create_context2(svn_client_ctx_t **ctx,
                            apr_hash_t *cfg_hash,
@@ -85,25 +101,25 @@ svn_client_create_context2(svn_client_ct
   svn_config_t *cfg_config;
 
   client_ctx_t *const private_ctx = apr_pcalloc(pool, sizeof(*private_ctx));
-  svn_client_ctx_t *const public_ctx = &private_ctx->ctx;
+  svn_client_ctx_t *const public_ctx = &private_ctx->public_ctx;
 
   private_ctx->magic_null = 0;
   private_ctx->magic_id = CLIENT_CTX_MAGIC;
 
-  private_ctx->ctx.notify_func2 = call_notify_func;
-  private_ctx->ctx.notify_baton2 = public_ctx;
+  public_ctx->notify_func2 = call_notify_func;
+  public_ctx->notify_baton2 = public_ctx;
 
-  private_ctx->ctx.conflict_func2 = call_conflict_func;
-  private_ctx->ctx.conflict_baton2 = public_ctx;
+  public_ctx->conflict_func2 = call_conflict_func;
+  public_ctx->conflict_baton2 = public_ctx;
 
-  private_ctx->ctx.config = cfg_hash;
+  public_ctx->config = cfg_hash;
 
   if (cfg_hash)
     cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
   else
     cfg_config = NULL;
 
-  SVN_ERR(svn_wc_context_create(&private_ctx->ctx.wc_ctx, cfg_config,
+  SVN_ERR(svn_wc_context_create(&public_ctx->wc_ctx, cfg_config,
                                 pool, pool));
   svn_client__ra_cache_init(private_ctx, cfg_hash, pool);
   *ctx = public_ctx;

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_client/ra.c?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_client/ra.c Mon Feb  2 15:58:18
2015
@@ -300,17 +300,19 @@ progress_func(apr_off_t progress,
               apr_pool_t *pool)
 {
   callback_baton_t *b = baton;
-  svn_client_ctx_t *ctx = b->ctx;
+  svn_client_ctx_t *public_ctx = b->ctx;
+  client_ctx_t *private_ctx = svn_client__get_private_ctx(public_ctx);
 
-  ctx->progress += (progress - b->last_progress);
+  private_ctx->total_progress += (progress - b->last_progress);
   b->last_progress = progress;
 
-  if (ctx->progress_func)
+  if (public_ctx->progress_func)
     {
       /* All RA implementations currently provide -1 for total. So it doesn't
          make sense to develop some complex logic to combine total across all
          RA sessions. */
-      ctx->progress_func(ctx->progress, -1, ctx->progress_baton, pool);
+      public_ctx->progress_func(private_ctx->total_progress, -1,
+                                public_ctx->progress_baton, pool);
     }
 }
 

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.c?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.c Mon Feb  2 15:58:18
2015
@@ -77,23 +77,12 @@ cleanup_session(void *data)
   return APR_SUCCESS;
 }
 
-/* Check that the private context struct is valid. */
-static void
-verify_client_context(client_ctx_t *private_ctx)
-{
-  SVN_ERR_ASSERT_NO_RETURN(0 == private_ctx->magic_null);
-  SVN_ERR_ASSERT_NO_RETURN(CLIENT_CTX_MAGIC == private_ctx->magic_id);
-}
-
 /* Convert a public client context pointer to a private client context
    pointer. */
 static client_ra_cache_t *
-get_private_ra_cache(svn_client_ctx_t *ctx)
+get_private_ra_cache(svn_client_ctx_t *public_ctx)
 {
-  client_ctx_t *const private_ctx =
-    (void*)((char *)ctx - offsetof(client_ctx_t, ctx));
-  SVN_ERR_ASSERT_NO_RETURN(&private_ctx->ctx == ctx);
-  verify_client_context(private_ctx);
+  client_ctx_t *const private_ctx = svn_client__get_private_ctx(public_ctx);
   return &private_ctx->ra_cache;
 }
 
@@ -102,8 +91,6 @@ svn_client__ra_cache_init(client_ctx_t *
                           apr_hash_t *config,
                           apr_pool_t *pool)
 {
-  verify_client_context(private_ctx);
-
   private_ctx->ra_cache.pool = pool;
   private_ctx->ra_cache.cached_session = apr_hash_make(pool);
   private_ctx->ra_cache.config = config;

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.h?rev=1656501&r1=1656500&r2=1656501&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_client/ra_cache.h Mon Feb  2 15:58:18
2015
@@ -31,45 +31,12 @@
 #include "svn_ra.h"
 #include "svn_types.h"
 
+#include "client.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-typedef struct client_ra_cache_t
-{
-  /* Hashtable of cached RA sessions. Keys are RA_SESSION_T and values
-   * are CLIENT_RA_SESION_T pointers. */
-  apr_hash_t *cached_session;
-  apr_pool_t *pool;
-  apr_hash_t *config;
-
-  /* Next ID for RA sessions. Used only for diagnostics purpose. */
-  int next_id;
-} client_ra_cache_t;
-
-
-/* Private client context.
- * This is what is actually allocated by context constructor. */
-typedef struct client_ctx_t
-{
-  /* Reserved field, always zero, to detect misuse of the private
-     context as a public client context. */
-  apr_uint64_t magic_null;
-
-  /* Reserved field, always set to a known magic number, to identify
-     this struct as the private client context. */
-  apr_uint64_t magic_id;
-
-  /* The RA session cache. */
-  client_ra_cache_t ra_cache;
-
-  /* The public context. */
-  svn_client_ctx_t ctx;
-} client_ctx_t;
-
-
-#define CLIENT_CTX_MAGIC APR_UINT64_C(0xDEADBEEF600DF00D)
-
 
 /* Initializes the CTX->ra_cache structure. Will use CONFIG for for RA
    sessions created in this context. Assumes that CTX was allocated



Mime
View raw message