[[[
Working towards issues #3217: svn commit should show unknown files in editor 

Create a new version of the commit message callback so that we can
pass a list of unversion items. This will be used by the client
to display a list of unversioned items with the items to be committed
when invoking and external editor.

* subversion/include/svn_client.h
  (svn_client_get_commit_log4_t): New callback with array of unversioned items
  (svn_client_get_commit_log3_t): Deprecated
  (svn_client_ctx_t): Added new commit log callback and baton

* subversion/libsvn_client/commit_util.c
  (svn_client__get_log_msg): Call new svn_client_get_commit_log4_t if
  provided by ctx else revert to old api.

* subversion/libsvn_client/commit.c
  (svn_client_import3): Pass NULL to new commit log callback because
  it doesn't make sense to list unversioned items in the log message
  when importing.
  (svn_client_commit4): For now we are passing NULL to the new
  log message callback, but this is where we need to have the
  list of unversioned item prepared so we can pass them to the
  log message.

* subversion/libsvn_client/client.h
  (SVN_CLIENT__HAS_LOG_MSG_FUNC): Add a condition for our new log
  message callback.
  (svn_client__get_log_msg): Add the new parameter apr_array_header_t
  *unversioned_items, that is used to pass unversioned item list
  to the callback.

* subversion/libsvn_client/delete.c
  subversion/libsvn_client/prop_commands.c
  subversion/libsvn_client/copy.c
  subversion/libsvn_client/add.c
  (delete_urls, propset_on_url, repos_to_repos_copy,
   wc_to_repos_copy, mkdir_urls): Modify the calls to log callback
   to pass NULL as the unversioned items list.  It doesn't make
   sense to display unversioned items in the log for these
   commands.


]]]

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h	(revision 31731)
+++ subversion/include/svn_client.h	(working copy)
@@ -550,11 +550,33 @@
  * structures, which may be fully or only partially filled-in,
  * depending on the type of commit operation.
  *
+ * @a unversioned_items is a read-only array of const char * strings
+ * that are the paths of any unversioned items that are currently
+ * contained in the same directories of all other commit targets. 
+ * Ignored items are not returned.  For commit operations that involve
+ * direct repository URLs, unversioned_items will be @c NULL.
+ * 
  * @a baton is provided along with the callback for use by the handler.
  *
  * All allocations should be performed in @a pool.
  *
+ * @since New in 1.6.
+ */
+typedef svn_error_t *(*svn_client_get_commit_log4_t)
+  (const char **log_msg,
+   const char **tmp_file,
+   const apr_array_header_t *commit_items,
+   const apr_array_header_t *unversioned_items,
+   void *baton,
+   apr_pool_t *pool);
+
+
+/** Similar to svn_client_get_commit_log4_t but without
+ * unversioned_items.
+ * 
  * @since New in 1.5.
+ *
+ * @deprecated Provided for backward compatibility with 1.5 the API.
  */
 typedef svn_error_t *(*svn_client_get_commit_log3_t)
   (const char **log_msg,
@@ -864,6 +886,16 @@
    * @since New in 1.5. */
   const char *client_name;
 
+  /** Log message callback function. NULL means that Subversion
+   *   should try @c log_msg_func3, then @c log_msg_func2 and 
+   *   @c log_msg_func
+   * @since New in 1.6. */
+  svn_client_get_commit_log4_t log_msg_func4;
+
+  /** The callback baton for @c log_msg_func4.
+   * @since New in 1.6. */
+  void *log_msg_baton4;
+
 } svn_client_ctx_t;
 
 /** @} end group: Client context management */
Index: subversion/libsvn_client/delete.c
===================================================================
--- subversion/libsvn_client/delete.c	(revision 31731)
+++ subversion/libsvn_client/delete.c	(working copy)
@@ -162,7 +162,7 @@
           APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
         }
       SVN_ERR(svn_client__get_log_msg(&log_msg, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
       if (! log_msg)
         {
           svn_pool_destroy(subpool);
Index: subversion/libsvn_client/client.h
===================================================================
--- subversion/libsvn_client/client.h	(revision 31731)
+++ subversion/libsvn_client/client.h	(working copy)
@@ -368,7 +368,10 @@
 
 /* CTX is of type "svn_client_ctx_t *". */
 #define SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx) \
-        ((ctx)->log_msg_func3 || (ctx)->log_msg_func2 || (ctx)->log_msg_func)
+        ((ctx)->log_msg_func4 \
+        || (ctx)->log_msg_func3 \
+        || (ctx)->log_msg_func2 \
+        || (ctx)->log_msg_func)
 
 /* This is the baton that we pass svn_ra_open3(), and is associated with
    the callback table we provide to RA. */
@@ -1038,13 +1041,14 @@
 
 
 /* Retrieve log messages using the first provided (non-NULL) callback
-   in the set of *CTX->log_msg_func3, CTX->log_msg_func2, or
-   CTX->log_msg_func.  Other arguments same as
+   in the set of *CTX->log_msg_func4, *CTX->log_msg_func3,
+   CTX->log_msg_func2, or CTX->log_msg_func.  Other arguments same as
    svn_client_get_commit_log3_t. */
 svn_error_t *
 svn_client__get_log_msg(const char **log_msg,
                         const char **tmp_file,
                         const apr_array_header_t *commit_items,
+                        const apr_array_header_t *unversioned_items,
                         svn_client_ctx_t *ctx,
                         apr_pool_t *pool);
 
Index: subversion/libsvn_client/prop_commands.c
===================================================================
--- subversion/libsvn_client/prop_commands.c	(revision 31731)
+++ subversion/libsvn_client/prop_commands.c	(working copy)
@@ -282,7 +282,7 @@
       item->state_flags = SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
       APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
       SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
       if (! message)
         return SVN_NO_ERROR;
     }
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c	(revision 31731)
+++ subversion/libsvn_client/copy.c	(working copy)
@@ -989,7 +989,7 @@
         }
 
       SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
       if (! message)
         return SVN_NO_ERROR;
     }
@@ -1217,7 +1217,7 @@
         }
 
       SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
       if (! message)
         {
           SVN_ERR(svn_wc_adm_close(adm_access));
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c	(revision 31731)
+++ subversion/libsvn_client/commit_util.c	(working copy)
@@ -1772,13 +1772,22 @@
 svn_client__get_log_msg(const char **log_msg,
                         const char **tmp_file,
                         const apr_array_header_t *commit_items,
+                        const apr_array_header_t *unversioned_items,
                         svn_client_ctx_t *ctx,
                         apr_pool_t *pool)
 {
-  if (ctx->log_msg_func3)
+  if (ctx->log_msg_func4)
     {
       /* The client provided a callback function for the current API.
          Forward the call to it directly. */
+      return (*ctx->log_msg_func4)(log_msg, tmp_file, commit_items,
+                                   unversioned_items,
+                                   ctx->log_msg_baton4, pool);
+    }
+  else if (ctx->log_msg_func3)
+    {
+      /* The client has provided a pre-1.6 API callback. All we
+         need to do is ignore the unversioned_items argument */
       return (*ctx->log_msg_func3)(log_msg, tmp_file, commit_items,
                                    ctx->log_msg_baton3, pool);
     }
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c	(revision 31731)
+++ subversion/libsvn_client/add.c	(working copy)
@@ -733,7 +733,7 @@
         }
 
       SVN_ERR(svn_client__get_log_msg(&log_msg, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
 
       if (! log_msg)
         return SVN_NO_ERROR;
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c	(revision 31731)
+++ subversion/libsvn_client/commit.c	(working copy)
@@ -698,7 +698,7 @@
       APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
 
       SVN_ERR(svn_client__get_log_msg(&log_msg, &tmp_file, commit_items,
-                                      ctx, pool));
+                                      NULL, ctx, pool));
       if (! log_msg)
         return SVN_NO_ERROR;
       if (tmp_file)
@@ -1669,8 +1669,11 @@
   if (SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx))
     {
       const char *tmp_file;
+      /* TODO: this is where we need to have unversioned_items
+      populated with a list of non-ignored files/directories
+      that will be displayed in the log message */
       cmt_err = svn_client__get_log_msg(&log_msg, &tmp_file, commit_items,
-                                        ctx, pool);
+                                        NULL, ctx, pool);
 
       if (cmt_err || (! log_msg))
         goto cleanup;

