You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/06/10 16:00:57 UTC

svn commit: r953325 - in /subversion/trunk/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/repos.c

Author: hwright
Date: Thu Jun 10 14:00:57 2010
New Revision: 953325

URL: http://svn.apache.org/viewvc?rev=953325&view=rev
Log:
Apply the repository notification code to the upgrade API.

* subversion/include/svn_repos.h
  (svn_repos_notify_upgrade_start): New.
  (svn_repos_upgrade2): New.
  (svn_repos_upgrade): Deprecate.

* subversion/libsvn_repos/deprecated.c
  (svn_repos_upgrade): New wrapper.

* subversion/libsvn_repos/repos.c
  (svn_repos_upgrade2): New.

Modified:
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/libsvn_repos/deprecated.c
    subversion/trunk/subversion/libsvn_repos/repos.c

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=953325&r1=953324&r2=953325&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Thu Jun 10 14:00:57 2010
@@ -234,7 +234,10 @@ typedef enum svn_repos_notify_action_t
   svn_repos_notify_mutex_acquired,
 
   /** Recover has started. */
-  svn_repos_notify_recover_start
+  svn_repos_notify_recover_start,
+
+  /** Upgrade has started. */
+  svn_repos_notify_upgrade_start
 
 } svn_repos_notify_action_t;
 
@@ -388,8 +391,23 @@ svn_repos_create(svn_repos_t **repos_p,
  * It does *not* guarantee the most optimized repository state as a
  * dump and subsequent load would.
  *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_repos_upgrade2(const char *path,
+                   svn_boolean_t nonblocking,
+                   svn_repos_notify_func_t notify_func,
+                   void *notify_baton,
+                   apr_pool_t *pool);
+
+/**
+ * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
+ * rather than a notify_callback / baton
+ *
  * @since New in 1.5.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_repos_upgrade(const char *path,
                   svn_boolean_t nonblocking,

Modified: subversion/trunk/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/deprecated.c?rev=953325&r1=953324&r2=953325&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_repos/deprecated.c Thu Jun 10 14:00:57 2010
@@ -192,6 +192,21 @@ svn_repos_recover(const char *path,
   return svn_repos_recover2(path, FALSE, NULL, NULL, pool);
 }
 
+svn_error_t *
+svn_repos_upgrade(const char *path,
+                  svn_boolean_t nonblocking,
+                  svn_error_t *(*start_callback)(void *baton),
+                  void *start_callback_baton,
+                  apr_pool_t *pool)
+{
+  struct recover_baton rb;
+
+  rb.start_callback = start_callback;
+  rb.start_callback_baton = start_callback_baton;
+
+  return svn_repos_upgrade2(path, nonblocking, recovery_started, &rb, pool);
+}
+
 /*** From reporter.c ***/
 svn_error_t *
 svn_repos_begin_report(void **report_baton,

Modified: subversion/trunk/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=953325&r1=953324&r2=953325&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.c Thu Jun 10 14:00:57 2010
@@ -1553,11 +1553,11 @@ svn_repos_open(svn_repos_t **repos_p,
 
 
 svn_error_t *
-svn_repos_upgrade(const char *path,
-                  svn_boolean_t nonblocking,
-                  svn_error_t *(*start_callback)(void *baton),
-                  void *start_callback_baton,
-                  apr_pool_t *pool)
+svn_repos_upgrade2(const char *path,
+                   svn_boolean_t nonblocking,
+                   svn_repos_notify_func_t notify_func,
+                   void *notify_baton,
+                   apr_pool_t *pool)
 {
   svn_repos_t *repos;
   const char *format_path;
@@ -1571,8 +1571,17 @@ svn_repos_upgrade(const char *path,
      lock_repos.) */
   SVN_ERR(get_repos(&repos, path, TRUE, nonblocking, FALSE, subpool));
 
-  if (start_callback)
-    SVN_ERR(start_callback(start_callback_baton));
+  if (notify_func)
+    {
+      /* We notify *twice* here, because there are two different logistical
+         actions occuring. */
+      svn_repos_notify_t *notify = svn_repos_notify_create(
+                                    svn_repos_notify_mutex_acquired, subpool);
+      notify_func(notify_baton, notify, subpool);
+
+      notify->action = svn_repos_notify_upgrade_start;
+      notify_func(notify_baton, notify, subpool);
+    }
 
   /* Try to overwrite with its own contents.  We do this only to
      verify that we can, because we don't want to actually bump the