Author: rhuijben
Date: Thu Feb 28 12:54:26 2013
New Revision: 1451184

URL: http://svn.apache.org/r1451184
Log:
When harvesting commit items also store that we are really moving a node,
not just copying. This avoids some unneeded db queries and allows further
move handling streamlining later.

* subversion/include/svn_client.h
  (SVN_CLIENT_COMMIT_ITEM_MOVED_HERE): New macro.
  (svn_client_commit_item3_t): Add moved_from_abspath.

* subversion/libsvn_client/commit.c
  (svn_client_commit6): Read new flag.

* subversion/libsvn_client/commit_util.c
  (add_committable): Add argument.
  (harvest_not_present_for_copy): Update caller.
  (harvest_status_callback): Harvest moves.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/commit_util.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1451184&r1=1451183&r2=1451184&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Feb 28 12:54:26 2013
@@ -441,6 +441,8 @@ typedef struct svn_client_commit_info_t
 #define SVN_CLIENT_COMMIT_ITEM_IS_COPY     0x10
 /** @since New in 1.2. */
 #define SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN  0x20
+/** @since New in 1.8. */
+#define SVN_CLIENT_COMMIT_ITEM_MOVED_HERE  0x40
 /** @} */
 
 /** The commit candidate structure.
@@ -508,6 +510,15 @@ typedef struct svn_client_commit_item3_t
    * @since New in 1.7.
    */
   const char *session_relpath;
+
+  /**
+   * When committing a move, this contains the absolute path where
+   * the node was directly moved from. (If an ancestor at the original
+   * location was moved then it points to where the node itself was
+   * moved, from. Not the original location)
+   * @since New in 1.8.
+   */
+  const char *moved_from_abspath;
 } svn_client_commit_item3_t;
 
 /** The commit candidate structure.

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1451184&r1=1451183&r2=1451184&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Thu Feb 28 12:54:26 2013
@@ -766,8 +766,9 @@ svn_client_commit6(const apr_array_heade
 
       svn_pool_clear(iterpool);
 
-      if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
+      if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_MOVED_HERE)
         {
+          /* ### item->moved_from_abspath contains the move origin */
           const char *moved_from_abspath;
           const char *delete_op_root_abspath;
 

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1451184&r1=1451183&r2=1451184&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Thu Feb 28 12:54:26 
2013
@@ -196,6 +196,7 @@ add_committable(svn_client__committables
                 svn_revnum_t revision,
                 const char *copyfrom_relpath,
                 svn_revnum_t copyfrom_rev,
+                const char *moved_from_abspath,
                 apr_byte_t state_flags,
                 apr_hash_t *lock_tokens,
                 const svn_lock_t *lock,
@@ -245,6 +246,10 @@ add_committable(svn_client__committables
   new_item->incoming_prop_changes = apr_array_make(result_pool, 1,
                                                    sizeof(svn_prop_t *));
 
+  if (moved_from_abspath)
+    new_item->moved_from_abspath = apr_pstrdup(result_pool,
+                                               moved_from_abspath);
+
   /* Now, add the commit item to the array. */
   APR_ARRAY_PUSH(array, svn_client_commit_item3_t *) = new_item;
 
@@ -534,6 +539,7 @@ harvest_not_present_for_copy(svn_wc_cont
                               SVN_INVALID_REVNUM,
                               NULL /* copyfrom_relpath */,
                               SVN_INVALID_REVNUM /* copyfrom_rev */,
+                              NULL /* moved_from_abspath */,
                               SVN_CLIENT_COMMIT_ITEM_DELETE,
                               NULL, NULL,
                               result_pool, scratch_pool));
@@ -576,6 +582,7 @@ harvest_status_callback(void *status_bat
   void *notify_baton = baton->notify_baton;
   svn_wc_context_t *wc_ctx = baton->wc_ctx;
   apr_pool_t *result_pool = baton->result_pool;
+  const char *moved_from_abspath = NULL;
 
   if (baton->commit_relpath)
     commit_relpath = svn_relpath_join(
@@ -755,6 +762,12 @@ harvest_status_callback(void *status_bat
           state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
           cf_relpath = original_relpath;
           cf_rev = original_rev;
+
+          if (status->moved_from_abspath && !copy_mode)
+            {
+              state_flags |= SVN_CLIENT_COMMIT_ITEM_MOVED_HERE;
+              moved_from_abspath = status->moved_from_abspath;
+            }
         }
     }
 
@@ -844,6 +857,7 @@ harvest_status_callback(void *status_bat
                                       : node_rev,
                               cf_relpath,
                               cf_rev,
+                              moved_from_abspath,
                               state_flags,
                               baton->lock_tokens, status->lock,
                               result_pool, scratch_pool));


Reply via email to