subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1030512 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/copy.c libsvn_wc/adm_ops.c
Date Wed, 03 Nov 2010 16:09:51 GMT
Author: julianfoad
Date: Wed Nov  3 16:09:50 2010
New Revision: 1030512

URL: http://svn.apache.org/viewvc?rev=1030512&view=rev
Log:
Simplify the notification code of repos-to-WC copies.

* subversion/include/svn_wc.h,
* subversion/libsvn_wc/adm_ops.c
  (svn_wc__integrate_nested_wc_as_copy): Remove notification parameters,
    as it's easier for the caller to do it.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Do mergeinfo calculation and notification in
    the same way for both files and directories.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1030512&r1=1030511&r2=1030512&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed Nov  3 16:09:50 2010
@@ -4245,16 +4245,11 @@ svn_wc_add_from_disk(svn_wc_context_t *w
  * repository as the nested WC.  The nested WC will be integrated into the
  * parent's WC, and will no longer be a separate WC.
  *
- * Call @a notify_func (if it is not @c NULL) with the @a notify_baton and
- * the path.
- *
  * This is a replacement for svn_wc_add4() case 1.
  */
 svn_error_t *
 svn_wc__integrate_nested_wc_as_copy(svn_wc_context_t *wc_ctx,
                                     const char *local_abspath,
-                                    svn_wc_notify_func2_t notify_func,
-                                    void *notify_baton,
                                     apr_pool_t *scratch_pool);
 
 /**

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1030512&r1=1030511&r2=1030512&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Wed Nov  3 16:09:50 2010
@@ -1433,7 +1433,8 @@ repos_to_wc_copy_single(svn_client__copy
       /* Make a new checkout of the requested source. While doing so,
        * resolve pair->src_revnum to an actual revision number in case it
        * was until now 'invalid' meaning 'head'.  Ask this function not to
-       * sleep for timestamps, by passing a sleep_needed output param. */
+       * sleep for timestamps, by passing a sleep_needed output param.
+       * This sends notifications for all nodes except the root node. */
       SVN_ERR(svn_client__checkout_internal(&pair->src_revnum,
                                             pair->src_original,
                                             dst_abspath,
@@ -1443,38 +1444,11 @@ repos_to_wc_copy_single(svn_client__copy
                                             ignore_externals, FALSE, TRUE,
                                             &sleep_needed, ctx, pool));
 
-      /* Rewrite URLs recursively, remove wcprops, and mark everything
-         as 'copied' -- assuming that the src and dst are from the
-         same repository.  (It's kind of weird that svn_wc_add3() is the
-         way to do this; see its doc for more about the controversy.) */
-      if (same_repositories)
-        {
-          /* Schedule dst_path for addition in parent, with copy history.
-             (This function also recursively puts a 'copied' flag on every
-             entry). */
-          SVN_ERR(svn_wc__integrate_nested_wc_as_copy(ctx->wc_ctx, dst_abspath,
-                                                      ctx->notify_func2,
-                                                      ctx->notify_baton2,
-                                                      pool));
-
-          /* ### Recording of implied mergeinfo should really occur
-             ### *before* the notification callback is invoked by
-             ### svn_wc_add4(), but can't occur before we add the new
-             ### source path. */
-          SVN_ERR(calculate_target_mergeinfo(ra_session, &src_mergeinfo, NULL,
-                                             pair->src_abspath_or_url,
-                                             pair->src_revnum, ctx, pool));
-          SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
-        }
-      else  /* different repositories */
-        {
-          /* ### Someday, we would just call svn_wc_add4(), as above,
-             but with no copyfrom args.  I.e. in the
-             directory-foreign-UUID case, we still want everything
-             scheduled for addition, URLs rewritten, and wcprop cache
-             deleted, but WITHOUT any copied flags or copyfrom urls.
-             Unfortunately, svn_wc_add4() is such a mess that it chokes
-             at the moment when we pass a NULL copyfromurl. */
+      if (! same_repositories)
+        {
+          /* ### We want to schedule this as a simple add, or even better
+             a copy from a foreign repos, but we don't yet have the
+             WC APIs to do that. */
 
           svn_io_sleep_for_timestamps(dst_abspath, pool);
 
@@ -1483,6 +1457,14 @@ repos_to_wc_copy_single(svn_client__copy
              _("Source URL '%s' is from foreign repository; "
                "leaving it as a disjoint WC"), pair->src_abspath_or_url);
         }
+
+      /* Schedule dst_path for addition in parent, with copy history.
+         Don't send any notification here.
+
+         ### This is a wierd way to do it. See the doc string of
+             svn_wc_add_repos_file4() for more about the controversy. */
+      SVN_ERR(svn_wc__integrate_nested_wc_as_copy(ctx->wc_ctx, dst_abspath,
+                                                  pool));
     } /* end directory case */
 
   else if (pair->src_kind == svn_node_file)
@@ -1516,23 +1498,25 @@ repos_to_wc_copy_single(svn_client__copy
          ctx->cancel_func, ctx->cancel_baton,
          ctx->notify_func2, ctx->notify_baton2,
          pool));
+    }
 
-      SVN_ERR(calculate_target_mergeinfo(ra_session, &src_mergeinfo,
-                                         NULL, pair->src_abspath_or_url,
-                                         pair->src_revnum, ctx, pool));
-      SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
-
-      /* Ideally, svn_wc_add_repos_file3() would take a notify function
-         and baton, and we wouldn't have to make this call here.
-         However, the situation is... complicated.  See issue #1552
-         for the full story. */
-      if (ctx->notify_func2)
-        {
-          svn_wc_notify_t *notify = svn_wc_create_notify(
-                                      dst_abspath, svn_wc_notify_add, pool);
-          notify->kind = pair->src_kind;
-          (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
-        }
+  /* Record the implied mergeinfo (before the notification callback
+     is invoked for the root node). */
+  SVN_ERR(calculate_target_mergeinfo(ra_session, &src_mergeinfo, NULL,
+                                     pair->src_abspath_or_url,
+                                     pair->src_revnum, ctx, pool));
+  SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
+
+  /* Do our own notification for the root node, even if we could possibly
+     have delegated it.  See also issue #1552.
+
+     ### Maybe this notification should mention the mergeinfo change. */
+  if (ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify = svn_wc_create_notify(
+                                  dst_abspath, svn_wc_notify_add, pool);
+      notify->kind = pair->src_kind;
+      (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
     }
 
   svn_io_sleep_for_timestamps(dst_abspath, pool);

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1030512&r1=1030511&r2=1030512&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Wed Nov  3 16:09:50 2010
@@ -1158,8 +1158,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
 svn_error_t *
 svn_wc__integrate_nested_wc_as_copy(svn_wc_context_t *wc_ctx,
                                     const char *local_abspath,
-                                    svn_wc_notify_func2_t notify_func,
-                                    void *notify_baton,
                                     apr_pool_t *scratch_pool)
 {
   svn_wc__db_t *db = wc_ctx->db;
@@ -1181,16 +1179,6 @@ svn_wc__integrate_nested_wc_as_copy(svn_
 
   SVN_ERR(integrate_nested_wc_as_copy(wc_ctx, local_abspath, scratch_pool));
 
-  /* Report the addition to the caller. */
-  if (notify_func != NULL)
-    {
-      svn_wc_notify_t *notify
-        = svn_wc_create_notify(local_abspath, svn_wc_notify_add, scratch_pool);
-
-      notify->kind = svn_node_dir;
-      (*notify_func)(notify_baton, notify, scratch_pool);
-    }
-
   return SVN_NO_ERROR;
 }
 



Mime
View raw message