Author: stsp
Date: Thu Nov 24 17:03:23 2011
New Revision: 1205931

URL: http://svn.apache.org/viewvc?rev=1205931&view=rev
Log:
On the moves-scan-log branch, improve output of the conflict callback.

* subversion/svn/cl.h
  (svn_cl__conflict_baton_t): Add path_prefix, to allow showing relative
   paths in the conflict callback.
  (svn_cl__conflict_baton_make): Tweak declaration (see below).

* subversion/svn/main.c
  (main): Follow signature change of svn_cl__conflict_baton_make().

* subversion/svn/conflict-callbacks.c
  (svn_cl__conflict_baton_make): Return svn_error_t *, add output argument
   for the created baton.
  (svn_cl__conflict_handler): Show a standard human-readable description of
   the tree conflict. Use a relative path to describe the tree conflict victim.

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

Modified: subversion/branches/moves-scan-log/subversion/svn/cl.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/cl.h?rev=1205931&r1=1205930&r2=1205931&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/svn/cl.h (original)
+++ subversion/branches/moves-scan-log/subversion/svn/cl.h Thu Nov 24 17:03:23 
2011
@@ -329,13 +329,15 @@ typedef struct svn_cl__conflict_baton_t 
   const char *editor_cmd;
   svn_boolean_t external_failed;
   svn_cmdline_prompt_baton_t *pb;
+  const char *path_prefix;
 } svn_cl__conflict_baton_t;
 
-/* Create and return a conflict baton, allocated from POOL, with the values
-   ACCEPT_WHICH, CONFIG, EDITOR_CMD and PB placed in the same-named fields
-   of the baton, and its 'external_failed' field initialised to FALSE. */
-svn_cl__conflict_baton_t *
-svn_cl__conflict_baton_make(svn_cl__accept_t accept_which,
+/* Create and return a conflict baton in *B, allocated from POOL, with the
+ * values ACCEPT_WHICH, CONFIG, EDITOR_CMD and PB placed in the same-named
+ * fields of the baton, and its 'external_failed' field initialised to FALSE. 
*/
+svn_error_t *
+svn_cl__conflict_baton_make(svn_cl__conflict_baton_t **b,
+                            svn_cl__accept_t accept_which,
                             apr_hash_t *config,
                             const char *editor_cmd,
                             svn_cmdline_prompt_baton_t *pb,

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=1205931&r1=1205930&r2=1205931&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 17:03:23 2011
@@ -35,26 +35,29 @@
 #include "svn_pools.h"
 
 #include "cl.h"
+#include "tree-conflicts.h"
 
 #include "svn_private_config.h"
 
 
 
 
-svn_cl__conflict_baton_t *
-svn_cl__conflict_baton_make(svn_cl__accept_t accept_which,
+svn_error_t *
+svn_cl__conflict_baton_make(svn_cl__conflict_baton_t **b,
+                            svn_cl__accept_t accept_which,
                             apr_hash_t *config,
                             const char *editor_cmd,
                             svn_cmdline_prompt_baton_t *pb,
                             apr_pool_t *pool)
 {
-  svn_cl__conflict_baton_t *b = apr_palloc(pool, sizeof(*b));
-  b->accept_which = accept_which;
-  b->config = config;
-  b->editor_cmd = editor_cmd;
-  b->external_failed = FALSE;
-  b->pb = pb;
-  return b;
+  *b = apr_palloc(pool, sizeof(**b));
+  (*b)->accept_which = accept_which;
+  (*b)->config = config;
+  (*b)->editor_cmd = editor_cmd;
+  (*b)->external_failed = FALSE;
+  (*b)->pb = pb;
+  SVN_ERR(svn_dirent_get_absolute(&(*b)->path_prefix, "", pool));
+  return SVN_NO_ERROR;
 }
 
 svn_cl__accept_t
@@ -893,13 +896,21 @@ svn_cl__conflict_handler(svn_wc_conflict
       const char *prompt;
 
       if (!desc->suggested_moves)
-        SVN_ERR(svn_cmdline_fprintf(
-                     stderr, subpool,
-                     _("Tree conflict discovered when trying to delete\n'%s'\n"
-                       "Server is sending moves as copy+delete.\n"
-                       "Maybe this incoming delete is part of a move?\n"),
-                     svn_dirent_local_style(desc->local_abspath, subpool)));
+        {
+          const char *readable_desc;
 
+          SVN_ERR(svn_cl__get_human_readable_tree_conflict_description(
+                   &readable_desc, desc, scratch_pool));
+          SVN_ERR(svn_cmdline_fprintf(
+                       stderr, subpool,
+                       _("Tree conflict on '%s'\n   > %s\n"
+                         "Server is sending moves as copy+delete.\n"
+                         "Maybe this incoming delete is part of a move?\n"),
+                       svn_cl__local_style_skip_ancestor(b->path_prefix,
+                                                         desc->local_abspath,
+                                                         scratch_pool),
+                       readable_desc));
+        }
       prompt = _("Select: (p) postpone, (f) find-move,\n"
                  "        (a) ask-move, (d) is-delete, (h) help: ");
 

Modified: subversion/branches/moves-scan-log/subversion/svn/main.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/main.c?rev=1205931&r1=1205930&r2=1205931&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/svn/main.c (original)
+++ subversion/branches/moves-scan-log/subversion/svn/main.c Thu Nov 24 
17:03:23 2011
@@ -2626,12 +2626,12 @@ main(int argc, const char *argv[])
       ctx->conflict_func = NULL;
       ctx->conflict_baton = NULL;
       ctx->conflict_func2 = svn_cl__conflict_handler;
-      ctx->conflict_baton2 = svn_cl__conflict_baton_make(
-          opt_state.accept_which,
-          ctx->config,
-          opt_state.editor_cmd,
-          pb,
-          pool);
+      SVN_ERR(svn_cl__conflict_baton_make(&ctx->conflict_baton2,
+                                          opt_state.accept_which,
+                                          ctx->config,
+                                          opt_state.editor_cmd,
+                                          pb,
+                                          pool));
     }
 
   /* And now we finally run the subcommand. */


Reply via email to