Instrument svn_ra_open4() and svn_ra_reparent() and make 'svn merge' report
how many sessions were used and how many times a session was reparented.

* subversion/libsvn_ra/ra_loader.c
  (sessions_opened, reparentings, no_op_reparentings): New global variables.
  (svn_ra_open4): Increment 'sessions_opened'.
  (svn_ra_reparent): Increment one of the 'reparentings' variables.

* subversion/svn/merge-cmd.c
  (svn_cl__merge): Print stats in debug mode.
--This line, and those below, will be ignored--

Index: subversion/libsvn_ra/ra_loader.c
===================================================================
--- subversion/libsvn_ra/ra_loader.c	(revision 1365585)
+++ subversion/libsvn_ra/ra_loader.c	(working copy)
@@ -244,6 +244,9 @@ svn_ra_create_callbacks(svn_ra_callbacks
   return SVN_NO_ERROR;
 }
 
+int sessions_opened = 0;
+int reparentings = 0, no_op_reparentings = 0;
+
 svn_error_t *svn_ra_open4(svn_ra_session_t **session_p,
                           const char **corrected_url_p,
                           const char *repos_URL,
@@ -464,6 +467,8 @@ svn_error_t *svn_ra_open4(svn_ra_session
                              _("Unrecognized URL scheme for '%s'"),
                              repos_URL);
 
+  sessions_opened++;
+
   /* Create the session object. */
   session = apr_pcalloc(sesspool, sizeof(*session));
   session->vtable = vtable;
@@ -525,6 +530,7 @@ svn_error_t *svn_ra_reparent(svn_ra_sess
                              apr_pool_t *pool)
 {
   const char *repos_root;
+  const char *session_url;
 
   /* Make sure the new URL is in the same repository, so that the
      implementations don't have to do it. */
@@ -534,6 +540,15 @@ svn_error_t *svn_ra_reparent(svn_ra_sess
                              _("'%s' isn't in the same repository as '%s'"),
                              url, repos_root);
 
+  SVN_ERR(svn_ra_get_session_url(session, &session_url, pool));
+  if (strcmp(url, session_url) != 0)
+    {
+      SVN_DBG(("reparent '%s' -> '%s'\n", session_url, url));
+      reparentings++;
+    }
+  else
+    no_op_reparentings++;
+
   return session->vtable->reparent(session, url, pool);
 }
 
Index: subversion/svn/merge-cmd.c
===================================================================
--- subversion/svn/merge-cmd.c	(revision 1365585)
+++ subversion/svn/merge-cmd.c	(working copy)
@@ -37,6 +37,8 @@
 
 #include "svn_private_config.h"
 
+extern int sessions_opened, reparentings, no_op_reparentings;
+
 
 /*** Code. ***/
 
@@ -523,5 +525,7 @@ svn_cl__merge(apr_getopt_t *os,
         }
     }
 
+  SVN_DBG(("sessions: %2d, reparentings: %2d (+ no-ops %2d)\n",
+           sessions_opened, reparentings, no_op_reparentings));
   return svn_error_trace(err);
 }
