You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2013/02/12 19:32:38 UTC

svn commit: r1445301 - in /subversion/trunk/subversion/libsvn_wc: conflicts.c wc_db.c wc_db.h wc_db_update_move.c

Author: philip
Date: Tue Feb 12 18:32:38 2013
New Revision: 1445301

URL: http://svn.apache.org/r1445301
Log:
Notify when resolving a delete-edit conflict raises a move-edit conflict.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_resolve_delete_raise_moved_away): Add notify parameters.

* subversion/libsvn_wc/wc_db_update_move.c
  (update_move_list_notify): Only notify if func is not NULL.
  (mark_tree_conflict): Add notification to list.
  (check_tree_conflict, tc_editor_add_file, tc_editor_delete): Don't
   add notification to list.
  (tc_editor_complete): Add comment.
  (resolve_delete_raise_moved_away): Add notify parameters, create list.
  (svn_wc__db_resolve_delete_raise_moved_away): Add notify parameters, notify.

* subversion/libsvn_wc/conflicts.c
  (resolve_conflict_on_node): Pass notify parameters.

* subversion/libsvn_wc/wc_db.c
  (op_revert_txn): Pass NULL notify parameters.

Modified:
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1445301&r1=1445300&r2=1445301&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Tue Feb 12 18:32:38 2013
@@ -2624,7 +2624,8 @@ resolve_conflict_on_node(svn_boolean_t *
               if (conflict_choice == svn_wc_conflict_choose_merged)
                 {
                   SVN_ERR(svn_wc__db_resolve_delete_raise_moved_away(
-                            db, local_abspath, scratch_pool));
+                            db, local_abspath, notify_func, notify_baton,
+                            scratch_pool));
                   *did_resolve = TRUE;
                 }
             }

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1445301&r1=1445300&r2=1445301&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Feb 12 18:32:38 2013
@@ -6115,6 +6115,7 @@ op_revert_txn(void *baton,
                 SVN_ERR(svn_wc__db_resolve_delete_raise_moved_away(
                           db, svn_dirent_join(wcroot->abspath, local_relpath,
                                               scratch_pool),
+                          NULL, NULL /* ### How do we notify this? */,
                           scratch_pool));
             }
         }

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1445301&r1=1445300&r2=1445301&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Feb 12 18:32:38 2013
@@ -3300,6 +3300,8 @@ svn_wc__db_vacuum(svn_wc__db_t *db,
 svn_error_t *
 svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db,
                                            const char *local_abspath,
+                                           svn_wc_notify_func2_t notify_func,
+                                           void *notify_baton,
                                            apr_pool_t *scratch_pool);
 
 /* Like svn_wc__db_resolve_delete_raise_moved_away this should be

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1445301&r1=1445300&r2=1445301&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Tue Feb 12 18:32:38 2013
@@ -170,39 +170,43 @@ update_move_list_notify(svn_wc__db_wcroo
                         apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
-  svn_boolean_t have_row;
-  apr_pool_t *iterpool;
-
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_SELECT_UPDATE_MOVE_LIST));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-  iterpool = svn_pool_create(scratch_pool);
-  while (have_row)
+  if (notify_func)
     {
-      const char *local_relpath;
-      svn_wc_notify_action_t action;
-      svn_wc_notify_t *notify;
+      apr_pool_t *iterpool;
+      svn_boolean_t have_row;
 
-      svn_pool_clear(iterpool);
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_SELECT_UPDATE_MOVE_LIST));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-      local_relpath = svn_sqlite__column_text(stmt, 0, NULL);
-      action = svn_sqlite__column_int(stmt, 1);
-      notify = svn_wc_create_notify(svn_dirent_join(wcroot->abspath,
-                                                    local_relpath,
-                                                    iterpool),
-                                    action, iterpool);
-      notify->kind = svn_sqlite__column_int(stmt, 2);
-      notify->content_state = svn_sqlite__column_int(stmt, 3);
-      notify->prop_state = svn_sqlite__column_int(stmt, 4);
-      notify->old_revision = old_revision;
-      notify->revision = new_revision;
-      notify_func(notify_baton, notify, scratch_pool);
+      iterpool = svn_pool_create(scratch_pool);
+      while (have_row)
+        {
+          const char *local_relpath;
+          svn_wc_notify_action_t action;
+          svn_wc_notify_t *notify;
 
-      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+          svn_pool_clear(iterpool);
+
+          local_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+          action = svn_sqlite__column_int(stmt, 1);
+          notify = svn_wc_create_notify(svn_dirent_join(wcroot->abspath,
+                                                        local_relpath,
+                                                        iterpool),
+                                        action, iterpool);
+          notify->kind = svn_sqlite__column_int(stmt, 2);
+          notify->content_state = svn_sqlite__column_int(stmt, 3);
+          notify->prop_state = svn_sqlite__column_int(stmt, 4);
+          notify->old_revision = old_revision;
+          notify->revision = new_revision;
+          notify_func(notify_baton, notify, scratch_pool);
+
+          SVN_ERR(svn_sqlite__step(&have_row, stmt));
+        }
+      svn_pool_destroy(iterpool);
+      SVN_ERR(svn_sqlite__reset(stmt));
     }
-  svn_pool_destroy(iterpool);
-  SVN_ERR(svn_sqlite__reset(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_FINALIZE_UPDATE_MOVE));
@@ -354,6 +358,12 @@ mark_tree_conflict(struct tc_editor_bato
   SVN_ERR(svn_wc__db_mark_conflict_internal(b->wcroot, local_relpath,
                                             conflict, scratch_pool));
 
+  if (b->notify_func)
+    SVN_ERR(update_move_list_add(b->wcroot, local_relpath,
+                                 svn_wc_notify_tree_conflict,
+                                 new_kind,
+                                 svn_wc_notify_state_inapplicable,
+                                 svn_wc_notify_state_inapplicable));
   return SVN_NO_ERROR;
 }
 
@@ -434,12 +444,6 @@ check_tree_conflict(svn_boolean_t *is_co
                               : svn_wc_conflict_reason_deleted),
                              action, move_src_op_root_relpath,
                              scratch_pool));
-  if (b->notify_func)
-    SVN_ERR(update_move_list_add(b->wcroot, local_relpath,
-                                 svn_wc_notify_tree_conflict,
-                                 new_kind,
-                                 svn_wc_notify_state_inapplicable,
-                                 svn_wc_notify_state_inapplicable));
 
   return SVN_NO_ERROR;
 }
@@ -592,12 +596,6 @@ tc_editor_add_file(void *baton,
                                  svn_wc_conflict_reason_unversioned,
                                  svn_wc_conflict_action_add, NULL,
                                  scratch_pool));
-      if (b->notify_func)
-        SVN_ERR(update_move_list_add(b->wcroot, relpath,
-                                     svn_wc_notify_tree_conflict,
-                                     svn_node_file,
-                                     svn_wc_notify_state_inapplicable,
-                                     svn_wc_notify_state_inapplicable));
       return SVN_NO_ERROR;
     }
 
@@ -1108,12 +1106,6 @@ tc_editor_delete(void *baton,
                                      move_dst_repos_relpath, reason,
                                      svn_wc_conflict_action_delete, NULL,
                                      scratch_pool));
-          if (b->notify_func)
-            SVN_ERR(update_move_list_add(b->wcroot, relpath,
-                                         svn_wc_notify_tree_conflict,
-                                         svn_node_dir, /* ### kinds? */
-                                         svn_wc_notify_state_inapplicable,
-                                         svn_wc_notify_state_inapplicable));
         }
     }
 
@@ -1236,7 +1228,11 @@ tc_editor_complete(void *baton,
 {
   struct tc_editor_baton *b = baton;
 
-  /* Send all queued up notifications. */
+  /* Send all queued up notifications.
+
+     ### This is notifying too early.  One reason for using the
+     ### update_move_list is to do the notifications after the
+     ### transaction has completeted. */
   SVN_ERR(update_move_list_notify(b->wcroot,
                                   b->old_version->peg_rev,
                                   b->new_version->peg_rev,
@@ -2040,6 +2036,8 @@ resolve_delete_raise_moved_away(svn_wc__
                                 svn_wc_conflict_action_t action,
                                 svn_wc_conflict_version_t *old_version,
                                 svn_wc_conflict_version_t *new_version,
+                                svn_wc_notify_func2_t notify_func,
+                                void *notify_baton,
                                 apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
@@ -2047,6 +2045,9 @@ resolve_delete_raise_moved_away(svn_wc__
   int op_depth = relpath_depth(local_relpath);
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
   
+  SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
+                                      STMT_CREATE_UPDATE_MOVE_LIST));
+
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_OP_DEPTH_MOVED_PAIR));
   SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
@@ -2069,6 +2070,8 @@ resolve_delete_raise_moved_away(svn_wc__
       b.new_version = new_version;
       b.move_root_dst_relpath = svn_sqlite__column_text(stmt, 1, NULL);
       b.result_pool = scratch_pool;
+      b.notify_func = notify_func;
+      b.notify_baton = notify_baton;
       
       SVN_ERR(mark_tree_conflict(&b, moved_relpath,
                                  svn_node_dir /* ### ? */,
@@ -2077,8 +2080,6 @@ resolve_delete_raise_moved_away(svn_wc__
                                  svn_wc_conflict_reason_moved_away,
                                  action, local_relpath, iterpool));
 
-      /* ### Do notification? */
-
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
   SVN_ERR(svn_sqlite__reset(stmt));
@@ -2091,6 +2092,8 @@ resolve_delete_raise_moved_away(svn_wc__
 svn_error_t *
 svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db,
                                            const char *local_abspath,
+                                           svn_wc_notify_func2_t notify_func,
+                                           void *notify_baton,
                                            apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
@@ -2113,9 +2116,18 @@ svn_wc__db_resolve_delete_raise_moved_aw
     resolve_delete_raise_moved_away(wcroot, local_relpath,
                                     db, operation, action,
                                     old_version, new_version,
+                                    notify_func, notify_baton,
                                     scratch_pool),
     wcroot);
 
+  SVN_ERR(update_move_list_notify(wcroot,
+                                  old_version->peg_rev,
+                                  (new_version 
+                                   ? new_version->peg_rev
+                                   : SVN_INVALID_REVNUM),
+                                  notify_func, notify_baton,
+                                  scratch_pool));
+
   return SVN_NO_ERROR;
 }