You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2011/07/20 15:06:16 UTC

svn commit: r1148749 [8/11] - in /subversion/branches/svn-bisect: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ contrib/hook-scripts/ contrib/hook-scripts/enforcer/ contrib/server-side/ contrib/server-side/fsfsfixer/fixer/ note...

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/status.c?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/status.c Wed Jul 20 13:06:00 2011
@@ -248,9 +248,10 @@ read_info(const struct svn_wc__db_info_t
 
   SVN_ERR(svn_wc__db_read_info(&mtb->status, &mtb->kind,
                                &mtb->revnum, &mtb->repos_relpath,
-                               &mtb->repos_root_url, NULL, &mtb->changed_rev,
-                               &mtb->changed_date, &mtb->changed_author,
-                               &mtb->depth, &checksum, NULL, NULL, NULL, NULL,
+                               &mtb->repos_root_url, &mtb->repos_uuid,
+                               &mtb->changed_rev, &mtb->changed_date,
+                               &mtb->changed_author, &mtb->depth,
+                               &checksum, NULL, NULL, NULL, NULL,
                                NULL, &mtb->lock, &mtb->recorded_size,
                                &mtb->recorded_mod_time, &mtb->changelist,
                                &mtb->conflicted, &mtb->op_root,
@@ -277,7 +278,8 @@ read_info(const struct svn_wc__db_info_t
   mtb->has_checksum = (checksum != NULL);
 
 #ifdef HAVE_SYMLINK
-  if (mtb->had_props || mtb->props_mod)
+  if (mtb->kind == svn_wc__db_kind_file
+      && (mtb->had_props || mtb->props_mod))
     {
       apr_hash_t *properties;
 
@@ -304,9 +306,11 @@ read_info(const struct svn_wc__db_info_t
 static svn_error_t *
 get_repos_root_url_relpath(const char **repos_relpath,
                            const char **repos_root_url,
+                           const char **repos_uuid,
                            const struct svn_wc__db_info_t *info,
                            const char *parent_repos_relpath,
                            const char *parent_repos_root_url,
+                           const char *parent_repos_uuid,
                            svn_wc__db_t *db,
                            const char *local_abspath,
                            apr_pool_t *result_pool,
@@ -316,6 +320,7 @@ get_repos_root_url_relpath(const char **
     {
       *repos_relpath = info->repos_relpath;
       *repos_root_url = info->repos_root_url;
+      *repos_uuid = info->repos_uuid;
     }
   else if (parent_repos_relpath && parent_repos_root_url)
     {
@@ -324,18 +329,20 @@ get_repos_root_url_relpath(const char **
                                                             NULL),
                                         result_pool);
       *repos_root_url = parent_repos_root_url;
+      *repos_uuid = parent_repos_uuid;
     }
   else if (info->status == svn_wc__db_status_added)
     {
       SVN_ERR(svn_wc__db_scan_addition(NULL, NULL,
                                        repos_relpath, repos_root_url,
-                                       NULL, NULL, NULL, NULL, NULL,
+                                       repos_uuid, NULL, NULL, NULL, NULL,
                                        db, local_abspath,
                                        result_pool, scratch_pool));
     }
   else if (info->have_base)
     {
-      SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, repos_root_url, NULL,
+      SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, repos_root_url,
+                                         repos_uuid,
                                          db, local_abspath,
                                          result_pool, scratch_pool));
     }
@@ -343,6 +350,7 @@ get_repos_root_url_relpath(const char **
     {
       *repos_relpath = NULL;
       *repos_root_url = NULL;
+      *repos_uuid = NULL;
     }
   return SVN_NO_ERROR;
 }
@@ -378,6 +386,7 @@ assemble_status(svn_wc_status3_t **statu
                 const char *local_abspath,
                 const char *parent_repos_root_url,
                 const char *parent_repos_relpath,
+                const char *parent_repos_uuid,
                 const struct svn_wc__db_info_t *info,
                 const svn_io_dirent2_t *dirent,
                 svn_boolean_t get_all,
@@ -393,6 +402,7 @@ assemble_status(svn_wc_status3_t **statu
   svn_error_t *err;
   const char *repos_relpath;
   const char *repos_root_url;
+  const char *repos_uuid;
   svn_filesize_t filesize = (dirent && (dirent->kind == svn_node_file))
                                 ? dirent->filesize
                                 : SVN_INVALID_FILESIZE;
@@ -411,8 +421,8 @@ assemble_status(svn_wc_status3_t **statu
   else
     {
       /* A node is switched if it doesn't have the implied repos_relpath */
-      const char *name = svn_relpath__is_child(parent_repos_relpath,
-                                               info->repos_relpath, NULL);
+      const char *name = svn_relpath_skip_ancestor(parent_repos_relpath,
+                                                   info->repos_relpath);
       switched_p = !name || (strcmp(name, svn_dirent_basename(local_abspath, NULL)) != 0);
     }
 
@@ -528,7 +538,7 @@ assemble_status(svn_wc_status3_t **statu
 
               if (err)
                 {
-                  if (!APR_STATUS_IS_EACCES(err->apr_err))
+                  if (err->apr_err != SVN_ERR_WC_PATH_ACCESS_DENIED)
                     return svn_error_trace(err);
 
                   /* An access denied is very common on Windows when another
@@ -623,9 +633,11 @@ assemble_status(svn_wc_status3_t **statu
         return SVN_NO_ERROR;
       }
 
-  SVN_ERR(get_repos_root_url_relpath(&repos_relpath, &repos_root_url, info,
+  SVN_ERR(get_repos_root_url_relpath(&repos_relpath, &repos_root_url,
+                                     &repos_uuid, info,
                                      parent_repos_relpath,
                                      parent_repos_root_url,
+                                     parent_repos_uuid,
                                      db, local_abspath,
                                      scratch_pool, scratch_pool));
 
@@ -686,6 +698,7 @@ assemble_status(svn_wc_status3_t **statu
   stat->changelist = info->changelist;
   stat->repos_root_url = repos_root_url;
   stat->repos_relpath = repos_relpath;
+  stat->repos_uuid = repos_uuid;
 
   *status = stat;
 
@@ -704,36 +717,23 @@ static svn_error_t *
 assemble_unversioned(svn_wc_status3_t **status,
                      svn_wc__db_t *db,
                      const char *local_abspath,
-                     svn_node_kind_t path_kind,
+                     const svn_io_dirent2_t *dirent,
+                     svn_boolean_t tree_conflicted,
                      svn_boolean_t is_ignored,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
   svn_wc_status3_t *stat;
-  const svn_wc_conflict_description2_t *tree_conflict;
-  svn_error_t *err;
-
-  /* Find out whether the path is a tree conflict victim.
-     This function will set tree_conflict to NULL if the path
-     is not a victim. */
-  err = svn_wc__db_op_read_tree_conflict(&tree_conflict,
-                                         db, local_abspath,
-                                         scratch_pool, scratch_pool);
-
-  if (path_kind == svn_node_dir &&
-      err &&
-      err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED)
-    svn_error_clear(err);
-  else
-    SVN_ERR(err);
 
   /* return a fairly blank structure. */
-  stat = apr_pcalloc(result_pool, sizeof(**status));
+  stat = apr_pcalloc(result_pool, sizeof(*stat));
 
   /*stat->versioned = FALSE;*/
   stat->kind = svn_node_unknown; /* not versioned */
   stat->depth = svn_depth_unknown;
-  stat->filesize = SVN_INVALID_FILESIZE;
+  stat->filesize = (dirent && dirent->kind == svn_node_file)
+                        ? dirent->filesize
+                        : SVN_INVALID_FILESIZE;
   stat->node_status = svn_wc_status_none;
   stat->text_status = svn_wc_status_none;
   stat->prop_status = svn_wc_status_none;
@@ -746,18 +746,18 @@ assemble_unversioned(svn_wc_status3_t **
      to matching an ignore-pattern), the node_status is set to
      svn_wc_status_ignored.  Otherwise the node_status is set to
      svn_wc_status_unversioned. */
-  if (path_kind != svn_node_none)
+  if (dirent && dirent->kind != svn_node_none)
     {
       if (is_ignored)
         stat->node_status = svn_wc_status_ignored;
       else
         stat->node_status = svn_wc_status_unversioned;
     }
-  else if (tree_conflict != NULL)
+  else if (tree_conflicted)
     {
       /* If this path has no entry, is NOT present on disk, and IS a
-         tree conflict victim, count it as missing. */
-      stat->node_status = svn_wc_status_missing;
+         tree conflict victim, report it as conflicted. */
+      stat->node_status = svn_wc_status_conflicted;
     }
 
   stat->revision = SVN_INVALID_REVNUM;
@@ -767,7 +767,7 @@ assemble_unversioned(svn_wc_status3_t **
 
   /* For the case of an incoming delete to a locally deleted path during
      an update, we get a tree conflict. */
-  stat->conflicted = (tree_conflict != NULL);
+  stat->conflicted = tree_conflicted;
   stat->changelist = NULL;
 
   *status = stat;
@@ -783,6 +783,7 @@ send_status_structure(const struct walk_
                       const char *local_abspath,
                       const char *parent_repos_root_url,
                       const char *parent_repos_relpath,
+                      const char *parent_repos_uuid,
                       const struct svn_wc__db_info_t *info,
                       const svn_io_dirent2_t *dirent,
                       svn_boolean_t get_all,
@@ -796,11 +797,13 @@ send_status_structure(const struct walk_
   /* Check for a repository lock. */
   if (wb->repos_locks)
     {
-      const char *repos_relpath, *repos_root_url;
+      const char *repos_relpath, *repos_root_url, *repos_uuid;
 
       SVN_ERR(get_repos_root_url_relpath(&repos_relpath, &repos_root_url,
+                                         &repos_uuid,
                                          info, parent_repos_relpath,
                                          parent_repos_root_url,
+                                         parent_repos_uuid,
                                          wb->db, local_abspath,
                                          scratch_pool, scratch_pool));
       if (repos_relpath)
@@ -816,12 +819,13 @@ send_status_structure(const struct walk_
 
   SVN_ERR(assemble_status(&statstruct, wb->db, local_abspath,
                           parent_repos_root_url, parent_repos_relpath,
+                          parent_repos_uuid,
                           info, dirent, get_all, wb->ignore_text_mods,
                           repos_lock, scratch_pool, scratch_pool));
 
   if (statstruct && status_func)
     return svn_error_trace((*status_func)(status_baton, local_abspath,
-                                           statstruct, scratch_pool));
+                                          statstruct, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -930,7 +934,8 @@ is_external_path(apr_hash_t *externals,
 static svn_error_t *
 send_unversioned_item(const struct walk_status_baton *wb,
                       const char *local_abspath,
-                      svn_node_kind_t path_kind,
+                      const svn_io_dirent2_t *dirent,
+                      svn_boolean_t tree_conflicted,
                       const apr_array_header_t *patterns,
                       svn_boolean_t no_ignore,
                       svn_wc_status_func4_t status_func,
@@ -947,7 +952,7 @@ send_unversioned_item(const struct walk_
 
   SVN_ERR(assemble_unversioned(&status,
                                wb->db, local_abspath,
-                               path_kind, is_ignored,
+                               dirent, tree_conflicted, is_ignored,
                                scratch_pool, scratch_pool));
 
   is_external = is_external_path(wb->externals, local_abspath, scratch_pool);
@@ -964,7 +969,7 @@ send_unversioned_item(const struct walk_
      entry to the status func. */
   if (no_ignore || (! is_ignored) || is_external)
     return svn_error_trace((*status_func)(status_baton, local_abspath,
-                                           status, scratch_pool));
+                                          status, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -995,6 +1000,7 @@ get_dir_status(const struct walk_status_
                svn_boolean_t skip_this_dir,
                const char *parent_repos_root_url,
                const char *parent_repos_relpath,
+               const char *parent_repos_uuid,
                const struct svn_wc__db_info_t *dir_info,
                const svn_io_dirent2_t *dirent,
                const apr_array_header_t *ignore_patterns,
@@ -1010,6 +1016,7 @@ get_dir_status(const struct walk_status_
   apr_hash_index_t *hi;
   const char *dir_repos_root_url;
   const char *dir_repos_relpath;
+  const char *dir_repos_uuid;
   apr_hash_t *dirents, *nodes, *conflicts, *all_children;
   apr_array_header_t *patterns = NULL;
   apr_pool_t *iterpool, *subpool = svn_pool_create(scratch_pool);
@@ -1039,8 +1046,9 @@ get_dir_status(const struct walk_status_
                       subpool, iterpool));
 
   SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url,
-                                     dir_info, parent_repos_relpath,
-                                     parent_repos_root_url,
+                                     &dir_repos_uuid, dir_info,
+                                     parent_repos_relpath,
+                                     parent_repos_root_url, parent_repos_uuid,
                                      wb->db, local_abspath,
                                      subpool, iterpool));
   if (selected == NULL)
@@ -1100,6 +1108,7 @@ get_dir_status(const struct walk_status_
         SVN_ERR(send_status_structure(wb, local_abspath,
                                       parent_repos_root_url,
                                       parent_repos_relpath,
+                                      parent_repos_uuid,
                                       dir_info, dirent, get_all,
                                       status_func, status_baton,
                                       iterpool));
@@ -1142,6 +1151,7 @@ get_dir_status(const struct walk_status_
               SVN_ERR(send_status_structure(wb, node_abspath,
                                             dir_repos_root_url,
                                             dir_repos_relpath,
+                                            dir_repos_uuid,
                                             info, dirent_p, get_all,
                                             status_func, status_baton,
                                             iterpool));
@@ -1152,7 +1162,7 @@ get_dir_status(const struct walk_status_
                 {
                   SVN_ERR(get_dir_status(wb, node_abspath, NULL, TRUE,
                                          dir_repos_root_url, dir_repos_relpath,
-                                         info,
+                                         dir_repos_uuid, info,
                                          dirent_p, ignore_patterns,
                                          svn_depth_infinity, get_all,
                                          no_ignore,
@@ -1176,8 +1186,7 @@ get_dir_status(const struct walk_status_
 
           SVN_ERR(send_unversioned_item(wb,
                                         node_abspath,
-                                        dirent_p ? dirent_p->kind
-                                                 : svn_node_none,
+                                        dirent_p, TRUE,
                                         patterns,
                                         no_ignore,
                                         status_func,
@@ -1204,7 +1213,7 @@ get_dir_status(const struct walk_status_
 
       SVN_ERR(send_unversioned_item(wb,
                                     node_abspath,
-                                    dirent_p->kind,
+                                    dirent_p, FALSE,
                                     patterns,
                                     no_ignore || selected,
                                     status_func, status_baton,
@@ -1488,6 +1497,7 @@ make_dir_baton(void **dir_baton,
       SVN_ERR(get_dir_status(&eb->wb, local_abspath, NULL, TRUE,
                              status_in_parent->repos_root_url,
                              NULL /*parent_repos_relpath*/,
+                             status_in_parent->repos_uuid,
                              NULL,
                              NULL /* dirent */, ignores,
                              d->depth == svn_depth_files
@@ -1557,6 +1567,9 @@ is_sendable_status(const svn_wc_status3_
   if (status->repos_lock)
     return TRUE;
 
+  if (status->conflicted)
+    return TRUE;
+
   /* If the item is ignored, and we don't want ignores, skip it. */
   if ((status->node_status == svn_wc_status_ignored) && (! no_ignore))
     return FALSE;
@@ -1574,8 +1587,6 @@ is_sendable_status(const svn_wc_status3_
   if ((status->node_status != svn_wc_status_none
        && (status->node_status != svn_wc_status_normal)))
     return TRUE;
-  if (status->conflicted)
-    return TRUE;
 
   /* If it's switched, send it. */
   if (status->switched)
@@ -1629,6 +1640,7 @@ static svn_error_t *
 handle_statii(struct edit_baton *eb,
               const char *dir_repos_root_url,
               const char *dir_repos_relpath,
+              const char *dir_repos_uuid,
               apr_hash_t *statii,
               svn_boolean_t dir_was_deleted,
               svn_depth_t depth,
@@ -1667,6 +1679,7 @@ handle_statii(struct edit_baton *eb,
           SVN_ERR(get_dir_status(&eb->wb,
                                  local_abspath, NULL, TRUE,
                                  dir_repos_root_url, dir_repos_relpath,
+                                 dir_repos_uuid,
                                  NULL,
                                  NULL /* dirent */,
                                  ignores, depth, eb->get_all, eb->no_ignore,
@@ -1912,6 +1925,7 @@ close_directory(void *dir_baton,
       SVN_ERR(handle_statii(eb,
                             dir_status ? dir_status->repos_root_url : NULL,
                             dir_status ? dir_status->repos_relpath : NULL,
+                            dir_status ? dir_status->repos_uuid : NULL,
                             db->statii, was_deleted, db->depth, pool));
       if (dir_status && is_sendable_status(dir_status, eb->no_ignore,
                                            eb->get_all))
@@ -1936,7 +1950,8 @@ close_directory(void *dir_baton,
                 {
                   SVN_ERR(get_dir_status(&eb->wb,
                                          eb->target_abspath, NULL, TRUE,
-                                         NULL, NULL, NULL, NULL /* dirent */,
+                                         NULL, NULL, NULL, NULL,
+                                         NULL /* dirent */,
                                          eb->ignores,
                                          eb->default_depth,
                                          eb->get_all, eb->no_ignore,
@@ -1957,6 +1972,7 @@ close_directory(void *dir_baton,
           SVN_ERR(handle_statii(eb,
                                 eb->anchor_status->repos_root_url,
                                 eb->anchor_status->repos_relpath,
+                                eb->anchor_status->repos_uuid,
                                 db->statii, FALSE, eb->default_depth, pool));
           if (is_sendable_status(eb->anchor_status, eb->no_ignore,
                                  eb->get_all))
@@ -2163,6 +2179,7 @@ svn_wc_get_status_editor5(const svn_delt
                           svn_depth_t depth,
                           svn_boolean_t get_all,
                           svn_boolean_t no_ignore,
+                          svn_boolean_t depth_as_sticky,
                           svn_boolean_t server_performs_filtering,
                           const apr_array_header_t *ignore_patterns,
                           svn_wc_status_func4_t status_func,
@@ -2244,7 +2261,7 @@ svn_wc_get_status_editor5(const svn_delt
   inner_baton = eb;
 
   if (!server_performs_filtering
-      && depth == svn_depth_unknown)
+      && !depth_as_sticky)
     SVN_ERR(svn_wc__ambient_depth_filter_editor(&inner_editor,
                                                 &inner_baton,
                                                 wc_ctx->db,
@@ -2284,7 +2301,8 @@ svn_wc__internal_walk_status(svn_wc__db_
   const svn_io_dirent2_t *dirent;
   const char *anchor_abspath, *target_name;
   svn_boolean_t skip_root;
-  svn_wc__db_kind_t kind;
+  const struct svn_wc__db_info_t *dir_info;
+  svn_error_t *err;
 
   wb.db = db;
   wb.target_abspath = local_abspath;
@@ -2305,34 +2323,37 @@ svn_wc__internal_walk_status(svn_wc__db_
       ignore_patterns = ignores;
     }
 
-  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, TRUE, scratch_pool));
-  SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
-                             scratch_pool, scratch_pool));
+  err = read_info(&dir_info, local_abspath, db, scratch_pool, scratch_pool);
 
-  if (kind == svn_wc__db_kind_file && dirent->kind == svn_node_file)
-    {
-      anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-      target_name = svn_dirent_basename(local_abspath, NULL);
-      skip_root = TRUE;
-    }
-  else if (kind == svn_wc__db_kind_dir && dirent->kind == svn_node_dir)
+  if (!err && dir_info->kind == svn_wc__db_kind_dir)
     {
       anchor_abspath = local_abspath;
       target_name = NULL;
       skip_root = FALSE;
     }
+  else if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+    return svn_error_trace(err);
   else
     {
+      svn_error_clear(err);
+      dir_info = NULL; /* Don't pass information of the child */
+
+      /* Walk the status of the parent of LOCAL_ABSPATH, but only report
+         status on its child LOCAL_ABSPATH. */
       anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
       target_name = svn_dirent_basename(local_abspath, NULL);
-      skip_root = FALSE;
+      skip_root = TRUE;
     }
 
+  SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
+                             scratch_pool, scratch_pool));
+
   SVN_ERR(get_dir_status(&wb,
                          anchor_abspath,
                          target_name,
                          skip_root,
-                         NULL, NULL, NULL, /* parent info */
+                         NULL, NULL, NULL,
+                         dir_info,
                          dirent,
                          ignore_patterns,
                          depth,
@@ -2425,7 +2446,9 @@ internal_status(svn_wc_status3_t **statu
   svn_wc__db_kind_t node_kind;
   const char *parent_repos_relpath;
   const char *parent_repos_root_url;
+  const char *parent_repos_uuid;
   svn_wc__db_status_t node_status;
+  svn_boolean_t conflicted;
   svn_boolean_t is_root = FALSE;
   svn_error_t *err;
 
@@ -2436,8 +2459,8 @@ internal_status(svn_wc_status3_t **statu
 
   err = svn_wc__db_read_info(&node_status, &node_kind, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL,
+                             NULL, NULL, NULL, NULL, NULL, NULL, &conflicted,
+                             NULL, NULL, NULL, NULL, NULL, NULL,
                              db, local_abspath,
                              scratch_pool, scratch_pool);
 
@@ -2448,16 +2471,21 @@ internal_status(svn_wc_status3_t **statu
     {
       svn_error_clear(err);
       node_kind = svn_wc__db_kind_unknown;
+
+      /* Ensure conflicted is always set, but don't hide tree conflicts
+         on 'hidden' nodes. */
+      if (err)
+        conflicted = FALSE;
     }
   else
     SVN_ERR(err);
 
   if (node_kind == svn_wc__db_kind_unknown)
     return svn_error_trace(assemble_unversioned(status,
-                                                 db, local_abspath,
-                                                 dirent->kind,
-                                                 FALSE /* is_ignored */,
-                                                 result_pool, scratch_pool));
+                                                db, local_abspath,
+                                                dirent, conflicted,
+                                                FALSE /* is_ignored */,
+                                                result_pool, scratch_pool));
 
   if (svn_dirent_is_root(local_abspath, strlen(local_abspath)))
     is_root = TRUE;
@@ -2472,7 +2500,7 @@ internal_status(svn_wc_status3_t **statu
 
       err = svn_wc__db_read_info(&parent_status, NULL, NULL,
                                  &parent_repos_relpath, &parent_repos_root_url,
-                                 NULL, NULL, NULL, NULL,
+                                 &parent_repos_uuid, NULL, NULL, NULL,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                  NULL, NULL, NULL, NULL,
@@ -2485,34 +2513,27 @@ internal_status(svn_wc_status3_t **statu
           svn_error_clear(err);
           parent_repos_root_url = NULL;
           parent_repos_relpath = NULL;
+          parent_repos_uuid = NULL;
         }
-      else if (err)
-        return svn_error_trace(err);
-
-      if (!err
-          && parent_repos_relpath == NULL
-          && parent_status != svn_wc__db_status_added
-          && parent_status != svn_wc__db_status_deleted)
-        SVN_ERR(svn_wc__db_scan_base_repos(&parent_repos_relpath,
-                                           &parent_repos_root_url, NULL,
-                                           db, local_abspath,
-                                           result_pool, scratch_pool));
+      else SVN_ERR(err);
     }
   else
     {
       parent_repos_root_url = NULL;
       parent_repos_relpath = NULL;
+      parent_repos_uuid = NULL;
     }
 
   return svn_error_trace(assemble_status(status, db, local_abspath,
-                                          parent_repos_root_url,
-                                          parent_repos_relpath,
-                                          NULL,
-                                          dirent,
-                                          TRUE /* get_all */,
-                                          FALSE,
-                                          NULL /* repos_lock */,
-                                          result_pool, scratch_pool));
+                                         parent_repos_root_url,
+                                         parent_repos_relpath,
+                                         parent_repos_uuid,
+                                         NULL,
+                                         dirent,
+                                         TRUE /* get_all */,
+                                         FALSE,
+                                         NULL /* repos_lock */,
+                                         result_pool, scratch_pool));
 }
 
 
@@ -2563,6 +2584,10 @@ svn_wc_dup_status3(const svn_wc_status3_
     new_stat->repos_relpath
       = apr_pstrdup(pool, orig_stat->repos_relpath);
 
+  if (orig_stat->repos_uuid)
+    new_stat->repos_uuid
+      = apr_pstrdup(pool, orig_stat->repos_uuid);
+
   /* Return the new hotness. */
   return new_stat;
 }
@@ -2579,7 +2604,7 @@ svn_wc_get_ignores2(apr_array_header_t *
 
   SVN_ERR(svn_wc_get_default_ignores(&default_ignores, config, scratch_pool));
   return svn_error_trace(collect_ignore_patterns(patterns, wc_ctx->db,
-                                                  local_abspath,
-                                                  default_ignores,
-                                                  result_pool, scratch_pool));
+                                                 local_abspath,
+                                                 default_ignores,
+                                                 result_pool, scratch_pool));
 }

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/translate.c?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/translate.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/translate.c Wed Jul 20 13:06:00 2011
@@ -263,7 +263,7 @@ svn_wc__get_translate_info(svn_subst_eol
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
-  svn_string_t *propval;
+  const char *propval;
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
   if (props == NULL)
@@ -272,29 +272,26 @@ svn_wc__get_translate_info(svn_subst_eol
 
   if (eol)
     {
-      propval = props ? apr_hash_get(props, SVN_PROP_EOL_STYLE,
-                                     APR_HASH_KEY_STRING) : NULL;
+      propval = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
 
-      svn_subst_eol_style_from_value(style, eol, propval ? propval->data : NULL);
+      svn_subst_eol_style_from_value(style, eol, propval);
     }
 
   if (keywords)
     {
-      propval = props ? apr_hash_get(props, SVN_PROP_KEYWORDS,
-                                     APR_HASH_KEY_STRING) : NULL;
+      propval = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
 
-      if (!propval || propval->len == 0)
+      if (!propval || *propval == '\0')
         *keywords = NULL;
       else
         SVN_ERR(svn_wc__expand_keywords(keywords,
                                         db, local_abspath, NULL,
-                                        propval->data, for_normalization,
+                                        propval, for_normalization,
                                         result_pool, scratch_pool));
     }
   if (special)
     {
-      propval = props ? apr_hash_get(props, SVN_PROP_SPECIAL,
-                                     APR_HASH_KEY_STRING) : NULL;
+      propval = svn_prop_get_value(props, SVN_PROP_SPECIAL);
 
       *special = (propval != NULL);
     }

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/update_editor.c?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/update_editor.c Wed Jul 20 13:06:00 2011
@@ -773,6 +773,7 @@ make_file_baton(struct file_baton **f_p,
                 svn_boolean_t adding,
                 apr_pool_t *scratch_pool)
 {
+  struct edit_baton *eb = pb->edit_baton;
   apr_pool_t *file_pool = svn_pool_create(pb->pool);
 
   struct file_baton *f = apr_pcalloc(file_pool, sizeof(*f));
@@ -785,17 +786,35 @@ make_file_baton(struct file_baton **f_p,
   SVN_ERR(path_join_under_root(&f->local_abspath,
                                pb->local_abspath, f->name, file_pool));
 
-  /* Figure out the new_URL for this file. */
-  if (adding || pb->edit_baton->switch_relpath)
-    f->new_relpath = svn_relpath_join(pb->new_relpath, f->name, file_pool);
-  else
+  /* Figure out the new URL for this file. */
+  if (eb->switch_relpath)
     {
-      SVN_ERR(svn_wc__db_scan_base_repos(&f->new_relpath, NULL, NULL,
-                                         pb->edit_baton->db,
-                                         f->local_abspath,
-                                         file_pool, scratch_pool));
+      /* Handle switches... */
 
-      SVN_ERR_ASSERT(f->new_relpath);
+      /* This file has a parent directory. If there is
+         no grandparent, then we may have anchored at the parent,
+         and self is the target. If we match the target, then set
+         NEW_RELPATH to the SWITCH_RELPATH.
+
+         Otherwise, we simply extend NEW_RELPATH from the parent.  */
+      if (pb->parent_baton == NULL
+          && strcmp(eb->target_basename, f->name) == 0)
+        f->new_relpath = eb->switch_relpath;
+      else
+        f->new_relpath = svn_relpath_join(pb->new_relpath, f->name,
+                                          file_pool);
+    }
+  else  /* must be an update */
+    {
+      if (adding)
+        f->new_relpath = svn_relpath_join(pb->new_relpath, f->name, file_pool);
+      else
+        {
+          SVN_ERR(svn_wc__db_scan_base_repos(&f->new_relpath, NULL, NULL,
+                                             eb->db, f->local_abspath,
+                                             file_pool, scratch_pool));
+          SVN_ERR_ASSERT(f->new_relpath);
+        }
     }
 
   f->pool              = file_pool;
@@ -1046,7 +1065,6 @@ set_target_revision(void *edit_baton,
 {
   struct edit_baton *eb = edit_baton;
 
-  /* Stashing a target_revision in the baton */
   *(eb->target_revision) = target_revision;
   return SVN_NO_ERROR;
 }
@@ -1089,7 +1107,7 @@ open_root(void *edit_baton,
       /* Notify that we skipped the target, while we actually skipped
          the anchor */
       do_notification(eb, eb->target_abspath, svn_node_unknown,
-                      svn_wc_notify_skip, pool);
+                      svn_wc_notify_skip_conflicted, pool);
 
       return SVN_NO_ERROR;
     }
@@ -1144,6 +1162,7 @@ modcheck_callback(void *baton,
       case svn_wc_status_ignored:
       case svn_wc_status_none:
       case svn_wc_status_unversioned:
+      case svn_wc_status_external:
         break;
 
       case svn_wc_status_deleted:
@@ -1570,9 +1589,9 @@ check_tree_conflict(svn_wc_conflict_desc
   /* A conflict was detected. Append log commands to the log accumulator
    * to record it. */
   return svn_error_trace(create_tree_conflict(pconflict, eb, local_abspath,
-                                               reason, action, their_node_kind,
-                                               their_relpath,
-                                               result_pool, scratch_pool));
+                                              reason, action, their_node_kind,
+                                              their_relpath,
+                                              result_pool, scratch_pool));
 }
 
 
@@ -1739,7 +1758,8 @@ delete_entry(const char *path,
     {
       SVN_ERR(remember_skipped_tree(eb, local_abspath, scratch_pool));
 
-      do_notification(eb, local_abspath, svn_node_unknown, svn_wc_notify_skip,
+      do_notification(eb, local_abspath, svn_node_unknown,
+                      svn_wc_notify_skip_conflicted,
                       scratch_pool);
 
       svn_pool_destroy(scratch_pool);
@@ -2081,7 +2101,7 @@ add_directory(const char *path,
 
       /* ### TODO: Also print victim_path in the skip msg. */
       do_notification(eb, db->local_abspath, svn_node_dir,
-                      svn_wc_notify_skip, pool);
+                      svn_wc_notify_skip_conflicted, pool);
       return SVN_NO_ERROR;
     }
 
@@ -2312,7 +2332,7 @@ open_directory(const char *path,
       db->already_notified = TRUE;
 
       do_notification(eb, db->local_abspath, svn_node_unknown,
-                      svn_wc_notify_skip, pool);
+                      svn_wc_notify_skip_conflicted, pool);
 
       return SVN_NO_ERROR;
     }
@@ -2495,85 +2515,89 @@ close_directory(void *dir_baton,
 
   /* If this directory has property changes stored up, now is the time
      to deal with them. */
-  if (regular_prop_changes->nelts || entry_prop_changes->nelts
-      || dav_prop_changes->nelts)
+  if (regular_prop_changes->nelts)
     {
-      if (regular_prop_changes->nelts)
+      svn_skel_t *work_item;
+
+      /* If recording traversal info, then see if the
+         SVN_PROP_EXTERNALS property on this directory changed,
+         and record before and after for the change. */
+      if (eb->external_func)
         {
-          svn_skel_t *work_item;
+          const svn_prop_t *change
+            = externals_prop_changed(regular_prop_changes);
 
-          /* If recording traversal info, then see if the
-             SVN_PROP_EXTERNALS property on this directory changed,
-             and record before and after for the change. */
-          if (eb->external_func)
+          if (change)
             {
-              const svn_prop_t *change
-                = externals_prop_changed(regular_prop_changes);
+              const svn_string_t *new_val_s = change->value;
+              const svn_string_t *old_val_s;
 
-              if (change)
-                {
-                  const svn_string_t *new_val_s = change->value;
-                  const svn_string_t *old_val_s;
+              old_val_s = apr_hash_get(base_props, SVN_PROP_EXTERNALS,
+                                       APR_HASH_KEY_STRING);
 
-                  old_val_s = apr_hash_get(base_props, SVN_PROP_EXTERNALS,
-                                           APR_HASH_KEY_STRING);
-
-                  if ((new_val_s == NULL) && (old_val_s == NULL))
-                    ; /* No value before, no value after... so do nothing. */
-                  else if (new_val_s && old_val_s
-                           && (svn_string_compare(old_val_s, new_val_s)))
-                    ; /* Value did not change... so do nothing. */
-                  else if (old_val_s || new_val_s)
-                    /* something changed, record the change */
-                    {
-                      SVN_ERR((eb->external_func)(
-                                           eb->external_baton,
-                                           db->local_abspath,
-                                           old_val_s,
-                                           new_val_s,
-                                           db->ambient_depth,
-                                           db->pool));
-                    }
+              if ((new_val_s == NULL) && (old_val_s == NULL))
+                ; /* No value before, no value after... so do nothing. */
+              else if (new_val_s && old_val_s
+                       && (svn_string_compare(old_val_s, new_val_s)))
+                ; /* Value did not change... so do nothing. */
+              else if (old_val_s || new_val_s)
+                /* something changed, record the change */
+                {
+                  SVN_ERR((eb->external_func)(
+                                       eb->external_baton,
+                                       db->local_abspath,
+                                       old_val_s,
+                                       new_val_s,
+                                       db->ambient_depth,
+                                       db->pool));
                 }
             }
+        }
 
-          /* Merge pending properties into temporary files (ignoring
-             conflicts). */
-          SVN_ERR_W(svn_wc__merge_props(&work_item,
-                                        &prop_state,
-                                        &new_base_props,
-                                        &new_actual_props,
-                                        eb->db,
-                                        db->local_abspath,
-                                        svn_wc__db_kind_dir,
-                                        NULL, /* left_version */
-                                        NULL, /* right_version */
-                                        NULL /* use baseprops */,
-                                        base_props,
-                                        actual_props,
-                                        regular_prop_changes,
-                                        TRUE /* base_merge */,
-                                        FALSE /* dry_run */,
-                                        eb->conflict_func,
-                                        eb->conflict_baton,
-                                        eb->cancel_func,
-                                        eb->cancel_baton,
-                                        db->pool,
-                                        scratch_pool),
-                    _("Couldn't do property merge"));
-          /* After a (not-dry-run) merge, we ALWAYS have props to save.  */
-          SVN_ERR_ASSERT(new_base_props != NULL && new_actual_props != NULL);
-          all_work_items = svn_wc__wq_merge(all_work_items, work_item,
-                                            scratch_pool);
+      if (db->shadowed)
+        {
+          /* We don't have a relevant actual row, but we need actual properties
+             to allow property merging without conflicts. */
+          if (db->adding_dir)
+            actual_props = apr_hash_make(scratch_pool);
+          else
+            actual_props = base_props;
         }
 
-      SVN_ERR(accumulate_last_change(&new_changed_rev,
-                                     &new_changed_date,
-                                     &new_changed_author,
-                                     entry_prop_changes,
-                                     scratch_pool, scratch_pool));
+      /* Merge pending properties into temporary files (ignoring
+         conflicts). */
+      SVN_ERR_W(svn_wc__merge_props(&work_item,
+                                    &prop_state,
+                                    &new_base_props,
+                                    &new_actual_props,
+                                    eb->db,
+                                    db->local_abspath,
+                                    svn_wc__db_kind_dir,
+                                    NULL, /* left_version */
+                                    NULL, /* right_version */
+                                    NULL /* use baseprops */,
+                                    base_props,
+                                    actual_props,
+                                    regular_prop_changes,
+                                    TRUE /* base_merge */,
+                                    FALSE /* dry_run */,
+                                    eb->conflict_func,
+                                    eb->conflict_baton,
+                                    eb->cancel_func,
+                                    eb->cancel_baton,
+                                    db->pool,
+                                    scratch_pool),
+                _("Couldn't do property merge"));
+      /* After a (not-dry-run) merge, we ALWAYS have props to save.  */
+      SVN_ERR_ASSERT(new_base_props != NULL && new_actual_props != NULL);
+      all_work_items = svn_wc__wq_merge(all_work_items, work_item,
+                                        scratch_pool);
     }
 
+  SVN_ERR(accumulate_last_change(&new_changed_rev, &new_changed_date,
+                                 &new_changed_author, entry_prop_changes,
+                                 scratch_pool, scratch_pool));
+
   /* Check if we should add some not-present markers before marking the
      directory complete (Issue #3569) */
   {
@@ -2884,16 +2908,16 @@ absent_node(const char *path,
     const char *repos_relpath;
     repos_relpath = svn_relpath_join(pb->new_relpath, name, scratch_pool);
 
-    /* Insert an absent node below the parent node to note that this child
+    /* Insert an excluded node below the parent node to note that this child
        is absent. (This puts it in the parent db if the child is obstructed) */
-    SVN_ERR(svn_wc__db_base_add_absent_node(eb->db, local_abspath,
-                                            repos_relpath, eb->repos_root,
-                                            eb->repos_uuid,
-                                            *(eb->target_revision),
-                                            absent_kind,
-                                            svn_wc__db_status_server_excluded,
-                                            NULL, NULL,
-                                            scratch_pool));
+    SVN_ERR(svn_wc__db_base_add_excluded_node(eb->db, local_abspath,
+                                              repos_relpath, eb->repos_root,
+                                              eb->repos_uuid,
+                                              *(eb->target_revision),
+                                              absent_kind,
+                                              svn_wc__db_status_server_excluded,
+                                              NULL, NULL,
+                                              scratch_pool));
   }
 
   svn_pool_destroy(scratch_pool);
@@ -3099,7 +3123,7 @@ add_file(const char *path,
                    APR_HASH_KEY_STRING, (void*)1);
 
       do_notification(eb, fb->local_abspath, svn_node_unknown,
-                      svn_wc_notify_skip, scratch_pool);
+                      svn_wc_notify_skip_conflicted, scratch_pool);
 
       svn_pool_destroy(scratch_pool);
 
@@ -3300,7 +3324,7 @@ open_file(const char *path,
       fb->already_notified = TRUE;
 
       do_notification(eb, fb->local_abspath, svn_node_unknown,
-                      svn_wc_notify_skip, scratch_pool);
+                      svn_wc_notify_skip_conflicted, scratch_pool);
 
       svn_pool_destroy(scratch_pool);
 
@@ -4113,9 +4137,37 @@ close_file(void *file_baton,
       /* Merge the text. This will queue some additional work.  */
       if (!fb->obstruction_found)
         {
-          SVN_ERR(merge_file(&work_item, &install_pristine, &install_from,
-                             &content_state, fb, current_actual_props,
-                             fb->changed_date, scratch_pool, scratch_pool));
+          svn_error_t *err;
+          err = merge_file(&work_item, &install_pristine, &install_from,
+                           &content_state, fb, current_actual_props,
+                           fb->changed_date, scratch_pool, scratch_pool);
+
+          if (err && err->apr_err == SVN_ERR_WC_PATH_ACCESS_DENIED)
+            {
+              if (eb->notify_func)
+                {
+                  svn_wc_notify_t *notify =svn_wc_create_notify(
+                                fb->local_abspath,
+                                svn_wc_notify_update_skip_access_denied,
+                                scratch_pool);
+
+                  notify->kind = svn_node_file;
+                  notify->err = err;
+
+                  eb->notify_func(eb->notify_baton, notify, scratch_pool);
+                }
+              svn_error_clear(err);
+
+              SVN_ERR(remember_skipped_tree(eb, fb->local_abspath,
+                                            scratch_pool));
+              fb->skip_this = TRUE;
+
+              SVN_ERR(maybe_release_dir_info(fb->bump_info));
+              svn_pool_destroy(fb->pool);
+              return SVN_NO_ERROR;
+            }
+          else
+            SVN_ERR(err);
 
           all_work_items = svn_wc__wq_merge(all_work_items, work_item,
                                             scratch_pool);
@@ -4280,7 +4332,6 @@ close_file(void *file_baton,
      about files which were already notified for another reason.) */
   if (eb->notify_func && !fb->already_notified && fb->edited)
     {
-      const svn_string_t *mime_type;
       svn_wc_notify_t *notify;
       svn_wc_notify_action_t action = svn_wc_notify_update_update;
 
@@ -4307,12 +4358,8 @@ close_file(void *file_baton,
       notify->old_revision = fb->old_revision;
 
       /* Fetch the mimetype from the actual properties */
-      mime_type = (new_actual_props != NULL)
-                        ? apr_hash_get(new_actual_props, SVN_PROP_MIME_TYPE,
-                                       APR_HASH_KEY_STRING)
-                        : NULL;
-
-      notify->mime_type = mime_type == NULL ? NULL : mime_type->data;
+      notify->mime_type = svn_prop_get_value(new_actual_props,
+                                             SVN_PROP_MIME_TYPE);
 
       eb->notify_func(eb->notify_baton, notify, scratch_pool);
     }
@@ -5047,9 +5094,9 @@ svn_wc__strictly_is_wc_root(svn_boolean_
                             apr_pool_t *scratch_pool)
 {
   return svn_error_trace(svn_wc__db_is_wcroot(wc_root,
-                                               wc_ctx->db,
-                                               local_abspath,
-                                               scratch_pool));
+                                              wc_ctx->db,
+                                              local_abspath,
+                                              scratch_pool));
 }
 
 
@@ -5391,6 +5438,6 @@ svn_wc_add_repos_file4(svn_wc_context_t 
                                   pool));
 
   return svn_error_trace(svn_wc__wq_run(db, dir_abspath,
-                                         cancel_func, cancel_baton,
-                                         pool));
+                                        cancel_func, cancel_baton,
+                                        pool));
 }

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/upgrade.c?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/upgrade.c Wed Jul 20 13:06:00 2011
@@ -265,40 +265,20 @@ read_wcprops(apr_hash_t **all_wcprops,
   return svn_error_trace(svn_stream_close(stream));
 }
 
-
-/* If the versioned child (which should be a directory) exists on disk as
-   an actual directory, then add it to the array of subdirs.  */
-static svn_error_t *
-maybe_add_subdir(apr_array_header_t *subdirs,
-                 const char *dir_abspath,
-                 const char *child_name,
-                 apr_pool_t *result_pool,
-                 apr_pool_t *scratch_pool)
-{
-  const char *child_abspath = svn_dirent_join(dir_abspath, child_name,
-                                              scratch_pool);
-  svn_node_kind_t kind;
-
-  SVN_ERR(svn_io_check_path(child_abspath, &kind, scratch_pool));
-  if (kind == svn_node_dir)
-    {
-      APR_ARRAY_PUSH(subdirs, const char *) = apr_pstrdup(result_pool,
-                                                          child_abspath);
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Return in CHILDREN, the list of all 1.6 versioned subdirectories
    which also exist on disk as directories.
 
    If DELETE_DIR is not NULL set *DELETE_DIR to TRUE if the directory
-   should be deleted after migrating to WC-NG, otherwise to FALSE. */
+   should be deleted after migrating to WC-NG, otherwise to FALSE.
+
+   If SKIP_MISSING is TRUE, don't add missing or obstructed subdirectories
+   to the list of children.
+   */
 static svn_error_t *
 get_versioned_subdirs(apr_array_header_t **children,
                       svn_boolean_t *delete_dir,
                       const char *dir_abspath,
+                      svn_boolean_t skip_missing,
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
@@ -316,6 +296,9 @@ get_versioned_subdirs(apr_array_header_t
        hi = apr_hash_next(hi))
     {
       const char *name = svn__apr_hash_index_key(hi);
+      const svn_wc_entry_t *entry = svn__apr_hash_index_val(hi);
+      const char *child_abspath;
+      svn_boolean_t hidden;
 
       /* skip "this dir"  */
       if (*name == '\0')
@@ -323,11 +306,29 @@ get_versioned_subdirs(apr_array_header_t
           this_dir = svn__apr_hash_index_val(hi);
           continue;
         }
+      else if (entry->kind != svn_node_dir)
+        continue;
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(maybe_add_subdir(*children, dir_abspath, name,
-                               result_pool, iterpool));
+      /* If a directory is 'hidden' skip it as subdir */
+      SVN_ERR(svn_wc__entry_is_hidden(&hidden, entry));
+      if (hidden)
+        continue;
+
+      child_abspath = svn_dirent_join(dir_abspath, name, scratch_pool);
+
+      if (skip_missing)
+        {
+          svn_node_kind_t kind;
+          SVN_ERR(svn_io_check_path(child_abspath, &kind, scratch_pool));
+
+          if (kind != svn_node_dir)
+            continue;
+        }
+
+      APR_ARRAY_PUSH(*children, const char *) = apr_pstrdup(result_pool,
+                                                            child_abspath);
     }
 
   svn_pool_destroy(iterpool);
@@ -356,6 +357,7 @@ static svn_error_t *
 get_versioned_files(const apr_array_header_t **children,
                     const char *parent_relpath,
                     svn_sqlite__db_t *sdb,
+                    apr_int64_t wc_id,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
 {
@@ -365,7 +367,7 @@ get_versioned_files(const apr_array_head
 
   /* ### just select 'file' children. do we need 'symlink' in the future?  */
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ALL_FILES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "s", parent_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, parent_relpath));
 
   /* ### 10 is based on Subversion's average of 8.5 files per versioned
      ### directory in its repository. maybe use a different value? or
@@ -536,7 +538,7 @@ svn_wc__wipe_postupgrade(const char *dir
   if (cancel_func)
     SVN_ERR((*cancel_func)(cancel_baton));
 
-  err = get_versioned_subdirs(&subdirs, &delete_dir, dir_abspath,
+  err = get_versioned_subdirs(&subdirs, &delete_dir, dir_abspath, TRUE,
                               scratch_pool, iterpool);
   if (err)
     {
@@ -647,9 +649,9 @@ ensure_repos_info(svn_wc_entry_t *entry,
         svn_dirent_local_style(local_abspath, scratch_pool));
 
    return svn_error_trace((*repos_info_func)(&entry->repos, &entry->uuid,
-                                              repos_info_baton,
-                                              entry->url,
-                                              result_pool, scratch_pool));
+                                             repos_info_baton,
+                                             entry->url,
+                                             result_pool, scratch_pool));
 }
 
 
@@ -837,6 +839,7 @@ migrate_node_props(const char *dir_abspa
                    const char *name,
                    svn_sqlite__db_t *sdb,
                    int original_format,
+                   apr_int64_t wc_id,
                    apr_pool_t *scratch_pool)
 {
   const char *base_abspath;  /* old name. nowadays: "pristine"  */
@@ -903,7 +906,7 @@ migrate_node_props(const char *dir_abspa
                             sdb, new_wcroot_abspath,
                             svn_relpath_join(dir_relpath, name, scratch_pool),
                             base_props, revert_props, working_props,
-                            original_format,
+                            original_format, wc_id,
                             scratch_pool));
 }
 
@@ -914,6 +917,7 @@ migrate_props(const char *dir_abspath,
               const char *new_wcroot_abspath,
               svn_sqlite__db_t *sdb,
               int original_format,
+              apr_int64_t wc_id,
               apr_pool_t *scratch_pool)
 {
   /* General logic here: iterate over all the immediate children of the root
@@ -947,10 +951,10 @@ migrate_props(const char *dir_abspath,
 
   /* Migrate the props for "this dir".  */
   SVN_ERR(migrate_node_props(dir_abspath, new_wcroot_abspath, "", sdb,
-                             original_format, iterpool));
+                             original_format, wc_id, iterpool));
 
   /* Iterate over all the files in this SDB.  */
-  SVN_ERR(get_versioned_files(&children, dir_relpath, sdb, scratch_pool,
+  SVN_ERR(get_versioned_files(&children, dir_relpath, sdb, wc_id, scratch_pool,
                               iterpool));
   for (i = 0; i < children->nelts; i++)
     {
@@ -959,7 +963,7 @@ migrate_props(const char *dir_abspath,
       svn_pool_clear(iterpool);
 
       SVN_ERR(migrate_node_props(dir_abspath, new_wcroot_abspath,
-                                 name, sdb, original_format, iterpool));
+                                 name, sdb, original_format, wc_id, iterpool));
     }
 
   svn_pool_destroy(iterpool);
@@ -1269,16 +1273,14 @@ upgrade_externals(struct bump_baton *bb,
   while (have_row)
     {
       apr_hash_t *props;
-      const svn_string_t *externals = NULL;
+      const char *externals;
 
       svn_pool_clear(iterpool);
 
       SVN_ERR(svn_sqlite__column_properties(&props, stmt, 0,
                                             iterpool, iterpool));
 
-      if (props)
-        externals = apr_hash_get(props, SVN_PROP_EXTERNALS,
-                                 APR_HASH_KEY_STRING);
+      externals = svn_prop_get_value(props, SVN_PROP_EXTERNALS);
 
       if (externals)
         {
@@ -1292,7 +1294,7 @@ upgrade_externals(struct bump_baton *bb,
                                           iterpool);
 
           SVN_ERR(svn_wc_parse_externals_description3(&ext, local_abspath,
-                                                      externals->data, FALSE,
+                                                      externals, FALSE,
                                                       iterpool));
 
           for (i = 0; i < ext->nelts; i++)
@@ -1375,10 +1377,11 @@ upgrade_to_wcng(void **dir_baton,
                 svn_wc__db_t *db,
                 const char *dir_abspath,
                 int old_format,
+                apr_int64_t wc_id,
                 svn_wc_upgrade_get_repos_info_t repos_info_func,
                 void *repos_info_baton,
                 apr_hash_t *repos_cache,
-                struct upgrade_data_t *data,
+                const struct upgrade_data_t *data,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
@@ -1489,7 +1492,7 @@ upgrade_to_wcng(void **dir_baton,
      database. The upgrade process needs the children in BASE_NODE and
      WORKING_NODE, and to examine the resultant WORKING state.  */
   SVN_ERR(migrate_props(dir_abspath, data->root_abspath, data->sdb, old_format,
-                        scratch_pool));
+                        wc_id, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -1649,7 +1652,7 @@ upgrade_working_copy(void *parent_baton,
                      svn_wc_upgrade_get_repos_info_t repos_info_func,
                      void *repos_info_baton,
                      apr_hash_t *repos_cache,
-                     struct upgrade_data_t *data,
+                     const struct upgrade_data_t *data,
                      svn_cancel_func_t cancel_func,
                      void *cancel_baton,
                      svn_wc_notify_func2_t notify_func,
@@ -1681,11 +1684,12 @@ upgrade_working_copy(void *parent_baton,
       return SVN_NO_ERROR;
     }
 
-  err = get_versioned_subdirs(&subdirs, NULL, dir_abspath,
+  err = get_versioned_subdirs(&subdirs, NULL, dir_abspath, FALSE,
                               scratch_pool, iterpool);
   if (err)
     {
-      if (APR_STATUS_IS_ENOENT(err->apr_err))
+      if (APR_STATUS_IS_ENOENT(err->apr_err)
+          || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err))
         {
           /* An unversioned dir is obstructing a versioned dir */
           svn_error_clear(err);
@@ -1701,7 +1705,8 @@ upgrade_working_copy(void *parent_baton,
     }
 
 
-  SVN_ERR(upgrade_to_wcng(&dir_baton, parent_baton, db, dir_abspath, old_format,
+  SVN_ERR(upgrade_to_wcng(&dir_baton, parent_baton, db, dir_abspath,
+                          old_format, data->wc_id,
                           repos_info_func, repos_info_baton,
                           repos_cache, data, scratch_pool, iterpool));
 
@@ -1749,6 +1754,8 @@ is_old_wcroot(const char *local_abspath,
         _("Can't upgrade '%s' as it is not a pre-1.7 working copy directory"),
         svn_dirent_local_style(local_abspath, scratch_pool));
     }
+  else if (svn_dirent_is_root(local_abspath, strlen(local_abspath)))
+    return SVN_NO_ERROR;
 
   svn_dirent_split(&parent_abspath, &name, local_abspath, scratch_pool);
 
@@ -1763,14 +1770,15 @@ is_old_wcroot(const char *local_abspath,
   entry = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
   if (!entry
       || entry->absent
-      || (entry->deleted && entry->schedule != svn_wc_schedule_add))
+      || (entry->deleted && entry->schedule != svn_wc_schedule_add)
+      || entry->depth == svn_depth_exclude)
     {
       return SVN_NO_ERROR;
     }
 
-  svn_dirent_split(&parent_abspath, &name, parent_abspath, scratch_pool);
   while (!svn_dirent_is_root(parent_abspath, strlen(parent_abspath)))
     {
+      svn_dirent_split(&parent_abspath, &name, parent_abspath, scratch_pool);
       err = svn_wc__read_entries_old(&entries, parent_abspath,
                                      scratch_pool, scratch_pool);
       if (err)
@@ -1782,12 +1790,12 @@ is_old_wcroot(const char *local_abspath,
       entry = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
       if (!entry
           || entry->absent
-          || (entry->deleted && entry->schedule != svn_wc_schedule_add))
+          || (entry->deleted && entry->schedule != svn_wc_schedule_add)
+          || entry->depth == svn_depth_exclude)
         {
           parent_abspath = svn_dirent_join(parent_abspath, name, scratch_pool);
           break;
         }
-      svn_dirent_split(&parent_abspath, &name, parent_abspath, scratch_pool);
     }
 
   return svn_error_createf(
@@ -1806,7 +1814,7 @@ typedef struct upgrade_working_copy_bato
   svn_wc_upgrade_get_repos_info_t repos_info_func;
   void *repos_info_baton;
   apr_hash_t *repos_cache;
-  struct upgrade_data_t *data;
+  const struct upgrade_data_t *data;
   svn_cancel_func_t cancel_func;
   void *cancel_baton;
   svn_wc_notify_func2_t notify_func;

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/wc-metadata.sql?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/wc-metadata.sql Wed Jul 20 13:06:00 2011
@@ -763,6 +763,10 @@ PRAGMA user_version = 29;
    number will be, however, so we're just marking it as 99 for now.  */
 -- format: 99
 
+/* TODO: Rename the "absent" presence value to "server-excluded" before
+   the 1.7 release. wc_db.c and this file have references to "absent" which
+   still need to be changed to "server-excluded". */
+
 /* Now "drop" the tree_conflict_data column from actual_node. */
 CREATE TABLE ACTUAL_NODE_BACKUP (
   wc_id  INTEGER NOT NULL,

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/wc-queries.sql?rev=1148749&r1=1148748&r2=1148749&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/wc-queries.sql Wed Jul 20 13:06:00 2011
@@ -473,7 +473,10 @@ WHERE wc_id = ?1 AND (parent_relpath = ?
 INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
 SELECT wc_id, local_relpath, parent_relpath, kind
 FROM nodes_current
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+       AND (?2 = ''
+            OR local_relpath = ?2 
+            OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
 
 -- STMT_INSERT_TARGET_WITH_CHANGELIST
 INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
@@ -503,8 +506,11 @@ INSERT INTO targets_list(wc_id, local_re
 SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind
   FROM actual_node AS A JOIN nodes_current AS N
     ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
- WHERE N.wc_id = ?1 AND A.changelist = ?3
-       AND (N.local_relpath = ?2 OR N.local_relpath LIKE ?4 ESCAPE '#')
+ WHERE N.wc_id = ?1
+       AND (?2 = ''
+            OR N.local_relpath = ?2 
+            OR (N.local_relpath > ?2 || '/' AND N.local_relpath < ?2 || '0'))
+       AND A.changelist = ?3
 
 -- STMT_SELECT_TARGETS
 SELECT local_relpath, parent_relpath from targets_list
@@ -581,7 +587,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2
 
 -- STMT_DELETE_ACTUAL_NODE_RECURSIVE
 DELETE FROM actual_node
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
 
 -- STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT
 DELETE FROM actual_node
@@ -590,21 +599,23 @@ WHERE wc_id = ?1 AND local_relpath = ?2
 
 -- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST
 DELETE FROM actual_node
-WHERE wc_id = ?1 AND local_relpath = ?2
-      AND (changelist IS NULL
-           OR local_relpath NOT IN (SELECT local_relpath FROM nodes_current
-                                     WHERE wc_id  = ?1 AND local_relpath = ?2
-                                       AND kind = 'file'))
+WHERE wc_id = ?1
+  AND local_relpath = ?2
+  AND (changelist IS NULL
+       OR NOT EXISTS (SELECT 1 FROM nodes_current c
+                      WHERE c.wc_id = ?1 AND c.local_relpath = local_relpath
+                        AND kind = 'file'))
 
 -- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
 DELETE FROM actual_node
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
-      AND (changelist IS NULL
-           OR local_relpath NOT IN (SELECT local_relpath FROM nodes_current
-                                    WHERE wc_id = ?1
-                                      AND (local_relpath = ?2
-                                           OR local_relpath LIKE ?3 ESCAPE '#')
-                                      AND kind = 'file'))
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+  AND (changelist IS NULL
+       OR NOT EXISTS (SELECT 1 FROM nodes_current c
+                      WHERE c.wc_id = ?1 AND c.local_relpath = local_relpath
+                        AND kind = 'file'))
 
 -- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST
 UPDATE actual_node
@@ -632,7 +643,10 @@ SET properties = NULL,
     older_checksum = NULL,
     left_checksum = NULL,
     right_checksum = NULL
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
 
 -- STMT_UPDATE_NODE_BASE_DEPTH
 UPDATE nodes SET depth = ?3
@@ -762,10 +776,12 @@ AND NOT EXISTS (SELECT 1 FROM nodes
 -- STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE
 DELETE FROM wc_lock
 WHERE wc_id = ?1
-AND (local_dir_relpath = ?2 OR local_dir_relpath LIKE ?3 ESCAPE '#')
-AND NOT EXISTS (SELECT 1 FROM nodes
-                 WHERE nodes.wc_id = ?1
-                   AND nodes.local_relpath = wc_lock.local_dir_relpath)
+  AND (?2 = ''
+       OR local_dir_relpath = ?2
+       OR (local_dir_relpath > ?2 || '/' AND local_dir_relpath < ?2 || '0'))
+  AND NOT EXISTS (SELECT 1 FROM nodes
+                   WHERE nodes.wc_id = ?1
+                     AND nodes.local_relpath = wc_lock.local_dir_relpath)
 
 -- STMT_APPLY_CHANGES_TO_BASE_NODE
 /* translated_size and last_mod_time are not mentioned here because they will
@@ -823,31 +839,42 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 
 -- STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE
 UPDATE nodes SET op_depth = ?3 + 1
-WHERE wc_id = ?1 AND local_relpath LIKE ?2 ESCAPE '#' AND op_depth = ?3
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+ AND op_depth = ?3
 
 -- STMT_DOES_NODE_EXIST
 SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2
 LIMIT 1
 
--- STMT_HAS_ABSENT_NODES
+-- STMT_HAS_SERVER_EXCLUDED_NODES
 SELECT local_relpath FROM nodes
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
-  AND op_depth = 0 AND presence = 'absent' LIMIT 1
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+  AND op_depth = 0 AND presence = 'absent'
+LIMIT 1
 
-/* ### Select all absent nodes. */
--- STMT_SELECT_ALL_ABSENT_NODES
+/* ### Select all server-excluded nodes. */
+-- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES
 SELECT local_relpath FROM nodes
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
-  AND op_depth = 0 AND presence = 'absent'
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+  AND op_depth = 0
+  AND presence = 'absent'
 
 -- STMT_INSERT_WORKING_NODE_COPY_FROM_BASE
 INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id,
-    repos_path, revision, presence, depth, kind, changed_revision,
+    repos_path, revision, presence, depth, moved_here, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target )
 SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/, depth,
+    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7/*moved_here*/,
     kind, changed_revision, changed_date, changed_author, checksum, properties,
     translated_size, last_mod_time, symlink_target
 FROM nodes
@@ -856,11 +883,11 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 -- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING
 INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
-    revision, presence, depth, kind, changed_revision, changed_date,
+    revision, presence, depth, moved_here, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
 SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/, depth,
+    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7 /*moved_here*/,
     kind, changed_revision, changed_date, changed_author, checksum, properties,
     translated_size, last_mod_time, symlink_target
 FROM nodes
@@ -871,15 +898,15 @@ LIMIT 1
 -- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
 INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
-    revision, presence, depth, kind, changed_revision, changed_date,
+    revision, presence, depth, moved_here, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
 SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/,
-    depth, kind, changed_revision, changed_date, changed_author, checksum,
+    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7 /*moved_here*/,
+    kind, changed_revision, changed_date, changed_author, checksum,
     properties, translated_size, last_mod_time, symlink_target
 FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?7
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?8
 
 -- STMT_INSERT_ACTUAL_NODE_FROM_ACTUAL_NODE
 INSERT OR REPLACE INTO actual_node (
@@ -985,15 +1012,8 @@ WHERE tree_conflict_data IS NOT NULL
 UPDATE actual_node SET tree_conflict_data = NULL
 
 -- STMT_SELECT_ALL_FILES
-/* Should this select on wc_id as well? */
 SELECT DISTINCT local_relpath FROM nodes
-WHERE kind = 'file' AND parent_relpath = ?1
-
--- STMT_SELECT_NODE_UPGRADE
-SELECT op_depth, presence, wc_id, kind
-FROM nodes
-WHERE local_relpath = ?1
-ORDER BY op_depth DESC
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file'
 
 -- STMT_UPDATE_NODE_PROPS
 UPDATE nodes SET properties = ?4
@@ -1001,12 +1021,14 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 
 -- STMT_HAS_WORKING_NODES
 SELECT 1 FROM nodes WHERE op_depth > 0
+LIMIT 1
 
 -- STMT_HAS_ACTUAL_NODES_CONFLICTS
 SELECT 1 FROM actual_node
 WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
            AND (conflict_new IS NULL) AND (conflict_working IS NULL)
            AND (tree_conflict_data IS NULL))
+LIMIT 1
 
 /* ------------------------------------------------------------------------- */
 /* PROOF OF CONCEPT: Complex queries for callback walks, caching results
@@ -1182,14 +1204,19 @@ DROP TABLE IF EXISTS delete_list
 SELECT MIN(revision), MAX(revision),
        MIN(changed_revision), MAX(changed_revision) FROM nodes
   WHERE wc_id = ?1
-  AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
-  AND presence IN ('normal', 'incomplete')
-  AND file_external IS NULL
-  AND op_depth = 0
+    AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+    AND presence IN ('normal', 'incomplete')
+    AND file_external IS NULL
+    AND op_depth = 0
 
 -- STMT_HAS_SPARSE_NODES
 SELECT 1 FROM nodes
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
   AND op_depth = 0
   AND (presence IN ('absent', 'excluded')
         OR depth NOT IN ('infinity', 'unknown'))
@@ -1198,13 +1225,19 @@ LIMIT 1
 
 -- STMT_SUBTREE_HAS_TREE_MODIFICATIONS
 SELECT 1 FROM nodes
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
   AND op_depth > 0
 LIMIT 1
 
 -- STMT_SUBTREE_HAS_PROP_MODIFICATIONS
 SELECT 1 FROM actual_node
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+WHERE wc_id = ?1
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
   AND properties IS NOT NULL
 LIMIT 1
 
@@ -1280,7 +1313,9 @@ LIMIT 1
 -- STMT_SELECT_BASE_FILES_RECURSIVE
 SELECT local_relpath, translated_size, last_mod_time FROM nodes AS n
 WHERE wc_id = ?1
-  AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
   AND op_depth = 0
   AND kind='file'
   AND presence='normal'