You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/08/30 16:39:59 UTC

svn commit: r1163238 - in /subversion/trunk/subversion/libsvn_client: merge.c repos_diff.c

Author: julianfoad
Date: Tue Aug 30 14:39:58 2011
New Revision: 1163238

URL: http://svn.apache.org/viewvc?rev=1163238&view=rev
Log:
Move some merge-specific code from the client's repos-repos diff editor into
the merge code.  A follow-up to r1161219.

* subversion/libsvn_client/repos_diff.c
  (close_file): Don't adjust for a local move in the notification caller, ...

* subversion/libsvn_client/merge.c
  (notification_receiver): ... do it here in the callee instead.

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

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1163238&r1=1163237&r2=1163238&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Aug 30 14:39:58 2011
@@ -2694,6 +2694,7 @@ notification_receiver(void *baton, const
 {
   notification_receiver_baton_t *notify_b = baton;
   svn_boolean_t is_operative_notification = FALSE;
+  const char *notify_path;
 
   /* Skip notifications if this is a --record-only merge that is adding
      or deleting NOTIFY->PATH, allow only mergeinfo changes and headers.
@@ -2711,6 +2712,35 @@ notification_receiver(void *baton, const
       is_operative_notification = TRUE;
     }
 
+  /* If the node was moved-away, use its new path in the notification. */
+  /* ### Currently only for files, as following a local move of a dir is
+   * not yet implemented.
+   * ### We should stash the info about which moves have been followed and
+   * retrieve that info here, instead of querying the WC again here. */
+  notify_path = notify->path;
+  if (notify->action == svn_wc_notify_update_update
+      && notify->kind == svn_node_file)
+    {
+      svn_error_t *err;
+      const char *moved_to_abspath;
+
+      err = svn_wc__node_was_moved_away(&moved_to_abspath, NULL,
+                                        notify_b->merge_b->ctx->wc_ctx,
+                                        notify->path, pool, pool);
+      if (err)
+        {
+          if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+            {
+              svn_error_clear(err);
+              moved_to_abspath = NULL;
+            }
+          else
+            return;  /* ### return svn_error_trace(err); */
+        }
+      if (moved_to_abspath)
+        notify_path = moved_to_abspath;
+    }
+
   if (notify_b->merge_b->sources_ancestral
       || notify_b->merge_b->reintegrate_merge)
     {
@@ -2720,7 +2750,7 @@ notification_receiver(void *baton, const
           || notify->prop_state == svn_wc_notify_state_changed
           || notify->action == svn_wc_notify_update_add)
         {
-          const char *merged_path = apr_pstrdup(notify_b->pool, notify->path);
+          const char *merged_path = apr_pstrdup(notify_b->pool, notify_path);
 
           if (notify_b->merged_abspaths == NULL)
             notify_b->merged_abspaths = apr_hash_make(notify_b->pool);
@@ -2731,7 +2761,7 @@ notification_receiver(void *baton, const
 
       if (notify->action == svn_wc_notify_skip)
         {
-          const char *skipped_path = apr_pstrdup(notify_b->pool, notify->path);
+          const char *skipped_path = apr_pstrdup(notify_b->pool, notify_path);
 
           if (notify_b->skipped_abspaths == NULL)
             notify_b->skipped_abspaths = apr_hash_make(notify_b->pool);
@@ -2743,7 +2773,7 @@ notification_receiver(void *baton, const
       if (notify->action == svn_wc_notify_tree_conflict)
         {
           const char *tree_conflicted_path = apr_pstrdup(notify_b->pool,
-                                                         notify->path);
+                                                         notify_path);
 
           if (notify_b->tree_conflicted_abspaths == NULL)
             notify_b->tree_conflicted_abspaths =
@@ -2757,7 +2787,7 @@ notification_receiver(void *baton, const
       if (notify->action == svn_wc_notify_update_add)
         {
           svn_boolean_t is_root_of_added_subtree = FALSE;
-          const char *added_path = apr_pstrdup(notify_b->pool, notify->path);
+          const char *added_path = apr_pstrdup(notify_b->pool, notify_path);
           const char *added_path_parent = NULL;
 
           /* Stash the root path of any added subtrees. */
@@ -2806,7 +2836,7 @@ notification_receiver(void *baton, const
             find_nearest_ancestor(
               notify_b->children_with_mergeinfo,
               notify->action != svn_wc_notify_update_delete,
-              notify->path);
+              notify_path);
 
           if (new_nearest_ancestor_index != notify_b->cur_ancestor_index)
             {

Modified: subversion/trunk/subversion/libsvn_client/repos_diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/repos_diff.c?rev=1163238&r1=1163237&r2=1163238&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/repos_diff.c Tue Aug 30 14:39:58 2011
@@ -1074,7 +1074,6 @@ close_file(void *file_baton,
       svn_wc_notify_t *notify;
       svn_wc_notify_action_t action;
       svn_node_kind_t kind = svn_node_file;
-      const char *moved_to_abspath = NULL;
 
       /* Find out if a pending delete notification for this path is
        * still around. */
@@ -1110,30 +1109,9 @@ close_file(void *file_baton,
       else if (b->added)
         action = svn_wc_notify_update_add;
       else
-        {
-          svn_error_t *err;
-
-          action = svn_wc_notify_update_update;
-
-          /* If the file was moved-away, use its new path in the
-           * notification.
-           * ### This is redundant. The file_changed() callback should
-           * ### pass the moved-to path back up here. */
-          err = svn_wc__node_was_moved_away(&moved_to_abspath, NULL,
-                                            eb->wc_ctx, b->wcpath,
-                                            scratch_pool, scratch_pool);
-          if (err)
-            {
-              if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-                svn_error_clear(err);
-              else
-                return svn_error_trace(err);
-            }
-        }
+        action = svn_wc_notify_update_update;
 
-      notify = svn_wc_create_notify(moved_to_abspath ? moved_to_abspath
-                                                     : b->wcpath,
-                                    action, scratch_pool);
+      notify = svn_wc_create_notify(b->wcpath, action, scratch_pool);
       notify->kind = kind;
       notify->content_state = content_state;
       notify->prop_state = prop_state;