subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1550806 - in /subversion/trunk/subversion: libsvn_client/mtcc.c tests/libsvn_client/mtcc-test.c
Date Fri, 13 Dec 2013 18:51:41 GMT
Author: rhuijben
Date: Fri Dec 13 18:51:40 2013
New Revision: 1550806

URL: http://svn.apache.org/r1550806
Log:
Following up on r1550799 add more commit verification logic to the mtcc tests.

* subversion/libsvn_client/mtcc.c
  (add_commit_items): Store more information in the commit items.

* subversion/tests/libsvn_client/mtcc-test.c
  (verify_commit_baton): New struct.
  (verify_commit_callback): New function.
  (verify_mtcc_commit): Use verify_commit_callback to check the commit result.
    Add revision argument.

  (make_greek_tree,
   test_mkdir,
   test_mkgreek,
   test_swap): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_client/mtcc.c
    subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c

Modified: subversion/trunk/subversion/libsvn_client/mtcc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mtcc.c?rev=1550806&r1=1550805&r2=1550806&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mtcc.c (original)
+++ subversion/trunk/subversion/libsvn_client/mtcc.c Fri Dec 13 18:51:40 2013
@@ -681,6 +681,7 @@ commit_directory(const svn_delta_editor_
    to provide to the log message callback */
 static svn_error_t *
 add_commit_items(svn_client_mtcc_op_t *op,
+                 const char *session_url,
                  const char *url,
                  apr_array_header_t *commit_items,
                  apr_pool_t *result_pool,
@@ -703,6 +704,18 @@ add_commit_items(svn_client_mtcc_op_t *o
         item->kind = svn_node_unknown;
 
       item->url = apr_pstrdup(result_pool, url);
+      item->session_relpath = svn_relpath_skip_ancestor(session_url, item->url,
+                                                        result_pool);
+
+      if (op->src_relpath)
+        {
+          item->copyfrom_url = svn_path_url_add_component2(session_url,
+                                                           op->src_relpath,
+                                                           result_pool);
+          item->copyfrom_rev = op->src_rev;
+        }
+      else
+        item->copyfrom_rev = SVN_INVALID_REVNUM;
 
       if (op->kind == OP_ADD_DIR || op->kind == OP_ADD_FILE)
         item->state_flags = SVN_CLIENT_COMMIT_ITEM_ADD;
@@ -735,7 +748,7 @@ add_commit_items(svn_client_mtcc_op_t *o
 
           child_url = svn_path_url_add_component2(url, cop->name, iterpool);
 
-          SVN_ERR(add_commit_items(cop, child_url, commit_items,
+          SVN_ERR(add_commit_items(cop, session_url, child_url, commit_items,
                                    result_pool, iterpool));
         }
 

Modified: subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c?rev=1550806&r1=1550805&r2=1550806&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c Fri Dec 13 18:51:40 2013
@@ -33,12 +33,39 @@
 #include "../svn_test.h"
 #include "../svn_test_fs.h"
 
+/* Baton for verify_commit_callback*/
+struct verify_commit_baton
+{
+  const svn_commit_info_t *commit_info;
+  apr_pool_t *result_pool;
+};
+
+/* Commit result collector for verify_mtcc_commit */
+static svn_error_t *
+verify_commit_callback(const svn_commit_info_t *commit_info,
+                       void *baton,
+                       apr_pool_t *pool)
+{
+  struct verify_commit_baton *vcb = baton;
+
+  vcb->commit_info = svn_commit_info_dup(commit_info, vcb->result_pool);
+  return SVN_NO_ERROR;
+}
+
+
 static svn_error_t *
 verify_mtcc_commit(svn_client_mtcc_t *mtcc,
+                   svn_revnum_t expected_rev,
                    apr_pool_t *pool)
 {
-  /* TODO: Verify actual commit, etc. */
-  SVN_ERR(svn_client_mtcc_commit(NULL, NULL, NULL, mtcc, pool));
+  struct verify_commit_baton vcb;
+  vcb.commit_info = NULL;
+  vcb.result_pool = pool;
+
+  SVN_ERR(svn_client_mtcc_commit(NULL, verify_commit_callback, &vcb, mtcc, pool));
+
+  SVN_TEST_ASSERT(vcb.commit_info != NULL);
+  SVN_TEST_ASSERT(vcb.commit_info->revision == expected_rev);
 
   return SVN_NO_ERROR;
 };
@@ -81,7 +108,7 @@ make_greek_tree(const char *repos_url,
         }
     }
 
-  SVN_ERR(verify_mtcc_commit(mtcc, subpool));
+  SVN_ERR(verify_mtcc_commit(mtcc, 1, subpool));
 
   svn_pool_clear(subpool);
   return SVN_NO_ERROR;
@@ -112,7 +139,7 @@ test_mkdir(const svn_test_opts_t *opts,
   SVN_ERR(svn_client_mtcc_add_mkdir("tags/1.0", mtcc, pool));
   SVN_ERR(svn_client_mtcc_add_mkdir("tags/1.1", mtcc, pool));
 
-  SVN_ERR(verify_mtcc_commit(mtcc, pool));
+  SVN_ERR(verify_mtcc_commit(mtcc, 1, pool));
 
   return SVN_NO_ERROR;
 }
@@ -139,7 +166,7 @@ test_mkgreek(const svn_test_opts_t *opts
 
   SVN_ERR(svn_client_mtcc_add_copy("A", 1, "greek_A", mtcc, pool));
 
-  SVN_ERR(verify_mtcc_commit(mtcc, pool));
+  SVN_ERR(verify_mtcc_commit(mtcc, 2, pool));
 
   return SVN_NO_ERROR;
 }
@@ -168,7 +195,7 @@ test_swap(const svn_test_opts_t *opts,
   SVN_ERR(svn_client_mtcc_add_move("A/D", "A/B", mtcc, pool));
   SVN_ERR(svn_client_mtcc_add_copy("A/B", 1, "A/D", mtcc, pool));
 
-  SVN_ERR(verify_mtcc_commit(mtcc, pool));
+  SVN_ERR(verify_mtcc_commit(mtcc, 2, pool));
 
   return SVN_NO_ERROR;
 }



Mime
View raw message