Author: julianfoad
Date: Mon Feb 23 19:02:29 2015
New Revision: 1661748

URL: http://svn.apache.org/r1661748
Log:
On the 'move-tracking-2' branch: Print the changes after every commit.

* subversion/libsvn_delta/compat3b.c
  (svn_editor3_el_rev_get): Don't assert that the node has a content,
    because in the current usage the node might be a branch-root node.

* subversion/libsvn_ra/ra_loader.c
  (commit_callback_wrapper): Finalize and store the branching info before,
    not after, calling the commit callback.

* subversion/svnmover/svnmover.c
  (mtcc_create): Pass the new context baton to the commit callback.
  (commit_callback): Print a diff after the commit.
  (execute): Assume and require that the anchor URL is specified in
    advance.

* subversion/tests/cmdline/svnmover_tests.py
  (test_svnmover): Expect the commit summary line to come anywhere, not
    necessarily at the end of the output.

Modified:
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
    
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c?rev=1661748&r1=1661747&r2=1661748&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c Mon 
Feb 23 19:02:29 2015
@@ -834,12 +834,13 @@ svn_editor3_el_rev_get(svn_branch_el_rev
 
   /* Node content is null iff node is a subbranch root, but we shouldn't
      be querying a subbranch root. */
-  SVN_ERR_ASSERT(!node || node->content);
+  /* ### Why/how not? */
+  /*SVN_ERR_ASSERT(!node || node->content);*/
 
   node = node ? svn_branch_el_rev_content_dup(node, result_pool) : NULL;
 
   /* If content is by reference, fetch full content. */
-  if (node && (node->content->ref.relpath))
+  if (node && node->content && node->content->ref.relpath)
     {
       SVN_ERR(content_fetch(&node->content, NULL,
                             eb, &node->content->ref,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1661748&r1=1661747&r2=1661748&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Mon 
Feb 23 19:02:29 2015
@@ -824,19 +824,23 @@ commit_callback_wrapper(const svn_commit
 {
   struct ccw_baton *ccwb = baton;
 
-  if (ccwb->original_callback)
-    {
-      SVN_ERR(ccwb->original_callback(commit_info, ccwb->original_baton, 
pool));
-    }
-
   /* if this commit used element-branching info, store the new info */
   if (ccwb->branching_txn)
     {
+      svn_branch_repos_t *repos = ccwb->branching_txn->repos;
+
       ccwb->branching_txn->rev = commit_info->revision;
+      APR_ARRAY_PUSH(repos->rev_roots, void *) = ccwb->branching_txn;
       SVN_ERR(store_repos_info(ccwb->branching_txn, ccwb->session,
                                ccwb->branch_info_dir, pool));
     }
 
+  /* call the wrapped callback */
+  if (ccwb->original_callback)
+    {
+      SVN_ERR(ccwb->original_callback(commit_info, ccwb->original_baton, 
pool));
+    }
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1661748&r1=1661747&r2=1661748&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Mon Feb 
23 19:02:29 2015
@@ -114,12 +114,15 @@ typedef struct mtcc_t
 } mtcc_t;
 
 static svn_error_t *
+commit_callback(const svn_commit_info_t *commit_info,
+                void *baton,
+                apr_pool_t *pool);
+
+static svn_error_t *
 mtcc_create(mtcc_t **mtcc_p,
             const char *anchor_url,
             svn_revnum_t base_revision,
             apr_hash_t *revprops,
-            svn_commit_callback2_t commit_callback,
-            void *commit_baton,
             svn_client_ctx_t *ctx,
             apr_pool_t *result_pool,
             apr_pool_t *scratch_pool)
@@ -166,7 +169,7 @@ mtcc_create(mtcc_t **mtcc_p,
 
   SVN_ERR(svn_ra_get_commit_editor_ev3(mtcc->ra_session, &mtcc->editor,
                                        revprops,
-                                       commit_callback, commit_baton,
+                                       commit_callback, mtcc,
                                        NULL /*lock_tokens*/, FALSE 
/*keep_locks*/,
                                        branch_info_dir,
                                        result_pool));
@@ -215,19 +218,6 @@ mtcc_commit(mtcc_t *mtcc,
   return svn_error_trace(err);
 }
 
-static svn_error_t *
-commit_callback(const svn_commit_info_t *commit_info,
-                void *baton,
-                apr_pool_t *pool)
-{
-  SVN_ERR(svn_cmdline_printf(pool, "r%ld committed by %s at %s\n",
-                             commit_info->revision,
-                             (commit_info->author
-                              ? commit_info->author : "(no author)"),
-                             commit_info->date));
-  return SVN_NO_ERROR;
-}
-
 typedef enum action_code_t {
   ACTION_DIFF,
   ACTION_DIFF_E,
@@ -1318,6 +1308,38 @@ svn_branch_log(svn_editor3_t *editor,
   return SVN_NO_ERROR;
 }
 
+/* This commit callback prints not only a commit summary line but also
+ * a log-style summary of the changes.
+ */
+static svn_error_t *
+commit_callback(const svn_commit_info_t *commit_info,
+                void *baton,
+                apr_pool_t *pool)
+{
+  mtcc_t *mtcc = baton;
+  svn_branch_el_rev_id_t *el_rev_left, *el_rev_right;
+  const char *rrpath = "";
+
+  SVN_ERR(svn_cmdline_printf(pool, "r%ld committed by %s at %s\n",
+                             commit_info->revision,
+                             (commit_info->author
+                              ? commit_info->author : "(no author)"),
+                             commit_info->date));
+
+  SVN_ERR(find_el_rev_by_rrpath_rev(&el_rev_left, mtcc->editor,
+                                    commit_info->revision - 1, rrpath,
+                                    pool, pool));
+  SVN_ERR(find_el_rev_by_rrpath_rev(&el_rev_right, mtcc->editor,
+                                    commit_info->revision, rrpath,
+                                    pool, pool));
+  printf("   Committed change:\n");
+  SVN_ERR(svn_branch_diff_r(mtcc->editor,
+                            el_rev_left, el_rev_right,
+                            svn_branch_diff_e, "   ",
+                            pool));
+  return SVN_NO_ERROR;
+}
+
 #define VERIFY_REV_SPECIFIED(op, i)                                     \
   if (el_rev[i]->rev == SVN_INVALID_REVNUM)                             \
     return svn_error_createf(SVN_ERR_BRANCHING, NULL,                   \
@@ -1366,7 +1388,6 @@ execute(const apr_array_header_t *action
 
   SVN_ERR(mtcc_create(&mtcc,
                       anchor_url, base_revision, revprops,
-                      commit_callback, NULL,
                       ctx, pool, iterpool));
   editor = mtcc->editor;
   base_relpath = svn_uri_skip_ancestor(mtcc->repos_root_url, anchor_url, pool);

Modified: 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py?rev=1661748&r1=1661747&r2=1661748&view=diff
==============================================================================
--- 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py 
(original)
+++ 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py 
Mon Feb 23 19:02:29 2015
@@ -65,7 +65,7 @@ def test_svnmover(repo_url, expected_pat
                                                             *varargs)
   if errlines:
     raise svntest.main.SVNCommitFailure(str(errlines))
-  if len(outlines) < 1 or not _commit_re.match(outlines[-1]):
+  if not any(map(_commit_re.match, outlines)):
     raise svntest.main.SVNLineUnequal(str(outlines))
 
   # Now, run 'svn log -vq -rHEAD'


Reply via email to