subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1081604 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc_db.c wc_db.h
Date Mon, 14 Mar 2011 23:08:54 GMT
Author: rhuijben
Date: Mon Mar 14 23:08:53 2011
New Revision: 1081604

URL: http://svn.apache.org/viewvc?rev=1081604&view=rev
Log:
Convert tweak_entries() to use wcroot, relpath instead of db, abspath except
for the file_external handling.

* subversion/libsvn_wc/update_editor.c
  (edit_baton): Document that skipped_trees contains local_relpaths.
  (remember_skipped_tree): Accept scratch_pool and calculate relpaths.
  (do_entry_deletion, add_directory, open_directory,
   add_file, open_file): Update callers.

* subversion/libsvn_wc/wc_db.c
  (tweak_entries): Rename to ...
  (bump_nodes): ... this. Remove now unused arguments. Check for relpaths in
    hash. Only check file externals data for files.
  (svn_wc__db_op_bump_revisions_post_update): Update caller. Verify wcroot.
    Check for relpath in hash

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_bump_revisions_post_update): Update docstring.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1081604&r1=1081603&r2=1081604&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Mar 14 23:08:53 2011
@@ -226,10 +226,13 @@ struct edit_baton
 
   /* Subtrees that were skipped during the edit, and therefore shouldn't
      have their revision/url info updated at the end.  If a path is a
-     directory, its descendants will also be skipped.  The keys are absolute
-     pathnames and the values unspecified. */
+     directory, its descendants will also be skipped.  The keys are paths
+     relative to the working copy root and the values unspecified. */
   apr_hash_t *skipped_trees;
 
+  /* Absolute path of the working copy root or NULL if not initialized yet */
+  const char *wcroot_abspath;
+
   apr_pool_t *pool;
 };
 
@@ -241,11 +244,21 @@ struct edit_baton
  * LOCAL_ABSPATH.
  */
 static svn_error_t *
-remember_skipped_tree(struct edit_baton *eb, const char *local_abspath)
+remember_skipped_tree(struct edit_baton *eb,
+                      const char *local_abspath,
+                      apr_pool_t *scratch_pool)
 {
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  apr_hash_set(eb->skipped_trees,  apr_pstrdup(eb->pool, local_abspath),
+  if (eb->wcroot_abspath == NULL)
+    SVN_ERR(svn_wc__db_get_wcroot(&eb->wcroot_abspath,
+                                  eb->db, eb->anchor_abspath,
+                                  eb->pool, scratch_pool));
+
+  apr_hash_set(eb->skipped_trees,
+               apr_pstrdup(eb->pool,
+                           svn_dirent_skip_ancestor(eb->wcroot_abspath,
+                                                    local_abspath)),
                APR_HASH_KEY_STRING, (void*)1);
 
   return SVN_NO_ERROR;
@@ -1956,7 +1969,7 @@ do_entry_deletion(struct edit_baton *eb,
                                     local_abspath, pool));
   if (conflicted)
     {
-      SVN_ERR(remember_skipped_tree(eb, local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, local_abspath, pool));
 
       /* ### TODO: Also print victim_path in the skip msg. */
       do_notification(eb, local_abspath, svn_node_unknown, svn_wc_notify_skip,
@@ -2010,7 +2023,7 @@ do_entry_deletion(struct edit_baton *eb,
                                               tree_conflict,
                                               pool));
 
-      SVN_ERR(remember_skipped_tree(eb, local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, local_abspath, pool));
 
       do_notification(eb, local_abspath, svn_node_unknown,
                       svn_wc_notify_tree_conflict, pool);
@@ -2238,7 +2251,7 @@ add_directory(const char *path,
   if (conflicted)
     {
       /* Record this conflict so that its descendants are skipped silently. */
-      SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, db->local_abspath, pool));
 
       db->skip_this = TRUE;
       db->already_notified = TRUE;
@@ -2402,7 +2415,7 @@ add_directory(const char *path,
                                                   *eb->target_revision,
                                                   svn_wc__db_kind_dir,
                                                   NULL, NULL, pool));
-          SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
+          SVN_ERR(remember_skipped_tree(eb, db->local_abspath, pool));
 
           /* Mark a conflict */
           SVN_ERR(create_tree_conflict(&tree_conflict, eb,
@@ -2422,7 +2435,7 @@ add_directory(const char *path,
       SVN_ERR(svn_wc__db_op_set_tree_conflict(eb->db, db->local_abspath,
                                               tree_conflict, pool));
 
-      SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, db->local_abspath, pool));
 
       db->skip_this = TRUE;
       db->already_notified = TRUE;
@@ -2530,7 +2543,7 @@ open_directory(const char *path,
                                     db->local_abspath, pool));
   if (conflicted)
     {
-      SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, db->local_abspath, pool));
 
       db->skip_this = TRUE;
       db->already_notified = TRUE;
@@ -2568,7 +2581,7 @@ open_directory(const char *path,
       if (tree_conflict->reason != svn_wc_conflict_reason_deleted &&
           tree_conflict->reason != svn_wc_conflict_reason_replaced)
         {
-          SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
+          SVN_ERR(remember_skipped_tree(eb, db->local_abspath, pool));
           db->skip_this = TRUE;
 
           return SVN_NO_ERROR;
@@ -3126,7 +3139,7 @@ add_file(const char *path,
   /* Now the usual conflict handling: skip. */
   if (conflicted)
     {
-      SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, fb->local_abspath, pool));
 
       fb->skip_this = TRUE;
       fb->already_notified = TRUE;
@@ -3265,7 +3278,7 @@ add_file(const char *path,
                                                   *eb->target_revision,
                                                   svn_wc__db_kind_file,
                                                   NULL, NULL, subpool));
-          SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
+          SVN_ERR(remember_skipped_tree(eb, fb->local_abspath, pool));
 
           /* Mark a conflict */
           SVN_ERR(create_tree_conflict(&tree_conflict, eb,
@@ -3346,7 +3359,7 @@ open_file(const char *path,
                                     fb->local_abspath, pool));
   if (conflicted)
     {
-      SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
+      SVN_ERR(remember_skipped_tree(eb, fb->local_abspath, pool));
 
       fb->skip_this = TRUE;
       fb->already_notified = TRUE;
@@ -3381,7 +3394,7 @@ open_file(const char *path,
           fb->deleted = TRUE;
         }
       else
-        SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
+        SVN_ERR(remember_skipped_tree(eb, fb->local_abspath, pool));
 
       if (!fb->deleted)
         fb->skip_this = TRUE;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1081604&r1=1081603&r2=1081604&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Mar 14 23:08:53 2011
@@ -6419,25 +6419,22 @@ bump_node(svn_wc__db_wcroot_t *wcroot,
 
 /* The main body of bump_revisions_post_update. */
 static svn_error_t *
-tweak_entries(svn_wc__db_wcroot_t *wcroot,
-              const char *local_relpath,
-              svn_wc__db_t *db,
-              const char *dir_abspath,
-              apr_int64_t new_repos_id,
-              const char *new_repos_relpath,
-              const char *new_repos_root_url,
-              const char *new_repos_uuid,
-              svn_revnum_t new_rev,
-              svn_depth_t depth,
-              apr_hash_t *exclude_paths,
-              apr_pool_t *pool)
+bump_nodes(svn_wc__db_wcroot_t *wcroot,
+           const char *local_relpath,
+           svn_wc__db_t *db,
+           apr_int64_t new_repos_id,
+           const char *new_repos_relpath,
+           svn_revnum_t new_rev,
+           svn_depth_t depth,
+           apr_hash_t *exclude_relpaths,
+           apr_pool_t *pool)
 {
   apr_pool_t *iterpool;
   const apr_array_header_t *children;
   int i;
 
   /* Skip an excluded path and its descendants. */
-  if (apr_hash_get(exclude_paths, dir_abspath, APR_HASH_KEY_STRING))
+  if (apr_hash_get(exclude_relpaths, local_relpath, APR_HASH_KEY_STRING))
     return SVN_NO_ERROR;
 
   iterpool = svn_pool_create(pool);
@@ -6459,7 +6456,6 @@ tweak_entries(svn_wc__db_wcroot_t *wcroo
   for (i = 0; i < children->nelts; i++)
     {
       const char *child_basename = APR_ARRAY_IDX(children, i, const char *);
-      const char *child_abspath;
       const char *child_local_relpath;
       svn_wc__db_kind_t kind;
       svn_wc__db_status_t status;
@@ -6477,23 +6473,13 @@ tweak_entries(svn_wc__db_wcroot_t *wcroo
 
       child_local_relpath = svn_relpath_join(local_relpath, child_basename,
                                              iterpool);
-      child_abspath = svn_dirent_join(dir_abspath, child_basename, iterpool);
 
       /* Skip stuff we've already decided to exclude. */
-      excluded = (apr_hash_get(exclude_paths, child_abspath,
+      excluded = (apr_hash_get(exclude_relpaths, child_local_relpath,
                                APR_HASH_KEY_STRING) != NULL);
       if (excluded)
         continue;
 
-      /* Skip stuff we've identified as file externals.  (If we're
-         here, we were doing an update of a directory, not the actual
-         switch handling of a file external itself.) */
-      SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
-                                                db, child_abspath,
-                                                iterpool, iterpool));
-      if (serialized)
-        continue;
-
       SVN_ERR(base_get_info(&status, &kind, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL,
@@ -6506,6 +6492,19 @@ tweak_entries(svn_wc__db_wcroot_t *wcroo
             || status == svn_wc__db_status_absent
             || status == svn_wc__db_status_excluded)
         {
+          const char *child_abspath;
+          child_abspath = svn_dirent_join(wcroot->abspath, child_local_relpath, 
+                                          iterpool);
+
+          /* Skip stuff we've identified as file externals.  (If we're
+             here, we were doing an update of a directory, not the actual
+             switch handling of a file external itself.) */
+          SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
+                                                    db, child_abspath,
+                                                    iterpool, iterpool));
+          if (serialized)
+            continue;
+
           SVN_ERR(bump_node(wcroot, child_local_relpath, kind, new_repos_id,
                             child_repos_relpath, new_rev, FALSE /* is_root */,
                             iterpool));
@@ -6521,13 +6520,9 @@ tweak_entries(svn_wc__db_wcroot_t *wcroo
           if (depth == svn_depth_immediates)
             depth_below_here = svn_depth_empty;
 
-          SVN_ERR(tweak_entries(wcroot, child_local_relpath,
-                                db, child_abspath, new_repos_id,
-                                child_repos_relpath,
-                                new_repos_root_url, new_repos_uuid,
-                                new_rev,
-                                depth_below_here,
-                                exclude_paths, iterpool));
+          SVN_ERR(bump_nodes(wcroot, child_local_relpath, db, new_repos_id,
+                             child_repos_relpath, new_rev, depth_below_here,
+                             exclude_relpaths, iterpool));
         }
     }
 
@@ -6546,7 +6541,7 @@ svn_wc__db_op_bump_revisions_post_update
                                          const char *new_repos_root_url,
                                          const char *new_repos_uuid,
                                          svn_revnum_t new_revision,
-                                         apr_hash_t *exclude_paths,
+                                         apr_hash_t *exclude_relpaths,
                                          apr_pool_t *scratch_pool)
 {
   const char *local_relpath;
@@ -6556,13 +6551,15 @@ svn_wc__db_op_bump_revisions_post_update
   svn_error_t *err;
   apr_int64_t new_repos_id = -1;
 
-  if (apr_hash_get(exclude_paths, local_abspath, APR_HASH_KEY_STRING))
-    return SVN_NO_ERROR;
-
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
 
+  VERIFY_USABLE_WCROOT(wcroot);
+
+  if (apr_hash_get(exclude_relpaths, local_relpath, APR_HASH_KEY_STRING))
+    return SVN_NO_ERROR;
+
   err = base_get_info(&status, &kind, NULL, NULL, NULL, NULL, NULL, NULL,
                       NULL, NULL, NULL, NULL, NULL, NULL,
                       wcroot, local_relpath, scratch_pool, scratch_pool);
@@ -6600,11 +6597,9 @@ svn_wc__db_op_bump_revisions_post_update
     }
   else if (kind == svn_wc__db_kind_dir)
     {
-      SVN_ERR(tweak_entries(wcroot, local_relpath,
-                            db, local_abspath, new_repos_id, new_repos_relpath,
-                            new_repos_root_url, new_repos_uuid, new_revision,
-                            depth, exclude_paths,
-                            scratch_pool));
+      SVN_ERR(bump_nodes(wcroot, local_relpath, db, new_repos_id,
+                         new_repos_relpath, new_revision, depth,
+                         exclude_relpaths, scratch_pool));
     }
   else
     return svn_error_createf(SVN_ERR_NODE_UNKNOWN_KIND, NULL,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1081604&r1=1081603&r2=1081604&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Mar 14 23:08:53 2011
@@ -1885,9 +1885,9 @@ svn_wc__db_global_update(svn_wc__db_t *d
    or replacement).  Likewise, if BASE_URL is non-null, then rewrite
    all urls to be "telescoping" children of the base_url.
 
-   EXCLUDE_PATHS is a hash containing const char *abspathnames.  Nodes
-   for pathnames contained in EXCLUDE_PATHS are not touched by this
-   function.  These pathnames should be absolute paths.
+   EXCLUDE_RELPATHS is a hash containing const char *local_relpath.  Nodes
+   for pathnames contained in EXCLUDE_RELPATHS are not touched by this
+   function.  These pathnames should be paths relative to the wcroot.
 */
 svn_error_t *
 svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db,
@@ -1897,7 +1897,7 @@ svn_wc__db_op_bump_revisions_post_update
                                          const char *new_repos_root_url,
                                          const char *new_repos_uuid,
                                          svn_revnum_t new_revision,
-                                         apr_hash_t *exclude_paths,
+                                         apr_hash_t *exclude_relpaths,
                                          apr_pool_t *scratch_pool);
 
 



Mime
View raw message