subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1440077 - /subversion/trunk/subversion/libsvn_client/merge.c
Date Tue, 29 Jan 2013 19:38:52 GMT
Author: rhuijben
Date: Tue Jan 29 19:38:52 2013
New Revision: 1440077

URL: http://svn.apache.org/viewvc?rev=1440077&view=rev
Log:
Add the 'D'elete +'A'dd is 'R'eplace logic to the merge notification code, to
make it 100% compatible with the current diff notification code.

* subversion/libsvn_client/merge.c
  (HANDLE_NOTIFY_FROM_MERGE): Move to the file header.
  (merge_cmd_baton_t): Add hash to collect to be notified paths.
  (HANDLE_NOTIFY_FROM_MERGE): Remove here.
  (record_update_add): If a delete is pending for the same path notify
    a replace.
  (record_update_delete): Store paths that are deleted, instead of directly
    notifying them.
  (merge_dir_closed): Notify deletes below the directory.
  (do_merge): (Re-)initialize the pending deletes hash.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1440077&r1=1440076&r2=1440077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Jan 29 19:38:52 2013
@@ -64,6 +64,8 @@
 
 #include "svn_private_config.h"
 
+/* #define HANDLE_NOTIFY_FROM_MERGE */
+
 /*-----------------------------------------------------------------------*/
 
 /* MERGEINFO MERGE SOURCE NORMALIZATION
@@ -386,6 +388,13 @@ typedef struct merge_cmd_baton_t {
 
   } nrb;
 
+#ifdef HANDLE_NOTIFY_FROM_MERGE
+  /* const char * local_abspath to const char *kind mapping, containing
+     deleted nodes that still need a delete notification (which may be a
+     replaced notification if the node is not just deleted) */
+  apr_hash_t *pending_deletes;
+#endif
+
 } merge_cmd_baton_t;
 
 
@@ -1439,8 +1448,6 @@ check_moved_here(svn_boolean_t *moved_he
   return SVN_NO_ERROR;
 }
 
-/* #defined HANDLE_NOTIFY_FROM_MERGE */
-
 /* Record the skip for future processing and (later) produce the
    skip notification */
 static svn_error_t *
@@ -1576,9 +1583,16 @@ record_update_add(merge_cmd_baton_t *mer
   if (merge_b->ctx->notify_func2)
     {
       svn_wc_notify_t *notify;
+      svn_wc_notify_action_t action = svn_wc_notify_update_add;
 
-      notify = svn_wc_create_notify(local_abspath, svn_wc_notify_update_add,
-                                    scratch_pool);
+      if (contains_path(merge_b->pending_deletes, local_abspath))
+        {
+          action = svn_wc_notify_update_replace;
+          apr_hash_set(merge_b->pending_deletes, local_abspath,
+                       APR_HASH_KEY_STRING, NULL);
+        }
+
+      notify = svn_wc_create_notify(local_abspath, action, scratch_pool);
       notify->kind = kind;
 
       (*merge_b->ctx->notify_func2)(merge_b->ctx->notify_baton2, notify,
@@ -1652,14 +1666,10 @@ record_update_delete(merge_cmd_baton_t *
 #ifdef HANDLE_NOTIFY_FROM_MERGE
   if (merge_b->ctx->notify_func2)
     {
-      svn_wc_notify_t *notify;
+      const char *dup_abspath = apr_pstrdup(merge_b->pool, local_abspath);
 
-      notify = svn_wc_create_notify(local_abspath, svn_wc_notify_update_delete,
-                                    scratch_pool);
-      notify->kind = kind;
-
-      (*merge_b->ctx->notify_func2)(merge_b->ctx->notify_baton2, notify,
-                                    scratch_pool);
+      apr_hash_set(merge_b->pending_deletes, dup_abspath, APR_HASH_KEY_STRING,
+                   svn_node_kind_to_word(kind));
     }
 #endif
 
@@ -2996,6 +3006,39 @@ merge_dir_closed(svn_wc_notify_state_t *
   if (merge_b->dry_run)
     SVN_ERR(svn_hash__clear(merge_b->dry_run_deletions, scratch_pool));
 
+#ifdef HANDLE_NOTIFY_FROM_MERGE
+  if (merge_b->ctx->notify_func2)
+    {
+      apr_hash_index_t *hi;
+      const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
+                                                  path, scratch_pool);
+
+      for (hi = apr_hash_first(scratch_pool, merge_b->pending_deletes);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          const char *del_abspath = svn__apr_hash_index_key(hi);
+
+          if (svn_dirent_is_child(local_abspath, del_abspath, NULL))
+            {
+              svn_wc_notify_t *notify;
+
+              notify = svn_wc_create_notify(del_abspath,
+                                            svn_wc_notify_update_delete,
+                                            scratch_pool);
+              notify->kind = svn_node_kind_from_word(
+                                    svn__apr_hash_index_val(hi));
+
+              (*merge_b->ctx->notify_func2)(merge_b->ctx->notify_baton2,
+                                            notify, scratch_pool);
+
+              apr_hash_set(merge_b->pending_deletes, del_abspath,
+                           APR_HASH_KEY_STRING, NULL);
+            }
+        }
+    }
+#endif
+
   return SVN_NO_ERROR;
 }
 
@@ -9322,6 +9365,10 @@ do_merge(apr_hash_t **modified_subtrees,
       merge_cmd_baton.ra_session1 = ra_session1;
       merge_cmd_baton.ra_session2 = ra_session2;
 
+#ifdef HANDLE_NOTIFY_FROM_MERGE
+      merge_cmd_baton.pending_deletes = apr_hash_make(iterpool);
+#endif
+
       /* Populate the portions of the merge context baton that require
          an RA session to set, but shouldn't be reset for each iteration. */
       if (! checked_mergeinfo_capability)



Mime
View raw message