[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] ra->get_commit_editor API cleanup

From: Chia-liang Kao <clkao_at_clkao.org>
Date: 2003-09-06 07:34:25 CEST

the patch passes {basic,commit}_tests for ra_local and ra_dav.

log message:

API cleanup for ra->get_commit_editor. This makes it consistent
with the svn_repos_get_commit_editor interface, and also makes the
function easier to wrap in bindings.

* include/svn_repos.h, include/svn_types.h, libsvn_repos/commit.c:
  Rename svn_repos_commit_callback_t to svn_commit_callback_t,
  and move it to svn_types.h. All callers changed.

* include/svn_ra.h, libsvn_ra_dav/ra_dav.h, libsvn_ra_dav/commit.c,
  libsvn_ra_svn/client.c:
  (ra->get_commit_editor): use svn_commit_callback_t instead of
    pointers for committed info.

* libsvn_ra_local/ra_plugin.c:
  (cleanup_commit): Removed.
  (svn_ra_local__get_commit_editor): Use svn_repos_get_commit_editor
    with svn_commit_callback_t directly.

* libsvn_client/client.h, libsvn_client/commit_util.c:
  (svn_client__make_commit_info): Removed.
  (svn_client__commit_get_baton): New.
  (svn_client__commit_callback): New.

* libsvn_client/delete.c, libsvn_client/copy.c,
  libsvn_client/commit.c, libsvn_client/add.c
  Use the new ra->get_commit_editor interface.

Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 6981)
+++ subversion/include/svn_repos.h (working copy)
@@ -362,18 +362,6 @@
 
 /* Making commits. */
 
-/** Callback function type for commits.
- *
- * When a filesystem commit succeeds, an instance of this is invoked on
- * the @a new_revision, @a date, and @a author of the commit, along
with
- * the @a baton closure.
- */
-typedef svn_error_t * (*svn_repos_commit_callback_t) (
- svn_revnum_t new_revision,
- const char *date,
- const char *author,
- void *baton);
-
 /** Return an @a editor and @a edit_baton to commit changes to @a
session->fs,
  * beginning at location 'rev:@a base_path', where "rev" is the
argument
  * given to @c open_root(). Store @a user as the author of the commit
and
@@ -398,7 +386,7 @@
                                           const char *base_path,
                                           const char *user,
                                           const char *log_msg,
- svn_repos_commit_callback_t
hook,
+ svn_commit_callback_t hook,
                                           void *callback_baton,
                                           apr_pool_t *pool);
 
Index: subversion/include/svn_types.h
===================================================================
--- subversion/include/svn_types.h (revision 6981)
+++ subversion/include/svn_types.h (working copy)
@@ -299,6 +299,19 @@
       apr_pool_t *pool);
 
 
+/** Callback function type for commits.
+ *
+ * When a filesystem commit succeeds, an instance of this is invoked on
+ * the @a new_revision, @a date, and @a author of the commit, along
with
+ * the @a baton closure.
+ */
+typedef svn_error_t * (*svn_commit_callback_t) (
+ svn_revnum_t new_revision,
+ const char *date,
+ const char *author,
+ void *baton);
+
+
 /** The maximum amount we (ideally) hold in memory at a time when
  * processing a stream of data.
  *
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 6981)
+++ subversion/include/svn_ra.h (working copy)
@@ -343,16 +343,17 @@
    *
    * Any of these functions may be @c NULL.
    *
- * After the editor's close_edit function returns successfully,
- * @a *new_rev holds either the new revision, or @c
SVN_INVALID_REVNUM if
- * the commit was a no-op (i.e. nothing was committed);
- * @a *committed_date holds the repository-side date, or NULL if the
- * date is unavailable; @a *committed_author holds the
repository-side
- * author (i.e., the one recorded as the author of the commit in the
- * repository), or @c NULL if the author is unavailable. Allocate
the
- * latter two in the session. Any of @a new_rev, @a committed_date,
or
- * @a committed_author may be @c NULL, in which case not touched.
+ * Before @c close_edit returns, but after the commit has succeeded,
+ * it will invoke @a callback with the new revision number, the
+ * commit date (as a <tt>const char *</tt>), commit author (as a
+ * <tt>const char *</tt>), and @a callback_baton as arguments. If
+ * @a callback returns an error, that error will be returned from @c
+ * close_edit, otherwise @c close_edit will return successfully
+ * (unless it encountered an error before invoking @a callback).
    *
+ * The callback will not be called if the commit was a no-op
+ * (i.e. nothing was committed);
+ *
    * The caller may not perform any ra operations using
    * @a session_baton before finishing the edit.
    *
@@ -361,10 +362,9 @@
   svn_error_t *(*get_commit_editor) (void *session_baton,
                                      const svn_delta_editor_t **editor,
                                      void **edit_baton,
- svn_revnum_t *new_rev,
- const char **committed_date,
- const char **committed_author,
                                      const char *log_msg,
+ svn_commit_callback_t callback,
+ void *callback_baton,
                                      apr_pool_t *pool);
 
   /** Fetch the contents and properties of file @a path at @a revision.
Index: subversion/libsvn_ra_local/ra_plugin.c
===================================================================
--- subversion/libsvn_ra_local/ra_plugin.c (revision 6981)
+++ subversion/libsvn_ra_local/ra_plugin.c (working copy)
@@ -28,73 +28,7 @@
 #include <apr_want.h>
 
 /*----------------------------------------------------------------*/
-
-/** Callbacks **/
 
-/* A device to record the targets of commits, and ensuring that proper
- commit closure happens on them (namely, revision setting and wc
- property setting). This is passed to the `commit hook' routine by
- svn_repos_get_commit_editor. ( ) */
-struct commit_cleanup_baton
-{
- /* Allocation for this baton, as well as all committed_targets */
- apr_pool_t *pool;
-
- /* The filesystem that we just committed to. */
- svn_fs_t *fs;
-
- /* If non-null, store the new revision here. */
- svn_revnum_t *new_rev;
-
- /* If non-null, store the repository date of the commit here. */
- const char **committed_date;
-
- /* If non-null, store the repository author of the commit here. */
- const char **committed_author;
-};
-
-
-/* An instance of svn_repos_commit_callback_t.
- *
- * BATON is `struct commit_cleanup_baton *'. Loop over all committed
- * target paths in BATON->committed_targets, invoking
- * BATON->close_func() on each one with NEW_REV.
- *
- * Set *(BATON->new_rev) to NEW_REV, and copy COMMITTED_DATE and
- * COMMITTED_AUTHOR to *(BATON->committed_date) and
- * *(BATON->committed_date) respectively, allocating the new storage
- * in BATON->pool.
- *
- * This routine is originally passed as a "hook" to the filesystem
- * commit editor. When we get here, the track-editor has already
- * stored committed targets inside the baton.
- */
-static svn_error_t *
-cleanup_commit (svn_revnum_t new_rev,
- const char *committed_date,
- const char *committed_author,
- void *baton)
-{
- struct commit_cleanup_baton *cb = baton;
-
- /* Store the new revision information in the baton. */
- if (cb->new_rev)
- *(cb->new_rev) = new_rev;
-
- if (cb->committed_date)
- *(cb->committed_date) = committed_date
- ? apr_pstrdup (cb->pool, committed_date)
- : NULL;
-
- if (cb->committed_author)
- *(cb->committed_author) = committed_author
- ? apr_pstrdup (cb->pool,
committed_author)
- : NULL;
-
- return SVN_NO_ERROR;
-}
-
-
 
 /* The reporter vtable needed by do_update() */
 typedef struct reporter_baton_t
@@ -364,27 +298,18 @@
 svn_ra_local__get_commit_editor (void *session_baton,
                                  const svn_delta_editor_t **editor,
                                  void **edit_baton,
- svn_revnum_t *new_rev,
- const char **committed_date,
- const char **committed_author,
                                  const char *log_msg,
+ svn_commit_callback_t callback,
+ void *callback_baton,
                                  apr_pool_t *pool)
 {
   svn_ra_local__session_baton_t *sess = session_baton;
- struct commit_cleanup_baton *cb = apr_pcalloc (pool, sizeof (*cb));
-
- /* Construct a commit cleanup baton */
- cb->pool = pool;
- cb->fs = sess->fs;
- cb->new_rev = new_rev;
- cb->committed_date = committed_date;
- cb->committed_author = committed_author;
                                          
   /* Get the repos commit-editor */
   SVN_ERR (svn_repos_get_commit_editor (editor, edit_baton,
sess->repos,
                                         sess->repos_url, sess->fs_path,
                                         sess->username, log_msg,
- cleanup_commit, cb, pool));
+ callback, callback_baton,
pool));
 
   return SVN_NO_ERROR;
 }
Index: subversion/libsvn_client/delete.c
===================================================================
--- subversion/libsvn_client/delete.c (revision 6981)
+++ subversion/libsvn_client/delete.c (working copy)
@@ -113,9 +113,7 @@
   svn_ra_plugin_t *ra_lib;
   const svn_delta_editor_t *editor;
   void *edit_baton;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
+ void *commit_baton;
   const char *log_msg;
   svn_node_kind_t kind;
   const char *auth_dir;
@@ -185,11 +183,10 @@
     }
 
   /* Fetch RA commit editor */
+ SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info,
pool));
   SVN_ERR (ra_lib->get_commit_editor (session, &editor, &edit_baton,
- &committed_rev,
- &committed_date,
- &committed_author,
- log_msg, pool));
+ log_msg,
svn_client__commit_callback,
+ commit_baton, pool));
 
   /* Call the path-based editor driver. */
   SVN_ERR (svn_delta_path_driver (editor, edit_baton,
SVN_INVALID_REVNUM,
@@ -199,12 +196,6 @@
   /* Close the edit. */
   SVN_ERR (editor->close_edit (edit_baton, pool));
 
- /* Fill in the commit_info structure. */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date,
- pool);
-
   return SVN_NO_ERROR;
 }
 
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (revision 6981)
+++ subversion/libsvn_client/copy.c (working copy)
@@ -280,9 +280,7 @@
   svn_node_kind_t src_kind, dst_kind;
   const svn_delta_editor_t *editor;
   void *edit_baton;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
+ void *commit_baton;
   svn_revnum_t src_revnum;
   const char *auth_dir;
   svn_boolean_t resurrection = FALSE;
@@ -424,11 +422,10 @@
     }
 
   /* Fetch RA commit editor. */
- SVN_ERR (ra_lib->get_commit_editor (sess, &editor, &edit_baton,
- &committed_rev,
- &committed_date,
- &committed_author,
- message, pool));
+ SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info,
pool));
+ SVN_ERR (ra_lib->get_commit_editor (sess, &editor, &edit_baton,
message,
+ svn_client__commit_callback,
+ commit_baton, pool));
 
   /* Setup our PATHS for the path-based editor drive. */
   APR_ARRAY_PUSH (paths, const char *) = dst_rel;
@@ -453,12 +450,6 @@
   /* Close the edit. */
   SVN_ERR (editor->close_edit (edit_baton, pool));
 
- /* Fill in the commit_info structure. */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date,
- pool);
-
   return SVN_NO_ERROR;
 }
 
@@ -566,9 +557,7 @@
   const svn_delta_editor_t *editor;
   void *edit_baton;
   svn_node_kind_t src_kind, dst_kind;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
+ void *commit_baton;
   apr_hash_t *committables, *tempfiles = NULL;
   svn_wc_adm_access_t *adm_access, *dir_access;
   apr_array_header_t *commit_items;
@@ -667,9 +656,11 @@
     goto cleanup;
 
   /* Fetch RA commit editor. */
+ SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info,
pool));
   if ((cmt_err = ra_lib->get_commit_editor (session, &editor,
&edit_baton,
- &committed_rev,
&committed_date,
- &committed_author, message,
pool)))
+ message,
+
svn_client__commit_callback,
+ commit_baton, pool)))
     goto cleanup;
 
   /* Make a note that we have a commit-in-progress. */
@@ -700,11 +691,6 @@
                                    ctx->cancel_func, ctx->cancel_baton,
                                    pool);
 
- /* Fill in the commit_info structure */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date, pool);
-
   return reconcile_errors (cmt_err, unlock_err, cleanup_err, pool);
 }
 
Index: subversion/libsvn_client/client.h
===================================================================
--- subversion/libsvn_client/client.h (revision 6981)
+++ subversion/libsvn_client/client.h (working copy)
@@ -186,14 +186,20 @@
 
 /*** Commit ***/
 
-/* If REVISION or AUTHOR or DATE has a valid value, then allocate (in
- POOL) an svn_client_commit_info_t structure and populate it with
- those values (that is, copies of them allocated in POOL). */
-svn_client_commit_info_t *svn_client__make_commit_info (svn_revnum_t
revision,
- const char
*author,
- const char
*date,
- apr_pool_t
*pool);
+/* get the commit_baton to be used in couple with commit_callback. */
+svn_error_t *svn_client__commit_get_baton (void **baton,
+ svn_client_commit_info_t
**info,
+ apr_pool_t *pool);
 
+/* the commit_callback function for storing svn_client_commit_info_t
+ pointed by commit_baton. If the commit_info supplied by get_baton
+ points to NULL after close_edit, it means the commit is a no-op.
+*/
+svn_error_t *svn_client__commit_callback (svn_revnum_t revision,
+ const char *date,
+ const char *author,
+ void *baton);
+
 /* ---------------------------------------------------------------- */
 
 /*** Status ***/
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c (revision 6981)
+++ subversion/libsvn_client/commit_util.c (working copy)
@@ -1229,27 +1229,42 @@
   return SVN_NO_ERROR;
 }
 
+/* Commit callback baton */
 
-svn_client_commit_info_t *
-svn_client__make_commit_info (svn_revnum_t revision,
- const char *author,
- const char *date,
- apr_pool_t *pool)
+struct commit_baton {
+ svn_client_commit_info_t **info;
+ apr_pool_t *pool;
+};
+
+svn_error_t *svn_client__commit_get_baton (void **baton,
+ svn_client_commit_info_t
**info,
+ apr_pool_t *pool)
 {
- svn_client_commit_info_t *info;
+ struct commit_baton *cb = apr_pcalloc (pool, sizeof (*cb));
+ cb->info = info;
+ cb->pool = pool;
+ *baton = cb;
 
- if (date || author || SVN_IS_VALID_REVNUM (revision))
- {
- info = apr_palloc (pool, sizeof (*info));
- info->date = date ? apr_pstrdup (pool, date) : NULL;
- info->author = author ? apr_pstrdup (pool, author) : NULL;
- info->revision = revision;
- return info;
- }
- return NULL;
+ return SVN_NO_ERROR;
 }
 
+svn_error_t *svn_client__commit_callback (svn_revnum_t revision,
+ const char *date,
+ const char *author,
+ void *baton)
+{
+ struct commit_baton *cb = baton;
+ svn_client_commit_info_t **info = cb->info;
 
+ *info = apr_palloc (cb->pool, sizeof (**info));
+ (*info)->date = date ? apr_pstrdup (cb->pool, date) : NULL;
+ (*info)->author = author ? apr_pstrdup (cb->pool, author) : NULL;
+ (*info)->revision = revision;
+
+ return SVN_NO_ERROR;
+}
+
+
 #ifdef SVN_CLIENT_COMMIT_DEBUG
 
 /*** Temporary test editor ***/
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c (revision 6981)
+++ subversion/libsvn_client/commit.c (working copy)
@@ -482,12 +482,12 @@
                svn_wc_adm_access_t *base_access,
                const char *log_msg,
                apr_array_header_t *commit_items,
- svn_revnum_t *committed_rev,
- const char **committed_date,
- const char **committed_author,
+ svn_client_commit_info_t **commit_info,
                svn_boolean_t is_commit,
                apr_pool_t *pool)
 {
+ void *commit_baton;
+
   /* Get the RA vtable that matches URL. */
   SVN_ERR (svn_ra_init_ra_libs (ra_baton, pool));
   SVN_ERR (svn_ra_get_ra_library (ra_lib, *ra_baton,
@@ -519,9 +519,10 @@
     SVN_ERR ((*ra_lib)->get_latest_revnum (*session, latest_rev,
pool));
   
   /* Fetch RA commit editor. */
- return (*ra_lib)->get_commit_editor (*session, editor, edit_baton,
- committed_rev, committed_date,
- committed_author, log_msg,
pool);
+ SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info,
pool));
+ return (*ra_lib)->get_commit_editor (*session, editor, edit_baton,
log_msg,
+ svn_client__commit_callback,
+ commit_baton, pool);
 }
 
 
@@ -541,9 +542,6 @@
   void *edit_baton;
   void *ra_baton, *session;
   svn_ra_plugin_t *ra_lib;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
   apr_hash_t *excludes = apr_hash_make (pool);
   const char *new_entry = NULL;
 
@@ -621,8 +619,7 @@
         }
       while ((err = get_ra_editor (&ra_baton, &session, &ra_lib, NULL,
                                    &editor, &edit_baton, ctx, url,
base_dir,
- NULL, log_msg, NULL, &committed_rev,
- &committed_date, &committed_author,
+ NULL, log_msg, NULL, commit_info,
                                    FALSE, subpool)));
 
       /* If there were some intermediate directories that needed to be
@@ -663,11 +660,6 @@
       return err;
     }
 
- /* Finally, fill in the commit_info structure. */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date,
- pool);
   return SVN_NO_ERROR;
 }
 
@@ -810,9 +802,6 @@
   void *edit_baton;
   void *ra_baton, *session;
   const char *log_msg;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
   svn_ra_plugin_t *ra_lib;
   const char *base_dir;
   const char *base_url;
@@ -929,8 +918,7 @@
   if ((cmt_err = get_ra_editor (&ra_baton, &session, &ra_lib, NULL,
                                 &editor, &edit_baton, ctx,
                                 base_url, base_dir, base_dir_access,
- log_msg, commit_items, &committed_rev,
- &committed_date, &committed_author,
+ log_msg, commit_items, commit_info,
                                 TRUE, pool)))
     goto cleanup;
 
@@ -1024,11 +1012,12 @@
               && (item->copyfrom_url))
             recurse = TRUE;
 
+ assert (*commit_info);
           if ((bump_err = svn_wc_process_committed (item->path,
adm_access,
                                                     recurse,
- committed_rev,
- committed_date,
- committed_author,
+
(*commit_info)->revision,
+
(*commit_info)->date,
+
(*commit_info)->author,
                                                    
item->wcprop_changes,
                                                     subpool)))
             break;
@@ -1059,10 +1048,5 @@
         cleanup_err = remove_tmpfiles (tempfiles, pool);
     }
 
- /* Fill in the commit_info structure */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date, pool);
-
   return reconcile_errors (cmt_err, unlock_err, bump_err, cleanup_err,
pool);
 }
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 6981)
+++ subversion/libsvn_client/add.c (working copy)
@@ -207,9 +207,7 @@
   svn_ra_plugin_t *ra_lib;
   const svn_delta_editor_t *editor;
   void *edit_baton;
- svn_revnum_t committed_rev = SVN_INVALID_REVNUM;
- const char *committed_date = NULL;
- const char *committed_author = NULL;
+ void *commit_baton;
   const char *log_msg;
   const char *auth_dir;
   apr_array_header_t *targets;
@@ -299,11 +297,10 @@
     }
 
   /* Fetch RA commit editor */
+ SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info,
pool));
   SVN_ERR (ra_lib->get_commit_editor (session, &editor, &edit_baton,
- &committed_rev,
- &committed_date,
- &committed_author,
- log_msg, pool));
+ log_msg,
svn_client__commit_callback,
+ commit_baton, pool));
 
   /* Call the path-based editor driver. */
   SVN_ERR (svn_delta_path_driver (editor, edit_baton,
SVN_INVALID_REVNUM,
@@ -313,12 +310,6 @@
   /* Close the edit. */
   SVN_ERR (editor->close_edit (edit_baton, pool));
 
- /* Fill in the commit_info structure. */
- *commit_info = svn_client__make_commit_info (committed_rev,
- committed_author,
- committed_date,
- pool);
-
   return SVN_NO_ERROR;
 }
 
Index: subversion/libsvn_repos/commit.c
===================================================================
--- subversion/libsvn_repos/commit.c (revision 6981)
+++ subversion/libsvn_repos/commit.c (working copy)
@@ -48,7 +48,7 @@
   const char *log_msg;
 
   /* Callback to run when the commit is done. */
- svn_repos_commit_callback_t callback;
+ svn_commit_callback_t callback;
   void *callback_baton;
 
   /* The already-open svn repository to commit to. */
@@ -596,7 +596,7 @@
                              const char *base_path,
                              const char *user,
                              const char *log_msg,
- svn_repos_commit_callback_t callback,
+ svn_commit_callback_t callback,
                              void *callback_baton,
                              apr_pool_t *pool)
 {
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (revision 6981)
+++ subversion/libsvn_ra_svn/client.c (working copy)
@@ -43,8 +43,8 @@
   svn_ra_svn_conn_t *conn;
   apr_pool_t *pool;
   svn_revnum_t *new_rev;
- const char **committed_date;
- const char **committed_author;
+ svn_commit_callback_t callback;
+ void *callback_baton;
 } ra_svn_commit_callback_baton_t;
 
 typedef struct {
@@ -543,20 +543,26 @@
 static svn_error_t *ra_svn_end_commit(void *baton)
 {
   ra_svn_commit_callback_baton_t *ccb = baton;
+ svn_revnum_t new_rev;
+ const char *committed_date;
+ const char *committed_author;
 
- return svn_ra_svn_read_tuple(ccb->conn, ccb->pool, "r(?c)(?c)",
- ccb->new_rev,
- ccb->committed_date,
- ccb->committed_author);
+ SVN_ERR (svn_ra_svn_read_tuple(ccb->conn, ccb->pool, "r(?c)(?c)",
+ &new_rev,
+ &committed_date,
+ &committed_author));
+
+ return ccb->callback (new_rev, committed_date, committed_author,
+ ccb->callback_baton);
+
 }
 
 static svn_error_t *ra_svn_commit(void *sess,
                                   const svn_delta_editor_t **editor,
                                   void **edit_baton,
- svn_revnum_t *new_rev,
- const char **committed_date,
- const char **committed_author,
                                   const char *log_msg,
+ svn_commit_callback_t callback,
+ void *callback_baton,
                                   apr_pool_t *pool)
 {
   svn_ra_svn_conn_t *conn = sess;
@@ -570,9 +576,8 @@
   ccb = apr_palloc(pool, sizeof(*ccb));
   ccb->conn = conn;
   ccb->pool = pool;
- ccb->new_rev = new_rev;
- ccb->committed_date = committed_date;
- ccb->committed_author = committed_author;
+ ccb->callback = callback;
+ ccb->callback_baton = callback_baton;
 
   /* Fetch an editor for the caller to drive. The editor will call
    * ra_svn_end_commit() upon close_edit(), at which point we'll fill
Index: subversion/libsvn_ra_dav/ra_dav.h
===================================================================
--- subversion/libsvn_ra_dav/ra_dav.h (revision 6981)
+++ subversion/libsvn_ra_dav/ra_dav.h (working copy)
@@ -218,10 +218,9 @@
   void *session_baton,
   const svn_delta_editor_t **editor,
   void **edit_baton,
- svn_revnum_t *new_rev,
- const char **committed_date,
- const char **committed_author,
   const char *log_msg,
+ svn_commit_callback_t callback,
+ void *callback_baton,
   apr_pool_t *pool);
 
 svn_error_t * svn_ra_dav__get_file(
Index: subversion/libsvn_ra_dav/commit.c
===================================================================
--- subversion/libsvn_ra_dav/commit.c (revision 6981)
+++ subversion/libsvn_ra_dav/commit.c (working copy)
@@ -98,15 +98,9 @@
   /* Log message for the commit. */
   const char *log_msg;
 
- /* The new revision created by this commit. */
- svn_revnum_t *new_rev;
-
- /* The date (according to the repository) of this commit. */
- const char **committed_date;
-
- /* The author (also according to the repository) of this commit. */
- const char **committed_author;
-
+ /* The commit callback and baton */
+ svn_commit_callback_t callback;
+ void *callback_baton;
 } commit_ctx_t;
 
 typedef struct
@@ -1128,11 +1122,14 @@
                                        apr_pool_t *pool)
 {
   commit_ctx_t *cc = edit_baton;
+ svn_revnum_t new_rev;
+ const char *committed_date;
+ const char *committed_author;
 
   /* ### different pool? */
- SVN_ERR( svn_ra_dav__merge_activity(cc->new_rev,
- cc->committed_date,
- cc->committed_author,
+ SVN_ERR( svn_ra_dav__merge_activity(&new_rev,
+ &committed_date,
+ &committed_author,
                                       cc->ras,
                                       cc->ras->root.path,
                                       cc->activity_url,
@@ -1142,6 +1139,10 @@
   SVN_ERR( delete_activity(edit_baton, pool) );
   SVN_ERR( svn_ra_dav__maybe_store_auth_info(cc->ras) );
 
+ if (new_rev != SVN_INVALID_REVNUM)
+ SVN_ERR ( cc->callback (new_rev, committed_date, committed_author,
+ cc->callback_baton));
+
   return SVN_NO_ERROR;
 }
 
@@ -1205,10 +1206,9 @@
   void *session_baton,
   const svn_delta_editor_t **editor,
   void **edit_baton,
- svn_revnum_t *new_rev,
- const char **committed_date,
- const char **committed_author,
   const char *log_msg,
+ svn_commit_callback_t callback,
+ void *callback_baton,
   apr_pool_t *pool)
 {
   svn_ra_session_t *ras = session_baton;
@@ -1224,9 +1224,8 @@
   cc->push_func = ras->callbacks->push_wc_prop;
   cc->cb_baton = ras->callback_baton;
   cc->log_msg = log_msg;
- cc->new_rev = new_rev;
- cc->committed_date = committed_date;
- cc->committed_author = committed_author;
+ cc->callback = callback;
+ cc->callback_baton = callback_baton;
 
   /* If the caller didn't give us any way of storing wcprops, then
      there's no point in getting back a MERGE response full of VR's. */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 5 23:35:35 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.