Author: stsp
Date: Thu Nov 24 13:57:21 2011
New Revision: 1205832

URL: http://svn.apache.org/viewvc?rev=1205832&view=rev
Log:
On the moves-scan-log branch, show move chains to the user.

* subversion/svn/conflict-callbacks.c
  (format_move_chain_for_display): New helper.
  (pick_move): Use the new helper to print combined move operations,
   as well as the individual moves which make up combined moves.

Modified:
    subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c

Modified: subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c?rev=1205832&r1=1205831&r2=1205832&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c Thu 
Nov 24 13:57:21 2011
@@ -256,6 +256,53 @@ launch_resolver(svn_boolean_t *performed
 }
 
 
+static const char *
+format_move_chain_for_display(svn_wc_repos_move_info_t *first_move,
+                              apr_pool_t *result_pool)
+{
+  const char *s;
+  svn_wc_repos_move_info_t *last_move;
+
+  last_move = first_move;
+  while (last_move->next)
+    last_move = last_move->next;
+
+  if (last_move != first_move)
+    {
+      svn_wc_repos_move_info_t *this_move;
+
+      s = apr_psprintf(result_pool,
+                        _("Combined move:\n  %s@%ld -> %s\n"
+                       "Individual moves:\n"),
+                       first_move->moved_from_repos_relpath,
+                       first_move->copyfrom_rev,
+                       last_move->moved_to_repos_relpath);
+      
+      this_move = first_move;
+      do
+        {
+          s = apr_pstrcat(result_pool, s,
+                          apr_psprintf(
+                            result_pool, _("  [r%ld] %s@%ld -> %s\n"),
+                            this_move->revision,
+                            this_move->moved_from_repos_relpath,
+                            this_move->copyfrom_rev,
+                            this_move->moved_to_repos_relpath),
+                          (char *)NULL);
+          this_move = this_move->next;
+        }
+      while (this_move);
+    }
+  else
+    s = apr_psprintf(result_pool, _("  [r%ld] %s@%ld -> %s\n"),
+                     first_move->revision,
+                     first_move->moved_from_repos_relpath,
+                     first_move->copyfrom_rev,
+                     first_move->moved_to_repos_relpath);
+
+  return s;
+}
+
 static svn_error_t *
 pick_move(svn_wc_repos_move_info_t **move,
           apr_array_header_t *suggested_moves,
@@ -272,11 +319,9 @@ pick_move(svn_wc_repos_move_info_t **mov
     {
       this_move = APR_ARRAY_IDX(suggested_moves, 0,
                                 svn_wc_repos_move_info_t *);
-      SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
-                _("  [r%ld] %s@%ld -> %s\n"),
-                this_move->revision, this_move->moved_from_repos_relpath,
-                this_move->copyfrom_rev, this_move->moved_to_repos_relpath));
-      
+      SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool, "%s\n",
+                                  format_move_chain_for_display(this_move,
+                                                                
scratch_pool)));
       *move = this_move;
       return SVN_NO_ERROR;
     }
@@ -284,15 +329,13 @@ pick_move(svn_wc_repos_move_info_t **mov
   prompt = _("Multiple moves found in revision log:\n");
   for (i = 0; i < suggested_moves->nelts; i++)
     {
+      this_move = APR_ARRAY_IDX(suggested_moves, i,
+                                 svn_wc_repos_move_info_t *);
       prompt = apr_pstrcat(scratch_pool, prompt,
-                  apr_psprintf(scratch_pool,
-                                _("  (%i) [r%ld] %s@%ld -> %s\n"),
-                                i, this_move->revision,
-                                this_move->moved_from_repos_relpath,
-                                this_move->copyfrom_rev,
-                                this_move->moved_to_repos_relpath),
+                  apr_psprintf(scratch_pool, _("  (%i) %s\n"), i,
+                               format_move_chain_for_display(this_move,
+                                                             scratch_pool)),
                   (char *)NULL);
-      this_move = this_move->next;
     }
 
   prompt = apr_pstrcat(scratch_pool, prompt,


Reply via email to