Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 38740)
+++ subversion/include/svn_wc.h	(arbetskopia)
@@ -5558,22 +5558,35 @@
 
 
 /**
- * Recurse from @a path, upgrading to the latest working copy format if
- * @a upgrade_wc is set, and cleaning up unfinished log business.  Perform
- * any temporary allocations in @a scratch_pool.  Any working copy locks
- * under @a path will be taken over and then cleared by this function.  If
- * @a diff3_cmd is non-NULL, then use it as the diff3 command for any
- * merging; otherwise, use the built-in merge code.
+ * Recurse from @a local_abspath, upgrading to the latest working copy format
+ * if @a upgrade_wc is set, and cleaning up unfinished log business.  Perform
+ * any temporary allocations in @a scratch_pool.  Any working copy locks under
+ * @a local_path will be taken over and then cleared by this function.  
  *
- * WARNING: there is no mechanism that will protect locks that are still
- * being used.
+ * WARNING: there is no mechanism that will protect locks that are still being
+ * used.
  *
- * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at
- * various points during the operation.  If it returns an error
- * (typically @c SVN_ERR_CANCELLED), return that error immediately.
+ * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at various
+ * points during the operation.  If it returns an error (typically @c
+ * SVN_ERR_CANCELLED), return that error immediately.
  *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_wc_cleanup3(const char *local_abspath,
+                svn_wc_context_t *wc_ctx,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
+                apr_pool_t *scratch_pool);
+
+/**
+ * Similar to svn_wc_cleanup3() but uses relative paths and creates its own
+ * swn_wc_context_t.
+ *
  * @since New in 1.2.
+ * @deprecated Provided for backward compability with the 1.2 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_wc_cleanup2(const char *path,
                 const char *diff3_cmd,
Index: subversion/libsvn_wc/deprecated.c
===================================================================
--- subversion/libsvn_wc/deprecated.c	(revision 38740)
+++ subversion/libsvn_wc/deprecated.c	(arbetskopia)
@@ -2268,6 +2268,30 @@
 /*** From log.c ***/
 
 svn_error_t *
+svn_wc_cleanup2(const char *path,
+                const char *diff3_cmd,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
+                apr_pool_t *pool)
+{
+  svn_wc__db_t *db;
+  svn_wc_context_t *wc_ctx;
+  const char *local_abspath;
+
+  SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_readwrite,
+                         NULL, pool, pool));
+
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+
+  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL, db, pool));
+
+  SVN_ERR(svn_wc_cleanup3(local_abspath, wc_ctx, cancel_func, 
+                         cancel_baton, pool));
+
+  svn_error_return(svn_wc_context_destroy(wc_ctx));
+}
+
+svn_error_t *
 svn_wc_cleanup(const char *path,
                svn_wc_adm_access_t *optional_adm_access,
                const char *diff3_cmd,
Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c	(revision 38740)
+++ subversion/libsvn_wc/log.c	(arbetskopia)
@@ -2388,37 +2388,33 @@
   return svn_wc_adm_close2(adm_access, scratch_pool);
 }
 
-
 svn_error_t *
-svn_wc_cleanup2(const char *path,
-                const char *diff3_cmd,  /* ### OBSOLETE  */
+svn_wc_cleanup3(const char *local_abspath,
+                svn_wc_context_t *wc_ctx,
                 svn_cancel_func_t cancel_func,
                 void *cancel_baton,
-                apr_pool_t *scratch_pool)
+                apr_pool_t * scratch_pool)
 {
-  svn_wc__db_t *db;
-  const char *local_abspath;
   int wc_format_version;
 
-  SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_readwrite,
-                          NULL /* ### config */, scratch_pool, scratch_pool));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
+  SVN_ERR(svn_wc__internal_check_wc(&wc_format_version, wc_ctx->db, 
+                                    local_abspath, scratch_pool));
 
-  SVN_ERR(svn_wc__internal_check_wc(&wc_format_version, db, local_abspath,
-                                    scratch_pool));
-
   /* a "version" of 0 means a non-wc directory */
   if (wc_format_version == 0)
     return svn_error_createf(SVN_ERR_WC_NOT_DIRECTORY, NULL,
                              _("'%s' is not a working copy directory"),
-                             svn_dirent_local_style(path, scratch_pool));
+                             svn_dirent_local_style(local_abspath, 
+                                                    scratch_pool));
 
   if (wc_format_version < SVN_WC__VERSION)
     return svn_error_create(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
                             _("Log format too old, please use "
                               "Subversion 1.6 or earlier"));
 
-  return svn_error_return(cleanup_internal(db, path, cancel_func, cancel_baton,
+  return svn_error_return(cleanup_internal(wc_ctx->db, local_abspath, 
+                                           cancel_func, cancel_baton, 
                                            scratch_pool));
 }

