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 2012/10/02 11:47:26 UTC

svn commit: r1392818 [2/2] - in /subversion/branches/1.7.x-issue4153: ./ build/ build/generator/ build/generator/templates/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversion/bindings/javahl/tests...

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/lock.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/lock.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/lock.c Tue Oct  2 09:47:23 2012
@@ -97,7 +97,8 @@ svn_wc__internal_check_wc(int *wc_format
     {
       svn_node_kind_t kind;
 
-      if (err->apr_err != SVN_ERR_WC_MISSING)
+      if (err->apr_err != SVN_ERR_WC_MISSING &&
+          err->apr_err != SVN_ERR_WC_UNSUPPORTED_FORMAT)
         return svn_error_trace(err);
       svn_error_clear(err);
 
@@ -1524,6 +1525,21 @@ svn_wc__acquire_write_lock(const char **
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));
 
+  if (lock_anchor && kind == svn_wc__db_kind_dir)
+    {
+      svn_boolean_t is_wcroot;
+
+      SVN_ERR_ASSERT(lock_root_abspath != NULL);
+
+      /* Perform a cheap check to avoid looking for a parent working copy,
+         which might be very expensive in some specific scenarios */
+      SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath,
+                                   scratch_pool));
+
+      if (is_wcroot)
+        lock_anchor = FALSE;
+    }
+
   if (lock_anchor)
     {
       const char *parent_abspath;

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/merge.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/merge.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/merge.c Tue Oct  2 09:47:23 2012
@@ -940,6 +940,8 @@ merge_file_trivial(svn_skel_t **work_ite
                    const char *target_abspath,
                    svn_boolean_t dry_run,
                    svn_wc__db_t *db,
+                   svn_cancel_func_t cancel_func,
+                   void *cancel_baton,
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
@@ -977,6 +979,41 @@ merge_file_trivial(svn_skel_t **work_ite
           *merge_outcome = svn_wc_merge_merged;
           if (!dry_run)
             {
+              const char *wcroot_abspath;
+              svn_boolean_t delete_src = FALSE;
+
+              /* The right_abspath might be outside our working copy. In that
+                 case we should copy the file to a safe location before
+                 installing to avoid breaking the workqueue */
+
+              SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath,
+                                            db, target_abspath,
+                                            scratch_pool, scratch_pool));
+
+              if (!svn_dirent_is_child(wcroot_abspath, right_abspath, NULL))
+                {
+                  svn_stream_t *tmp_src;
+                  svn_stream_t *tmp_dst;
+
+                  SVN_ERR(svn_stream_open_readonly(&tmp_src, right_abspath,
+                                                   scratch_pool,
+                                                   scratch_pool));
+
+                  SVN_ERR(svn_wc__open_writable_base(&tmp_dst, &right_abspath,
+                                                     NULL, NULL,
+                                                     db, target_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
+
+                  SVN_ERR(svn_stream_copy3(tmp_src, tmp_dst,
+                                           cancel_func, cancel_baton,
+                                           scratch_pool));
+
+                  /* no need to strdup right_abspath, as the wq_build_()
+                     call already does that for us */
+                  delete_src = TRUE;
+                }
+
               SVN_ERR(svn_wc__wq_build_file_install(
                         &work_item, db, target_abspath, right_abspath,
                         FALSE /* use_commit_times */,
@@ -984,6 +1021,15 @@ merge_file_trivial(svn_skel_t **work_ite
                         result_pool, scratch_pool));
               *work_items = svn_wc__wq_merge(*work_items, work_item,
                                              result_pool);
+
+              if (delete_src)
+                {
+                  SVN_ERR(svn_wc__wq_build_file_remove(
+                                    &work_item, db, right_abspath,
+                                    result_pool, scratch_pool));
+                  *work_items = svn_wc__wq_merge(*work_items, work_item,
+                                                 result_pool);
+                }
             }
         }
 
@@ -1418,6 +1464,7 @@ svn_wc__internal_merge(svn_skel_t **work
   SVN_ERR(merge_file_trivial(work_items, merge_outcome,
                              left_abspath, right_abspath,
                              target_abspath, dry_run, db,
+                             cancel_func, cancel_baton,
                              result_pool, scratch_pool));
   if (*merge_outcome == svn_wc_merge_no_merge)
     {

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/node.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/node.c Tue Oct  2 09:47:23 2012
@@ -1407,6 +1407,15 @@ svn_wc__internal_get_origin(svn_boolean_
             return SVN_NO_ERROR; /* Local addition */
           }
 
+        /* We don't know how the following error condition can be fulfilled
+         * but we have seen that happening in the wild.  Better to create
+         * an error than a SEGFAULT. */
+        if (status == svn_wc__db_status_incomplete && !original_repos_relpath)
+          return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+                               _("Incomplete copy information on path '%s'."),
+                                   svn_dirent_local_style(local_abspath,
+                                                          scratch_pool));
+
         *repos_relpath = svn_relpath_join(
                                 original_repos_relpath,
                                 svn_dirent_skip_ancestor(op_root_abspath,

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/props.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/props.c Tue Oct  2 09:47:23 2012
@@ -1846,8 +1846,10 @@ svn_wc__prop_list_recursive(svn_wc_conte
 {
   svn_wc__proplist_receiver_t receiver = receiver_func;
   void *baton = receiver_baton;
-  struct propname_filter_baton_t pfb = { receiver_func, receiver_baton,
-                                         propname };
+  struct propname_filter_baton_t pfb;
+  pfb.receiver_func = receiver_func;
+  pfb.receiver_baton = receiver_baton;
+  pfb.propname = propname;
 
   SVN_ERR_ASSERT(receiver_func);
 
@@ -2311,7 +2313,7 @@ do_propset(svn_wc__db_t *db,
     }
   else if (kind == svn_node_file && strcmp(name, SVN_PROP_EOL_STYLE) == 0)
     {
-      svn_string_t *old_value = apr_hash_get(prophash, SVN_PROP_KEYWORDS,
+      svn_string_t *old_value = apr_hash_get(prophash, SVN_PROP_EOL_STYLE,
                                              APR_HASH_KEY_STRING);
 
       if (((value == NULL) != (old_value == NULL))
@@ -2473,8 +2475,13 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
     }
   else
     {
-      struct propset_walk_baton wb = { name, value, wc_ctx->db, skip_checks,
-                                       notify_func, notify_baton };
+      struct propset_walk_baton wb;
+      wb.propname = name;
+      wb.propval = value;
+      wb.db = wc_ctx->db;
+      wb.force = skip_checks;
+      wb.notify_func = notify_func;
+      wb.notify_baton = notify_baton;
 
       SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath,
                                              FALSE, changelist_filter,

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/status.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/status.c Tue Oct  2 09:47:23 2012
@@ -41,6 +41,7 @@
 #include "svn_config.h"
 #include "svn_time.h"
 #include "svn_hash.h"
+#include "svn_sorts.h"
 
 #include "svn_private_config.h"
 
@@ -1019,14 +1020,15 @@ get_dir_status(const struct walk_status_
                void *cancel_baton,
                apr_pool_t *scratch_pool)
 {
-  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_array_header_t *sorted_children;
   apr_pool_t *iterpool, *subpool = svn_pool_create(scratch_pool);
   svn_error_t *err;
+  int i;
 
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
@@ -1125,20 +1127,25 @@ get_dir_status(const struct walk_status_
     }
 
   /* Walk all the children of this directory. */
-  for (hi = apr_hash_first(subpool, all_children); hi; hi = apr_hash_next(hi))
+  sorted_children = svn_sort__hash(all_children,
+                                   svn_sort_compare_items_lexically,
+                                   subpool);
+  for (i = 0; i < sorted_children->nelts; i++)
     {
       const void *key;
       apr_ssize_t klen;
       const char *node_abspath;
       svn_io_dirent2_t *dirent_p;
       const struct svn_wc__db_info_t *info;
+      svn_sort__item_t item;
 
       svn_pool_clear(iterpool);
 
-      apr_hash_this(hi, &key, &klen, NULL);
+      item = APR_ARRAY_IDX(sorted_children, i, svn_sort__item_t);
+      key = item.key;
+      klen = item.klen;
 
       node_abspath = svn_dirent_join(local_abspath, key, iterpool);
-
       dirent_p = apr_hash_get(dirents, key, klen);
 
       info = apr_hash_get(nodes, key, klen);

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/tree_conflicts.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/tree_conflicts.c Tue Oct  2 09:47:23 2012
@@ -155,15 +155,18 @@ read_node_version_info(const svn_wc_conf
                             _("Invalid version info in tree conflict "
                               "description"));
 
-  repos_root = apr_pstrmemdup(result_pool,
-                                           skel->children->next->data,
-                                           skel->children->next->len);
+  repos_root = apr_pstrmemdup(scratch_pool,
+                              skel->children->next->data,
+                              skel->children->next->len);
   if (*repos_root == '\0')
     {
       *version_info = NULL;
       return SVN_NO_ERROR;
     }
 
+  /* Apply the Subversion 1.7+ url canonicalization rules to a pre 1.7 url */
+  repos_root = svn_uri_canonicalize(repos_root, result_pool);
+
   peg_rev = SVN_STR_TO_REV(apr_pstrmemdup(scratch_pool,
                                           skel->children->next->next->data,
                                           skel->children->next->next->len));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/upgrade.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/upgrade.c Tue Oct  2 09:47:23 2012
@@ -1545,7 +1545,8 @@ svn_wc__upgrade_sdb(int *result_format,
                     int start_format,
                     apr_pool_t *scratch_pool)
 {
-  struct bump_baton bb = { wcroot_abspath };
+  struct bump_baton bb;
+  bb.wcroot_abspath = wcroot_abspath;
 
   if (start_format < SVN_WC__WC_NG_VERSION /* 12 */)
     return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
@@ -1993,3 +1994,44 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__upgrade_add_external_info(svn_wc_context_t *wc_ctx,
+                                  const char *local_abspath,
+                                  svn_node_kind_t kind,
+                                  const char *def_local_abspath,
+                                  const char *repos_relpath,
+                                  const char *repos_root_url,
+                                  const char *repos_uuid,
+                                  svn_revnum_t def_peg_revision,
+                                  svn_revnum_t def_revision,
+                                  apr_pool_t *scratch_pool)
+{
+  svn_wc__db_kind_t db_kind;
+  switch (kind)
+    {
+      case svn_node_dir:
+        db_kind = svn_wc__db_kind_dir;
+        break;
+
+      case svn_node_file:
+        db_kind = svn_wc__db_kind_file;
+        break;
+
+      case svn_node_unknown:
+        db_kind = svn_wc__db_kind_unknown;
+        break;
+
+      default:
+        SVN_ERR_MALFUNCTION();
+    }
+
+  SVN_ERR(svn_wc__db_upgrade_insert_external(wc_ctx->db, local_abspath,
+                                             db_kind,
+                                             svn_dirent_dirname(local_abspath,
+                                                                scratch_pool),
+                                             def_local_abspath, repos_relpath,
+                                             repos_root_url, repos_uuid,
+                                             def_peg_revision, def_revision,
+                                             scratch_pool));
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc-queries.sql?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc-queries.sql Tue Oct  2 09:47:23 2012
@@ -1025,7 +1025,7 @@ WHERE tree_conflict_data IS NOT NULL
 UPDATE actual_node SET tree_conflict_data = NULL
 
 -- STMT_SELECT_ALL_FILES
-SELECT DISTINCT local_relpath FROM nodes
+SELECT local_relpath FROM nodes_current
 WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file'
 
 -- STMT_UPDATE_NODE_PROPS

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.c Tue Oct  2 09:47:23 2012
@@ -4994,8 +4994,10 @@ svn_wc__db_op_set_changelist(svn_wc__db_
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
-  struct set_changelist_baton_t scb = { new_changelist, changelist_filter,
-                                        depth };
+  struct set_changelist_baton_t scb;
+  scb.new_changelist = new_changelist;
+  scb.changelist_filter = changelist_filter;
+  scb.depth = depth;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -5514,9 +5516,15 @@ svn_wc__db_revert_list_read(svn_boolean_
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
-  struct revert_list_read_baton b = {reverted, conflict_old, conflict_new,
-                                     conflict_working, prop_reject,
-                                     copied_here, kind, result_pool};
+  struct revert_list_read_baton b;
+  b.reverted = reverted;
+  b.conflict_old = conflict_old;
+  b.conflict_new = conflict_new;
+  b.conflict_working = conflict_working;
+  b.prop_reject = prop_reject;
+  b.copied_here = copied_here;
+  b.kind = kind;
+  b.result_pool = result_pool;
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                               db, local_abspath, scratch_pool, scratch_pool));
@@ -5588,7 +5596,9 @@ svn_wc__db_revert_list_read_copied_child
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
-  struct revert_list_read_copied_children_baton b = {children, result_pool};
+  struct revert_list_read_copied_children_baton b;
+  b.children = children;
+  b.result_pool = result_pool;
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                               db, local_abspath, scratch_pool, scratch_pool));
@@ -7410,8 +7420,15 @@ read_url_txn(void *baton,
           else
             {
               /* The parent of the WORKING delete, must be an addition */
-              const char *work_relpath = svn_relpath_dirname(work_del_relpath,
-                                                             scratch_pool);
+              const char *work_relpath = NULL;
+
+              /* work_del_relpath should not be NULL. However, we have
+               * observed instances where that assumption was not met.
+               * Bail out in that case instead of crashing with a segfault.
+               */
+              SVN_ERR_ASSERT(work_del_relpath != NULL);
+              work_relpath = svn_relpath_dirname(work_del_relpath,
+                                                 scratch_pool);
 
               SVN_ERR(scan_addition(NULL, NULL, &repos_relpath, &repos_id,
                                     NULL, NULL, NULL,
@@ -7473,7 +7490,9 @@ read_url(const char **url,
          apr_pool_t *result_pool,
          apr_pool_t *scratch_pool)
 {
-  struct read_url_baton_t rub = { url, result_pool };
+  struct read_url_baton_t rub;
+  rub.url = url;
+  rub.result_pool = result_pool;
   SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, read_url_txn, &rub,
                               scratch_pool));
 
@@ -9961,6 +9980,79 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
+                                   const char *local_abspath,
+                                   svn_wc__db_kind_t kind,
+                                   const char *parent_abspath,
+                                   const char *def_local_abspath,
+                                   const char *repos_relpath,
+                                   const char *repos_root_url,
+                                   const char *repos_uuid,
+                                   svn_revnum_t def_peg_revision,
+                                   svn_revnum_t def_revision,
+                                   apr_pool_t *scratch_pool)
+{
+  svn_wc__db_wcroot_t *wcroot;
+  const char *def_local_relpath;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  apr_int64_t repos_id;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+  /* We know only of DEF_LOCAL_ABSPATH that it definitely belongs to "this"
+   * WC, i.e. where the svn:externals prop is set. The external target path
+   * itself may be "hidden behind" other working copies. */
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &def_local_relpath,
+                                                db, def_local_abspath,
+                                                scratch_pool, scratch_pool));
+  VERIFY_USABLE_WCROOT(wcroot);
+
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_REPOSITORY));
+  SVN_ERR(svn_sqlite__bindf(stmt, "s", repos_root_url));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+  if (have_row)
+    repos_id = svn_sqlite__column_int64(stmt, 0);
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  if (!have_row)
+    {
+      /* Need to set up a new repository row. */
+      SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
+                              wcroot->sdb, scratch_pool));
+    }
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_INSERT_EXTERNAL));
+
+  /* wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath,
+   * repos_id, def_repos_relpath, def_operational_revision, def_revision */
+  SVN_ERR(svn_sqlite__bindf(stmt, "issstsis",
+                            wcroot->wc_id,
+                            svn_dirent_skip_ancestor(wcroot->abspath,
+                                                     local_abspath),
+                            svn_dirent_skip_ancestor(wcroot->abspath,
+                                                     parent_abspath),
+                            "normal",
+                            kind_map, kind,
+                            def_local_relpath,
+                            repos_id,
+                            repos_relpath));
+
+  if (SVN_IS_VALID_REVNUM(def_peg_revision))
+    SVN_ERR(svn_sqlite__bind_revnum(stmt, 9, def_peg_revision));
+
+  if (SVN_IS_VALID_REVNUM(def_revision))
+    SVN_ERR(svn_sqlite__bind_revnum(stmt, 10, def_revision));
+
+  SVN_ERR(svn_sqlite__insert(NULL, stmt));
+
+  return SVN_NO_ERROR;
+}
 
 svn_error_t *
 svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id,
@@ -12187,9 +12279,17 @@ svn_wc__db_revision_status(svn_revnum_t 
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
-  struct revision_status_baton_t rsb = { min_revision, max_revision,
-        is_sparse_checkout, is_modified, is_switched, trail_url, committed,
-        cancel_func, cancel_baton, db };
+  struct revision_status_baton_t rsb;
+  rsb.min_revision = min_revision;
+  rsb.max_revision = max_revision;
+  rsb.is_sparse_checkout = is_sparse_checkout;
+  rsb.is_modified = is_modified;
+  rsb.is_switched = is_switched;
+  rsb.trail_url = trail_url;
+  rsb.committed = committed;
+  rsb.cancel_func = cancel_func;
+  rsb.cancel_baton = cancel_baton;
+  rsb.db = db;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.h?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db.h Tue Oct  2 09:47:23 2012
@@ -2635,6 +2635,19 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
                                apr_int64_t wc_id,
                                apr_pool_t *scratch_pool);
 
+/* Simply insert (or replace) one row in the EXTERNALS table. */
+svn_error_t *
+svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
+                                   const char *local_abspath,
+                                   svn_wc__db_kind_t kind,
+                                   const char *parent_abspath,
+                                   const char *def_local_abspath,
+                                   const char *repos_relpath,
+                                   const char *repos_root_url,
+                                   const char *repos_uuid,
+                                   svn_revnum_t def_peg_revision,
+                                   svn_revnum_t def_revision,
+                                   apr_pool_t *scratch_pool);
 
 /* Get the repository identifier corresponding to REPOS_ROOT_URL from the
    database in SDB. The value is returned in *REPOS_ID. All allocations

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_util.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_util.c Tue Oct  2 09:47:23 2012
@@ -196,7 +196,11 @@ svn_wc__db_with_txn(svn_wc__db_wcroot_t 
                     void *cb_baton,
                     apr_pool_t *scratch_pool)
 {
-  struct txn_baton_t tb = { wcroot, local_relpath, cb_func, cb_baton };
+  struct txn_baton_t tb;
+  tb.wcroot = wcroot;
+  tb.local_relpath = local_relpath;
+  tb.cb_func = cb_func;
+  tb.cb_baton = cb_baton;
 
   return svn_error_trace(
     svn_sqlite__with_lock(wcroot->sdb, run_txn, &tb, scratch_pool));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_wcroot.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_wc/wc_db_wcroot.c Tue Oct  2 09:47:23 2012
@@ -374,6 +374,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
   svn_boolean_t always_check = FALSE;
   svn_boolean_t is_symlink;
   int wc_format = 0;
+  const char *adm_relpath;
 
   /* ### we need more logic for finding the database (if it is located
      ### outside of the wcroot) and then managing all of that within DB.
@@ -461,48 +462,60 @@ svn_wc__db_wcroot_parse_local_abspath(sv
      database in the right place. If we find it... great! If not, then
      peel off some components, and try again. */
 
+  adm_relpath = svn_wc_get_adm_dir(scratch_pool);
   while (TRUE)
     {
       svn_error_t *err;
+      svn_node_kind_t adm_subdir_kind;
 
-      /* We always open the database in read/write mode.  If the database
-         isn't writable in the filesystem, SQLite will internally open
-         it as read-only, and we'll get an error if we try to do a write
-         operation.
-
-         We could decide what to do on a per-operation basis, but since
-         we're caching database handles, it make sense to be as permissive
-         as the filesystem allows. */
-      err = svn_wc__db_util_open_db(&sdb, local_abspath, SDB_FILE,
-                                    svn_sqlite__mode_readwrite, NULL,
-                                    db->state_pool, scratch_pool);
-      if (err == NULL)
+      const char *adm_subdir = svn_dirent_join(local_abspath, adm_relpath,
+                                               scratch_pool);
+
+      SVN_ERR(svn_io_check_path(adm_subdir, &adm_subdir_kind, scratch_pool));
+
+      if (adm_subdir_kind == svn_node_dir)
         {
+          /* We always open the database in read/write mode.  If the database
+             isn't writable in the filesystem, SQLite will internally open
+             it as read-only, and we'll get an error if we try to do a write
+             operation.
+
+             We could decide what to do on a per-operation basis, but since
+             we're caching database handles, it make sense to be as permissive
+             as the filesystem allows. */
+          err = svn_wc__db_util_open_db(&sdb, local_abspath, SDB_FILE,
+                                        svn_sqlite__mode_readwrite, NULL,
+                                        db->state_pool, scratch_pool);
+          if (err == NULL)
+            {
 #ifdef SVN_DEBUG
-          /* Install self-verification trigger statements. */
-          SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_VERIFICATION_TRIGGERS));
+              /* Install self-verification trigger statements. */
+              SVN_ERR(svn_sqlite__exec_statements(sdb,
+                                                  STMT_VERIFICATION_TRIGGERS));
 #endif
-          break;
-        }
-      if (err->apr_err != SVN_ERR_SQLITE_ERROR
-          && !APR_STATUS_IS_ENOENT(err->apr_err))
-        return svn_error_trace(err);
-      svn_error_clear(err);
-
-      /* If we have not moved upwards, then check for a wc-1 working copy.
-         Since wc-1 has a .svn in every directory, and we didn't find one
-         in the original directory, then we aren't looking at a wc-1.
-
-         If the original path is not present, then we have to check on every
-         iteration. The content may be the immediate parent, or possibly
-         five ancetors higher. We don't test for directory presence (just
-         for the presence of subdirs/files), so we don't know when we can
-         stop checking ... so just check always.  */
-      if (!moved_upwards || always_check)
-        {
-          SVN_ERR(get_old_version(&wc_format, local_abspath, scratch_pool));
-          if (wc_format != 0)
-            break;
+              break;
+            }
+          if (err->apr_err != SVN_ERR_SQLITE_ERROR
+              && !APR_STATUS_IS_ENOENT(err->apr_err))
+            return svn_error_trace(err);
+          svn_error_clear(err);
+
+          /* If we have not moved upwards, then check for a wc-1 working copy.
+             Since wc-1 has a .svn in every directory, and we didn't find one
+             in the original directory, then we aren't looking at a wc-1.
+
+             If the original path is not present, then we have to check on every
+             iteration. The content may be the immediate parent, or possibly
+             five ancetors higher. We don't test for directory presence (just
+             for the presence of subdirs/files), so we don't know when we can
+             stop checking ... so just check always.  */
+          if (!moved_upwards || always_check)
+            {
+              SVN_ERR(get_old_version(&wc_format, local_abspath,
+                                      scratch_pool));
+              if (wc_format != 0)
+                break;
+            }
         }
 
       /* We couldn't open the SDB within the specified directory, so

Modified: subversion/branches/1.7.x-issue4153/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/mod_authz_svn/mod_authz_svn.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/mod_authz_svn/mod_authz_svn.c Tue Oct  2 09:47:23 2012
@@ -44,6 +44,7 @@
 #include "svn_config.h"
 #include "svn_string.h"
 #include "svn_repos.h"
+#include "svn_pools.h"
 #include "svn_dirent_uri.h"
 #include "private/svn_fspath.h"
 
@@ -163,7 +164,8 @@ static const command_rec authz_svn_cmds[
  * Get the, possibly cached, svn_authz_t for this request.
  */
 static svn_authz_t *
-get_access_conf(request_rec *r, authz_svn_config_rec *conf)
+get_access_conf(request_rec *r, authz_svn_config_rec *conf,
+                apr_pool_t *scratch_pool)
 {
   const char *cache_key = NULL;
   const char *access_file;
@@ -181,7 +183,7 @@ get_access_conf(request_rec *r, authz_sv
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s", dav_err->desc);
         return NULL;
       }
-      access_file = svn_dirent_join_many(r->pool, repos_path, "conf",
+      access_file = svn_dirent_join_many(scratch_pool, repos_path, "conf",
                                          conf->repo_relative_access_file,
                                          NULL);
     }
@@ -193,7 +195,7 @@ get_access_conf(request_rec *r, authz_sv
   ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                 "Path to authz file is %s", access_file);
 
-  cache_key = apr_pstrcat(r->pool, "mod_authz_svn:",
+  cache_key = apr_pstrcat(scratch_pool, "mod_authz_svn:",
                           access_file, (char *)NULL);
   apr_pool_userdata_get(&user_data, cache_key, r->connection->pool);
   access_conf = user_data;
@@ -242,12 +244,13 @@ convert_case(char *text, svn_boolean_t t
 /* Return the username to authorize, with case-conversion performed if
    CONF->force_username_case is set. */
 static char *
-get_username_to_authorize(request_rec *r, authz_svn_config_rec *conf)
+get_username_to_authorize(request_rec *r, authz_svn_config_rec *conf,
+                          apr_pool_t *pool)
 {
   char *username_to_authorize = r->user;
   if (username_to_authorize && conf->force_username_case)
     {
-      username_to_authorize = apr_pstrdup(r->pool, r->user);
+      username_to_authorize = apr_pstrdup(pool, r->user);
       convert_case(username_to_authorize,
                    strcasecmp(conf->force_username_case, "upper") == 0);
     }
@@ -282,7 +285,8 @@ req_check_access(request_rec *r,
   svn_authz_t *access_conf = NULL;
   svn_error_t *svn_err;
   char errbuf[256];
-  const char *username_to_authorize = get_username_to_authorize(r, conf);
+  const char *username_to_authorize = get_username_to_authorize(r, conf,
+                                                                r->pool);
 
   switch (r->method_number)
     {
@@ -418,7 +422,7 @@ req_check_access(request_rec *r,
     }
 
   /* Retrieve/cache authorization file */
-  access_conf = get_access_conf(r,conf);
+  access_conf = get_access_conf(r,conf, r->pool);
   if (access_conf == NULL)
     return DECLINED;
 
@@ -576,14 +580,13 @@ log_access_verdict(LOG_ARGS_SIGNATURE,
 }
 
 /*
- * This function is used as a provider to allow mod_dav_svn to bypass the
- * generation of an apache request when checking GET access from
- * "mod_dav_svn/authz.c" .
+ * Implementation of subreq_bypass with scratch_pool parameter.
  */
 static int
-subreq_bypass(request_rec *r,
-              const char *repos_path,
-              const char *repos_name)
+subreq_bypass2(request_rec *r,
+               const char *repos_path,
+               const char *repos_name,
+               apr_pool_t *scratch_pool)
 {
   svn_error_t *svn_err = NULL;
   svn_authz_t *access_conf = NULL;
@@ -594,7 +597,7 @@ subreq_bypass(request_rec *r,
 
   conf = ap_get_module_config(r->per_dir_config,
                               &authz_svn_module);
-  username_to_authorize = get_username_to_authorize(r, conf);
+  username_to_authorize = get_username_to_authorize(r, conf, scratch_pool);
 
   /* If configured properly, this should never be true, but just in case. */
   if (!conf->anonymous
@@ -605,7 +608,7 @@ subreq_bypass(request_rec *r,
     }
 
   /* Retrieve authorization file */
-  access_conf = get_access_conf(r, conf);
+  access_conf = get_access_conf(r, conf, scratch_pool);
   if (access_conf == NULL)
     return HTTP_FORBIDDEN;
 
@@ -619,7 +622,7 @@ subreq_bypass(request_rec *r,
                                              username_to_authorize,
                                              svn_authz_none|svn_authz_read,
                                              &authz_access_granted,
-                                             r->pool);
+                                             scratch_pool);
       if (svn_err)
         {
           ap_log_rerror(APLOG_MARK, APLOG_ERR,
@@ -649,6 +652,26 @@ subreq_bypass(request_rec *r,
 }
 
 /*
+ * This function is used as a provider to allow mod_dav_svn to bypass the
+ * generation of an apache request when checking GET access from
+ * "mod_dav_svn/authz.c" .
+ */
+static int
+subreq_bypass(request_rec *r,
+              const char *repos_path,
+              const char *repos_name)
+{
+  int status;
+  apr_pool_t *scratch_pool;
+
+  scratch_pool = svn_pool_create(r->pool);
+  status = subreq_bypass2(r, repos_path, repos_name, scratch_pool);
+  svn_pool_destroy(scratch_pool);
+
+  return status;
+}
+
+/*
  * Hooks
  */
 

Modified: subversion/branches/1.7.x-issue4153/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/mod_dav_svn/repos.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/mod_dav_svn/repos.c Tue Oct  2 09:47:23 2012
@@ -1149,8 +1149,11 @@ create_private_resource(const dav_resour
   comb->res.collection = TRUE;                  /* ### always true? */
   /* versioned = baselined = working = FALSE */
 
-  comb->res.uri = apr_pstrcat(base->pool, base->info->repos->root_path,
-                              path->data, (char *)NULL);
+  if (base->info->repos->root_path[1])
+    comb->res.uri = apr_pstrcat(base->pool, base->info->repos->root_path,
+                                path->data, (char *)NULL);
+  else
+    comb->res.uri = path->data;
   comb->res.info = &comb->priv;
   comb->res.hooks = &dav_svn__hooks_repository;
   comb->res.pool = base->pool;
@@ -1904,9 +1907,11 @@ parse_querystring(request_rec *r, const 
          only use a temporary redirect. */
       apr_table_setn(r->headers_out, "Location",
                      ap_construct_url(r->pool,
-                                      apr_psprintf(r->pool, "%s%s?p=%ld",
-                                                   comb->priv.repos->root_path,
-                                                   newpath, working_rev),
+                                  apr_psprintf(r->pool, "%s%s?p=%ld",
+                                               (comb->priv.repos->root_path[1]
+                                                ? comb->priv.repos->root_path
+                                                : ""),
+                                               newpath, working_rev),
                                       r));
       return dav_svn__new_error(r->pool,
                                 prevstr ? HTTP_MOVED_PERMANENTLY
@@ -4338,8 +4343,11 @@ dav_svn__create_working_resource(dav_res
   res->baselined = base->baselined;
   /* collection = FALSE.   ### not necessarily correct */
 
-  res->uri = apr_pstrcat(base->pool, base->info->repos->root_path,
-                         path, (char *)NULL);
+  if (base->info->repos->root_path[1])
+    res->uri = apr_pstrcat(base->pool, base->info->repos->root_path,
+                           path, (char *)NULL);
+  else
+    res->uri = path;
   res->hooks = &dav_svn__hooks_repository;
   res->pool = base->pool;
 

Modified: subversion/branches/1.7.x-issue4153/subversion/po/zh_CN.po
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/po/zh_CN.po?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/po/zh_CN.po [UTF-8] (original)
+++ subversion/branches/1.7.x-issue4153/subversion/po/zh_CN.po [UTF-8] Tue Oct  2 09:47:23 2012
@@ -55,8 +55,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: subversion 1.7\n"
 "Report-Msgid-Bugs-To: dev@subversion.apache.org\n"
-"POT-Creation-Date: 2012-02-27 09:18+0000\n"
-"PO-Revision-Date: 2012-02-27 09:18+0000\n"
+"POT-Creation-Date: 2012-08-17 15:23+0000\n"
+"PO-Revision-Date: 2012-08-17 15:18+0000\n"
 "Last-Translator: Subversion Developers <de...@subversion.apache.org>\n"
 "Language-Team: Simplified Chinese <de...@subversion.apache.org>\n"
 "Language: \n"
@@ -1371,6 +1371,10 @@ msgid "URL '%s' at revision %ld is not a
 msgstr "URL “%s” 在版本 %ld 中不是文件或目录"
 
 #, c-format
+msgid "Unsupported external: url of file external '%s' is not in repository '%s'"
+msgstr "不支持的外部定义:外部文件“%s”的 URL 不在版本库“%s”中"
+
+#, c-format
 msgid "Traversal of '%s' found no ambient depth"
 msgstr "在 “%s” 中找不到深度"
 
@@ -2303,6 +2307,10 @@ msgid "Empty noderev in cache"
 msgstr "缓存中 noderev 为空"
 
 #, c-format
+msgid "Attempted to update ancestry of non-mutable node"
+msgstr "试图更新非可变节点的祖先"
+
+#, c-format
 msgid "Can't fetch FSFS shared data"
 msgstr "不能获取文件系统互斥体"
 
@@ -2533,8 +2541,8 @@ msgid "Corrupt 'current' file"
 msgstr "文件 “current” 损坏"
 
 #, c-format
-msgid "predecessor count for the root node-revision is wrong: found %d, committing r%ld"
-msgstr "根节点版本的前驱计数错误:发现 %d,正在提交 r%ld"
+msgid "predecessor count for the root node-revision is wrong: found (%d+%ld != %d), committing r%ld"
+msgstr "根节点版本的前任计数错误: 发现 (%d+%ld != %d), 正在提交 r%ld"
 
 msgid "Truncated protorev file detected"
 msgstr "检测到文件 protorev 被截断"
@@ -3175,6 +3183,10 @@ msgid "Adding directory failed: %s on %s
 msgstr "增加目录失败: “%s” 于 “%s”(%d %s)"
 
 #, c-format
+msgid "MERGE request failed: returned %d (during commit)"
+msgstr "MERGE 请求失败:返回 %d (在提交期间)"
+
+#, c-format
 msgid "Location segment report failed on '%s'@'%ld'"
 msgstr "位置分段报告失败于“%s”@“%ld”"
 
@@ -5190,6 +5202,10 @@ msgid "Conflict callback violated API: r
 msgstr "冲突的回调函数违反 API:没有返回合并文件。"
 
 #, c-format
+msgid "Incomplete copy information on path '%s'."
+msgstr "位于路径“%s”上的复制信息不完整"
+
+#, c-format
 msgid "'%s' is not the root of the working copy '%s'"
 msgstr "“%s”不是工作副本“%s”的根"
 
@@ -5687,6 +5703,10 @@ msgid "Missing a row in WCROOT."
 msgstr "WCROOT 中丢失了一行。"
 
 #, c-format
+msgid "Working copy database '%s' not found"
+msgstr "找不到工作副本数据库“%s”"
+
+#, c-format
 msgid "Working copy format of '%s' is too old (%d); please check out your working copy again"
 msgstr "“%s”的工作副本格式太旧(%d);请重新取出工作副本"
 
@@ -7880,20 +7900,20 @@ msgid ""
 "\n"
 "  Example output:\n"
 "    svn status wc\n"
-"     M     wc/bar.c\n"
-"    A  +   wc/qax.c\n"
+"     M      wc/bar.c\n"
+"    A  +    wc/qax.c\n"
 "\n"
 "    svn status -u wc\n"
-"     M           965    wc/bar.c\n"
-"           *     965    wc/foo.c\n"
-"    A  +           -    wc/qax.c\n"
+"     M             965   wc/bar.c\n"
+"            *      965   wc/foo.c\n"
+"    A  +             -   wc/qax.c\n"
 "    Status against revision:   981\n"
 "\n"
 "    svn status --show-updates --verbose wc\n"
-"     M           965       938 kfogel       wc/bar.c\n"
-"           *     965       922 sussman      wc/foo.c\n"
-"    A  +           -       687 joe          wc/qax.c\n"
-"                 965       687 joe          wc/zig.c\n"
+"     M             965      938 kfogel       wc/bar.c\n"
+"            *      965      922 sussman      wc/foo.c\n"
+"    A  +             -      687 joe          wc/qax.c\n"
+"                   965      687 joe          wc/zig.c\n"
 "    Status against revision:   981\n"
 "\n"
 "    svn status\n"
@@ -7967,20 +7987,20 @@ msgstr ""
 "\n"
 "  范例输出: \n"
 "    svn status wc\n"
-"     M     wc/bar.c\n"
-"    A  +   wc/qax.c\n"
+"     M      wc/bar.c\n"
+"    A  +    wc/qax.c\n"
 "\n"
 "    svn status -u wc\n"
-"     M           965    wc/bar.c\n"
-"           *     965    wc/foo.c\n"
-"    A  +           -    wc/qax.c\n"
+"     M             965   wc/bar.c\n"
+"            *      965   wc/foo.c\n"
+"    A  +             -   wc/qax.c\n"
 "    版本 981 的状态\n"
 "\n"
 "    svn status --show-updates --verbose wc\n"
-"     M           965       938 kfogel       wc/bar.c\n"
-"           *     965       922 sussman      wc/foo.c\n"
-"    A  +           -       687 joe          wc/qax.c\n"
-"                 965       687 joe          wc/zig.c\n"
+"     M             965      938 kfogel       wc/bar.c\n"
+"            *      965      922 sussman      wc/foo.c\n"
+"    A  +             -      687 joe          wc/qax.c\n"
+"                   965      687 joe          wc/zig.c\n"
 "    版本 981 的状态\n"
 "\n"
 "    svn status\n"
@@ -10715,6 +10735,3 @@ msgstr "“%s” 的类型未知\n"
 #, c-format
 msgid "Uncommitted local addition, copy or move%s"
 msgstr "未提交的本地增加,复制或移动 %s"
-
-#~ msgid "'%s' is scheduled for addition within unversioned parent"
-#~ msgstr "在未纳入版本控制的父目录,“%s” 被加入增加调度"

Modified: subversion/branches/1.7.x-issue4153/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/svn/main.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/svn/main.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/svn/main.c Tue Oct  2 09:47:23 2012
@@ -1329,20 +1329,20 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "\n"
      "  Example output:\n"
      "    svn status wc\n"
-     "     M     wc/bar.c\n"
-     "    A  +   wc/qax.c\n"
+     "     M      wc/bar.c\n"
+     "    A  +    wc/qax.c\n"
      "\n"
      "    svn status -u wc\n"
-     "     M           965    wc/bar.c\n"
-     "           *     965    wc/foo.c\n"
-     "    A  +           -    wc/qax.c\n"
+     "     M             965   wc/bar.c\n"
+     "            *      965   wc/foo.c\n"
+     "    A  +             -   wc/qax.c\n"
      "    Status against revision:   981\n"
      "\n"
      "    svn status --show-updates --verbose wc\n"
-     "     M           965       938 kfogel       wc/bar.c\n"
-     "           *     965       922 sussman      wc/foo.c\n"
-     "    A  +           -       687 joe          wc/qax.c\n"
-     "                 965       687 joe          wc/zig.c\n"
+     "     M             965      938 kfogel       wc/bar.c\n"
+     "            *      965      922 sussman      wc/foo.c\n"
+     "    A  +             -      687 joe          wc/qax.c\n"
+     "                   965      687 joe          wc/zig.c\n"
      "    Status against revision:   981\n"
      "\n"
      "    svn status\n"

Modified: subversion/branches/1.7.x-issue4153/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/svn/propget-cmd.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/svn/propget-cmd.c Tue Oct  2 09:47:23 2012
@@ -34,6 +34,7 @@
 #include "svn_error_codes.h"
 #include "svn_error.h"
 #include "svn_utf.h"
+#include "svn_sorts.h"
 #include "svn_subst.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
@@ -71,13 +72,16 @@ print_properties_xml(const char *pname,
                      apr_hash_t *props,
                      apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
   apr_pool_t *iterpool = svn_pool_create(pool);
 
-  for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(props, svn_sort_compare_items_as_paths, pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *filename = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *filename = item.key;
+      svn_string_t *propval = item.value;
       svn_stringbuf_t *sb = NULL;
 
       svn_pool_clear(iterpool);
@@ -115,16 +119,19 @@ print_properties(svn_stream_t *out,
                  svn_boolean_t like_proplist,
                  apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
   apr_pool_t *iterpool = svn_pool_create(pool);
   const char *path_prefix;
 
   SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", pool));
 
-  for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(props, svn_sort_compare_items_as_paths, pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *filename = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *filename = item.key;
+      svn_string_t *propval = item.value;
 
       svn_pool_clear(iterpool);
 

Modified: subversion/branches/1.7.x-issue4153/subversion/svn/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/svn/props.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/svn/props.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/svn/props.c Tue Oct  2 09:47:23 2012
@@ -31,6 +31,7 @@
 #include "svn_cmdline.h"
 #include "svn_string.h"
 #include "svn_error.h"
+#include "svn_sorts.h"
 #include "svn_subst.h"
 #include "svn_props.h"
 #include "svn_string.h"
@@ -87,12 +88,16 @@ svn_cl__print_prop_hash(svn_stream_t *ou
                         svn_boolean_t names_only,
                         apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
 
-  for (hi = apr_hash_first(pool, prop_hash); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *pname = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
       const char *pname_stdout;
       apr_size_t len;
 
@@ -153,15 +158,19 @@ svn_cl__print_xml_prop_hash(svn_stringbu
                             svn_boolean_t names_only,
                             apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
 
   if (*outstr == NULL)
     *outstr = svn_stringbuf_create("", pool);
 
-  for (hi = apr_hash_first(pool, prop_hash); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *pname = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
 
       if (names_only)
         {

Modified: subversion/branches/1.7.x-issue4153/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/svndumpfilter/main.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/svndumpfilter/main.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/svndumpfilter/main.c Tue Oct  2 09:47:23 2012
@@ -1453,6 +1453,8 @@ main(int argc, const char *argv[])
         {
           svn_stringbuf_t *buffer, *buffer_utf8;
           const char *utf8_targets_file;
+          apr_array_header_t *targets = apr_array_make(pool, 0,
+                                                       sizeof(const char *));
 
           /* We need to convert to UTF-8 now, even before we divide
              the targets into an array, because otherwise we wouldn't
@@ -1465,10 +1467,18 @@ main(int argc, const char *argv[])
                                                pool));
           SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
 
-          opt_state.prefixes = apr_array_append(pool,
-                                    svn_cstring_split(buffer_utf8->data, "\n\r",
-                                                      TRUE, pool),
-                                    opt_state.prefixes);
+          targets = apr_array_append(pool,
+                         svn_cstring_split(buffer_utf8->data, "\n\r",
+                                           TRUE, pool),
+                         targets);
+
+          for (i = 0; i < targets->nelts; i++)
+            {
+              const char *prefix = APR_ARRAY_IDX(targets, i, const char *);
+              if (prefix[0] != '/')
+                prefix = apr_pstrcat(pool, "/", prefix, (char *)NULL);
+              APR_ARRAY_PUSH(opt_state.prefixes, const char *) = prefix;
+            }
         }
 
       if (apr_is_empty_array(opt_state.prefixes))

Modified: subversion/branches/1.7.x-issue4153/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/svnlook/main.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/svnlook/main.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/svnlook/main.c Tue Oct  2 09:47:23 2012
@@ -1284,6 +1284,30 @@ print_tree(svn_fs_root_t *root,
 }
 
 
+/* Set *BASE_REV to the revision on which the target root specified in
+   C is based, or to SVN_INVALID_REVNUM when C represents "revision
+   0" (because that revision isn't based on another revision). */
+static svn_error_t *
+get_base_rev(svn_revnum_t *base_rev, svnlook_ctxt_t *c, apr_pool_t *pool)
+{
+  if (c->is_revision)
+    {
+      *base_rev = c->rev_id - 1;
+    }
+  else
+    {
+      *base_rev = svn_fs_txn_base_revision(c->txn);
+
+      if (! SVN_IS_VALID_REVNUM(*base_rev))
+        return svn_error_createf
+          (SVN_ERR_FS_NO_SUCH_REVISION, NULL,
+           _("Transaction '%s' is not based on a revision; how odd"),
+           c->txn_name);
+    }
+  return SVN_NO_ERROR;
+}
+
+
 
 /*** Subcommand handlers. ***/
 
@@ -1390,16 +1414,9 @@ do_dirs_changed(svnlook_ctxt_t *c, apr_p
   svn_repos_node_t *tree;
 
   SVN_ERR(get_root(&root, c, pool));
-  if (c->is_revision)
-    base_rev_id = c->rev_id - 1;
-  else
-    base_rev_id = svn_fs_txn_base_revision(c->txn);
-
-  if (! SVN_IS_VALID_REVNUM(base_rev_id))
-    return svn_error_createf
-      (SVN_ERR_FS_NO_SUCH_REVISION, NULL,
-       _("Transaction '%s' is not based on a revision; how odd"),
-       c->txn_name);
+  SVN_ERR(get_base_rev(&base_rev_id, c, pool));
+  if (base_rev_id == SVN_INVALID_REVNUM)
+    return SVN_NO_ERROR;
 
   SVN_ERR(generate_delta_tree(&tree, c->repos, root, base_rev_id,
                               TRUE, pool));
@@ -1496,16 +1513,9 @@ do_changed(svnlook_ctxt_t *c, apr_pool_t
   svn_repos_node_t *tree;
 
   SVN_ERR(get_root(&root, c, pool));
-  if (c->is_revision)
-    base_rev_id = c->rev_id - 1;
-  else
-    base_rev_id = svn_fs_txn_base_revision(c->txn);
-
-  if (! SVN_IS_VALID_REVNUM(base_rev_id))
-    return svn_error_createf
-      (SVN_ERR_FS_NO_SUCH_REVISION, NULL,
-       _("Transaction '%s' is not based on a revision; how odd"),
-       c->txn_name);
+  SVN_ERR(get_base_rev(&base_rev_id, c, pool));
+  if (base_rev_id == SVN_INVALID_REVNUM)
+    return SVN_NO_ERROR;
 
   SVN_ERR(generate_delta_tree(&tree, c->repos, root, base_rev_id,
                               TRUE, pool));
@@ -1525,16 +1535,9 @@ do_diff(svnlook_ctxt_t *c, apr_pool_t *p
   svn_repos_node_t *tree;
 
   SVN_ERR(get_root(&root, c, pool));
-  if (c->is_revision)
-    base_rev_id = c->rev_id - 1;
-  else
-    base_rev_id = svn_fs_txn_base_revision(c->txn);
-
-  if (! SVN_IS_VALID_REVNUM(base_rev_id))
-    return svn_error_createf
-      (SVN_ERR_FS_NO_SUCH_REVISION, NULL,
-       _("Transaction '%s' is not based on a revision; how odd"),
-       c->txn_name);
+  SVN_ERR(get_base_rev(&base_rev_id, c, pool));
+  if (base_rev_id == SVN_INVALID_REVNUM)
+    return SVN_NO_ERROR;
 
   SVN_ERR(generate_delta_tree(&tree, c->repos, root, base_rev_id,
                               TRUE, pool));

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/README
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/README?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/README (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/README Tue Oct  2 09:47:23 2012
@@ -333,7 +333,8 @@ svntest/tree.py.  It will explain the ge
 
 Finally, try copying-and-pasting a simple test and then edit from
 there.  Don't forget to add your test to the 'test_list' variable at
-the bottom of the file.
+the bottom of the file. To avoid renumbering of existing tests, you
+should add new tests to the end of the list.
 
 
 Testing Compatability With Previous Release

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/depth_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/depth_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/depth_tests.py Tue Oct  2 09:47:23 2012
@@ -2881,7 +2881,29 @@ def commit_then_immediates_update(sbox):
                                         expected_status,
                                         None, None, None, None, None, False,
                                         "--depth=immediates", wc_dir)
+
+def revert_depth_files(sbox):
+  "depth immediate+files should revert deleted files"
+
+  sbox.build(read_only = True)
+  
+  expected_output = "Reverted '" + re.escape(sbox.ospath('A/mu')) + "'"
   
+  # Apply an unrelated delete one level to deep
+  sbox.simple_rm('A/D/gamma')
+
+  sbox.simple_rm('A/mu')
+  # Expect reversion of just 'mu'
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                     'revert', '--depth=immediates', sbox.ospath('A'))
+
+  # Apply an unrelated directory delete
+  sbox.simple_rm('A/D')
+
+  sbox.simple_rm('A/mu')
+  # Expect reversion of just 'mu'
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                     'revert', '--depth=files', sbox.ospath('A'))
 
 
 #----------------------------------------------------------------------
@@ -2932,6 +2954,7 @@ test_list = [ None,
               sparse_update_with_dash_dash_parents,
               update_below_depth_empty,
               commit_then_immediates_update,
+              revert_depth_files,
               ]
 
 if __name__ == "__main__":

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/patch_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/patch_tests.py Tue Oct  2 09:47:23 2012
@@ -3968,6 +3968,61 @@ def patch_add_and_delete(sbox):
                                        1, # check-props
                                        1) # dry-run
 
+
+def patch_git_with_index_line(sbox):
+  "apply git patch with 'index' line"
+
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+  patch_file_path = make_patch_path(sbox)
+
+  unidiff_patch = [
+    "diff --git a/src/tools/ConsoleRunner/hi.txt b/src/tools/ConsoleRunner/hi.txt\n",
+    "new file mode 100644\n",
+    "index 0000000..c82a38f\n",
+    "--- /dev/null\n",
+    "+++ b/src/tools/ConsoleRunner/hi.txt\n",
+    "@@ -0,0 +1 @@\n",
+    "+hihihihihihi\n",
+    "\ No newline at end of file\n",
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'A         %s\n' % sbox.ospath('src'),
+    'A         %s\n' % sbox.ospath('src/tools'),
+    'A         %s\n' % sbox.ospath('src/tools/ConsoleRunner'),
+    'A         %s\n' % sbox.ospath('src/tools/ConsoleRunner/hi.txt'),
+  ]
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+      'src/'                            : Item(status='A ', wc_rev=0),
+      'src/tools'                       : Item(status='A ', wc_rev=0),
+      'src/tools/ConsoleRunner/'        : Item(status='A ', wc_rev=0),
+      'src/tools/ConsoleRunner/hi.txt'  : Item(status='A ', wc_rev=0),
+  })
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'src'                            : Item(),
+                     'src/tools'                      : Item(),
+                     'src/tools/ConsoleRunner'        : Item(),
+                     'src/tools/ConsoleRunner/hi.txt' :
+                        Item(contents="hihihihihihi")
+                   })
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       None, # expected err
+                                       1, # check-props
+                                       1) # dry-run
+
 ########################################################################
 #Run the tests
 
@@ -4011,6 +4066,7 @@ test_list = [ None,
               patch_lacking_trailing_eol,
               patch_target_no_eol_at_eof,
               patch_add_and_delete,
+              patch_git_with_index_line,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/prop_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/prop_tests.py Tue Oct  2 09:47:23 2012
@@ -2268,7 +2268,7 @@ def propget_redirection(sbox):
 
   # Run propget -vR svn:mergeinfo, redirecting the stdout to a file.
   arglist = [svntest.main.svn_binary, 'propget', SVN_PROP_MERGEINFO, '-vR',
-             wc_dir]
+             '--config-dir', svntest.main.default_config_dir, wc_dir]
   redir_file = open(redirect_file, 'wb')
   pg_proc = subprocess.Popen(arglist, stdout=redir_file)
   pg_proc.wait()

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/stat_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/stat_tests.py Tue Oct  2 09:47:23 2012
@@ -990,11 +990,16 @@ def status_ignored_dir(sbox):
 def status_unversioned_dir(sbox):
   "status on unversioned dir"
   sbox.build(read_only = True)
-  dir = sbox.repo_dir
-  expected_err = "svn: warning: W155007: '.*(/|\\\\)" + os.path.basename(dir) + \
+
+  # Create two unversioned directories within the test working copy
+  path = sbox.ospath('1/2')
+  os.makedirs(path)
+
+  expected_err = "svn: warning: W1550(07|10): .*'.*(/|\\\\)" + \
+                 os.path.basename(path) + \
                  "' is not a working copy"
   svntest.actions.run_and_verify_svn2(None, [], expected_err, 0,
-                                      "status", dir, dir)
+                                      "status", path)
 
 #----------------------------------------------------------------------
 
@@ -1557,6 +1562,82 @@ def status_depth_update(sbox):
 
 
 #----------------------------------------------------------------------
+def status_depth_update_local_modifications(sbox):
+  "run 'status --depth=X -u' with local changes"
+  
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  A_path = sbox.ospath('A')
+  D_path = os.path.join(A_path, 'D')
+
+  mu_path = os.path.join(A_path, 'mu')
+  gamma_path = os.path.join(D_path, 'gamma')
+
+  svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path)
+  svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path)
+
+  svntest.main.file_append(mu_path, 'modified')
+  svntest.main.file_append(gamma_path, 'modified')
+
+  # depth=empty
+  expected = svntest.verify.UnorderedOutput(
+                  [" M               1   %s\n" % A_path,
+                   "Status against revision:      1\n"])
+
+  svntest.actions.run_and_verify_svn(None,
+                                     expected,
+                                     [],
+                                     "status", "-u", "--depth=empty", A_path)
+
+  expected = svntest.verify.UnorderedOutput(
+                  ["M                1   %s\n" % mu_path,
+                   "Status against revision:      1\n"])
+
+  svntest.actions.run_and_verify_svn(None,
+                                     expected,
+                                     [],
+                                     "status", "-u", "--depth=empty", mu_path)
+
+  # depth=files
+  expected = svntest.verify.UnorderedOutput(
+                  ["M                1   %s\n" % mu_path,
+                   " M               1   %s\n" % A_path,
+                   "Status against revision:      1\n"])
+
+  svntest.actions.run_and_verify_svn(None,
+                                     expected,
+                                     [],
+                                     "status", "-u", "--depth=files",
+                                     A_path)
+
+  # depth=immediates
+  expected = svntest.verify.UnorderedOutput(
+                  [" M               1   %s\n" % A_path,
+                   " M               1   %s\n" % D_path,
+                   "M                1   %s\n" % mu_path,
+                   "Status against revision:      1\n"])
+
+  svntest.actions.run_and_verify_svn(None,
+                                     expected,
+                                     [],
+                                     "status", "-u", "--depth=immediates",
+                                     A_path)
+
+  # depth=infinity (the default)
+  expected = svntest.verify.UnorderedOutput(
+                  [" M               1   %s\n" % A_path,
+                   " M               1   %s\n" % D_path,
+                   "M                1   %s\n" % mu_path,
+                   "M                1   %s\n" % gamma_path,
+                   "Status against revision:      1\n"])
+
+  svntest.actions.run_and_verify_svn(None,
+                                     expected,
+                                     [],
+                                     "status", "-u", "--depth=infinity",
+                                     A_path)
+
+#----------------------------------------------------------------------
 # Test for issue #2420
 @Issue(2420)
 def status_dash_u_deleted_directories(sbox):
@@ -1958,6 +2039,7 @@ test_list = [ None,
               status_dash_u_deleted_directories,
               status_depth_local,
               status_depth_update,
+              status_depth_update_local_modifications,
               status_dash_u_type_change,
               status_with_tree_conflicts,
               status_nested_wc_old_format,

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svndumpfilter_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svndumpfilter_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svndumpfilter_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svndumpfilter_tests.py Tue Oct  2 09:47:23 2012
@@ -596,6 +596,33 @@ def dropped_but_not_renumbered_empty_rev
                                      'propget', 'svn:mergeinfo', '-R',
                                      sbox.repo_url)
 
+@Issue(4234)
+def dumpfilter_targets_expect_leading_slash_prefixes(sbox):
+  "dumpfilter targets expect leading '/' in prefixes"
+  ## See http://subversion.tigris.org/issues/show_bug.cgi?id=4234. ##
+
+  test_create(sbox)
+
+  dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
+                                   'svndumpfilter_tests_data',
+                                   'greek_tree.dump')
+  dumpfile = open(dumpfile_location).read()
+
+  (fd, targets_file) = tempfile.mkstemp(dir=svntest.main.temp_dir)
+  try:
+    targets = open(targets_file, 'w')
+
+    # Removing the leading slash in path prefixes should work.
+    targets.write('A/D/H\n')
+    targets.write('A/D/G\n')
+    targets.close()
+    _simple_dumpfilter_test(sbox, dumpfile,
+                            'exclude', '/A/B/E', '--targets', targets_file)
+  finally:
+    os.close(fd)
+    os.remove(targets_file)
+
+
 ########################################################################
 # Run the tests
 
@@ -608,6 +635,7 @@ test_list = [ None,
               dumpfilter_with_patterns,
               filter_mergeinfo_revs_outside_of_dump_stream,
               dropped_but_not_renumbered_empty_revs,
+              dumpfilter_targets_expect_leading_slash_prefixes,
               ]
 
 if __name__ == '__main__':

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svnsync_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svnsync_tests.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svnsync_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svnsync_tests.py Tue Oct  2 09:47:23 2012
@@ -394,25 +394,32 @@ def basic_authz(sbox):
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
+  args = map(lambda x: x.authz_name(), [sbox, sbox, dest_sbox])
   svntest.main.file_write(sbox.authz_file,
-                          "[svnsync-basic-authz:/]\n"
+                          "[%s:/]\n"
                           "* = r\n"
                           "\n"
-                          "[svnsync-basic-authz:/A/B]\n"
+                          "[%s:/A/B]\n"
                           "* = \n"
                           "\n"
-                          "[svnsync-basic-authz-1:/]\n"
-                          "* = rw\n")
+                          "[%s:/]\n"
+                          "* = rw\n" % tuple(args))
 
   run_sync(dest_sbox.repo_url)
 
   lambda_url = dest_sbox.repo_url + '/A/B/lambda'
+  iota_url = dest_sbox.repo_url + '/iota'
 
   # this file should have been blocked by authz
   svntest.actions.run_and_verify_svn(None,
                                      [], svntest.verify.AnyOutput,
                                      'cat',
                                      lambda_url)
+  # this file should have been synced
+  svntest.actions.run_and_verify_svn(None,
+                                     svntest.verify.AnyOutput, [],
+                                     'cat',
+                                     iota_url)
 
 #----------------------------------------------------------------------
 @Skip(svntest.main.is_ra_type_file)
@@ -465,29 +472,17 @@ def copy_from_unreadable_dir(sbox):
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  fp = open(sbox.authz_file, 'w')
-
-  # For mod_dav_svn's parent path setup we need per-repos permissions in
-  # the authz file...
-  if sbox.repo_url.startswith('http'):
-    fp.write("[svnsync-copy-from-unreadable-dir:/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[svnsync-copy-from-unreadable-dir:/A/B]\n" +
-             "* = \n" +
-             "\n" +
-             "[svnsync-copy-from-unreadable-dir-1:/]\n" +
-             "* = rw")
-
-  # Otherwise we can just go with the permissions needed for the source
-  # repository.
-  else:
-    fp.write("[/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[/A/B]\n" +
-             "* =\n")
-  fp.close()
+  args = map(lambda x: x.authz_name(), [sbox, sbox, dest_sbox])
+  open(sbox.authz_file, 'w').write(
+             "[%s:/]\n"
+             "* = r\n"
+             "\n"
+             "[%s:/A/B]\n"
+             "* = \n"
+             "\n"
+             "[%s:/]\n"
+             "* = rw"
+             % tuple(args))
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -591,29 +586,17 @@ def copy_with_mod_from_unreadable_dir(sb
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  fp = open(sbox.authz_file, 'w')
-
-  # For mod_dav_svn's parent path setup we need per-repos permissions in
-  # the authz file...
-  if sbox.repo_url.startswith('http'):
-    fp.write("[svnsync-copy-with-mod-from-unreadable-dir:/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[svnsync-copy-with-mod-from-unreadable-dir:/A/B]\n" +
-             "* = \n" +
-             "\n" +
-             "[svnsync-copy-with-mod-from-unreadable-dir-1:/]\n" +
-             "* = rw")
-
-  # Otherwise we can just go with the permissions needed for the source
-  # repository.
-  else:
-    fp.write("[/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[/A/B]\n" +
-             "* =\n")
-  fp.close()
+  args = map(lambda x: x.authz_name(), [sbox, sbox, dest_sbox])
+  open(sbox.authz_file, 'w').write(
+             "[%s:/]\n"
+             "* = r\n"
+             "\n"
+             "[%s:/A/B]\n"
+             "* = \n"
+             "\n"
+             "[%s:/]\n"
+             "* = rw"
+             % tuple(args))
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -695,29 +678,17 @@ def copy_with_mod_from_unreadable_dir_an
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  fp = open(sbox.authz_file, 'w')
-
-  # For mod_dav_svn's parent path setup we need per-repos permissions in
-  # the authz file...
-  if sbox.repo_url.startswith('http'):
-    fp.write("[svnsync-copy-with-mod-from-unreadable-dir-and-copy:/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[svnsync-copy-with-mod-from-unreadable-dir-and-copy:/A/B]\n" +
-             "* = \n" +
-             "\n" +
-             "[svnsync-copy-with-mod-from-unreadable-dir-and-copy-1:/]\n" +
-             "* = rw")
-
-  # Otherwise we can just go with the permissions needed for the source
-  # repository.
-  else:
-    fp.write("[/]\n" +
-             "* = r\n" +
-             "\n" +
-             "[/A/B]\n" +
-             "* =\n")
-  fp.close()
+  args = map(lambda x: x.authz_name(), [sbox, sbox, dest_sbox])
+  open(sbox.authz_file, 'w').write(
+             "[%s:/]\n"
+             "* = r\n"
+             "\n"
+             "[%s:/A/B]\n"
+             "* = \n"
+             "\n"
+             "[%s:/]\n"
+             "* = rw"
+             % tuple(args))
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -1021,6 +992,46 @@ def fd_leak_sync_from_serf_to_local(sbox
   import resource
   resource.setrlimit(resource.RLIMIT_NOFILE, (128, 128))
   run_test(sbox, "largemods.dump", is_src_ra_local=None, is_dest_ra_local=True)
+@Issue(4121)
+@Skip(svntest.main.is_ra_type_file)
+def copy_delete_unreadable_child(sbox):
+  "copy, then rm at-src-unreadable child"
+
+  ## Prepare the source: Greek tree (r1), cp+rm (r2).
+  sbox.build("copy-delete-unreadable-child")
+  svntest.actions.run_and_verify_svnmucc(None, None, [], 
+                                         '-m', 'r2',
+                                         '-U', sbox.repo_url,
+                                         'cp', 'HEAD', '/', 'branch',
+                                         'rm', 'branch/A')
+
+  ## Create the destination.
+  dest_sbox = sbox.clone_dependent()
+  build_repos(dest_sbox)
+  svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
+
+  ## Lock down the source.
+  args = map(lambda x: x.authz_name(), [sbox, sbox])
+  write_restrictive_svnserve_conf(sbox.repo_dir, anon_access='read')
+  svntest.main.file_write(sbox.authz_file,
+      "[%s:/]\n"
+      "* = r\n"
+      "[%s:/A]\n"
+      "* =  \n"
+      % tuple(args)
+  )
+
+  dest_url = svntest.main.file_scheme_prefix \
+             + svntest.main.pathname2url(os.path.abspath(dest_sbox.repo_dir))
+  run_init(dest_url, sbox.repo_url)
+  run_sync(dest_url)
+
+  # sanity check
+  svntest.actions.run_and_verify_svn(None, 
+                                     ["iota\n"], [],
+                                     'ls', dest_url+'/branch@2')
+
+
 ########################################################################
 # Run the tests
 
@@ -1062,6 +1073,7 @@ test_list = [ None,
               descend_into_replace,
               delete_revprops,
               fd_leak_sync_from_serf_to_local,
+              copy_delete_unreadable_child,
              ]
 serial_only = True
 

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svntest/sandbox.py?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svntest/sandbox.py Tue Oct  2 09:47:23 2012
@@ -101,6 +101,14 @@ class Sandbox:
     svntest.actions.make_repo_and_wc(self, create_wc, read_only)
     self._is_built = True
 
+  def authz_name(self, repo_dir=None):
+    "return this sandbox's name for use in an authz file"
+    repo_dir = repo_dir or self.repo_dir
+    if self.repo_url.startswith("http"):
+      return os.path.basename(repo_dir)
+    else:
+      return repo_dir.replace('\\', '/')
+
   def add_test_path(self, path, remove=True):
     self.test_paths.append(path)
     if remove:

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_subr/dirent_uri-test.c Tue Oct  2 09:47:23 2012
@@ -1357,6 +1357,9 @@ static const testcase_ancestor_t dirent_
     { "foo.",           "foo./.bar",        ".bar" },
     { "X:foo",          "X:bar",            NULL },
     { "../foo",         "..",               NULL },
+    { "/foo/bar/zig",   "/foo",             NULL },
+    { "/foo/bar/zig",   "/foo/ba",          NULL },
+    { "/foo/bar/zig",   "/foo/bar/zi",      NULL },
 #ifdef SVN_USE_DOS_PATHS
     { "",               "C:",               NULL },
     { "",               "C:foo",            NULL },
@@ -1377,6 +1380,9 @@ static const testcase_ancestor_t dirent_
     { "X:/foo",         "X:/",              NULL },
     { "A:/foo",         "A:/foo/bar",       "bar" },
     { "A:/foo",         "A:/foot",          NULL },
+    { "A:/foo/bar/zig", "A:/foo",           NULL },
+    { "A:/foo/bar/zig", "A:/foo/ba",        NULL },
+    { "A:/foo/bar/zig", "A:/foo/bar/zi",    NULL },
     { "//srv",          "//srv/share",      NULL },
     { "//srv",          "//srv/shr/fld",    NULL },
     { "//srv/shr",      "//srv",            NULL },
@@ -1386,6 +1392,7 @@ static const testcase_ancestor_t dirent_
     { "//srv/s r",      "//srv/s r/fld",    "fld" },
     { "//srv/shr/fld",  "//srv/shr",        NULL },
     { "//srv/shr/fld",  "//srv2/shr/fld",   NULL },
+    { "//srv/shr/fld",  "//srv/shr/f",      NULL },
     { "/",              "//srv/share",      NULL },
 #else /* !SVN_USE_DOS_PATHS */
     { "",               "C:",               "C:" },
@@ -1473,6 +1480,8 @@ static const testcase_ancestor_t uri_anc
     { "http://",        "http://test",      NULL },
     { "http://server",  "http://server/q",  "q" },
     { "svn://server",   "http://server/q",  NULL },
+    { "http://foo/bar", "http://foo",       NULL },
+    { "http://foo/bar", "http://foo/ba",    NULL },
   };
 
 static svn_error_t *

Modified: subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_wc/op-depth-test.c?rev=1392818&r1=1392817&r2=1392818&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/libsvn_wc/op-depth-test.c Tue Oct  2 09:47:23 2012
@@ -233,7 +233,9 @@ wc_update(svn_test__sandbox_t *b, const 
   apr_array_header_t *result_revs;
   apr_array_header_t *paths = apr_array_make(b->pool, 1,
                                              sizeof(const char *));
-  svn_opt_revision_t revision = { svn_opt_revision_number, { revnum } };
+  svn_opt_revision_t revision;
+  revision.kind = svn_opt_revision_number;
+  revision.value.number = revnum;
 
   APR_ARRAY_PUSH(paths, const char *) = wc_path(b, path);
   SVN_ERR(svn_client_create_context(&ctx, b->pool));
@@ -449,8 +451,12 @@ check_db_rows(svn_test__sandbox_t *b,
   svn_boolean_t have_row;
   apr_hash_t *found_hash = apr_hash_make(b->pool);
   apr_hash_t *expected_hash = apr_hash_make(b->pool);
-  comparison_baton_t comparison_baton
-    = { expected_hash, found_hash, b->pool, NULL };
+  comparison_baton_t comparison_baton;
+
+  comparison_baton.expected_hash = expected_hash;
+  comparison_baton.found_hash = found_hash;
+  comparison_baton.scratch_pool = b->pool;
+  comparison_baton.errors = NULL;
 
   /* Fill ACTUAL_HASH with data from the WC DB. */
   SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
@@ -511,23 +517,23 @@ struct copy_subtest_t
   nodes_row_t expected[20];
 };
 
+#define source_everything   "A/B"
+
+#define source_base_file    "A/B/lambda"
+#define source_base_dir     "A/B/E"
+
+#define source_added_file   "A/B/file-added"
+#define source_added_dir    "A/B/D-added"
+#define source_added_dir2   "A/B/D-added/D2"
+
+#define source_copied_file  "A/B/lambda-copied"
+#define source_copied_dir   "A/B/E-copied"
+
 /* Check that all kinds of WC-to-WC copies give correct op_depth results:
  * create a Greek tree, make copies in it, and check the resulting DB rows. */
 static svn_error_t *
 wc_wc_copies(svn_test__sandbox_t *b)
 {
-  const char source_everything[]  = "A/B";
-
-  const char source_base_file[]   = "A/B/lambda";
-  const char source_base_dir[]    = "A/B/E";
-
-  const char source_added_file[]  = "A/B/file-added";
-  const char source_added_dir[]   = "A/B/D-added";
-  const char source_added_dir2[]  = "A/B/D-added/D2";
-
-  const char source_copied_file[] = "A/B/lambda-copied";
-  const char source_copied_dir[]  = "A/B/E-copied";
-
   SVN_ERR(add_and_commit_greek_tree(b));
 
   /* Create the various kinds of source node which will be copied */
@@ -744,13 +750,15 @@ repo_wc_copies(svn_test__sandbox_t *b)
     for (subtest = subtests; subtest->from_path; subtest++)
       {
         svn_opt_revision_t rev = { svn_opt_revision_number, { 1 } };
-        svn_client_copy_source_t source = { NULL, &rev, &rev };
+        svn_client_copy_source_t source;
         apr_array_header_t *sources
           = apr_array_make(b->pool, 0, sizeof(svn_client_copy_source_t *));
 
         source.path = svn_path_url_add_component2(b->repos_url,
                                                   subtest->from_path,
                                                   b->pool);
+        source.revision = &rev;
+        source.peg_revision = &rev;
         APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source;
         SVN_ERR(svn_client_copy6(sources,
                                  wc_path(b, subtest->to_path),