You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/05/08 18:04:54 UTC

svn commit: r1100760 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/externals.c libsvn_wc/adm_ops.c libsvn_wc/externals.c

Author: rhuijben
Date: Sun May  8 16:04:54 2011
New Revision: 1100760

URL: http://svn.apache.org/viewvc?rev=1100760&view=rev
Log:
Remove the separate wc apis that registered a file external before it was
inserted in the working copy. The external editor can install externals in
a single step, which removes intermediate database states.

* subversion/include/private/svn_wc_private.h
  (svn_wc__set_file_external_location): Remove function.
  (svn_wc__get_file_external_editor): Provide the definition to the editor.
  (svn_wc__register_file_external): Remove function.

* subversion/libsvn_client/externals.c
  (switch_file_external): Stop registering file externals before they are
    inserted.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc__register_file_external): Remove function.

* subversion/libsvn_wc/externals.c
  (svn_wc__set_file_external_location): Remove function.
  (edit_baton): Add some comments. Add to be recorded information.
  (close_file): Register the provided information instead of the actual
    information.
  (svn_wc__get_file_external_editor): Store to be recorded information in
    baton.

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

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1100760&r1=1100759&r2=1100760&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Sun May  8 16:04:54 2011
@@ -54,24 +54,6 @@ svn_wc__changelist_match(svn_wc_context_
                          const apr_hash_t *clhash,
                          apr_pool_t *scratch_pool);
 
-
-/* For the LOCAL_ABSPATH entry in WC_CTX, set the
- * file_external_path to URL, the file_external_peg_rev to *PEG_REV
- * and the file_external_rev to *REV.  The URL may be NULL which
- * clears the file external information in the entry.  The repository
- * root URL is given in REPOS_ROOT_URL and is used to store a
- * repository root relative path in the entry.  SCRATCH_POOL is used for
- * temporary allocations.
- */
-svn_error_t *
-svn_wc__set_file_external_location(svn_wc_context_t *wc_ctx,
-                                   const char *local_abspath,
-                                   const char *url,
-                                   const svn_opt_revision_t *peg_rev,
-                                   const svn_opt_revision_t *rev,
-                                   const char *repos_root_url,
-                                   apr_pool_t *scratch_pool);
-
 /* Like svn_wc_get_update_editorX and svn_wc_get_status_editorX, but only
    allows updating a file external LOCAL_ABSPATH */
 svn_error_t *
@@ -86,6 +68,9 @@ svn_wc__get_file_external_editor(const s
                                  svn_boolean_t use_commit_times,
                                  const char *diff3_cmd,
                                  const apr_array_header_t *preserved_exts,
+                                 const char *recorded_url,
+                                 svn_opt_revision_t *recorded_peg_rev,
+                                 svn_opt_revision_t *recorded_rev,
                                  svn_wc_conflict_resolver_func2_t conflict_func,
                                  void *conflict_baton,
                                  svn_cancel_func_t cancel_func,
@@ -652,24 +637,6 @@ svn_wc__call_with_write_lock(svn_wc__wit
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_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);
-
 /**
  * Calculates the schedule and copied status of a node as that would
  * have been stored in an svn_wc_entry_t instance.

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1100760&r1=1100759&r2=1100760&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Sun May  8 16:04:54 2011
@@ -422,11 +422,6 @@ switch_file_external(const char *local_a
                                                          subpool));
           goto cleanup;
         }
-
-      err = svn_wc__register_file_external(ctx->wc_ctx, local_abspath, url,
-                                           peg_revision, revision, subpool);
-      if (err)
-        goto cleanup;
     }
 
   {
@@ -456,6 +451,7 @@ switch_file_external(const char *local_a
                                              repos_uuid,
                                              use_commit_times,
                                              diff3_cmd, preserved_exts,
+                                             url, peg_revision, revision,
                                              ctx->conflict_func2,
                                              ctx->conflict_baton2,
                                              ctx->cancel_func,

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1100760&r1=1100759&r2=1100760&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Sun May  8 16:04:54 2011
@@ -1221,34 +1221,6 @@ svn_wc_add_from_disk(svn_wc_context_t *w
 
   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;
-  const char *base_name;
-  const char *repos_root_url;
-
-  svn_dirent_split(&parent_abspath, &base_name, local_abspath, 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.
 

Modified: subversion/trunk/subversion/libsvn_wc/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/externals.c?rev=1100760&r1=1100759&r2=1100760&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/externals.c (original)
+++ subversion/trunk/subversion/libsvn_wc/externals.c Sun May  8 16:04:54 2011
@@ -329,57 +329,17 @@ svn_wc_parse_externals_description3(apr_
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_wc__set_file_external_location(svn_wc_context_t *wc_ctx,
-                                   const char *local_abspath,
-                                   const char *url,
-                                   const svn_opt_revision_t *peg_rev,
-                                   const svn_opt_revision_t *rev,
-                                   const char *repos_root_url,
-                                   apr_pool_t *scratch_pool)
-{
-  const char *external_repos_relpath;
-  const svn_opt_revision_t unspecified_rev = { svn_opt_revision_unspecified };
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-  SVN_ERR_ASSERT(!url || svn_uri_is_canonical(url, scratch_pool));
-
-  if (url)
-    {
-      external_repos_relpath = svn_uri_is_child(repos_root_url, url,
-                                                scratch_pool);
-
-      if (external_repos_relpath == NULL)
-          return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
-                                   _("Can't add a file external to '%s' as it"
-                                     " is not a file in repository '%s'."),
-                                   url, repos_root_url);
-
-      SVN_ERR_ASSERT(peg_rev != NULL);
-      SVN_ERR_ASSERT(rev != NULL);
-    }
-  else
-    {
-      external_repos_relpath = NULL;
-      peg_rev = &unspecified_rev;
-      rev = &unspecified_rev;
-    }
-
-  SVN_ERR(svn_wc__db_temp_op_set_file_external(wc_ctx->db, local_abspath,
-                                               external_repos_relpath, peg_rev,
-                                               rev, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
 
 struct edit_baton
 {
   apr_pool_t *pool;
   svn_wc__db_t *db;
 
-  const char *wri_abspath;
-  const char *local_abspath;
-  const char *name;
+  /* We explicitly use wri_abspath and local_abspath here, because we
+     might want to install file externals in an obstructing working copy */
+  const char *wri_abspath;     /* The working defining the file external */
+  const char *local_abspath;   /* The file external itself */
+  const char *name;            /* The basename of the file external itself */
 
   /* Information from the caller */
   svn_boolean_t use_commit_times;
@@ -390,6 +350,10 @@ struct edit_baton
   const char *repos_root_url;
   const char *repos_uuid;
 
+  const char *recorded_url;
+  svn_opt_revision_t *recorded_peg_rev;
+  svn_opt_revision_t *recorded_rev;
+
   svn_wc_conflict_resolver_func2_t conflict_func;
   void *conflict_baton;
   svn_cancel_func_t cancel_func;
@@ -845,14 +809,14 @@ close_file(void *file_baton,
                                      pool));
 
     {
-      svn_opt_revision_t peg_rev, rev;
-      peg_rev.kind = svn_opt_revision_number;
-      peg_rev.value.number = *eb->target_revision;
-      rev.kind = svn_opt_revision_number;
-      rev.value.number = *eb->target_revision;
+      const char *register_relpath = svn_uri_is_child(eb->repos_root_url,
+                                                      eb->recorded_url, pool);
+
       SVN_ERR(svn_wc__db_temp_op_set_file_external(eb->db, eb->local_abspath,
-                                                   repos_relpath, &peg_rev,
-                                                   &rev, pool));
+                                                   register_relpath,
+                                                   eb->recorded_peg_rev,
+                                                   eb->recorded_rev,
+                                                   pool));
     }
 
     SVN_ERR(svn_wc__wq_run(eb->db, eb->wri_abspath,
@@ -921,6 +885,9 @@ svn_wc__get_file_external_editor(const s
                                  svn_boolean_t use_commit_times,
                                  const char *diff3_cmd,
                                  const apr_array_header_t *preserved_exts,
+                                 const char *recorded_url,
+                                 svn_opt_revision_t *recorded_peg_rev,
+                                 svn_opt_revision_t *recorded_rev,
                                  svn_wc_conflict_resolver_func2_t conflict_func,
                                  void *conflict_baton,
                                  svn_cancel_func_t cancel_func,
@@ -950,6 +917,10 @@ svn_wc__get_file_external_editor(const s
   eb->ext_patterns = preserved_exts;
   eb->diff3cmd = diff3_cmd;
 
+  eb->recorded_url = recorded_url;
+  eb->recorded_peg_rev = recorded_peg_rev;
+  eb->recorded_rev = recorded_rev;
+
   eb->conflict_func = conflict_func;
   eb->conflict_baton = conflict_baton;
   eb->cancel_func = cancel_func;