subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r932535 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/externals.c libsvn_wc/adm_ops.c
Date Fri, 09 Apr 2010 18:07:20 GMT
Author: cmpilato
Date: Fri Apr  9 18:07:19 2010
New Revision: 932535

URL: http://svn.apache.org/viewvc?rev=932535&view=rev
Log:
Bury the hackery that is our file externals implementation inside
libsvn_wc.

* subversion/include/svn_wc.h,
* subversion/libsvn_wc/adm_ops.c
  (svn_wc_register_file_external): New public API for registering file
    externals (as opposed to exposing our add+switch hack).

* subversion/libsvn_client/externals.c
  (switch_file_external): Now use svn_wc_register_file_external()
    instead of svn_wc_add4() and a private WC function.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=932535&r1=932534&r2=932535&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Fri Apr  9 18:07:19 2010
@@ -4265,6 +4265,22 @@ svn_wc_delete(const char *path,
               void *notify_baton,
               apr_pool_t *pool);
 
+/**
+ * Register @a local_abspath as a new file external aimed at
+ * @a external_url, @a external_peg_rev, and @a external_rev.
+ *
+ * If not @c NULL, @a external_peg_rev and @a external_rev must each
+ * be of kind @c svn_opt_revision_number or @c svn_opt_revision_head.
+ *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_wc_register_file_external(svn_wc_context_t *wc_ctx,
+                              const char *local_abspath,
+                              const char *external_url,
+                              const svn_opt_revision_t *external_peg_rev,
+                              const svn_opt_revision_t *external_rev,
+                              apr_pool_t *scratch_pool);
 
 /**
  * Put @a local_abspath under version control by adding an entry in its

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=932535&r1=932534&r2=932535&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Fri Apr  9 18:07:19 2010
@@ -423,20 +423,8 @@ switch_file_external(const char *path,
       if (err)
         goto cleanup;
 
-      err = svn_wc_add4(ctx->wc_ctx, local_abspath, svn_depth_infinity,
-                        NULL, /* const char *copyfrom_url */
-                        SVN_INVALID_REVNUM, /* svn_revnum_t copyfrom_rev */
-                        ctx->cancel_func, ctx->cancel_baton,
-                        NULL, /* svn_wc_notify_func2_t notify_func */
-                        NULL, /* void *notify_baton */
-                        subpool);
-      if (err)
-        goto cleanup;
-      revert_file = TRUE;
-
-      err = svn_wc__set_file_external_location(ctx->wc_ctx, local_abspath,
-                                               url, peg_revision, revision,
-                                               repos_root_url, subpool);
+      err = svn_wc_register_file_external(ctx->wc_ctx, local_abspath, url,
+                                          peg_revision, revision, subpool);
       if (err)
         goto cleanup;
     }

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=932535&r1=932534&r2=932535&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Apr  9 18:07:19 2010
@@ -1673,6 +1673,32 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc_register_file_external(svn_wc_context_t *wc_ctx,
+                              const char *local_abspath,
+                              const char *external_url,
+                              const svn_opt_revision_t *external_peg_rev,
+                              const svn_opt_revision_t *external_rev,
+                              apr_pool_t *scratch_pool)
+{
+  svn_wc__db_t *db = wc_ctx->db;
+  const char *parent_abspath, *base_name, *repos_root_url;
+
+  svn_dirent_split(local_abspath, &parent_abspath, &base_name, scratch_pool);
+
+  SVN_ERR(svn_wc_add4(wc_ctx, local_abspath, svn_depth_infinity,
+                      NULL, SVN_INVALID_REVNUM, NULL, NULL, NULL, NULL,
+                      scratch_pool));
+  SVN_ERR(svn_wc__db_scan_base_repos(NULL, &repos_root_url, NULL, db,
+                                     parent_abspath, scratch_pool,
+                                     scratch_pool));
+  SVN_ERR(svn_wc__set_file_external_location(wc_ctx, local_abspath,
+                                             external_url, external_peg_rev,
+                                             external_rev, repos_root_url,
+                                             scratch_pool));
+  return SVN_NO_ERROR;
+}
+
 
 /* Thoughts on Reversion.
 



Mime
View raw message