subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1412731 [6/10] - in /subversion/branches/ev2-export: ./ build/ build/ac-macros/ contrib/client-side/svnmerge/ contrib/server-side/svncutter/ notes/ subversion/ subversion/bindings/javahl/native/ subversion/bindings/swig/perl/native/ subver...
Date Fri, 23 Nov 2012 01:12:45 GMT
Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_update_move.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_update_move.c Fri Nov 23 01:12:18 2012
@@ -47,6 +47,7 @@
 
 #include "wc.h"
 #include "wc_db_private.h"
+#include "wc-queries.h"
 #include "conflicts.h"
 #include "workqueue.h"
 
@@ -55,8 +56,8 @@
  */
 
 struct tc_editor_baton {
-  const char *src_relpath;
-  const char *dst_relpath;
+  const char *move_root_src_relpath;
+  const char *move_root_dst_relpath;
   svn_wc__db_t *db;
   svn_wc__db_wcroot_t *wcroot;
   svn_skel_t **work_items;
@@ -122,130 +123,209 @@ tc_editor_alter_directory(void *baton,
   return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL);
 }
 
+
+/* Check whether the node at LOCAL_RELPATH in the working copy at WCROOT
+ * is shadowed by some node at a higher op depth than EXPECTED_OP_DEPTH. */
+static svn_error_t *
+check_shadowed_node(svn_boolean_t *is_shadowed,
+                    int expected_op_depth,
+                    const char *local_relpath,
+                    svn_wc__db_wcroot_t *wcroot)
+{
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_WORKING_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+  while (have_row)
+    {
+      int op_depth = svn_sqlite__column_int(stmt, 0);
+
+      if (op_depth > expected_op_depth)
+        {
+          *is_shadowed = TRUE;
+          SVN_ERR(svn_sqlite__reset(stmt));
+
+          return SVN_NO_ERROR;
+        }
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    }
+
+  *is_shadowed = FALSE;
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  return SVN_NO_ERROR;
+}
+
+/* Update text and prop contents of the working file at DST_RELPATH
+ * in the working copy at WCROOT, from OLD_VERSION to NEW_VERSION,
+ * based on pristine contents identified by MOVE_SRC_CHECKSUM and
+ * MOVE_DST_CHECKSUM. MOVE_DST_REPOS_RELPATH is the repository path 
+ * the node at DST_RELPATH would be committed to.
+ * Use working copy database DB.
+ * Use NOTIFY_FUNC and NOTIFY_BATON for notifications.
+ * Add any required work items to *WORK_ITEMS, allocated in RESULT_POOL.
+ * Use SCRATCH_POOL for temporary allocations. */
+static svn_error_t *
+update_working_file(svn_skel_t **work_items,
+                    const char *dst_relpath,
+                    const char *move_dst_repos_relpath,
+                    const svn_checksum_t *move_src_checksum,
+                    const svn_checksum_t *move_dst_checksum,
+                    svn_wc_conflict_version_t *old_version,
+                    svn_wc_conflict_version_t *new_version,
+                    svn_wc__db_wcroot_t *wcroot,
+                    svn_wc__db_t *db,
+                    svn_wc_notify_func2_t notify_func,
+                    void *notify_baton,
+                    apr_pool_t *result_pool,
+                    apr_pool_t *scratch_pool)
+{
+  const char *moved_to_abspath = svn_dirent_join(wcroot->abspath,
+                                                 dst_relpath,
+                                                 scratch_pool);
+  const char *pre_update_pristine_abspath;
+  const char *post_update_pristine_abspath;
+  svn_skel_t *conflict_skel;
+  enum svn_wc_merge_outcome_t merge_outcome;
+  svn_wc_notify_state_t content_state;
+  svn_wc_notify_t *notify;
+
+  /*
+   * Run a 3-way merge to update the file, using the pre-update
+   * pristine text as the merge base, the post-update pristine
+   * text as the merge-left version, and the current content of the
+   * moved-here working file as the merge-right version.
+   */
+  SVN_ERR(svn_wc__db_pristine_get_path(&pre_update_pristine_abspath,
+                                       db, wcroot->abspath,
+                                       move_dst_checksum,
+                                       scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_pristine_get_path(&post_update_pristine_abspath,
+                                       db, wcroot->abspath,
+                                       move_src_checksum,
+                                       scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__internal_merge(work_items, &conflict_skel,
+                                 &merge_outcome, db,
+                                 pre_update_pristine_abspath,
+                                 post_update_pristine_abspath,
+                                 moved_to_abspath,
+                                 moved_to_abspath,
+                                 NULL, NULL, NULL, /* diff labels */
+                                 NULL, /* actual props */
+                                 FALSE, /* dry-run */
+                                 NULL, /* diff3-cmd */
+                                 NULL, /* merge options */
+                                 NULL, /* prop_diff */
+                                 NULL, NULL, /* cancel_func + baton */
+                                 result_pool, scratch_pool));
+
+  if (merge_outcome == svn_wc_merge_conflict)
+    {
+      svn_skel_t *work_item;
+      svn_wc_conflict_version_t *original_version;
+
+      if (conflict_skel)
+        {
+          original_version = svn_wc_conflict_version_dup(old_version,
+                                                         scratch_pool);
+          original_version->path_in_repos = move_dst_repos_relpath;
+          original_version->node_kind = svn_node_file;
+          SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_skel,
+                                                      original_version,
+                                                      scratch_pool,
+                                                      scratch_pool));
+          SVN_ERR(svn_wc__conflict_create_markers(&work_item, db,
+                                                  moved_to_abspath,
+                                                  conflict_skel,
+                                                  scratch_pool,
+                                                  scratch_pool));
+          *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
+        }
+      content_state = svn_wc_notify_state_conflicted;
+    }
+  else
+    {
+      svn_boolean_t is_locally_modified;
+
+      SVN_ERR(svn_wc__internal_file_modified_p(&is_locally_modified,
+                                               db, moved_to_abspath,
+                                               FALSE /* exact_comparison */,
+                                               scratch_pool));
+      if (is_locally_modified)
+        content_state = svn_wc_notify_state_merged;
+      else
+        content_state = svn_wc_notify_state_changed;
+    }
+
+  notify = svn_wc_create_notify(moved_to_abspath,
+                                svn_wc_notify_update_update,
+                                scratch_pool);
+  notify->kind = svn_node_file;
+  notify->content_state = content_state;
+  notify->prop_state = svn_wc_notify_state_unknown; /* ### TODO */
+  notify->old_revision = old_version->peg_rev;
+  notify->revision = new_version->peg_rev;
+  notify_func(notify_baton, notify, scratch_pool);
+
+  return SVN_NO_ERROR;
+}
+
+
 static svn_error_t *
 tc_editor_alter_file(void *baton,
                      const char *dst_relpath,
-                     svn_revnum_t expected_moved_here_revision,
+                     svn_revnum_t expected_move_dst_revision,
                      apr_hash_t *props,
-                     const svn_checksum_t *moved_away_checksum,
+                     const svn_checksum_t *move_src_checksum,
                      svn_stream_t *post_update_contents,
                      apr_pool_t *scratch_pool)
 {
   struct tc_editor_baton *b = baton;
-  const svn_checksum_t *moved_here_checksum;
-  const char *original_repos_relpath;
-  svn_revnum_t original_revision;
-  svn_kind_t kind;
+  const svn_checksum_t *move_dst_checksum;
+  const char *move_dst_repos_relpath;
+  svn_revnum_t move_dst_revision;
+  svn_kind_t move_dst_kind;
 
   /* Get kind, revision, and checksum of the moved-here node. */
-  /* 
-   * ### Currently doesn't work right if the moved-away node has been replaced.
-   * ### Need to read info from the move op-root's op-depth, not WORKING, to
-   * ### properly update shadowed nodes within multi-layer move destinations.
-   */
-  SVN_ERR(svn_wc__db_read_info_internal(NULL, &kind, NULL, NULL, NULL, NULL,
-                                        NULL, NULL, NULL, &moved_here_checksum,
-                                        NULL, &original_repos_relpath, NULL,
-                                        &original_revision, NULL, NULL, NULL,
-                                        NULL, NULL, NULL, NULL, NULL, NULL,
-                                        NULL, NULL, b->wcroot, dst_relpath,
-                                        scratch_pool, scratch_pool));
-  SVN_ERR_ASSERT(original_revision == expected_moved_here_revision);
-
-  /* ### check original revision against moved-here op-root revision? */
-  if (kind != svn_kind_file)
-    return SVN_NO_ERROR;
-
-  /* ### what if checksum kind differs?*/
-  if (!svn_checksum_match(moved_away_checksum, moved_here_checksum))
+  SVN_ERR(svn_wc__db_depth_get_info(NULL, &move_dst_kind, &move_dst_revision,
+                                    &move_dst_repos_relpath, NULL, NULL, NULL,
+                                    NULL, NULL, &move_dst_checksum, NULL,
+                                    NULL, b->wcroot, dst_relpath,
+                                    relpath_depth(b->move_root_dst_relpath),
+                                    scratch_pool, scratch_pool));
+  SVN_ERR_ASSERT(move_dst_revision == expected_move_dst_revision);
+  SVN_ERR_ASSERT(move_dst_kind == svn_kind_file);
+
+  /* ### TODO update revision etc. in NODES table */
+
+  /* Update file and prop contents if the update has changed them. */
+  if (!svn_checksum_match(move_src_checksum, move_dst_checksum)
+      /* ### || props have changed */)
     {
-      const char *moved_to_abspath = svn_dirent_join(b->wcroot->abspath,
-                                                     dst_relpath,
-                                                     scratch_pool);
-      const char *pre_update_pristine_abspath;
-      const char *post_update_pristine_abspath;
-      svn_skel_t *conflict_skel;
-      enum svn_wc_merge_outcome_t merge_outcome;
-      svn_wc_notify_state_t content_state;
-      svn_wc_notify_t *notify;
-
-      /*
-       * Run a 3-way merge to update the file, using the pre-update
-       * pristine text as the merge base, the post-update pristine
-       * text as the merge-left version, and the current content of the
-       * moved-here working file as the merge-right version.
-       */
-      SVN_ERR(svn_wc__db_pristine_get_path(&pre_update_pristine_abspath,
-                                           b->db, moved_to_abspath,
-                                           moved_here_checksum,
-                                           scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__db_pristine_get_path(&post_update_pristine_abspath,
-                                           b->db, moved_to_abspath,
-                                           moved_away_checksum,
-                                           scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__internal_merge(b->work_items, &conflict_skel,
-                                     &merge_outcome, b->db,
-                                     pre_update_pristine_abspath,
-                                     post_update_pristine_abspath,
-                                     moved_to_abspath,
-                                     moved_to_abspath,
-                                     NULL, NULL, NULL, /* diff labels */
-                                     NULL, /* actual props */
-                                     FALSE, /* dry-run */
-                                     NULL, /* diff3-cmd */
-                                     NULL, /* merge options */
-                                     NULL, /* prop_diff */
-                                     NULL, NULL, /* cancel_func + baton */
-                                     b->result_pool, scratch_pool));
+      svn_boolean_t is_shadowed;
 
-      if (merge_outcome == svn_wc_merge_conflict)
+      /* If the node is shadowed by a higher layer, we need to flag a 
+       * tree conflict and must not touch the working file. */
+      SVN_ERR(check_shadowed_node(&is_shadowed,
+                                  relpath_depth(b->move_root_dst_relpath),
+                                  dst_relpath, b->wcroot));
+      if (is_shadowed)
         {
-          svn_skel_t *work_item;
-          svn_wc_conflict_version_t *original_version;
-
-          if (conflict_skel)
-            {
-              original_version = svn_wc_conflict_version_dup(b->old_version,
-                                                             scratch_pool);
-              original_version->path_in_repos = original_repos_relpath;
-              original_version->node_kind = svn_node_file;
-              SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_skel,
-                                                          original_version,
-                                                          scratch_pool,
-                                                          scratch_pool));
-              SVN_ERR(svn_wc__conflict_create_markers(&work_item, b->db,
-                                                      moved_to_abspath,
-                                                      conflict_skel,
-                                                      scratch_pool,
-                                                      scratch_pool));
-              *b->work_items = svn_wc__wq_merge(*b->work_items, work_item,
-                                                b->result_pool);
-            }
-          content_state = svn_wc_notify_state_conflicted;
+          /* ### TODO flag tree conflict */
         }
       else
-        {
-          svn_boolean_t is_locally_modified;
-
-          SVN_ERR(svn_wc__internal_file_modified_p(&is_locally_modified,
-                                                   b->db, moved_to_abspath,
-                                                   FALSE /* exact_comparison */,
-                                                   scratch_pool));
-          if (is_locally_modified)
-            content_state = svn_wc_notify_state_merged;
-          else
-            content_state = svn_wc_notify_state_changed;
-        }
-
-      notify = svn_wc_create_notify(moved_to_abspath,
-                                    svn_wc_notify_update_update,
-                                    scratch_pool);
-      notify->kind = svn_node_file;
-      notify->content_state = content_state;
-      notify->prop_state = svn_wc_notify_state_unknown; /* ### TODO */
-      notify->old_revision = b->old_version->peg_rev;
-      notify->revision = b->new_version->peg_rev;
-      b->notify_func(b->notify_baton, notify, scratch_pool);
+        SVN_ERR(update_working_file(b->work_items, dst_relpath,
+                                    move_dst_repos_relpath,
+                                    move_src_checksum, move_dst_checksum,
+                                    b->old_version, b->new_version,
+                                    b->wcroot, b->db,
+                                    b->notify_func, b->notify_baton,
+                                    b->result_pool, scratch_pool));
     }
 
   return SVN_NO_ERROR;
@@ -310,7 +390,7 @@ tc_editor_complete(void *baton,
   svn_wc_notify_t *notify;
 
   notify = svn_wc_create_notify(svn_dirent_join(b->wcroot->abspath,
-                                                b->dst_relpath,
+                                                b->move_root_dst_relpath,
                                                 scratch_pool),
                                 svn_wc_notify_update_completed,
                                 scratch_pool);
@@ -351,6 +431,11 @@ static const svn_editor_cb_many_t editor
  * Driver code.
  */
 
+/* Set *OPERATION, *LOCAL_CHANGE, *INCOMING_CHANGE, *OLD_VERSION, *NEW_VERSION
+ * to reflect the tree conflict on the victim SRC_ABSPATH in DB.
+ *
+ * If SRC_ABSPATH is not a tree-conflict victim, return an error.
+ */
 static svn_error_t *
 get_tc_info(svn_wc_operation_t *operation,
             svn_wc_conflict_reason_t *local_change,
@@ -404,7 +489,7 @@ get_tc_info(svn_wc_operation_t *operatio
           svn_revnum_t revision;
           svn_node_kind_t node_kind;
 
-          /* Construct b->new_version from BASE info. */
+          /* Construct new_version from BASE info. */
           SVN_ERR(svn_wc__db_base_get_info(NULL, &kind, &revision,
                                            &repos_relpath, &repos_root_url,
                                            &repos_uuid, NULL, NULL, NULL,
@@ -430,47 +515,51 @@ get_tc_info(svn_wc_operation_t *operatio
   return SVN_NO_ERROR;
 }
 
+/* ### Drive TC_EDITOR so as to ...
+ */
 static svn_error_t *
 update_moved_away_file(svn_editor_t *tc_editor,
                        const char *src_relpath,
                        const char *dst_relpath,
-                       const char *move_dst_op_root_relpath,
-                       svn_revnum_t move_dst_op_root_revision,
+                       const char *move_root_dst_relpath,
+                       svn_revnum_t move_root_dst_revision,
                        svn_wc__db_t *db,
                        svn_wc__db_wcroot_t *wcroot,
                        apr_pool_t *scratch_pool)
 {
   svn_kind_t kind;
   svn_stream_t *post_update_contents;
-  const svn_checksum_t *moved_away_checksum;
+  const svn_checksum_t *move_src_checksum;
                     
   /* Read post-update contents from the updated moved-away file and tell
    * the editor to merge them into the moved-here file. */
   SVN_ERR(svn_wc__db_read_pristine_info(NULL, &kind, NULL, NULL, NULL, NULL,
-                                        &moved_away_checksum, NULL, NULL, db,
+                                        &move_src_checksum, NULL, NULL, db,
                                         svn_dirent_join(wcroot->abspath,
                                                         src_relpath,
                                                         scratch_pool),
                                         scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_pristine_read(&post_update_contents, NULL, db,
-                                   wcroot->abspath, moved_away_checksum,
+                                   wcroot->abspath, move_src_checksum,
                                    scratch_pool, scratch_pool));
   SVN_ERR(svn_editor_alter_file(tc_editor, dst_relpath,
-                                move_dst_op_root_revision,
+                                move_root_dst_revision,
                                 NULL, /* ### TODO props */
-                                moved_away_checksum,
+                                move_src_checksum,
                                 post_update_contents));
   SVN_ERR(svn_stream_close(post_update_contents));
 
   return SVN_NO_ERROR;
 }
 
+/* ### Drive TC_EDITOR so as to ...
+ */
 static svn_error_t *
 update_moved_away_dir(svn_editor_t *tc_editor,
                       const char *src_relpath,
                       const char *dst_relpath,
-                      const char *move_dst_op_root_relpath,
-                      svn_revnum_t move_dst_op_root_revision,
+                      const char *move_root_dst_relpath,
+                      svn_revnum_t move_root_dst_revision,
                       svn_wc__db_t *db,
                       svn_wc__db_wcroot_t *wcroot,
                       apr_pool_t *scratch_pool)
@@ -484,12 +573,14 @@ update_moved_away_dir(svn_editor_t *tc_e
   return SVN_NO_ERROR;
 }
 
+/* ### Drive TC_EDITOR so as to ...
+ */
 static svn_error_t *
 update_moved_away_subtree(svn_editor_t *tc_editor,
                           const char *src_relpath,
                           const char *dst_relpath,
-                          const char *move_dst_op_root_relpath,
-                          svn_revnum_t move_dst_op_root_revision,
+                          const char *move_root_dst_relpath,
+                          svn_revnum_t move_root_dst_revision,
                           svn_wc__db_t *db,
                           svn_wc__db_wcroot_t *wcroot,
                           apr_pool_t *scratch_pool)
@@ -499,8 +590,8 @@ update_moved_away_subtree(svn_editor_t *
   int i;
 
   SVN_ERR(update_moved_away_dir(tc_editor, src_relpath, dst_relpath,
-                                move_dst_op_root_relpath,
-                                move_dst_op_root_revision,
+                                move_root_dst_relpath,
+                                move_root_dst_revision,
                                 db, wcroot, scratch_pool));
 
   SVN_ERR(svn_wc__db_base_get_children(&children, db,
@@ -531,7 +622,7 @@ update_moved_away_subtree(svn_editor_t *
                                                 wcroot, child_src_relpath,
                                                 iterpool, iterpool));
       if (child_dst_op_root_relpath == NULL ||
-          strcmp(child_dst_op_root_relpath, move_dst_op_root_relpath) != 0)
+          strcmp(child_dst_op_root_relpath, move_root_dst_relpath) != 0)
         continue;
 
       SVN_ERR(svn_wc__db_base_get_info_internal(NULL, &child_kind,
@@ -544,14 +635,14 @@ update_moved_away_subtree(svn_editor_t *
       if (child_kind == svn_kind_file || child_kind == svn_kind_symlink)
         SVN_ERR(update_moved_away_file(tc_editor, child_src_relpath,
                                        child_dst_relpath,
-                                       move_dst_op_root_relpath,
-                                       move_dst_op_root_revision,
+                                       move_root_dst_relpath,
+                                       move_root_dst_revision,
                                        db, wcroot, iterpool));
       else if (child_kind == svn_kind_dir)
         SVN_ERR(update_moved_away_subtree(tc_editor, child_src_relpath,
                                           child_dst_relpath,
-                                          move_dst_op_root_relpath,
-                                          move_dst_op_root_revision,
+                                          move_root_dst_relpath,
+                                          move_root_dst_revision,
                                           db, wcroot, iterpool));
     }
   svn_pool_destroy(iterpool);
@@ -559,6 +650,8 @@ update_moved_away_subtree(svn_editor_t *
   return SVN_NO_ERROR;
 }
 
+/* ### Drive TC_EDITOR so as to ...
+ */
 static svn_error_t *
 drive_tree_conflict_editor(svn_editor_t *tc_editor,
                            const char *src_relpath,
@@ -628,7 +721,8 @@ struct update_moved_away_conflict_victim
   apr_pool_t *result_pool;
 };
 
-/* An implementation of svn_wc__db_txn_callback_t. */
+/* The body of svn_wc__db_update_moved_away_conflict_victim(), which see.
+ * An implementation of svn_wc__db_txn_callback_t. */
 static svn_error_t *
 update_moved_away_conflict_victim(void *baton,
                                   svn_wc__db_wcroot_t *wcroot,
@@ -643,13 +737,11 @@ update_moved_away_conflict_victim(void *
 
   /* Construct editor baton. */
   tc_editor_baton = apr_pcalloc(scratch_pool, sizeof(*tc_editor_baton));
-  tc_editor_baton->src_relpath = b->victim_relpath;
-  SVN_ERR(svn_wc__db_scan_deletion_internal(NULL,
-                                            &tc_editor_baton->dst_relpath,
-                                            NULL, NULL, wcroot,
-                                            tc_editor_baton->src_relpath,
-                                            scratch_pool, scratch_pool));
-  if (tc_editor_baton->dst_relpath == NULL)
+  tc_editor_baton->move_root_src_relpath = b->victim_relpath;
+  SVN_ERR(svn_wc__db_scan_deletion_internal(
+            NULL, &tc_editor_baton->move_root_dst_relpath, NULL, NULL,
+            wcroot, b->victim_relpath, scratch_pool, scratch_pool));
+  if (tc_editor_baton->move_root_dst_relpath == NULL)
     return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
                              _("The node '%s' has not been moved away"),
                              svn_dirent_local_style(
@@ -674,8 +766,8 @@ update_moved_away_conflict_victim(void *
 
   /* ... and drive it. */
   SVN_ERR(drive_tree_conflict_editor(tc_editor,
-                                     tc_editor_baton->src_relpath,
-                                     tc_editor_baton->dst_relpath,
+                                     tc_editor_baton->move_root_src_relpath,
+                                     tc_editor_baton->move_root_dst_relpath,
                                      b->operation,
                                      b->local_change, b->incoming_change,
                                      tc_editor_baton->old_version,

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c Fri Nov 23 01:12:18 2012
@@ -27,6 +27,7 @@
 
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
+#include "svn_version.h"
 
 #include "wc.h"
 #include "adm_files.h"
@@ -294,9 +295,24 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
     }
 
   /* Auto-upgrade the SDB if possible.  */
-  if (format < SVN_WC__VERSION && auto_upgrade)
-    SVN_ERR(svn_wc__upgrade_sdb(&format, wcroot_abspath, sdb, format,
-                                scratch_pool));
+  if (format < SVN_WC__VERSION)
+    {
+      if (auto_upgrade)
+        {
+          if (format >= SVN_WC__WC_NG_VERSION)
+            SVN_ERR(svn_wc__upgrade_sdb(&format, wcroot_abspath, sdb, format,
+                                        scratch_pool));
+        }
+      else
+        return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
+                                 _("The working copy at '%s'\nis too old "
+                                   "(format %d) to work with client version "
+                                   "'%s' (expects format %d). You need to "
+                                   "upgrade the working copy first.\n"),
+                                   svn_dirent_local_style(wcroot_abspath,
+                                   scratch_pool), format, SVN_VERSION,
+                                   SVN_WC__VERSION);
+    }
 
   *wcroot = apr_palloc(result_pool, sizeof(**wcroot));
 
@@ -403,7 +419,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
   svn_wc__db_wcroot_t *probe_wcroot;
   svn_wc__db_wcroot_t *found_wcroot = NULL;
   const char *scan_abspath;
-  svn_sqlite__db_t *sdb;
+  svn_sqlite__db_t *sdb = NULL;
   svn_boolean_t moved_upwards = FALSE;
   svn_boolean_t always_check = FALSE;
   int wc_format = 0;
@@ -654,7 +670,8 @@ try_symlink_as_dir:
                             sdb, wc_id, FORMAT_FROM_SDB,
                             db->auto_upgrade, db->enforce_empty_wq,
                             db->state_pool, scratch_pool);
-      if (err && err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT &&
+      if (err && (err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT ||
+                  err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) &&
           kind == svn_kind_symlink)
         {
           /* We found an unsupported WC after traversing upwards from a
@@ -746,7 +763,8 @@ try_symlink_as_dir:
                                        scratch_pool));
               /* This handle was opened in this function but is not going
                  to be used further so close it. */
-              SVN_ERR(svn_sqlite__close(sdb));
+              if (sdb)
+                SVN_ERR(svn_sqlite__close(sdb));
               goto try_symlink_as_dir;
             }
         }

Modified: subversion/branches/ev2-export/subversion/mod_dav_svn/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/mod_dav_svn/authz.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/mod_dav_svn/authz.c (original)
+++ subversion/branches/ev2-export/subversion/mod_dav_svn/authz.c Fri Nov 23 01:12:18 2012
@@ -97,6 +97,55 @@ dav_svn__allow_read(request_rec *r,
 }
 
 
+svn_boolean_t
+dav_svn__allow_list_repos(request_rec *r,
+                          const char *repos_name,
+                          apr_pool_t *pool)
+{
+  const char *uri;
+  request_rec *subreq;
+  svn_boolean_t allowed = FALSE;
+  authz_svn__subreq_bypass_func_t allow_read_bypass = NULL;
+
+  /* Easy out:  if the admin has explicitly set 'SVNPathAuthz Off',
+     then this whole callback does nothing. */
+  if (! dav_svn__get_pathauthz_flag(r))
+    {
+      return TRUE;
+    }
+
+  /* If bypass is specified and authz has exported the provider.
+     Otherwise, we fall through to the full version.  This should be
+     safer than allowing or disallowing all accesses if there is a
+     configuration error.
+     XXX: Is this the proper thing to do in this case? */
+  allow_read_bypass = dav_svn__get_pathauthz_bypass(r);
+  if (allow_read_bypass != NULL)
+    {
+      if (allow_read_bypass(r, "/", repos_name) == OK)
+        return TRUE;
+      else
+        return FALSE;
+    }
+
+  /* Build a Public Resource uri representing repository root. */
+  uri =  svn_urlpath__join(dav_svn__get_root_dir(r),
+                           svn_path_uri_encode(repos_name, pool), pool);
+
+  /* Check if GET would work against this uri. */
+  subreq = ap_sub_req_method_uri("GET", uri, r, r->output_filters);
+
+  if (subreq)
+    {
+      if (subreq->status == HTTP_OK)
+        allowed = TRUE;
+
+      ap_destroy_sub_req(subreq);
+    }
+
+  return allowed;
+}
+
 /* This function implements 'svn_repos_authz_func_t', specifically
    for read authorization.
 

Modified: subversion/branches/ev2-export/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/mod_dav_svn/dav_svn.h?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/ev2-export/subversion/mod_dav_svn/dav_svn.h Fri Nov 23 01:12:18 2012
@@ -746,6 +746,20 @@ dav_svn__allow_read_resource(const dav_r
                              apr_pool_t *pool);
 
 
+/* Return TRUE iff the current user (as determined by Apache's
+   authentication system) has permission to read repository REPOS_NAME.
+   This will invoke any authz modules loaded into Apache unless this
+   Subversion location has been configured to bypass those in favor of a
+   direct lookup in the Subversion authz subsystem. Use POOL for any
+   temporary allocation.
+   IMPORTANT: R must be request for DAV_SVN_RESTYPE_PARENTPATH_COLLECTION
+   resource.
+*/
+svn_boolean_t
+dav_svn__allow_list_repos(request_rec *r,
+                          const char *repos_name,
+                          apr_pool_t *pool);
+
 /* If authz is enabled in the specified BATON, return a read authorization
    function. Otherwise, return NULL. */
 svn_repos_authz_func_t

Modified: subversion/branches/ev2-export/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/mod_dav_svn/reports/update.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/branches/ev2-export/subversion/mod_dav_svn/reports/update.c Fri Nov 23 01:12:18 2012
@@ -618,12 +618,8 @@ send_propchange(item_baton_t *b,
 {
   const char *qname;
 
-  /* Ensure that the property name is XML-safe.
-     apr_xml_quote_string() doesn't realloc if there is nothing to
-     quote, so dup the name, but only if necessary. */
-  qname = apr_xml_quote_string(b->pool, name, 1);
-  if (qname == name)
-    qname = apr_pstrdup(b->pool, name);
+  /* Ensure that the property name is XML-safe. */
+  qname = apr_xml_quote_string(pool, name, 1);
 
   if (value)
     {

Modified: subversion/branches/ev2-export/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/mod_dav_svn/repos.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/ev2-export/subversion/mod_dav_svn/repos.c Fri Nov 23 01:12:18 2012
@@ -3469,9 +3469,9 @@ deliver(const dav_resource *resource, ap
             }
           else
             {
-              /* ### TODO:  We could test for readability of the root
-                     directory of each repository and hide those that
-                     the user can't see. */
+                if (! dav_svn__allow_list_repos(resource->info->r,
+                                                entry->name, entry_pool))
+                  continue;
             }
 
           /* append a trailing slash onto the name for directories. we NEED

Modified: subversion/branches/ev2-export/subversion/svn/add-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/add-cmd.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/add-cmd.c (original)
+++ subversion/branches/ev2-export/subversion/svn/add-cmd.c Fri Nov 23 01:12:18 2012
@@ -75,10 +75,11 @@ svn_cl__add(apr_getopt_t *os,
       svn_pool_clear(iterpool);
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
       SVN_ERR(svn_cl__try
-              (svn_client_add4(target,
+              (svn_client_add5(target,
                                opt_state->depth,
                                opt_state->force, opt_state->no_ignore,
-                               opt_state->parents, ctx, iterpool),
+                               opt_state->no_autoprops, opt_state->parents,
+                               ctx, iterpool),
                errors, opt_state->quiet,
                SVN_ERR_ENTRY_EXISTS,
                SVN_ERR_WC_PATH_NOT_FOUND,

Modified: subversion/branches/ev2-export/subversion/svn/import-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/import-cmd.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/import-cmd.c (original)
+++ subversion/branches/ev2-export/subversion/svn/import-cmd.c Fri Nov 23 01:12:18 2012
@@ -118,6 +118,7 @@ svn_cl__import(apr_getopt_t *os,
                               url,
                               opt_state->depth,
                               opt_state->no_ignore,
+                              opt_state->no_autoprops,
                               opt_state->force,
                               opt_state->revprop_table,
                               NULL, NULL,  /* filter callback / baton */

Modified: subversion/branches/ev2-export/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/main.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/main.c (original)
+++ subversion/branches/ev2-export/subversion/svn/main.c Fri Nov 23 01:12:18 2012
@@ -217,7 +217,9 @@ const apr_getopt_option_t svn_cl__option
   {"stop-on-copy",  opt_stop_on_copy, 0,
                     N_("do not cross copies while traversing history")},
   {"no-ignore",     opt_no_ignore, 0,
-                    N_("disregard default and svn:ignore property ignores")},
+                    N_("disregard default and svn:ignore and\n"
+                       "                             "
+                       "svn:global-ignores property ignores")},
   {"no-auth-cache", opt_no_auth_cache, 0,
                     N_("do not cache authentication tokens")},
   {"trust-server-cert", opt_trust_server_cert, 0,
@@ -1113,7 +1115,8 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "\n"
      "  A unidiff patch suitable for application to a working copy can be\n"
      "  produced with the 'svn diff' command or third-party diffing tools.\n"
-     "  Any non-unidiff content of PATCHFILE is ignored.\n"
+     "  Any non-unidiff content of PATCHFILE is ignored, except for Subversion\n"
+     "  property diffs as produced by 'svn diff'.\n"
      "\n"
      "  Changes listed in the patch will either be applied or rejected.\n"
      "  If a change does not match at its exact line offset, it may be applied\n"
@@ -1228,6 +1231,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  Note: svn recognizes the following special versioned properties\n"
      "  but will store any arbitrary properties set:\n"
      "    svn:ignore     - A newline separated list of file glob patterns to ignore.\n"
+     "    svn:global-ignores         - Like svn:ignore, but inheritable.\n"
      "    svn:keywords   - Keywords to be expanded.  Valid keywords are:\n"
      "      URL, HeadURL             - The URL for the head version of the object.\n"
      "      Author, LastChangedBy    - The last person to modify the file.\n"

Modified: subversion/branches/ev2-export/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/mergeinfo-cmd.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/branches/ev2-export/subversion/svn/mergeinfo-cmd.c Fri Nov 23 01:12:18 2012
@@ -37,7 +37,6 @@
 #include "cl.h"
 
 #include "svn_private_config.h"
-#include "private/svn_client_private.h"
 
 
 /*** Code. ***/
@@ -60,10 +59,15 @@ print_log_rev(void *baton,
  * of merging between two branches, given the merge description
  * indicated by YCA, BASE, RIGHT, TARGET, REINTEGRATE_LIKE. */
 static svn_error_t *
-mergeinfo_diagram(svn_client__pathrev_t *yca,
-                  svn_client__pathrev_t *base,
-                  svn_client__pathrev_t *right,
-                  svn_client__pathrev_t *target,
+mergeinfo_diagram(const char *yca_url,
+                  const char *base_url,
+                  const char *right_url,
+                  const char *target_url,
+                  svn_revnum_t yca_rev,
+                  svn_revnum_t base_rev,
+                  svn_revnum_t right_rev,
+                  svn_revnum_t target_rev,
+                  const char *repos_root_url,
                   svn_boolean_t target_is_wc,
                   svn_boolean_t reintegrate_like,
                   apr_pool_t *pool)
@@ -82,16 +86,16 @@ mergeinfo_diagram(svn_client__pathrev_t 
 
   /* The YCA (that is, the branching point).  And an ellipsis, because we
    * don't show information about earlier merges */
-  g[0][0] = apr_psprintf(pool, "  %-8ld  ", yca->rev);
+  g[0][0] = apr_psprintf(pool, "  %-8ld  ", yca_rev);
   g[1][0] =     "  |         ";
-  if (strcmp(yca->url, right->url) == 0)
+  if (strcmp(yca_url, right_url) == 0)
     {
       g[2][0] = "-------| |--";
       g[3][0] = "   \\        ";
       g[4][0] = "    \\       ";
       g[5][0] = "     --| |--";
     }
-  else if (strcmp(yca->url, target->url) == 0)
+  else if (strcmp(yca_url, target_url) == 0)
     {
       g[2][0] = "     --| |--";
       g[3][0] = "    /       ";
@@ -107,18 +111,18 @@ mergeinfo_diagram(svn_client__pathrev_t 
     }
 
   /* The last full merge */
-  if ((base->rev > yca->rev) && reintegrate_like)
+  if ((base_rev > yca_rev) && reintegrate_like)
     {
       g[2][2] = "---------";
       g[3][2] = "  /      ";
       g[4][2] = " /       ";
       g[5][2] = "---------";
       g[6][2] = "|        ";
-      g[7][2] = apr_psprintf(pool, "%-8ld ", base->rev);
+      g[7][2] = apr_psprintf(pool, "%-8ld ", base_rev);
     }
-  else if (base->rev > yca->rev)
+  else if (base_rev > yca_rev)
     {
-      g[0][2] = apr_psprintf(pool, "%-8ld ", base->rev);
+      g[0][2] = apr_psprintf(pool, "%-8ld ", base_rev);
       g[1][2] = "|        ";
       g[2][2] = "---------";
       g[3][2] = " \\       ";
@@ -135,7 +139,7 @@ mergeinfo_diagram(svn_client__pathrev_t 
 
   /* The tips of the branches */
     {
-      g[0][3] = apr_psprintf(pool, "%-8ld", right->rev);
+      g[0][3] = apr_psprintf(pool, "%-8ld", right_rev);
       g[1][3] = "|       ";
       g[2][3] = "-       ";
       g[3][3] = "        ";
@@ -143,7 +147,7 @@ mergeinfo_diagram(svn_client__pathrev_t 
       g[5][3] = "-       ";
       g[6][3] = "|       ";
       g[7][3] = target_is_wc ? "WC      "
-                             : apr_psprintf(pool, "%-8ld", target->rev);
+                             : apr_psprintf(pool, "%-8ld", target_rev);
     }
 
   /* Find the width of each column, so we know how to print blank cells */
@@ -152,8 +156,8 @@ mergeinfo_diagram(svn_client__pathrev_t 
       col_width[col] = 0;
       for (row = 0; row < ROWS; row++)
         {
-          if (g[row][col] && (strlen(g[row][col]) > col_width[col]))
-            col_width[col] = strlen(g[row][col]);
+          if (g[row][col] && ((int)strlen(g[row][col]) > col_width[col]))
+            col_width[col] = (int)strlen(g[row][col]);
         }
     }
 
@@ -183,10 +187,10 @@ mergeinfo_diagram(svn_client__pathrev_t 
         }
       if (row == 2)
         SVN_ERR(svn_cmdline_printf(pool, "  %s",
-                svn_client__pathrev_relpath(right, pool)));
+                svn_uri_skip_ancestor(repos_root_url, right_url, pool)));
       if (row == 5)
         SVN_ERR(svn_cmdline_printf(pool, "  %s",
-                svn_client__pathrev_relpath(target, pool)));
+                svn_uri_skip_ancestor(repos_root_url, target_url, pool)));
       SVN_ERR(svn_cmdline_fputs("\n", stdout, pool));
     }
 
@@ -206,7 +210,9 @@ mergeinfo_summary(
                   apr_pool_t *pool)
 {
   svn_client_automatic_merge_t *the_merge;
-  svn_client__pathrev_t *yca, *base, *right, *target;
+  const char *yca_url, *base_url, *right_url, *target_url;
+  svn_revnum_t yca_rev, base_rev, right_rev, target_rev;
+  const char *repos_root_url;
   svn_boolean_t target_is_wc, reintegrate_like;
 
   target_is_wc = (! svn_path_is_url(target_path_or_url))
@@ -226,12 +232,18 @@ mergeinfo_summary(
               target_path_or_url, target_revision,
               ctx, pool, pool));
 
-  SVN_ERR(svn_client__automatic_merge_get_locations(
-            &yca, &base, &right, &target, the_merge, pool));
+  SVN_ERR(svn_client_automatic_merge_get_locations(
+            &yca_url, &yca_rev,
+            &base_url, &base_rev,
+            &right_url, &right_rev,
+            &target_url, &target_rev,
+            &repos_root_url,
+            the_merge, pool));
   reintegrate_like = svn_client_automatic_merge_is_reintegrate_like(the_merge);
 
-  SVN_ERR(mergeinfo_diagram(yca, base, right, target,
-                            target_is_wc, reintegrate_like,
+  SVN_ERR(mergeinfo_diagram(yca_url, base_url, right_url, target_url,
+                            yca_rev, base_rev, right_rev, target_rev,
+                            repos_root_url, target_is_wc, reintegrate_like,
                             pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/ev2-export/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/propget-cmd.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/ev2-export/subversion/svn/propget-cmd.c Fri Nov 23 01:12:18 2012
@@ -147,6 +147,7 @@ print_properties_xml(const char *pname,
    All other arguments are as per print_properties. */
 static svn_error_t *
 print_single_prop(svn_string_t *propval,
+                  const char *target_abspath_or_url,
                   const char *abspath_or_URL,
                   const char *wc_path_prefix,
                   svn_stream_t *out,
@@ -171,9 +172,24 @@ print_single_prop(svn_string_t *propval,
       /* In verbose mode, print exactly same as "proplist" does;
        * otherwise, print a brief header. */
       if (inherited_property)
-        header = apr_psprintf(scratch_pool, like_proplist
-                              ? _("Properties inherited from '%s':\n")
-                              : "%s - ", abspath_or_URL);
+        {
+          if (like_proplist)
+            {
+              if (! svn_path_is_url(target_abspath_or_url))
+                target_abspath_or_url =
+                  svn_cl__local_style_skip_ancestor(wc_path_prefix,
+                                                    target_abspath_or_url,
+                                                    scratch_pool);
+              header = apr_psprintf(
+                scratch_pool,
+                _("Inherited properties on '%s',\nfrom '%s':\n"),
+                target_abspath_or_url, abspath_or_URL);
+            }
+          else
+            {
+              header = apr_psprintf(scratch_pool, "%s - ", abspath_or_URL);
+            }
+        }
       else
         header = apr_psprintf(scratch_pool, like_proplist
                               ? _("Properties on '%s':\n")
@@ -218,6 +234,8 @@ print_single_prop(svn_string_t *propval,
    value.  INHERITED_PROPS is a depth-first ordered array of
    svn_prop_inherited_item_t * structures.
 
+   TARGET_ABSPATH_OR_URL is the path which inherits INHERITED_PROPS.
+
    PROPS may be an empty hash, but is never null.  INHERITED_PROPS may be
    null.
 
@@ -234,6 +252,7 @@ print_single_prop(svn_string_t *propval,
    like "svn proplist -v" does. */
 static svn_error_t *
 print_properties(svn_stream_t *out,
+                 const char *target_abspath_or_url,
                  const char *pname_utf8,
                  apr_hash_t *props,
                  apr_array_header_t *inherited_props,
@@ -259,7 +278,7 @@ print_properties(svn_stream_t *out,
             APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
           svn_string_t *propval = svn__apr_hash_index_val(apr_hash_first(pool,
                                                           iprop->prop_hash));
-          SVN_ERR(print_single_prop(propval,
+          SVN_ERR(print_single_prop(propval, target_abspath_or_url,
                                     iprop->path_or_url,
                                     path_prefix, out, pname_utf8,
                                     print_filenames, omit_newline,
@@ -276,8 +295,8 @@ print_properties(svn_stream_t *out,
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(print_single_prop(propval, filename, path_prefix,
-                                out, pname_utf8, print_filenames,
+      SVN_ERR(print_single_prop(propval, target_abspath_or_url, filename,
+                                path_prefix, out, pname_utf8, print_filenames,
                                 omit_newline, like_proplist, FALSE,
                                 iterpool));
     }
@@ -443,7 +462,8 @@ svn_cl__propget(apr_getopt_t *os,
           print_filenames = ((opt_state->depth > svn_depth_empty
                               || targets->nelts > 1
                               || apr_hash_count(props) > 1
-                              || opt_state->verbose)
+                              || opt_state->verbose
+                              || opt_state->show_inherited_props)
                              && (! opt_state->strict));
           omit_newline = opt_state->strict;
           like_proplist = opt_state->verbose && !opt_state->strict;
@@ -455,7 +475,7 @@ svn_cl__propget(apr_getopt_t *os,
               subpool));
           else
             SVN_ERR(print_properties(
-              out, pname_utf8,
+              out, truepath, pname_utf8,
               props,
               opt_state->show_inherited_props ? inherited_props : NULL,
               print_filenames,

Modified: subversion/branches/ev2-export/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/proplist-cmd.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn/proplist-cmd.c (original)
+++ subversion/branches/ev2-export/subversion/svn/proplist-cmd.c Fri Nov 23 01:12:18 2012
@@ -151,12 +151,13 @@ proplist_receiver(void *baton,
             {
               if (svn_path_is_url(iprop->path_or_url))
                 SVN_ERR(svn_cmdline_printf(
-                  iterpool, _("Properties inherited from '%s':\n"),
-                  iprop->path_or_url));
+                  iterpool, _("Inherited properties on '%s',\nfrom '%s':\n"),
+                  name_local, iprop->path_or_url));
               else
                 SVN_ERR(svn_cmdline_printf(
-                  iterpool, _("Properties inherited from '%s':\n"),
-                  svn_dirent_local_style(iprop->path_or_url, iterpool)));
+                  iterpool, _("Inherited properties on '%s',\nfrom '%s':\n"),
+                  name_local, svn_dirent_local_style(iprop->path_or_url,
+                                                     iterpool)));
             }
 
           SVN_ERR(svn_cl__print_prop_hash(NULL, iprop->prop_hash,

Modified: subversion/branches/ev2-export/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn_private_config.hw?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svn_private_config.hw (original)
+++ subversion/branches/ev2-export/subversion/svn_private_config.hw Fri Nov 23 01:12:18 2012
@@ -33,6 +33,16 @@
 /* Define to a Windows-specific equivalent of config.guess output */
 #define SVN_BUILD_HOST "x86-microsoft-windows"
 
+#if defined(_M_X64)
+#define SVN_BUILD_TARGET "x64-microsoft-windows"
+#elif defined(_M_IA64)
+#define SVN_BUILD_TARGET "ia64-microsoft-windows"
+#elif defined( _M_IX86)
+#define SVN_BUILD_TARGET "x86-microsoft-windows"
+#else
+#error Unsupported build target.
+#endif
+
 /* The minimal version of Berkeley DB we want */
 #define SVN_FS_WANT_DB_MAJOR    4
 #define SVN_FS_WANT_DB_MINOR    0

Modified: subversion/branches/ev2-export/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnadmin/main.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svnadmin/main.c (original)
+++ subversion/branches/ev2-export/subversion/svnadmin/main.c Fri Nov 23 01:12:18 2012
@@ -43,7 +43,7 @@
 #include "svn_xml.h"
 
 #include "private/svn_opt_private.h"
-#include "private/svn_named_atomic.h"
+#include "private/svn_subr_private.h"
 
 #include "svn_private_config.h"
 
@@ -116,8 +116,7 @@ open_repos(svn_repos_t **repos,
   apr_hash_set(fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
                APR_HASH_KEY_STRING, "1");
   apr_hash_set(fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
-               APR_HASH_KEY_STRING,
-               svn_named_atomic__is_efficient() ? "1" : "0");
+               APR_HASH_KEY_STRING, "2");
 
   /* now, open the requested repository */
   SVN_ERR(svn_repos_open2(repos, path, fs_config, pool));
@@ -195,7 +194,7 @@ enum svnadmin__cmdline_options_t
     svnadmin__pre_1_4_compatible,
     svnadmin__pre_1_5_compatible,
     svnadmin__pre_1_6_compatible,
-    svnadmin__pre_1_8_compatible
+    svnadmin__compatible_version
   };
 
 /* Option codes and descriptions.
@@ -273,26 +272,23 @@ static const apr_getopt_option_t options
         "                             use by another process")},
 
     {"pre-1.4-compatible",     svnadmin__pre_1_4_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.4")},
+     N_("deprecated; see --compatible-version")},
 
     {"pre-1.5-compatible",     svnadmin__pre_1_5_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.5")},
+     N_("deprecated; see --compatible-version")},
 
     {"pre-1.6-compatible",     svnadmin__pre_1_6_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.6")},
-
-    {"pre-1.8-compatible",     svnadmin__pre_1_8_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.8")},
+     N_("deprecated; see --compatible-version")},
 
     {"memory-cache-size",     'M', 1,
      N_("size of the extra in-memory cache in MB used to\n"
         "                             minimize redundant operations. Default: 16.\n"
         "                             [used for FSFS repositories only]")},
 
+    {"compatible-version",     svnadmin__compatible_version, 1,
+     N_("use repository format compatible with Subversion\n"
+        "                             version ARG (\"1.5.5\", \"1.7\", etc.)")},
+
     {NULL}
   };
 
@@ -312,9 +308,9 @@ static const svn_opt_subcommand_desc2_t 
    ("usage: svnadmin create REPOS_PATH\n\n"
     "Create a new, empty repository at REPOS_PATH.\n"),
    {svnadmin__bdb_txn_nosync, svnadmin__bdb_log_keep,
-    svnadmin__config_dir, svnadmin__fs_type, svnadmin__pre_1_4_compatible,
-    svnadmin__pre_1_5_compatible, svnadmin__pre_1_6_compatible,
-    svnadmin__pre_1_8_compatible
+    svnadmin__config_dir, svnadmin__fs_type, svnadmin__compatible_version,
+    svnadmin__pre_1_4_compatible, svnadmin__pre_1_5_compatible,
+    svnadmin__pre_1_6_compatible
     } },
 
   {"deltify", subcommand_deltify, {0}, N_
@@ -489,7 +485,7 @@ struct svnadmin_opt_state
   svn_boolean_t pre_1_4_compatible;                 /* --pre-1.4-compatible */
   svn_boolean_t pre_1_5_compatible;                 /* --pre-1.5-compatible */
   svn_boolean_t pre_1_6_compatible;                 /* --pre-1.6-compatible */
-  svn_boolean_t pre_1_8_compatible;                 /* --pre-1.8-compatible */
+  svn_version_t *compatible_version;                /* --compatible-version */
   svn_opt_revision_t start_revision, end_revision;  /* -r X[:Y] */
   svn_boolean_t help;                               /* --help or -? */
   svn_boolean_t version;                            /* --version */
@@ -640,25 +636,35 @@ subcommand_create(apr_getopt_t *os, void
                  APR_HASH_KEY_STRING,
                  opt_state->fs_type);
 
+  /* Prior to 1.8, we had explicit options to specify compatibility
+     with a handful of prior Subversion releases. */
   if (opt_state->pre_1_4_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
-
+                 APR_HASH_KEY_STRING, "1");
   if (opt_state->pre_1_5_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
-
+                 APR_HASH_KEY_STRING, "1");
   if (opt_state->pre_1_6_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
+                 APR_HASH_KEY_STRING, "1");
 
-  if (opt_state->pre_1_8_compatible)
-    apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
+  /* In 1.8, we figured out that we didn't have to keep extending this
+     madness indefinitely. */
+  if (opt_state->compatible_version)
+    {
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 4, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 5, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 6, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 8, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+    }
 
   SVN_ERR(svn_repos_create(&repos, opt_state->repository_path,
                            NULL, NULL, NULL, fs_config, pool));
@@ -1989,8 +1995,42 @@ sub_main(int argc, const char *argv[], a
       case svnadmin__pre_1_6_compatible:
         opt_state.pre_1_6_compatible = TRUE;
         break;
-      case svnadmin__pre_1_8_compatible:
-        opt_state.pre_1_8_compatible = TRUE;
+      case svnadmin__compatible_version:
+        {
+          svn_version_t latest = { SVN_VER_MAJOR, SVN_VER_MINOR,
+                                   SVN_VER_PATCH, NULL };
+          svn_version_t *compatible_version;
+
+          /* Parse the version string which carries our target
+             compatibility. */
+          SVN_INT_ERR(svn_version__parse_version_string(&compatible_version,
+                                                        opt_arg, pool));
+
+          /* We can't create repository with a version older than 1.0.0.  */
+          if (! svn_version__at_least(compatible_version, 1, 0, 0))
+            {
+              err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                      _("Cannot create pre-1.0-compatible "
+                                        "repositories"));
+              return EXIT_ERROR(err);
+            }
+
+          /* We can't create repository with a version newer than what
+             the running version of Subversion supports. */
+          if (! svn_version__at_least(&latest,
+                                      compatible_version->major,
+                                      compatible_version->minor,
+                                      compatible_version->patch))
+            {
+              err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                      _("Cannot guaranteed compatibility "
+                                        "beyond the current running version "
+                                        "(" SVN_VER_NUM ")"));
+              return EXIT_ERROR(err);
+            }
+
+          opt_state.compatible_version = compatible_version;
+        }
         break;
       case svnadmin__fs_type:
         SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));

Modified: subversion/branches/ev2-export/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svndumpfilter/main.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svndumpfilter/main.c (original)
+++ subversion/branches/ev2-export/subversion/svndumpfilter/main.c Fri Nov 23 01:12:18 2012
@@ -45,7 +45,12 @@
 
 #include "private/svn_mergeinfo_private.h"
 
-
+#ifdef _WIN32
+typedef apr_status_t (__stdcall *open_fn_t)(apr_file_t **, apr_pool_t *);
+#else
+typedef apr_status_t (*open_fn_t)(apr_file_t **, apr_pool_t *);
+#endif
+
 /*** Code. ***/
 
 /* Helper to open stdio streams */
@@ -62,8 +67,7 @@
 */
 static svn_error_t *
 create_stdio_stream(svn_stream_t **stream,
-                    APR_DECLARE(apr_status_t) open_fn(apr_file_t **,
-                                                      apr_pool_t *),
+                    open_fn_t open_fn,
                     apr_pool_t *pool)
 {
   apr_file_t *stdio_file;

Modified: subversion/branches/ev2-export/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnlook/main.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svnlook/main.c (original)
+++ subversion/branches/ev2-export/subversion/svnlook/main.c Fri Nov 23 01:12:18 2012
@@ -52,6 +52,7 @@
 #include "svn_version.h"
 #include "svn_xml.h"
 
+#include "private/svn_diff_private.h"
 #include "private/svn_cmdline_private.h"
 #include "private/svn_fspath.h"
 
@@ -93,7 +94,9 @@ enum
     svnlook__revprop_opt,
     svnlook__full_paths,
     svnlook__copy_info,
-    svnlook__xml_opt
+    svnlook__xml_opt,
+    svnlook__ignore_properties,
+    svnlook__properties_only
   };
 
 /*
@@ -125,6 +128,12 @@ static const apr_getopt_option_t options
   {"no-diff-deleted",   svnlook__no_diff_deleted, 0,
    N_("do not print differences for deleted files")},
 
+  {"ignore-properties",   svnlook__ignore_properties, 0,
+   N_("ignore properties during the operation")},
+
+  {"properties-only",   svnlook__properties_only, 0,
+   N_("show only properties during the operation")},
+
   {"non-recursive",     'N', 0,
    N_("operate on single directory only")},
 
@@ -218,7 +227,8 @@ static const svn_opt_subcommand_desc2_t 
    N_("usage: svnlook diff REPOS_PATH\n\n"
       "Print GNU-style diffs of changed files and properties.\n"),
    {'r', 't', svnlook__no_diff_deleted, svnlook__no_diff_added,
-    svnlook__diff_copy_from, 'x'} },
+    svnlook__diff_copy_from, 'x', svnlook__ignore_properties,
+    svnlook__properties_only} },
 
   {"dirs-changed", subcommand_dirschanged, {0},
    N_("usage: svnlook dirs-changed REPOS_PATH\n\n"
@@ -320,6 +330,8 @@ struct svnlook_opt_state
   svn_boolean_t xml;              /* --xml */
   const char *extensions;         /* diff extension args (UTF-8!) */
   svn_boolean_t quiet;            /* --quiet */
+  svn_boolean_t ignore_properties;  /* --ignore_properties */
+  svn_boolean_t properties_only;    /* --properties-only */
 };
 
 
@@ -339,6 +351,8 @@ typedef struct svnlook_ctxt_t
   svn_fs_txn_t *txn;
   const char *txn_name /* UTF-8! */;
   const apr_array_header_t *diff_options;
+  svn_boolean_t ignore_properties;
+  svn_boolean_t properties_only;
 
 } svnlook_ctxt_t;
 
@@ -778,44 +792,6 @@ generate_label(const char **label,
   return SVN_NO_ERROR;
 }
 
-/* A helper function used by display_prop_diffs.
-   TOKEN is a string holding a property value.
-   If TOKEN is empty, or is already terminated by an EOL marker,
-   return TOKEN unmodified. Else, return a new string consisting
-   of the concatenation of TOKEN and the system's default EOL marker.
-   The new string is allocated from POOL.
-   If HAD_EOL is not NULL, indicate in *HAD_EOL if the token had a EOL. */
-static const svn_string_t *
-maybe_append_eol(const svn_string_t *token, svn_boolean_t *had_eol,
-                 apr_pool_t *pool)
-{
-  const char *curp;
-
-  if (had_eol)
-    *had_eol = FALSE;
-
-  if (token->len == 0)
-    return token;
-
-  curp = token->data + token->len - 1;
-  if (*curp == '\r')
-    {
-      if (had_eol)
-        *had_eol = TRUE;
-      return token;
-    }
-  else if (*curp != '\n')
-    {
-      return svn_string_createf(pool, "%s%s", token->data, APR_EOL_STR);
-    }
-  else
-    {
-      if (had_eol)
-        *had_eol = TRUE;
-      return token;
-    }
-}
-
 /*
  * Constant diff output separator strings
  */
@@ -827,92 +803,39 @@ static const char under_string[] =
 
 /* Helper function to display differences in properties of a file */
 static svn_error_t *
-display_prop_diffs(const apr_array_header_t *prop_diffs,
-                   apr_hash_t *orig_props,
+display_prop_diffs(svn_stream_t *outstream,
+                   const char *encoding,
+                   const apr_array_header_t *propchanges,
+                   apr_hash_t *original_props,
                    const char *path,
                    apr_pool_t *pool)
 {
-  int i;
 
-  SVN_ERR(svn_cmdline_printf(pool, "\nProperty changes on: %s\n%s\n",
-                             path, under_string));
+  SVN_ERR(svn_stream_printf_from_utf8(outstream, encoding, pool,
+                                      _("%sProperty changes on: %s%s"),
+                                      APR_EOL_STR,
+                                      path,
+                                      APR_EOL_STR));
 
-  for (i = 0; i < prop_diffs->nelts; i++)
-    {
-      const char *header_label;
-      const svn_string_t *orig_value;
-      const svn_prop_t *pc = &APR_ARRAY_IDX(prop_diffs, i, svn_prop_t);
-
-      SVN_ERR(check_cancel(NULL));
-
-      if (orig_props)
-        orig_value = apr_hash_get(orig_props, pc->name, APR_HASH_KEY_STRING);
-      else
-        orig_value = NULL;
+  SVN_ERR(svn_stream_printf_from_utf8(outstream, encoding, pool,
+                                      "%s" APR_EOL_STR, under_string));
 
-      if (! orig_value)
-        header_label = "Added";
-      else if (! pc->value)
-        header_label = "Deleted";
-      else
-        header_label = "Modified";
-      SVN_ERR(svn_cmdline_printf(pool, "%s: %s\n", header_label, pc->name));
+  SVN_ERR(check_cancel(NULL));
 
-      /* Flush stdout before we open a stream to it below. */
-      SVN_ERR(svn_cmdline_fflush(stdout));
+  SVN_ERR(svn_diff__display_prop_diffs(
+            outstream, encoding, propchanges, original_props,
+            FALSE /* pretty_print_mergeinfo */, pool));
 
-      {
-        svn_stream_t *out;
-        svn_diff_t *diff;
-        svn_diff_file_options_t options;
-        const svn_string_t *tmp;
-        const svn_string_t *orig;
-        const svn_string_t *val;
-        svn_boolean_t val_has_eol;
-
-        SVN_ERR(svn_stream_for_stdout(&out, pool));
-
-        /* The last character in a property is often not a newline.
-           An eol character is appended to prevent the diff API to add a
-           ' \ No newline at end of file' line. We add
-           ' \ No newline at end of property' manually if needed. */
-        tmp = orig_value ? orig_value : svn_string_create_empty(pool);
-        orig = maybe_append_eol(tmp, NULL, pool);
-
-        tmp = pc->value ? pc->value :
-                                  svn_string_create_empty(pool);
-        val = maybe_append_eol(tmp, &val_has_eol, pool);
-
-        SVN_ERR(svn_diff_mem_string_diff(&diff, orig, val, &options, pool));
-
-        /* UNIX patch will try to apply a diff even if the diff header
-         * is missing. It tries to be helpful by asking the user for a
-         * target filename when it can't determine the target filename
-         * from the diff header. But there usually are no files which
-         * UNIX patch could apply the property diff to, so we use "##"
-         * instead of "@@" as the default hunk delimiter for property diffs.
-         * We also supress the diff header. */
-        SVN_ERR(svn_diff_mem_string_output_unified2(out, diff, FALSE, "##",
-                                           svn_dirent_local_style(path, pool),
-                                           svn_dirent_local_style(path, pool),
-                                           svn_cmdline_output_encoding(pool),
-                                           orig, val, pool));
-        if (!val_has_eol)
-          {
-            const char *s = "\\ No newline at end of property" APR_EOL_STR;
-            SVN_ERR(svn_stream_puts(out, s));
-          }
-      }
-    }
-  return svn_cmdline_fflush(stdout);
+  return SVN_NO_ERROR;
 }
 
 
-
 /* Recursively print all nodes in the tree that have been modified
    (do not include directories affected only by "bubble-up"). */
 static svn_error_t *
-print_diff_tree(svn_fs_root_t *root,
+print_diff_tree(svn_stream_t *out_stream,
+                const char *encoding,
+                svn_fs_root_t *root,
                 svn_fs_root_t *base_root,
                 svn_repos_node_t *node,
                 const char *path /* UTF-8! */,
@@ -1031,7 +954,7 @@ print_diff_tree(svn_fs_root_t *root,
         }
     }
 
-  if (do_diff)
+  if (do_diff && (! c->properties_only))
     {
       svn_stringbuf_appendcstr(header, equal_string);
       svn_stringbuf_appendcstr(header, "\n");
@@ -1039,7 +962,8 @@ print_diff_tree(svn_fs_root_t *root,
       if (binary)
         {
           svn_stringbuf_appendcstr(header, _("(Binary files differ)\n\n"));
-          SVN_ERR(svn_cmdline_printf(pool, "%s", header->data));
+          SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                              "%s", header->data));
         }
       else
         {
@@ -1054,38 +978,11 @@ print_diff_tree(svn_fs_root_t *root,
 
           if (svn_diff_contains_diffs(diff))
             {
-              svn_stream_t *ostream;
               const char *orig_label, *new_label;
 
               /* Print diff header. */
-              SVN_ERR(svn_cmdline_printf(pool, "%s", header->data));
-
-              /* This fflush() might seem odd, but it was added to deal
-                 with this bug report:
-
-                   http://subversion.tigris.org/servlets/ReadMsg?\
-                   list=dev&msgNo=140782
-
-                   From: "Steve Hay" <SteveHay{_AT_}planit.com>
-                   To: <dev@subversion.tigris.org>
-                   Subject: svnlook diff output in wrong order when redirected
-                   Date: Fri, 4 Jul 2008 16:34:15 +0100
-                   Message-ID: <1B32FF956ABF414C9BCE5E487A1497E702014F62@\
-                                ukmail02.planit.group>
-
-                 Adding the fflush() fixed the bug (not everyone could
-                 reproduce it, but those who could confirmed the fix).
-                 Later in the thread, Daniel Shahaf speculated as to
-                 why the fix works:
-
-                   "Because svn_cmdline_printf() uses the standard
-                    'FILE *stdout' to write to stdout, while
-                    svn_stream_for_stdout() uses (through
-                    apr_file_open_stdout()) Windows API's to get a
-                    handle for stdout?" */
-              SVN_ERR(svn_cmdline_fflush(stdout));
-
-              SVN_ERR(svn_stream_for_stdout(&ostream, pool));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "%s", header->data));
 
               if (orig_empty)
                 SVN_ERR(generate_label(&orig_label, NULL, path, pool));
@@ -1094,12 +991,12 @@ print_diff_tree(svn_fs_root_t *root,
                                        base_path, pool));
               SVN_ERR(generate_label(&new_label, root, path, pool));
               SVN_ERR(svn_diff_file_output_unified3
-                      (ostream, diff, orig_path, new_path,
+                      (out_stream, diff, orig_path, new_path,
                        orig_label, new_label,
                        svn_cmdline_output_encoding(pool), NULL,
                        opts->show_c_function, pool));
-              SVN_ERR(svn_stream_close(ostream));
-              SVN_ERR(svn_cmdline_printf(pool, "\n"));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "\n"));
               diff_header_printed = TRUE;
             }
           else if (! node->prop_mod &&
@@ -1109,10 +1006,10 @@ print_diff_tree(svn_fs_root_t *root,
               /* There was an empty file added or deleted in this revision.
                * We can't print a diff, but we can at least print
                * a diff header since we know what happened to this file. */
-              SVN_ERR(svn_cmdline_printf(pool, "%s", header->data));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "%s", header->data));
             }
         }
-      SVN_ERR(svn_cmdline_fflush(stdout));
     }
 
   /* Make sure we delete any temporary files. */
@@ -1122,7 +1019,7 @@ print_diff_tree(svn_fs_root_t *root,
     SVN_ERR(svn_io_remove_file2(new_path, FALSE, pool));
 
   /*** Now handle property diffs ***/
-  if ((node->prop_mod) && (node->action != 'D'))
+  if ((node->prop_mod) && (node->action != 'D') && (! c->ignore_properties))
     {
       apr_hash_t *local_proptable;
       apr_hash_t *base_proptable;
@@ -1152,12 +1049,17 @@ print_diff_tree(svn_fs_root_t *root,
                                      pool));
               SVN_ERR(generate_label(&new_label, root, path, pool));
 
-              SVN_ERR(svn_cmdline_printf(pool, "Index: %s\n", path));
-              SVN_ERR(svn_cmdline_printf(pool, "%s\n", equal_string));
-              SVN_ERR(svn_cmdline_printf(pool, "--- %s\n", orig_label));
-              SVN_ERR(svn_cmdline_printf(pool, "+++ %s\n", new_label));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "Index: %s\n", path));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "%s\n", equal_string));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "--- %s\n", orig_label));
+              SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
+                                                  "+++ %s\n", new_label));
             }
-          SVN_ERR(display_prop_diffs(props, base_proptable, path, pool));
+          SVN_ERR(display_prop_diffs(out_stream, encoding,
+                                     props, base_proptable, path, pool));
         }
     }
 
@@ -1168,7 +1070,7 @@ print_diff_tree(svn_fs_root_t *root,
 
   /* Recursively handle the node's children. */
   subpool = svn_pool_create(pool);
-  SVN_ERR(print_diff_tree(root, base_root, node,
+  SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, node,
                           svn_dirent_join(path, node->name, subpool),
                           svn_dirent_join(base_path, node->name, subpool),
                           c, tmpdir, subpool));
@@ -1176,7 +1078,7 @@ print_diff_tree(svn_fs_root_t *root,
     {
       svn_pool_clear(subpool);
       node = node->sibling;
-      SVN_ERR(print_diff_tree(root, base_root, node,
+      SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, node,
                               svn_dirent_join(path, node->name, subpool),
                               svn_dirent_join(base_path, node->name, subpool),
                               c, tmpdir, subpool));
@@ -1539,12 +1441,40 @@ do_diff(svnlook_ctxt_t *c, apr_pool_t *p
   if (tree)
     {
       const char *tmpdir;
+      svn_stream_t *out_stream;
+      const char *encoding = svn_cmdline_output_encoding(pool);
 
       SVN_ERR(svn_fs_revision_root(&base_root, c->fs, base_rev_id, pool));
       SVN_ERR(svn_io_temp_dir(&tmpdir, pool));
 
-      SVN_ERR(print_diff_tree(root, base_root, tree, "", "",
-                              c, tmpdir, pool));
+      /* This fflush() might seem odd, but it was added to deal
+         with this bug report:
+
+         http://subversion.tigris.org/servlets/ReadMsg?\
+         list=dev&msgNo=140782
+
+         From: "Steve Hay" <SteveHay{_AT_}planit.com>
+         To: <dev@subversion.tigris.org>
+         Subject: svnlook diff output in wrong order when redirected
+         Date: Fri, 4 Jul 2008 16:34:15 +0100
+         Message-ID: <1B32FF956ABF414C9BCE5E487A1497E702014F62@\
+                     ukmail02.planit.group>
+
+         Adding the fflush() fixed the bug (not everyone could
+         reproduce it, but those who could confirmed the fix).
+         Later in the thread, Daniel Shahaf speculated as to
+         why the fix works:
+
+         "Because svn_cmdline_printf() uses the standard
+         'FILE *stdout' to write to stdout, while
+         svn_stream_for_stdout() uses (through
+         apr_file_open_stdout()) Windows API's to get a
+         handle for stdout?" */
+      SVN_ERR(svn_cmdline_fflush(stdout));
+      SVN_ERR(svn_stream_for_stdout(&out_stream, pool));
+
+      SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, tree,
+                              "", "", c, tmpdir, pool));
     }
   return SVN_NO_ERROR;
 }
@@ -1913,6 +1843,8 @@ get_ctxt_baton(svnlook_ctxt_t **baton_p,
   baton->diff_options = svn_cstring_split(opt_state->extensions
                                           ? opt_state->extensions : "",
                                           " \t\n\r", TRUE, pool);
+  baton->ignore_properties = opt_state->ignore_properties;
+  baton->properties_only = opt_state->properties_only;
 
   if (baton->txn_name)
     SVN_ERR(svn_fs_open_txn(&(baton->txn), baton->fs,
@@ -2414,6 +2346,14 @@ main(int argc, const char *argv[])
           opt_state.extensions = opt_arg;
           break;
 
+        case svnlook__ignore_properties:
+          opt_state.ignore_properties = TRUE;
+          break;
+
+        case svnlook__properties_only:
+          opt_state.properties_only = TRUE;
+          break;
+
         default:
           SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);

Modified: subversion/branches/ev2-export/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnmucc/svnmucc.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/ev2-export/subversion/svnmucc/svnmucc.c Fri Nov 23 01:12:18 2012
@@ -203,15 +203,14 @@ change_props(const svn_delta_editor_t *e
       for (hi = apr_hash_first(pool, child->prop_mods);
            hi; hi = apr_hash_next(hi))
         {
-          const void *key;
-          void *val;
+          const char *propname = svn__apr_hash_index_key(hi);
+          const svn_string_t *val = svn__apr_hash_index_val(hi);
 
           svn_pool_clear(iterpool);
-          apr_hash_this(hi, &key, NULL, &val);
           if (child->kind == svn_node_dir)
-            SVN_ERR(editor->change_dir_prop(baton, key, val, iterpool));
+            SVN_ERR(editor->change_dir_prop(baton, propname, val, iterpool));
           else
-            SVN_ERR(editor->change_file_prop(baton, key, val, iterpool));
+            SVN_ERR(editor->change_file_prop(baton, propname, val, iterpool));
         }
     }
 
@@ -234,14 +233,11 @@ drive(struct operation *operation,
   for (hi = apr_hash_first(pool, operation->children);
        hi; hi = apr_hash_next(hi))
     {
-      const void *key;
-      void *val;
-      struct operation *child;
+      const char *key = svn__apr_hash_index_key(hi);
+      struct operation *child = svn__apr_hash_index_val(hi);
       void *file_baton = NULL;
 
       svn_pool_clear(subpool);
-      apr_hash_this(hi, &key, NULL, &val);
-      child = val;
 
       /* Deletes and replacements are simple -- delete something. */
       if (child->operation == OP_DELETE || child->operation == OP_REPLACE)
@@ -284,22 +280,18 @@ drive(struct operation *operation,
           svn_txdelta_window_handler_t handler;
           void *handler_baton;
           svn_stream_t *contents;
-          apr_file_t *f = NULL;
 
           SVN_ERR(editor->apply_textdelta(file_baton, NULL, subpool,
                                           &handler, &handler_baton));
-          if (strcmp(child->src_file, "-"))
+          if (strcmp(child->src_file, "-") != 0)
             {
-              SVN_ERR(svn_io_file_open(&f, child->src_file, APR_READ,
-                                       APR_OS_DEFAULT, pool));
+              SVN_ERR(svn_stream_open_readonly(&contents, child->src_file,
+                                               pool, pool));
             }
           else
             {
-              apr_status_t apr_err = apr_file_open_stdin(&f, pool);
-              if (apr_err)
-                return svn_error_wrap_apr(apr_err, "Can't open stdin");
+              SVN_ERR(svn_stream_for_stdin(&contents, pool));
             }
-          contents = svn_stream_from_aprfile2(f, FALSE, pool);
           SVN_ERR(svn_txdelta_send_stream(contents, handler,
                                           handler_baton, NULL, pool));
         }
@@ -316,15 +308,12 @@ drive(struct operation *operation,
       /* If we opened, added, or replaced a directory, we need to
          recurse, apply outstanding propmods, and then close it. */
       if ((child->kind == svn_node_dir)
-          && (child->operation == OP_OPEN
-              || child->operation == OP_ADD
-              || child->operation == OP_REPLACE))
+          && child->operation != OP_DELETE)
         {
+          SVN_ERR(change_props(editor, child->baton, child, subpool));
+
           SVN_ERR(drive(child, head, editor, subpool));
-          if (child->kind == svn_node_dir)
-            {
-              SVN_ERR(change_props(editor, child->baton, child, subpool));
-            }
+
           SVN_ERR(editor->close_directory(child->baton, subpool));
         }
     }
@@ -766,12 +755,27 @@ execute(const apr_array_header_t *action
                               pool));
   SVN_ERR(svn_ra_open4(&session, NULL, anchor, NULL, ra_callbacks,
                        NULL, config, pool));
+  /* Open, then reparent to avoid AUTHZ errors when opening the reposroot */
   SVN_ERR(svn_ra_open4(&aux_session, NULL, anchor, NULL, ra_callbacks,
                        NULL, config, pool));
   SVN_ERR(svn_ra_get_repos_root2(aux_session, &repos_root, pool));
   SVN_ERR(svn_ra_reparent(aux_session, repos_root, pool));
-
   SVN_ERR(svn_ra_get_latest_revnum(session, &head, pool));
+
+  /* Reparent to ANCHOR's dir, if ANCHOR is not a directory. */
+  {
+    svn_node_kind_t kind;
+
+    SVN_ERR(svn_ra_check_path(aux_session,
+                              svn_uri_skip_ancestor(repos_root, anchor, pool),
+                              head, &kind, pool));
+    if (kind != svn_node_dir)
+      {
+        anchor = svn_uri_dirname(anchor, pool);
+        SVN_ERR(svn_ra_reparent(session, anchor, pool));
+      }
+  }
+
   if (SVN_IS_VALID_REVNUM(base_revision))
     {
       if (base_revision > head)
@@ -781,8 +785,13 @@ execute(const apr_array_header_t *action
       head = base_revision;
     }
 
+  memset(&root, 0, sizeof(root));
   root.children = apr_hash_make(pool);
   root.operation = OP_OPEN;
+  root.kind = svn_node_dir; /* For setting properties */
+  root.prop_mods = apr_hash_make(pool);
+  root.prop_dels = apr_array_make(pool, 1, sizeof(const char *));
+
   for (i = 0; i < actions->nelts; ++i)
     {
       struct action *action = APR_ARRAY_IDX(actions, i, struct action *);
@@ -845,11 +854,17 @@ execute(const apr_array_header_t *action
                                     commit_callback, NULL, NULL, FALSE, pool));
 
   SVN_ERR(editor->open_root(editor_baton, head, pool, &root.baton));
-  err = drive(&root, head, editor, pool);
+  err = change_props(editor, root.baton, &root, pool);
+  if (!err)
+    err = drive(&root, head, editor, pool);
+  if (!err)
+    err = editor->close_directory(root.baton, pool);
   if (!err)
     err = editor->close_edit(editor_baton, pool);
+
   if (err)
-    svn_error_clear(editor->abort_edit(editor_baton, pool));
+    err = svn_error_compose_create(err,
+                                   editor->abort_edit(editor_baton, pool));
 
   return err;
 }
@@ -861,11 +876,8 @@ read_propvalue_file(const svn_string_t *
 {
   svn_stringbuf_t *value;
   apr_pool_t *scratch_pool = svn_pool_create(pool);
-  apr_file_t *f;
 
-  SVN_ERR(svn_io_file_open(&f, filename, APR_READ | APR_BINARY | APR_BUFFERED,
-                           APR_OS_DEFAULT, scratch_pool));
-  SVN_ERR(svn_stringbuf_from_aprfile(&value, f, scratch_pool));
+  SVN_ERR(svn_stringbuf_from_file2(&value, filename, scratch_pool));
   *value_p = svn_string_create_from_buf(value, pool);
   svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
@@ -1133,7 +1145,7 @@ main(int argc, const char **argv)
     {
       int j, num_url_args;
       const char *action_string = APR_ARRAY_IDX(action_args, i, const char *);
-      struct action *action = apr_palloc(pool, sizeof(*action));
+      struct action *action = apr_pcalloc(pool, sizeof(*action));
 
       /* First, parse the action. */
       if (! strcmp(action_string, "mv"))
@@ -1195,8 +1207,8 @@ main(int argc, const char **argv)
       if (action->action == ACTION_PUT)
         {
           action->path[1] =
-            svn_dirent_canonicalize(APR_ARRAY_IDX(action_args, i,
-                                                  const char *), pool);
+            svn_dirent_internal_style(APR_ARRAY_IDX(action_args, i,
+                                                    const char *), pool);
           if (++i == action_args->nelts)
             insufficient(pool);
         }
@@ -1226,8 +1238,8 @@ main(int argc, const char **argv)
           else
             {
               const char *propval_file =
-                svn_dirent_canonicalize(APR_ARRAY_IDX(action_args, i,
-                                                      const char *), pool);
+                svn_dirent_internal_style(APR_ARRAY_IDX(action_args, i,
+                                                        const char *), pool);
 
               if (++i == action_args->nelts)
                 insufficient(pool);
@@ -1291,16 +1303,19 @@ main(int argc, const char **argv)
           url = sanitize_url(url, pool);
           action->path[j] = url;
 
-          /* The cp source could be the anchor, but the other URLs should be
-             children of the anchor. */
-          if (! (action->action == ACTION_CP && j == 0))
+          /* The first URL arguments to 'cp', 'pd', 'ps' could be the anchor,
+             but the other URLs should be children of the anchor. */
+          if (! (action->action == ACTION_CP && j == 0)
+              && action->action != ACTION_PROPDEL
+              && action->action != ACTION_PROPSET
+              && action->action != ACTION_PROPSETF)
             url = svn_uri_dirname(url, pool);
           if (! anchor)
             anchor = url;
           else
             anchor = svn_uri_get_longest_ancestor(anchor, url, pool);
 
-          if ((++i == action_args->nelts) && (j >= num_url_args))
+          if ((++i == action_args->nelts) && (j + 1 < num_url_args))
             insufficient(pool);
         }
       APR_ARRAY_PUSH(actions, struct action *) = action;



Mime
View raw message