subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1619127 [2/5] - in /subversion/branches/move-tracking-2: ./ build/generator/ notes/ notes/api-errata/1.8/ notes/api-errata/1.9/ subversion/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ sub...
Date Wed, 20 Aug 2014 15:31:36 GMT
Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_client/merge.c Wed Aug 20 15:31:32 2014
@@ -569,14 +569,16 @@ perform_obstruction_check(svn_wc_notify_
 }
 
 /* Create *LEFT and *RIGHT conflict versions for conflict victim
- * at VICTIM_ABSPATH, with kind NODE_KIND, using information obtained
- * from MERGE_SOURCE and TARGET.
+ * at VICTIM_ABSPATH, with merge-left node kind MERGE_LEFT_NODE_KIND
+ * and merge-right node kind MERGE_RIGHT_NODE_KIND, using information
+ * obtained from MERGE_SOURCE and TARGET.
  * Allocate returned conflict versions in RESULT_POOL. */
 static svn_error_t *
 make_conflict_versions(const svn_wc_conflict_version_t **left,
                        const svn_wc_conflict_version_t **right,
                        const char *victim_abspath,
-                       svn_node_kind_t node_kind,
+                       svn_node_kind_t merge_left_node_kind,
+                       svn_node_kind_t merge_right_node_kind,
                        const merge_source_t *merge_source,
                        const merge_target_t *target,
                        apr_pool_t *result_pool,
@@ -596,13 +598,15 @@ make_conflict_versions(const svn_wc_conf
             merge_source->loc1->repos_root_url,
             merge_source->loc1->repos_uuid,
             svn_relpath_join(left_relpath, child, scratch_pool),
-            merge_source->loc1->rev, node_kind, result_pool);
+            merge_source->loc1->rev,
+            merge_left_node_kind, result_pool);
 
   *right = svn_wc_conflict_version_create2(
              merge_source->loc2->repos_root_url,
              merge_source->loc2->repos_uuid,
              svn_relpath_join(right_relpath, child, scratch_pool),
-             merge_source->loc2->rev, node_kind, result_pool);
+             merge_source->loc2->rev,
+             merge_right_node_kind, result_pool);
 
   return SVN_NO_ERROR;
 }
@@ -1181,6 +1185,9 @@ struct merge_dir_baton_t
    */
   svn_wc_conflict_reason_t tree_conflict_reason;
   svn_wc_conflict_action_t tree_conflict_action;
+  svn_node_kind_t tree_conflict_local_node_kind;
+  svn_node_kind_t tree_conflict_merge_left_node_kind;
+  svn_node_kind_t tree_conflict_merge_right_node_kind;
 
   /* When TREE_CONFLICT_REASON is CONFLICT_REASON_SKIP, the skip state to
      add to the notification */
@@ -1201,7 +1208,7 @@ struct merge_dir_baton_t
   apr_hash_t *pending_deletes;
 
   /* NULL, or an hashtable mapping const char * LOCAL_ABSPATHs to
-     a const svn_wc_conflict_description3_t * instance, describing the just
+     a const svn_wc_conflict_description2_t * instance, describing the just
      installed conflict */
   apr_hash_t *new_tree_conflicts;
 
@@ -1232,6 +1239,9 @@ struct merge_file_baton_t
      merge_tree_baton_t for an explanation. */
   svn_wc_conflict_reason_t tree_conflict_reason;
   svn_wc_conflict_action_t tree_conflict_action;
+  svn_node_kind_t tree_conflict_local_node_kind;
+  svn_node_kind_t tree_conflict_merge_left_node_kind;
+  svn_node_kind_t tree_conflict_merge_right_node_kind;
 
   /* When TREE_CONFLICT_REASON is CONFLICT_REASON_SKIP, the skip state to
      add to the notification */
@@ -1292,8 +1302,6 @@ record_skip(merge_cmd_baton_t *merge_b,
  * The tree conflict, with its victim specified by VICTIM_PATH, is
  * assumed to have happened during a merge using merge baton MERGE_B.
  *
- * NODE_KIND must be the node kind of "old" and "theirs" and "mine";
- * this function cannot cope with node kind clashes.
  * ACTION and REASON correspond to the fields
  * of the same names in svn_wc_tree_conflict_description_t.
  */
@@ -1301,10 +1309,12 @@ static svn_error_t *
 record_tree_conflict(merge_cmd_baton_t *merge_b,
                      const char *local_abspath,
                      struct merge_dir_baton_t *parent_baton,
-                     svn_node_kind_t node_kind,
+                     svn_node_kind_t local_node_kind,
+                     svn_node_kind_t merge_left_node_kind,
+                     svn_node_kind_t merge_right_node_kind,
                      svn_wc_conflict_action_t action,
                      svn_wc_conflict_reason_t reason,
-                     const svn_wc_conflict_description3_t *existing_conflict,
+                     const svn_wc_conflict_description2_t *existing_conflict,
                      svn_boolean_t notify_tc,
                      apr_pool_t *scratch_pool)
 {
@@ -1324,7 +1334,7 @@ record_tree_conflict(merge_cmd_baton_t *
 
   if (!merge_b->dry_run)
     {
-       svn_wc_conflict_description3_t *conflict;
+       svn_wc_conflict_description2_t *conflict;
        const svn_wc_conflict_version_t *left;
        const svn_wc_conflict_version_t *right;
        apr_pool_t *result_pool = parent_baton ? parent_baton->pool
@@ -1355,7 +1365,9 @@ record_tree_conflict(merge_cmd_baton_t *
             reason = svn_wc_conflict_reason_moved_here;
         }
 
-      SVN_ERR(make_conflict_versions(&left, &right, local_abspath, node_kind,
+      SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
+                                     merge_left_node_kind,
+                                     merge_right_node_kind,
                                      &merge_b->merge_source, merge_b->target,
                                      result_pool, scratch_pool));
 
@@ -1363,8 +1375,9 @@ record_tree_conflict(merge_cmd_baton_t *
       if (existing_conflict != NULL && existing_conflict->src_left_version)
           left = existing_conflict->src_left_version;
 
-      conflict = svn_wc_conflict_description_create_tree3(
-                        local_abspath, node_kind, svn_wc_operation_merge,
+      conflict = svn_wc_conflict_description_create_tree2(
+                        local_abspath, local_node_kind,
+                        svn_wc_operation_merge,
                         left, right, result_pool);
 
       conflict->action = action;
@@ -1400,7 +1413,7 @@ record_tree_conflict(merge_cmd_baton_t *
 
       notify = svn_wc_create_notify(local_abspath, svn_wc_notify_tree_conflict,
                                     scratch_pool);
-      notify->kind = node_kind;
+      notify->kind = local_node_kind;
 
       (*merge_b->ctx->notify_func2)(merge_b->ctx->notify_baton2, notify,
                                     scratch_pool);
@@ -1621,7 +1634,10 @@ mark_dir_edited(merge_cmd_baton_t *merge
       /* open_directory() decided that a tree conflict should be raised */
 
       SVN_ERR(record_tree_conflict(merge_b, local_abspath, db->parent_baton,
-                                   svn_node_dir, db->tree_conflict_action,
+                                   db->tree_conflict_local_node_kind,
+                                   db->tree_conflict_merge_left_node_kind,
+                                   db->tree_conflict_merge_right_node_kind,
+                                   db->tree_conflict_action,
                                    db->tree_conflict_reason,
                                    NULL, TRUE,
                                    scratch_pool));
@@ -1700,7 +1716,10 @@ mark_file_edited(merge_cmd_baton_t *merg
       /* open_file() decided that a tree conflict should be raised */
 
       SVN_ERR(record_tree_conflict(merge_b, local_abspath, fb->parent_baton,
-                                   svn_node_file, fb->tree_conflict_action,
+                                   fb->tree_conflict_local_node_kind,
+                                   fb->tree_conflict_merge_left_node_kind,
+                                   fb->tree_conflict_merge_right_node_kind,
+                                   fb->tree_conflict_action,
                                    fb->tree_conflict_reason,
                                    NULL, TRUE,
                                    scratch_pool));
@@ -1740,6 +1759,16 @@ merge_file_opened(void **new_file_baton,
   fb->tree_conflict_action = svn_wc_conflict_action_edit;
   fb->skip_reason = svn_wc_notify_state_unknown;
 
+  if (left_source)
+    fb->tree_conflict_merge_left_node_kind = svn_node_file;
+  else
+    fb->tree_conflict_merge_left_node_kind = svn_node_none;
+
+  if (right_source)
+    fb->tree_conflict_merge_right_node_kind = svn_node_file;
+  else
+    fb->tree_conflict_merge_right_node_kind = svn_node_none;
+
   *new_file_baton = fb;
 
   if (pdb)
@@ -1756,7 +1785,6 @@ merge_file_opened(void **new_file_baton,
   else if (left_source != NULL)
     {
       /* Node is expected to be a file, which will be changed or deleted. */
-      svn_node_kind_t kind;
       svn_boolean_t is_deleted;
       svn_boolean_t excluded;
       svn_depth_t parent_depth;
@@ -1768,7 +1796,8 @@ merge_file_opened(void **new_file_baton,
         svn_wc_notify_state_t obstr_state;
 
         SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &excluded,
-                                          &kind, &parent_depth,
+                                          &fb->tree_conflict_local_node_kind,
+                                          &parent_depth,
                                           merge_b, local_abspath,
                                           scratch_pool));
 
@@ -1781,10 +1810,10 @@ merge_file_opened(void **new_file_baton,
           }
 
         if (is_deleted)
-          kind = svn_node_none;
+          fb->tree_conflict_local_node_kind = svn_node_none;
       }
 
-      if (kind == svn_node_none)
+      if (fb->tree_conflict_local_node_kind == svn_node_none)
         {
           fb->shadowed = TRUE;
 
@@ -1818,7 +1847,7 @@ merge_file_opened(void **new_file_baton,
           return SVN_NO_ERROR;
           /* ### /Similar */
         }
-      else if (kind != svn_node_file)
+      else if (fb->tree_conflict_local_node_kind != svn_node_file)
         {
           fb->shadowed = TRUE;
 
@@ -1853,7 +1882,7 @@ merge_file_opened(void **new_file_baton,
     }
   else
     {
-      const svn_wc_conflict_description3_t *old_tc = NULL;
+      const svn_wc_conflict_description2_t *old_tc = NULL;
 
       /* The node doesn't exist pre-merge: We have an addition */
       fb->added = TRUE;
@@ -1877,6 +1906,8 @@ merge_file_opened(void **new_file_baton,
 
           /* Update the tree conflict to store that this is a replace */
           SVN_ERR(record_tree_conflict(merge_b, local_abspath, pdb,
+                                       old_tc->node_kind,
+                                       old_tc->src_left_version->node_kind,
                                        svn_node_file,
                                        fb->tree_conflict_action,
                                        fb->tree_conflict_reason,
@@ -1903,12 +1934,11 @@ merge_file_opened(void **new_file_baton,
                   && ((pdb && pdb->added) || fb->add_is_replace)))
         {
           svn_wc_notify_state_t obstr_state;
-          svn_node_kind_t kind;
           svn_boolean_t is_deleted;
 
           SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, NULL,
-                                            &kind, NULL,
-                                            merge_b, local_abspath,
+                                            &fb->tree_conflict_local_node_kind,
+                                            NULL, merge_b, local_abspath,
                                             scratch_pool));
 
           if (obstr_state != svn_wc_notify_state_inapplicable)
@@ -1918,7 +1948,8 @@ merge_file_opened(void **new_file_baton,
               fb->tree_conflict_reason = CONFLICT_REASON_SKIP;
               fb->skip_reason = obstr_state;
             }
-          else if (kind != svn_node_none && !is_deleted)
+          else if (fb->tree_conflict_local_node_kind != svn_node_none
+                   && !is_deleted)
             {
               /* Set a tree conflict */
               fb->shadowed = TRUE;
@@ -1997,7 +2028,8 @@ merge_file_changed(const char *relpath,
                                       scratch_pool, scratch_pool));
 
   SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
-                                 svn_node_file, &merge_b->merge_source, merge_b->target,
+                                 svn_node_file, svn_node_file,
+                                 &merge_b->merge_source, merge_b->target,
                                  scratch_pool, scratch_pool));
 
   /* Do property merge now, if we are not going to perform a text merge */
@@ -2422,6 +2454,8 @@ merge_file_deleted(const char *relpath,
        */
       SVN_ERR(record_tree_conflict(merge_b, local_abspath, fb->parent_baton,
                                    svn_node_file,
+                                   svn_node_file,
+                                   svn_node_none,
                                    svn_wc_conflict_action_delete,
                                    svn_wc_conflict_reason_edited,
                                    NULL, TRUE,
@@ -2472,6 +2506,16 @@ merge_dir_opened(void **new_dir_baton,
 
   *new_dir_baton = db;
 
+  if (left_source)
+    db->tree_conflict_merge_left_node_kind = svn_node_dir;
+  else
+    db->tree_conflict_merge_left_node_kind = svn_node_none;
+
+  if (right_source)
+    db->tree_conflict_merge_right_node_kind = svn_node_dir;
+  else
+    db->tree_conflict_merge_right_node_kind = svn_node_none;
+
   if (pdb)
     {
       db->parent_baton = pdb;
@@ -2488,7 +2532,6 @@ merge_dir_opened(void **new_dir_baton,
   else if (left_source != NULL)
     {
       /* Node is expected to be a directory. */
-      svn_node_kind_t kind;
       svn_boolean_t is_deleted;
       svn_boolean_t excluded;
       svn_depth_t parent_depth;
@@ -2500,9 +2543,9 @@ merge_dir_opened(void **new_dir_baton,
       {
         svn_wc_notify_state_t obstr_state;
         SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &excluded,
-                                          &kind, &parent_depth,
-                                          merge_b, local_abspath,
-                                          scratch_pool));
+                                          &db->tree_conflict_local_node_kind,
+                                          &parent_depth, merge_b,
+                                          local_abspath, scratch_pool));
 
         if (obstr_state != svn_wc_notify_state_inapplicable)
           {
@@ -2537,10 +2580,10 @@ merge_dir_opened(void **new_dir_baton,
           }
 
         if (is_deleted)
-          kind = svn_node_none;
+          db->tree_conflict_local_node_kind = svn_node_none;
       }
 
-      if (kind == svn_node_none)
+      if (db->tree_conflict_local_node_kind == svn_node_none)
         {
           db->shadowed = TRUE;
 
@@ -2576,7 +2619,7 @@ merge_dir_opened(void **new_dir_baton,
           return SVN_NO_ERROR;
           /* ### /avoid breaking tests */
         }
-      else if (kind != svn_node_dir)
+      else if (db->tree_conflict_local_node_kind != svn_node_dir)
         {
           db->shadowed = TRUE;
 
@@ -2629,7 +2672,7 @@ merge_dir_opened(void **new_dir_baton,
     }
   else
     {
-      const svn_wc_conflict_description3_t *old_tc = NULL;
+      const svn_wc_conflict_description2_t *old_tc = NULL;
 
       /* The node doesn't exist pre-merge: We have an addition */
       db->added = TRUE;
@@ -2667,6 +2710,8 @@ merge_dir_opened(void **new_dir_baton,
 
               /* Update the tree conflict to store that this is a replace */
               SVN_ERR(record_tree_conflict(merge_b, local_abspath, pdb,
+                                           old_tc->node_kind,
+                                           old_tc->src_left_version->node_kind,
                                            svn_node_dir,
                                            db->tree_conflict_action,
                                            db->tree_conflict_reason,
@@ -2681,12 +2726,11 @@ merge_dir_opened(void **new_dir_baton,
              && ((pdb && pdb->added) || db->add_is_replace)))
         {
           svn_wc_notify_state_t obstr_state;
-          svn_node_kind_t kind;
           svn_boolean_t is_deleted;
 
           SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, NULL,
-                                            &kind, NULL,
-                                            merge_b, local_abspath,
+                                            &db->tree_conflict_local_node_kind,
+                                            NULL, merge_b, local_abspath,
                                             scratch_pool));
 
           /* In this case of adding a directory, we have an exception to the
@@ -2696,7 +2740,8 @@ merge_dir_opened(void **new_dir_baton,
            * versioned but unexpectedly missing from disk, or is unversioned
            * but obstructed by a node of the wrong kind. */
           if (obstr_state == svn_wc_notify_state_obstructed
-              && (is_deleted || kind == svn_node_none))
+              && (is_deleted ||
+                  db->tree_conflict_local_node_kind == svn_node_none))
             {
               svn_node_kind_t disk_kind;
 
@@ -2717,7 +2762,8 @@ merge_dir_opened(void **new_dir_baton,
               db->tree_conflict_reason = CONFLICT_REASON_SKIP;
               db->skip_reason = obstr_state;
             }
-          else if (kind != svn_node_none && !is_deleted)
+          else if (db->tree_conflict_local_node_kind != svn_node_none
+                   && !is_deleted)
             {
               /* Set a tree conflict */
               db->shadowed = TRUE;
@@ -2796,6 +2842,8 @@ merge_dir_opened(void **new_dir_baton,
             {
               /* ### Should be atomic with svn_wc_add(4|_from_disk2)() */
               SVN_ERR(record_tree_conflict(merge_b, local_abspath, pdb,
+                                           old_tc->node_kind,
+                                           svn_node_none,
                                            svn_node_dir,
                                            db->tree_conflict_action,
                                            db->tree_conflict_reason,
@@ -2864,7 +2912,8 @@ merge_dir_changed(const char *relpath,
       svn_wc_notify_state_t prop_state;
 
       SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
-                                     svn_node_dir, &merge_b->merge_source,
+                                     svn_node_dir, svn_node_dir,
+                                     &merge_b->merge_source,
                                      merge_b->target,
                                      scratch_pool, scratch_pool));
 
@@ -3212,6 +3261,8 @@ merge_dir_deleted(const char *relpath,
        */
       SVN_ERR(record_tree_conflict(merge_b, local_abspath, db->parent_baton,
                                    svn_node_dir,
+                                   svn_node_dir,
+                                   svn_node_none,
                                    svn_wc_conflict_action_delete,
                                    svn_wc_conflict_reason_edited,
                                    NULL, TRUE,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/svndiff.c Wed Aug 20 15:31:32 2014
@@ -578,6 +578,10 @@ decode_window(svn_txdelta_window_t *wind
   return SVN_NO_ERROR;
 }
 
+static const char SVNDIFF_V0[] = { 'S', 'V', 'N', 0 };
+static const char SVNDIFF_V1[] = { 'S', 'V', 'N', 1 };
+#define SVNDIFF_HEADER_SIZE (sizeof(SVNDIFF_V0))
+
 static svn_error_t *
 write_handler(void *baton,
               const char *buffer,
@@ -590,14 +594,14 @@ write_handler(void *baton,
   apr_size_t buflen = *len;
 
   /* Chew up four bytes at the beginning for the header.  */
-  if (db->header_bytes < 4)
+  if (db->header_bytes < SVNDIFF_HEADER_SIZE)
     {
-      apr_size_t nheader = 4 - db->header_bytes;
+      apr_size_t nheader = SVNDIFF_HEADER_SIZE - db->header_bytes;
       if (nheader > buflen)
         nheader = buflen;
-      if (memcmp(buffer, "SVN\0" + db->header_bytes, nheader) == 0)
+      if (memcmp(buffer, SVNDIFF_V0 + db->header_bytes, nheader) == 0)
         db->version = 0;
-      else if (memcmp(buffer, "SVN\1" + db->header_bytes, nheader) == 0)
+      else if (memcmp(buffer, SVNDIFF_V1 + db->header_bytes, nheader) == 0)
         db->version = 1;
       else
         return svn_error_create(SVN_ERR_SVNDIFF_INVALID_HEADER, NULL,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/text_delta.c Wed Aug 20 15:31:32 2014
@@ -623,68 +623,27 @@ size_buffer(char **buf, apr_size_t *buf_
   return SVN_NO_ERROR;
 }
 
-/* Copy LEN bytes from SOURCE to TARGET, optimizing for the case where LEN
- * is often very small.  Return a pointer to the first byte after the copied
- * target range, unlike standard memcpy(), as a potential further
- * optimization for the caller.
- *
- * memcpy() is hard to tune for a wide range of buffer lengths.  Therefore,
- * it is often tuned for high throughput on large buffers and relatively
- * low latency for mid-sized buffers (tens of bytes).  However, the overhead
- * for very small buffers (<10 bytes) is still high.  Even passing the
- * parameters, for instance, may take as long as copying 3 bytes.
- *
- * Because short copy sequences seem to be a common case, at least in
- * "format 2" FSFS repositories, we copy them directly.  Larger buffer sizes
- * aren't hurt measurably by the exta 'if' clause.  */
-static APR_INLINE char *
-fast_memcpy(char *target, const char *source, apr_size_t len)
-{
-  if (len > 7)
-    {
-      memcpy(target, source, len);
-      target += len;
-    }
-  else
-    {
-      /* memcpy is not exactly fast for small block sizes.
-       * Since they are common, let's run optimized code for them. */
-      const char *end = source + len;
-      for (; source != end; source++)
-        *(target++) = *source;
-    }
-
-  return target;
-}
-
 /* Copy LEN bytes from SOURCE to TARGET.  Unlike memmove() or memcpy(),
  * create repeating patterns if the source and target ranges overlap.
  * Return a pointer to the first byte after the copied target range.  */
 static APR_INLINE char *
 patterning_copy(char *target, const char *source, apr_size_t len)
 {
-  const char *end = source + len;
-
-  /* On many machines, we can do "chunky" copies. */
-
-#if SVN_UNALIGNED_ACCESS_IS_OK
-
-  if (source + sizeof(apr_uint32_t) <= target)
-    {
-      /* Source and target are at least 4 bytes apart, so we can copy in
-       * 4-byte chunks.  */
-      for (; source + sizeof(apr_uint32_t) <= end;
-           source += sizeof(apr_uint32_t),
-           target += sizeof(apr_uint32_t))
-      *(apr_uint32_t *)(target) = *(apr_uint32_t *)(source);
+  /* If the source and target overlap, repeat the overlapping pattern
+     in the target buffer. Always copy from the source buffer because
+     presumably it will be in the L1 cache after the first iteration
+     and doing this should avoid pipeline stalls due to write/read
+     dependencies. */
+  const apr_size_t overlap = target - source;
+  while (len > overlap)
+    {
+      target = memcpy(target, source, overlap);
+      len -= overlap;
     }
 
-#endif
-
-  /* fall through to byte-wise copy (either for the below-chunk-size tail
-   * or the whole copy) */
-  for (; source != end; source++)
-    *(target++) = *source;
+  /* Copy any remaining source pattern. */
+  if (len)
+    target = memcpy(target, source, len);
 
   return target;
 }
@@ -711,7 +670,7 @@ svn_txdelta_apply_instructions(svn_txdel
           /* Copy from source area.  */
           assert(sbuf);
           assert(op->offset + op->length <= window->sview_len);
-          fast_memcpy(tbuf + tpos, sbuf + op->offset, buf_len);
+          memcpy(tbuf + tpos, sbuf + op->offset, buf_len);
           break;
 
         case svn_txdelta_target:
@@ -728,9 +687,9 @@ svn_txdelta_apply_instructions(svn_txdel
         case svn_txdelta_new:
           /* Copy from window new area.  */
           assert(op->offset + op->length <= window->new_data->len);
-          fast_memcpy(tbuf + tpos,
-                      window->new_data->data + op->offset,
-                      buf_len);
+          memcpy(tbuf + tpos,
+                 window->new_data->data + op->offset,
+                 buf_len);
           break;
 
         default:
@@ -747,20 +706,6 @@ svn_txdelta_apply_instructions(svn_txdel
   *tlen = tpos;
 }
 
-/* This is a private interlibrary compatibility wrapper. */
-void
-svn_txdelta__apply_instructions(svn_txdelta_window_t *window,
-                                const char *sbuf, char *tbuf,
-                                apr_size_t *tlen);
-void
-svn_txdelta__apply_instructions(svn_txdelta_window_t *window,
-                                const char *sbuf, char *tbuf,
-                                apr_size_t *tlen)
-{
-  svn_txdelta_apply_instructions(window, sbuf, tbuf, tlen);
-}
-
-
 /* Apply WINDOW to the streams given by APPL.  */
 static svn_error_t *
 apply_window(svn_txdelta_window_t *window, void *baton)

Modified: subversion/branches/move-tracking-2/subversion/libsvn_diff/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_diff/deprecated.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_diff/deprecated.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_diff/deprecated.c Wed Aug 20 15:31:32 2014
@@ -271,6 +271,31 @@ svn_diff_file_output_merge(svn_stream_t 
                                      pool);
 }
 
+svn_error_t *
+svn_diff_file_output_merge2(svn_stream_t *output_stream,
+                            svn_diff_t *diff,
+                            const char *original_path,
+                            const char *modified_path,
+                            const char *latest_path,
+                            const char *conflict_original,
+                            const char *conflict_modified,
+                            const char *conflict_latest,
+                            const char *conflict_separator,
+                            svn_diff_conflict_display_style_t conflict_style,
+                            apr_pool_t *pool)
+{
+  return svn_error_trace(svn_diff_file_output_merge3(output_stream,
+                                                     diff, original_path,
+                                                     modified_path,
+                                                     latest_path,
+                                                     conflict_original,
+                                                     conflict_modified,
+                                                     conflict_latest,
+                                                     conflict_separator,
+                                                     conflict_style,
+                                                     NULL, NULL, /* cancel */
+                                                     pool));
+}
 
 /*** From diff.c ***/
 svn_error_t *
@@ -326,3 +351,114 @@ svn_diff_output(svn_diff_t *diff,
                                           NULL, NULL /* cancel */));
 }
 
+/*** From diff_memory.c ***/
+svn_error_t *
+svn_diff_mem_string_output_merge(svn_stream_t *output_stream,
+                                 svn_diff_t *diff,
+                                 const svn_string_t *original,
+                                 const svn_string_t *modified,
+                                 const svn_string_t *latest,
+                                 const char *conflict_original,
+                                 const char *conflict_modified,
+                                 const char *conflict_latest,
+                                 const char *conflict_separator,
+                                 svn_boolean_t display_original_in_conflict,
+                                 svn_boolean_t display_resolved_conflicts,
+                                 apr_pool_t *pool)
+{
+  svn_diff_conflict_display_style_t style =
+    svn_diff_conflict_display_modified_latest;
+
+  if (display_resolved_conflicts)
+    style = svn_diff_conflict_display_resolved_modified_latest;
+
+  if (display_original_in_conflict)
+    style = svn_diff_conflict_display_modified_original_latest;
+
+  return svn_diff_mem_string_output_merge2(output_stream,
+                                           diff,
+                                           original,
+                                           modified,
+                                           latest,
+                                           conflict_original,
+                                           conflict_modified,
+                                           conflict_latest,
+                                           conflict_separator,
+                                           style,
+                                           pool);
+}
+
+svn_error_t *
+svn_diff_mem_string_output_merge2(svn_stream_t *output_stream,
+                                  svn_diff_t *diff,
+                                  const svn_string_t *original,
+                                  const svn_string_t *modified,
+                                  const svn_string_t *latest,
+                                  const char *conflict_original,
+                                  const char *conflict_modified,
+                                  const char *conflict_latest,
+                                  const char *conflict_separator,
+                                  svn_diff_conflict_display_style_t style,
+                                  apr_pool_t *pool)
+{
+  return svn_error_trace(svn_diff_mem_string_output_merge3(output_stream, diff,
+                                                           original,
+                                                           modified, latest,
+                                                           conflict_original,
+                                                           conflict_modified,
+                                                           conflict_latest,
+                                                           conflict_separator,
+                                                           style,
+                                                           /* no cancelation */
+                                                           NULL, NULL,
+                                                           pool));
+}
+
+svn_error_t *
+svn_diff_mem_string_output_unified(svn_stream_t *output_stream,
+                                   svn_diff_t *diff,
+                                   const char *original_header,
+                                   const char *modified_header,
+                                   const char *header_encoding,
+                                   const svn_string_t *original,
+                                   const svn_string_t *modified,
+                                   apr_pool_t *pool)
+{
+  return svn_error_trace(svn_diff_mem_string_output_unified2(output_stream,
+                                                             diff,
+                                                             TRUE,
+                                                             NULL,
+                                                             original_header,
+                                                             modified_header,
+                                                             header_encoding,
+                                                             original,
+                                                             modified,
+                                                             pool));
+}
+
+svn_error_t *
+svn_diff_mem_string_output_unified2(svn_stream_t *output_stream,
+                                    svn_diff_t *diff,
+                                    svn_boolean_t with_diff_header,
+                                    const char *hunk_delimiter,
+                                    const char *original_header,
+                                    const char *modified_header,
+                                    const char *header_encoding,
+                                    const svn_string_t *original,
+                                    const svn_string_t *modified,
+                                    apr_pool_t *pool)
+{
+  return svn_error_trace(svn_diff_mem_string_output_unified3(output_stream,
+                                                             diff,
+                                                             with_diff_header,
+                                                             hunk_delimiter,
+                                                             original_header,
+                                                             modified_header,
+                                                             header_encoding,
+                                                             original,
+                                                             modified,
+                                                             -1 /* context */,
+                                                             /* cancel */
+                                                             NULL, NULL,
+                                                             pool));
+}

Modified: subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_file.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_file.c Wed Aug 20 15:31:32 2014
@@ -1852,7 +1852,7 @@ svn_diff_file_output_unified4(svn_stream
       baton.hunk = svn_stringbuf_create_empty(pool);
       baton.show_c_function = show_c_function;
       baton.extra_context = svn_stringbuf_create_empty(pool);
-      baton.context_size = (context_size > 0) ? context_size
+      baton.context_size = (context_size >= 0) ? context_size
                                               : SVN_DIFF__UNIFIED_CONTEXT_SIZE;
 
       if (show_c_function)
@@ -1968,10 +1968,14 @@ context_saver_stream_write(void *baton,
                            apr_size_t *len)
 {
   context_saver_t *cs = baton;
-  cs->data[cs->next_slot] = data;
-  cs->len[cs->next_slot] = *len;
-  cs->next_slot = (cs->next_slot + 1) % cs->context_size;
-  cs->total_written++;
+
+  if (cs->context_size > 0)
+    {
+      cs->data[cs->next_slot] = data;
+      cs->len[cs->next_slot] = *len;
+      cs->next_slot = (cs->next_slot + 1) % cs->context_size;
+      cs->total_written++;
+    }
   return SVN_NO_ERROR;
 }
 
@@ -1998,6 +2002,10 @@ typedef struct svn_diff3__file_output_ba
   svn_diff_conflict_display_style_t conflict_style;
   int context_size;
 
+  /* cancel support */
+  svn_cancel_func_t cancel_func;
+  void *cancel_baton;
+
   /* The rest of the fields are for
      svn_diff_conflict_display_only_conflicts only.  Note that for
      these batons, OUTPUT_STREAM is either CONTEXT_SAVER->STREAM or
@@ -2296,8 +2304,10 @@ output_conflict(void *baton,
   if (style == svn_diff_conflict_display_resolved_modified_latest)
     {
       if (diff)
-        return svn_diff_output(diff, baton,
-                               &svn_diff3__file_output_vtable);
+        return svn_diff_output2(diff, baton,
+                                &svn_diff3__file_output_vtable,
+                                file_baton->cancel_func,
+                                file_baton->cancel_baton);
       else
         style = svn_diff_conflict_display_modified_latest;
     }
@@ -2340,7 +2350,7 @@ output_conflict(void *baton,
 }
 
 svn_error_t *
-svn_diff_file_output_merge2(svn_stream_t *output_stream,
+svn_diff_file_output_merge3(svn_stream_t *output_stream,
                             svn_diff_t *diff,
                             const char *original_path,
                             const char *modified_path,
@@ -2350,6 +2360,8 @@ svn_diff_file_output_merge2(svn_stream_t
                             const char *conflict_latest,
                             const char *conflict_separator,
                             svn_diff_conflict_display_style_t style,
+                            svn_cancel_func_t cancel_func,
+                            void *cancel_baton,
                             apr_pool_t *pool)
 {
   svn_diff3__file_output_baton_t baton;
@@ -2421,8 +2433,12 @@ svn_diff_file_output_merge2(svn_stream_t
     eol = APR_EOL_STR;
   baton.marker_eol = eol;
 
-  SVN_ERR(svn_diff_output(diff, &baton,
-                          &svn_diff3__file_output_vtable));
+  baton.cancel_func = cancel_func;
+  baton.cancel_baton = cancel_baton;
+
+  SVN_ERR(svn_diff_output2(diff, &baton,
+                          &svn_diff3__file_output_vtable,
+                          cancel_func, cancel_baton));
 
   for (idx = 0; idx < 3; idx++)
     {

Modified: subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_memory.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_diff/diff_memory.c Wed Aug 20 15:31:32 2014
@@ -610,7 +610,7 @@ static const svn_diff_output_fns_t mem_o
 
 
 svn_error_t *
-svn_diff_mem_string_output_unified2(svn_stream_t *output_stream,
+svn_diff_mem_string_output_unified3(svn_stream_t *output_stream,
                                     svn_diff_t *diff,
                                     svn_boolean_t with_diff_header,
                                     const char *hunk_delimiter,
@@ -619,6 +619,9 @@ svn_diff_mem_string_output_unified2(svn_
                                     const char *header_encoding,
                                     const svn_string_t *original,
                                     const svn_string_t *modified,
+                                    int context_size,
+                                    svn_cancel_func_t cancel_func,
+                                    void *cancel_baton,
                                     apr_pool_t *pool)
 {
 
@@ -636,7 +639,8 @@ svn_diff_mem_string_output_unified2(svn_
         = (hunk_delimiter == NULL || strcmp(hunk_delimiter, "##") != 0)
           ? APR_EOL_STR SVN_DIFF__NO_NEWLINE_AT_END_OF_FILE APR_EOL_STR
           : APR_EOL_STR SVN_DIFF__NO_NEWLINE_AT_END_OF_PROPERTY APR_EOL_STR;
-      baton.context_size = SVN_DIFF__UNIFIED_CONTEXT_SIZE;
+      baton.context_size = context_size >= 0 ? context_size
+                                             : SVN_DIFF__UNIFIED_CONTEXT_SIZE;
 
       SVN_ERR(svn_utf_cstring_from_utf8_ex2
               (&(baton.prefix_str[unified_output_context]), " ",
@@ -658,8 +662,9 @@ svn_diff_mem_string_output_unified2(svn_
                     original_header, modified_header, pool));
         }
 
-      SVN_ERR(svn_diff_output(diff, &baton,
-                              &mem_output_unified_vtable));
+      SVN_ERR(svn_diff_output2(diff, &baton,
+                              &mem_output_unified_vtable,
+                              cancel_func, cancel_baton));
 
       SVN_ERR(output_unified_flush_hunk(&baton, hunk_delimiter));
 
@@ -669,28 +674,6 @@ svn_diff_mem_string_output_unified2(svn_
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_diff_mem_string_output_unified(svn_stream_t *output_stream,
-                                   svn_diff_t *diff,
-                                   const char *original_header,
-                                   const char *modified_header,
-                                   const char *header_encoding,
-                                   const svn_string_t *original,
-                                   const svn_string_t *modified,
-                                   apr_pool_t *pool)
-{
-  SVN_ERR(svn_diff_mem_string_output_unified2(output_stream,
-                                              diff,
-                                              TRUE,
-                                              NULL,
-                                              original_header,
-                                              modified_header,
-                                              header_encoding,
-                                              original,
-                                              modified,
-                                              pool));
-  return SVN_NO_ERROR;
-}
 
 
 
@@ -739,6 +722,10 @@ typedef struct merge_output_baton_t
   svn_diff_conflict_display_style_t conflict_style;
   int context_size;
 
+  /* cancel support */
+  svn_cancel_func_t cancel_func;
+  void *cancel_baton;
+
   /* The rest of the fields are for
      svn_diff_conflict_display_only_conflicts only.  Note that for
      these batons, OUTPUT_STREAM is either CONTEXT_SAVER->STREAM or
@@ -923,7 +910,8 @@ output_conflict(void *baton,
   if (style == svn_diff_conflict_display_resolved_modified_latest)
     {
       if (diff)
-        return svn_diff_output(diff, baton, &merge_output_vtable);
+        return svn_diff_output2(diff, baton, &merge_output_vtable,
+                                btn->cancel_func, btn->cancel_baton);
       else
         style = svn_diff_conflict_display_modified_latest;
     }
@@ -1066,7 +1054,7 @@ detect_eol(svn_string_t *token)
 }
 
 svn_error_t *
-svn_diff_mem_string_output_merge2(svn_stream_t *output_stream,
+svn_diff_mem_string_output_merge3(svn_stream_t *output_stream,
                                   svn_diff_t *diff,
                                   const svn_string_t *original,
                                   const svn_string_t *modified,
@@ -1076,6 +1064,8 @@ svn_diff_mem_string_output_merge2(svn_st
                                   const char *conflict_latest,
                                   const char *conflict_separator,
                                   svn_diff_conflict_display_style_t style,
+                                  svn_cancel_func_t cancel_func,
+                                  void *cancel_baton,
                                   apr_pool_t *pool)
 {
   merge_output_baton_t btn;
@@ -1113,6 +1103,8 @@ svn_diff_mem_string_output_merge2(svn_st
     eol = APR_EOL_STR;  /* use the platform default */
 
   btn.marker_eol = eol;
+  btn.cancel_func = cancel_func;
+  btn.cancel_baton = cancel_baton;
 
   SVN_ERR(svn_utf_cstring_from_utf8(&btn.markers[1],
                                     conflict_modified
@@ -1135,45 +1127,9 @@ svn_diff_mem_string_output_merge2(svn_st
                                     : ">>>>>>> (latest)",
                                     pool));
 
-  SVN_ERR(svn_diff_output(diff, &btn, vtable));
+  SVN_ERR(svn_diff_output2(diff, &btn, vtable, cancel_func, cancel_baton));
   if (conflicts_only)
     svn_pool_destroy(btn.pool);
 
   return SVN_NO_ERROR;
 }
-
-svn_error_t *
-svn_diff_mem_string_output_merge(svn_stream_t *output_stream,
-                                 svn_diff_t *diff,
-                                 const svn_string_t *original,
-                                 const svn_string_t *modified,
-                                 const svn_string_t *latest,
-                                 const char *conflict_original,
-                                 const char *conflict_modified,
-                                 const char *conflict_latest,
-                                 const char *conflict_separator,
-                                 svn_boolean_t display_original_in_conflict,
-                                 svn_boolean_t display_resolved_conflicts,
-                                 apr_pool_t *pool)
-{
-  svn_diff_conflict_display_style_t style =
-    svn_diff_conflict_display_modified_latest;
-
-  if (display_resolved_conflicts)
-    style = svn_diff_conflict_display_resolved_modified_latest;
-
-  if (display_original_in_conflict)
-    style = svn_diff_conflict_display_modified_original_latest;
-
-  return svn_diff_mem_string_output_merge2(output_stream,
-                                           diff,
-                                           original,
-                                           modified,
-                                           latest,
-                                           conflict_original,
-                                           conflict_modified,
-                                           conflict_latest,
-                                           conflict_separator,
-                                           style,
-                                           pool);
-}

Modified: subversion/branches/move-tracking-2/subversion/libsvn_diff/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_diff/util.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_diff/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_diff/util.c Wed Aug 20 15:31:32 2014
@@ -516,6 +516,9 @@ svn_diff__display_prop_diffs(svn_stream_
                              const apr_array_header_t *propchanges,
                              apr_hash_t *original_props,
                              svn_boolean_t pretty_print_mergeinfo,
+                             int context_size,
+                             svn_cancel_func_t cancel_func,
+                             void *cancel_baton,
                              apr_pool_t *scratch_pool)
 {
   apr_pool_t *pool = scratch_pool;
@@ -600,9 +603,10 @@ svn_diff__display_prop_diffs(svn_stream_
          * UNIX patch could apply the property diff to, so we use "##"
          * instead of "@@" as the default hunk delimiter for property diffs.
          * We also suppress the diff header. */
-        SVN_ERR(svn_diff_mem_string_output_unified2(
+        SVN_ERR(svn_diff_mem_string_output_unified3(
                   outstream, diff, FALSE /* no header */, "##", NULL, NULL,
-                  encoding, orig, val, iterpool));
+                  encoding, orig, val, context_size,
+                  cancel_func, cancel_baton, iterpool));
       }
     }
   svn_pool_destroy(iterpool);

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/access.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/access.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/access.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/access.c Wed Aug 20 15:31:32 2014
@@ -91,13 +91,6 @@ svn_fs_access_add_lock_token2(svn_fs_acc
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
-                             const char *token)
-{
-  return svn_fs_access_add_lock_token2(access_ctx, (const char *) 1, token);
-}
-
 apr_hash_t *
 svn_fs__access_get_lock_tokens(svn_fs_access_t *access_ctx)
 {

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/editor.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/editor.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/editor.c Wed Aug 20 15:31:32 2014
@@ -63,8 +63,6 @@ struct edit_baton {
 };
 
 #define FSPATH(relpath, pool) apr_pstrcat(pool, "/", relpath, SVN_VA_NULL)
-#define UNUSED(x) ((void)(x))
-
 
 static svn_error_t *
 get_root(svn_fs_root_t **root,
@@ -522,7 +520,8 @@ alter_symlink_cb(void *baton,
 {
   struct edit_baton *eb = baton;
 
-  UNUSED(eb); SVN__NOT_IMPLEMENTED();
+  SVN_UNUSED(eb);
+  SVN__NOT_IMPLEMENTED();
 }
 
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c Wed Aug 20 15:31:32 2014
@@ -393,7 +393,7 @@ synchronized_initialize(void *baton, apr
 {
   common_pool = svn_pool_create(pool);
   base_defn.next = NULL;
-  SVN_ERR(svn_mutex__init(&common_pool_lock, TRUE, TRUE, common_pool));
+  SVN_ERR(svn_mutex__init(&common_pool_lock, TRUE, common_pool));
 
   /* ### This won't work if POOL is NULL and libsvn_fs is loaded as a DSO
      ### (via libsvn_ra_local say) since the global common_pool will live
@@ -559,12 +559,6 @@ svn_fs_upgrade2(const char *path,
 }
 
 svn_error_t *
-svn_fs_upgrade(const char *path, apr_pool_t *pool)
-{
-  return svn_error_trace(svn_fs_upgrade2(path, NULL, NULL, NULL, NULL, pool));
-}
-
-svn_error_t *
 svn_fs_verify(const char *path,
               apr_hash_t *fs_config,
               svn_revnum_t start,
@@ -679,26 +673,6 @@ svn_fs_hotcopy3(const char *src_path, co
 }
 
 svn_error_t *
-svn_fs_hotcopy2(const char *src_path, const char *dest_path,
-                svn_boolean_t clean, svn_boolean_t incremental,
-                svn_cancel_func_t cancel_func, void *cancel_baton,
-                apr_pool_t *scratch_pool)
-{
-  return svn_error_trace(svn_fs_hotcopy3(src_path, dest_path, clean,
-                                         incremental, NULL, NULL,
-                                         cancel_func, cancel_baton,
-                                         scratch_pool));
-}
-
-svn_error_t *
-svn_fs_hotcopy(const char *src_path, const char *dest_path,
-               svn_boolean_t clean, apr_pool_t *pool)
-{
-  return svn_error_trace(svn_fs_hotcopy2(src_path, dest_path, clean,
-                                         FALSE, NULL, NULL, pool));
-}
-
-svn_error_t *
 svn_fs_pack(const char *path,
             svn_fs_pack_notify_t notify_func,
             void *notify_baton,
@@ -848,14 +822,6 @@ svn_fs_begin_txn2(svn_fs_txn_t **txn_p, 
 
 
 svn_error_t *
-svn_fs_begin_txn(svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev,
-                 apr_pool_t *pool)
-{
-  return svn_error_trace(svn_fs_begin_txn2(txn_p, fs, rev, 0, pool));
-}
-
-
-svn_error_t *
 svn_fs_commit_txn(const char **conflict_p, svn_revnum_t *new_rev,
                    svn_fs_txn_t *txn, apr_pool_t *pool)
 {
@@ -1561,14 +1527,6 @@ svn_fs_change_rev_prop2(svn_fs_t *fs, sv
 }
 
 svn_error_t *
-svn_fs_change_rev_prop(svn_fs_t *fs, svn_revnum_t rev, const char *name,
-                       const svn_string_t *value, apr_pool_t *pool)
-{
-  return svn_error_trace(
-           svn_fs_change_rev_prop2(fs, rev, name, NULL, value, pool));
-}
-
-svn_error_t *
 svn_fs_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
                              svn_fs_root_t *source_root,
                              const char *source_path,
@@ -1832,16 +1790,6 @@ svn_fs_get_locks2(svn_fs_t *fs, const ch
                                                get_locks_baton, pool));
 }
 
-svn_error_t *
-svn_fs_get_locks(svn_fs_t *fs, const char *path,
-                 svn_fs_get_locks_callback_t get_locks_func,
-                 void *get_locks_baton, apr_pool_t *pool)
-{
-  return svn_error_trace(svn_fs_get_locks2(fs, path, svn_depth_infinity,
-                                           get_locks_func, get_locks_baton,
-                                           pool));
-}
-
 
 /* --- History functions --- */
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_base/bdb/env.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_base/bdb/env.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_base/bdb/env.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_base/bdb/env.c Wed Aug 20 15:31:32 2014
@@ -380,7 +380,7 @@ bdb_init_cb(void *baton, apr_pool_t *poo
   bdb_cache_pool = svn_pool_create(pool);
   bdb_cache = apr_hash_make(bdb_cache_pool);
 
-  SVN_ERR(svn_mutex__init(&bdb_cache_lock, TRUE, TRUE, bdb_cache_pool));
+  SVN_ERR(svn_mutex__init(&bdb_cache_lock, TRUE, bdb_cache_pool));
   apr_pool_cleanup_register(bdb_cache_pool, NULL, clear_cache,
                             apr_pool_cleanup_null);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c Wed Aug 20 15:31:32 2014
@@ -462,20 +462,11 @@ get_fs_id_at_offset(svn_fs_id_t **id_p,
    changed path offset in *CHANGES_OFFSET.  If either of these
    pointers is NULL, do nothing with it.
 
-   If PACKED is true, REV_FILE should be a packed shard file.
-   ### There is currently no such parameter.  This function assumes that
-       svn_fs_fs__is_packed_rev(FS, REV) will indicate whether REV_FILE is
-       a packed file.  Therefore FS->fsap_data->min_unpacked_rev must not
-       have been refreshed since REV_FILE was opened if there is a
-       possibility that revision REV may have become packed since then.
-       TODO: Take an IS_PACKED parameter instead, in order to remove this
-       requirement.
-
    Allocate temporary variables from POOL. */
 static svn_error_t *
 get_root_changes_offset(apr_off_t *root_offset,
                         apr_off_t *changes_offset,
-                        apr_file_t *rev_file,
+                        svn_fs_fs__revision_file_t *rev_file,
                         svn_fs_t *fs,
                         svn_revnum_t rev,
                         apr_pool_t *pool)
@@ -498,8 +489,7 @@ get_root_changes_offset(apr_off_t *root_
      Unless the next revision is in a different file, in which case, we can
      just seek to the end of the pack file -- just like we do in the
      non-packed case. */
-  if (svn_fs_fs__is_packed_rev(fs, rev)
-      && ((rev + 1) % ffd->max_files_per_dir != 0))
+  if (rev_file->is_packed && ((rev + 1) % ffd->max_files_per_dir != 0))
     {
       SVN_ERR(svn_fs_fs__get_packed_offset(&end, fs, rev + 1, pool));
       seek_relative = APR_SET;
@@ -511,14 +501,14 @@ get_root_changes_offset(apr_off_t *root_
     }
 
   /* Offset of the revision from the start of the pack file, if applicable. */
-  if (svn_fs_fs__is_packed_rev(fs, rev))
+  if (rev_file->is_packed)
     SVN_ERR(svn_fs_fs__get_packed_offset(&rev_offset, fs, rev, pool));
   else
     rev_offset = 0;
 
   /* We will assume that the last line containing the two offsets
      will never be longer than 64 characters. */
-  SVN_ERR(svn_io_file_seek(rev_file, seek_relative, &end, pool));
+  SVN_ERR(svn_io_file_seek(rev_file->file, seek_relative, &end, pool));
 
   if (end < sizeof(buffer))
     {
@@ -532,8 +522,9 @@ get_root_changes_offset(apr_off_t *root_
     }
 
   /* Read in this last block, from which we will identify the last line. */
-  SVN_ERR(aligned_seek(fs, rev_file, NULL, start, pool));
-  SVN_ERR(svn_io_file_read_full2(rev_file, buffer, len, NULL, NULL, pool));
+  SVN_ERR(aligned_seek(fs, rev_file->file, NULL, start, pool));
+  SVN_ERR(svn_io_file_read_full2(rev_file->file, buffer, len, NULL, NULL,
+                                 pool));
 
   /* Parse the last line. */
   trailer = svn_stringbuf_ncreate(buffer, len, pool);
@@ -580,7 +571,7 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
       SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev,
                                                scratch_pool, scratch_pool));
       SVN_ERR(get_root_changes_offset(&root_offset, NULL,
-                                      revision_file->file, fs, rev,
+                                      revision_file, fs, rev,
                                       scratch_pool));
 
       SVN_ERR(get_fs_id_at_offset(&root_id, revision_file, fs, rev,
@@ -2726,7 +2717,7 @@ svn_fs_fs__get_changes(apr_array_header_
                                            scratch_pool));
           else
             SVN_ERR(get_root_changes_offset(NULL, &changes_offset,
-                                            revision_file->file, fs, rev,
+                                            revision_file, fs, rev,
                                             scratch_pool));
 
           /* Actual reading and parsing are the same, though. */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c Wed Aug 20 15:31:32 2014
@@ -361,6 +361,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
   fs_fs_data_t *ffd = fs->fsap_data;
   const char *prefix = apr_pstrcat(pool,
                                    "fsfs:", fs->uuid,
+                                   ":", ffd->instance_id,
                                    "/", normalize_key_part(fs->path, pool),
                                    ":",
                                    SVN_VA_NULL);
@@ -787,6 +788,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
      Therefore, throw in a uuid as well - just to be sure. */
   const char *prefix = apr_pstrcat(pool,
                                    "fsfs:", fs->uuid,
+                                   ":", ffd->instance_id,
                                    "/", fs->path,
                                    ":", txn_id,
                                    ":", svn_uuid_generate(pool), ":",

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.c Wed Aug 20 15:31:32 2014
@@ -73,11 +73,28 @@ fs_serialized_init(svn_fs_t *fs, apr_poo
      svn_fs_initialize pool.  It's unlikely that anyone will notice
      the modest expenditure; the alternative is to allocate each structure
      in a subpool, add a reference-count, and add a serialized destructor
-     to the FS vtable.  That's more machinery than it's worth. */
+     to the FS vtable.  That's more machinery than it's worth.
+
+     Picking an appropriate key for the shared data is tricky, because,
+     unfortunately, a filesystem UUID is not really unique.  It is implicitly
+     shared between hotcopied (1), dump / loaded (2) or naively copied (3)
+     filesystems.  We tackle this problem by using a combination of the UUID
+     and an instance ID as the key.  This allows us to avoid key clashing
+     in (1) and (2) for formats >= SVN_FS_FS__MIN_INSTANCE_ID_FORMAT, which
+     do support instance IDs.  For old formats the shared data (locks, shared
+     transaction data, ...) will still clash.
+
+     Speaking of (3), there is not so much we can do about it, except maybe
+     provide a convenient way of fixing things.  Naively copied filesystems
+     have identical filesystem UUIDs *and* instance IDs.  With the key being
+     a combination of these two, clashes can be fixed by changing either of
+     them (or both), e.g. with svn_fs_set_uuid(). */
 
   SVN_ERR_ASSERT(fs->uuid);
-  key = apr_pstrcat(pool, SVN_FSFS_SHARED_USERDATA_PREFIX, fs->uuid,
-                    SVN_VA_NULL);
+  SVN_ERR_ASSERT(ffd->instance_id);
+
+  key = apr_pstrcat(pool, SVN_FSFS_SHARED_USERDATA_PREFIX,
+                    fs->uuid, ":", ffd->instance_id, SVN_VA_NULL);
   status = apr_pool_userdata_get(&val, key, common_pool);
   if (status)
     return svn_error_wrap_apr(status, _("Can't fetch FSFS shared data"));
@@ -91,22 +108,17 @@ fs_serialized_init(svn_fs_t *fs, apr_poo
       /* POSIX fcntl locks are per-process, so we need a mutex for
          intra-process synchronization when grabbing the repository write
          lock. */
-      SVN_ERR(svn_mutex__init(&ffsd->fs_write_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->fs_write_lock, TRUE, common_pool));
 
       /* ... the pack lock ... */
-      SVN_ERR(svn_mutex__init(&ffsd->fs_pack_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->fs_pack_lock, TRUE, common_pool));
 
       /* ... not to mention locking the txn-current file. */
-      SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock, TRUE, common_pool));
 
       /* We also need a mutex for synchronizing access to the active
-         transaction list and free transaction pointer.  This one is
-         enabled unconditionally. */
-      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock,
-                              TRUE, TRUE, common_pool));
+         transaction list and free transaction pointer. */
+      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock, TRUE, common_pool));
 
       key = apr_pstrdup(common_pool, key);
       status = apr_pool_userdata_set(ffsd, key, NULL, common_pool);
@@ -155,11 +167,22 @@ fs_freeze_body(void *baton,
 }
 
 static svn_error_t *
+fs_freeze_body2(void *baton,
+                apr_pool_t *pool)
+{
+  struct fs_freeze_baton_t *b = baton;
+  SVN_ERR(svn_fs_fs__with_write_lock(b->fs, fs_freeze_body, baton, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 fs_freeze(svn_fs_t *fs,
           svn_fs_freeze_func_t freeze_func,
           void *freeze_baton,
           apr_pool_t *pool)
 {
+  fs_fs_data_t *ffd = fs->fsap_data;
   struct fs_freeze_baton_t b;
 
   b.fs = fs;
@@ -167,7 +190,11 @@ fs_freeze(svn_fs_t *fs,
   b.freeze_baton = freeze_baton;
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
-  SVN_ERR(svn_fs_fs__with_write_lock(fs, fs_freeze_body, &b, pool));
+
+  if (ffd->format >= SVN_FS_FS__MIN_PACK_LOCK_FORMAT)
+    SVN_ERR(svn_fs_fs__with_pack_lock(fs, fs_freeze_body2, &b, pool));
+  else
+    SVN_ERR(fs_freeze_body2(&b, pool));
 
   return SVN_NO_ERROR;
 }
@@ -187,6 +214,18 @@ fs_info(const void **fsfs_info,
   return SVN_NO_ERROR;
 }
 
+/* Wrapper around svn_fs_fs__set_uuid() adapting between function
+   signatures. */
+static svn_error_t *
+fs_set_uuid(svn_fs_t *fs,
+            const char *uuid,
+            apr_pool_t *pool)
+{
+  /* Whenever we set a new UUID, imply that FS will also be a different
+   * instance (on formats that support this). */
+  return svn_error_trace(svn_fs_fs__set_uuid(fs, uuid, NULL, pool));
+}
+
 
 
 /* The vtable associated with a specific open filesystem. */
@@ -195,7 +234,7 @@ static fs_vtable_t fs_vtable = {
   svn_fs_fs__revision_prop,
   svn_fs_fs__get_revision_proplist,
   svn_fs_fs__change_rev_prop,
-  svn_fs_fs__set_uuid,
+  fs_set_uuid,
   svn_fs_fs__revision_root,
   svn_fs_fs__begin_txn,
   svn_fs_fs__open_txn,
@@ -230,6 +269,15 @@ initialize_fs_struct(svn_fs_t *fs)
   return SVN_NO_ERROR;
 }
 
+/* Reset vtable and fsap_data fields in FS such that the FS is basically
+ * closed now.  Note that FS must not hold locks when you call this. */
+static void
+uninitialize_fs_struct(svn_fs_t *fs)
+{
+  fs->vtable = NULL;
+  fs->fsap_data = NULL;
+}
+
 /* This implements the fs_library_vtable_t.create() API.  Create a new
    fsfs-backed Subversion filesystem at path PATH and link it into
    *FS.  Perform temporary allocations in POOL, and fs-global allocations
@@ -398,11 +446,13 @@ fs_hotcopy(svn_fs_t *src_fs,
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
 
-  /* Provide FFD for DST_FS, test / initialize target repo, remove FFD. */
+  /* Test target repo when in INCREMENTAL mode, initialize it when not.
+   * For this, we need our FS internal data structures to be temporarily
+   * available. */
   SVN_ERR(initialize_fs_struct(dst_fs));
   SVN_ERR(svn_fs_fs__hotcopy_prepare_target(src_fs, dst_fs, dst_path,
                                             incremental, pool));
-  dst_fs->fsap_data = NULL;
+  uninitialize_fs_struct(dst_fs);
 
   /* Now, the destination repo should open just fine. */
   SVN_ERR(fs_open(dst_fs, dst_path, common_pool_lock, pool, common_pool));

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.h?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs.h Wed Aug 20 15:31:32 2014
@@ -179,6 +179,9 @@ extern "C" {
 /* Minimum format number that stores mergeinfo-mode flag in changed paths */
 #define SVN_FS_FS__MIN_MERGEINFO_IN_CHANGES_FORMAT 7
 
+/* Minimum format number that supports per-instance filesystem IDs. */
+#define SVN_FS_FS__MIN_INSTANCE_ID_FORMAT 7
+
 /* The minimum format number that supports a configuration file (fsfs.conf) */
 #define SVN_FS_FS__MIN_CONFIG_FILE 4
 
@@ -295,13 +298,14 @@ typedef struct fs_fs_data_t
      and is not complete, yet. */
   svn_revnum_t min_log_addressing_rev;
 
-  /* Rev / pack file read granularity. */
+  /* Rev / pack file read granularity in bytes. */
   apr_int64_t block_size;
 
   /* Capacity in entries of log-to-phys index pages */
   apr_int64_t l2p_page_size;
 
-  /* Rev / pack file granularity covered by phys-to-log index pages */
+  /* Rev / pack file granularity (in bytes) covered by a single phys-to-log
+   * index page. */
   apr_int64_t p2l_page_size;
 
   /* If set, parse and cache *all* data of each block that we read
@@ -466,6 +470,12 @@ typedef struct fs_fs_data_t
   /* Pack after every commit. */
   svn_boolean_t pack_after_commit;
 
+  /* Per-instance filesystem ID, which provides an additional level of
+     uniqueness for filesystems that share the same UUID, but should
+     still be distinguishable (e.g. backups produced by svn_fs_hotcopy()
+     or dump / load cycles). */
+  const char *instance_id;
+
   /* Pointer to svn_fs_open. */
   svn_error_t *(*svn_fs_open_)(svn_fs_t **, const char *, apr_hash_t *,
                                apr_pool_t *, apr_pool_t *);

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.c Wed Aug 20 15:31:32 2014
@@ -743,15 +743,17 @@ read_config(fs_fs_data_t *ffd,
                                    CONFIG_OPTION_P2L_PAGE_SIZE,
                                    0x400));
 
+      /* convert kBytes to bytes */
       ffd->block_size *= 0x400;
       ffd->p2l_page_size *= 0x400;
+      /* L2P pages are in entries - not in (k)Bytes */
     }
   else
     {
       /* should be irrelevant but we initialize them anyway */
-      ffd->block_size = 0x1000;
-      ffd->l2p_page_size = 0x2000;
-      ffd->p2l_page_size = 0x100000;
+      ffd->block_size = 0x1000; /* Matches default APR file buffer size. */
+      ffd->l2p_page_size = 0x2000;    /* Matches above default. */
+      ffd->p2l_page_size = 0x100000;  /* Matches above default in bytes. */
     }
 
   if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
@@ -943,7 +945,7 @@ write_config(svn_fs_t *fs,
 "### may improve latency while still maximizing throughput.  If block-read"  NL
 "### has not been enabled, this will be capped to 4 kBytes."                 NL
 "### Can be changed at any time but must be a power of 2."                   NL
-"### block-size is 64 kBytes by default."                                    NL
+"### block-size is given in kBytes and with a default of 64 kBytes."         NL
 "# " CONFIG_OPTION_BLOCK_SIZE " = 64"                                        NL
 "###"                                                                        NL
 "### The log-to-phys index maps data item numbers to offsets within the"     NL
@@ -976,7 +978,7 @@ write_config(svn_fs_t *fs,
 "### smaller changes."                                                       NL
 "### For source code repositories, this should be about 16x the block-size." NL
 "### Must be a power of 2."                                                  NL
-"### p2l-page-size is 1024 kBytes by default."                               NL
+"### p2l-page-size is given in kBytes and with a default of 1024 kBytes."    NL
 "# " CONFIG_OPTION_P2L_PAGE_SIZE " = 1024"                                   NL
 ;
 #undef NL
@@ -1002,15 +1004,49 @@ read_global_config(svn_fs_t *fs)
   return SVN_NO_ERROR;
 }
 
+/* Read FS's UUID file and store the data in the FS struct. */
+static svn_error_t *
+read_uuid(svn_fs_t *fs,
+          apr_pool_t *scratch_pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  apr_file_t *uuid_file;
+  char buf[APR_UUID_FORMATTED_LENGTH + 2];
+  apr_size_t limit;
+
+  /* Read the repository uuid. */
+  SVN_ERR(svn_io_file_open(&uuid_file, path_uuid(fs, scratch_pool),
+                           APR_READ | APR_BUFFERED, APR_OS_DEFAULT,
+                           scratch_pool));
+
+  limit = sizeof(buf);
+  SVN_ERR(svn_io_read_length_line(uuid_file, buf, &limit, scratch_pool));
+  fs->uuid = apr_pstrdup(fs->pool, buf);
+
+  /* Read the instance ID. */
+  if (ffd->format >= SVN_FS_FS__MIN_INSTANCE_ID_FORMAT)
+    {
+      limit = sizeof(buf);
+      SVN_ERR(svn_io_read_length_line(uuid_file, buf, &limit,
+                                      scratch_pool));
+      ffd->instance_id = apr_pstrdup(fs->pool, buf);
+    }
+  else
+    {
+      ffd->instance_id = fs->uuid;
+    }
+
+  SVN_ERR(svn_io_file_close(uuid_file, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_fs_fs__open(svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-  apr_file_t *uuid_file;
   int format, max_files_per_dir;
   svn_revnum_t min_log_addressing_rev;
-  char buf[APR_UUID_FORMATTED_LENGTH + 2];
-  apr_size_t limit;
 
   fs->path = apr_pstrdup(fs->pool, path);
 
@@ -1024,14 +1060,7 @@ svn_fs_fs__open(svn_fs_t *fs, const char
   ffd->min_log_addressing_rev = min_log_addressing_rev;
 
   /* Read in and cache the repository uuid. */
-  SVN_ERR(svn_io_file_open(&uuid_file, path_uuid(fs, pool),
-                           APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
-
-  limit = sizeof(buf);
-  SVN_ERR(svn_io_read_length_line(uuid_file, buf, &limit, pool));
-  fs->uuid = apr_pstrdup(fs->pool, buf);
-
-  SVN_ERR(svn_io_file_close(uuid_file, pool));
+  SVN_ERR(read_uuid(fs, pool));
 
   /* Read the min unpacked revision. */
   if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
@@ -1162,11 +1191,22 @@ upgrade_body(void *baton, apr_pool_t *po
         * max_files_per_dir;
     }
 
-  /* Bump the format file. */
+  /* We will need the UUID info shortly ...
+     Read it before the format bump as the UUID file still uses the old
+     format. */
+  SVN_ERR(read_uuid(fs, pool));
+
+  /* Update the format info in the FS struct.  Upgrade steps further
+     down will use the format from FS to create missing info. */
   ffd->format = SVN_FS_FS__FORMAT_NUMBER;
   ffd->max_files_per_dir = max_files_per_dir;
   ffd->min_log_addressing_rev = min_log_addressing_rev;
 
+  /* Always add / bump the instance ID such that no form of caching
+     accidentally uses outdated information.  Keep the UUID. */
+  SVN_ERR(svn_fs_fs__set_uuid(fs, fs->uuid, NULL, pool));
+
+  /* Bump the format file. */
   SVN_ERR(svn_fs_fs__write_format(fs, TRUE, pool));
   if (upgrade_baton->notify_func)
     SVN_ERR(upgrade_baton->notify_func(upgrade_baton->notify_baton,
@@ -1642,7 +1682,7 @@ svn_fs_fs__create(svn_fs_t *fs,
                               ? "0\n" : "0 1 1\n"),
                              pool));
   SVN_ERR(svn_io_file_create_empty(svn_fs_fs__path_lock(fs, pool), pool));
-  SVN_ERR(svn_fs_fs__set_uuid(fs, NULL, pool));
+  SVN_ERR(svn_fs_fs__set_uuid(fs, NULL, NULL, pool));
 
   /* Create the fsfs.conf file if supported.  Older server versions would
      simply ignore the file but that might result in a different behavior
@@ -1685,28 +1725,40 @@ svn_fs_fs__create(svn_fs_t *fs,
 svn_error_t *
 svn_fs_fs__set_uuid(svn_fs_t *fs,
                     const char *uuid,
+                    const char *instance_id,
                     apr_pool_t *pool)
 {
-  char *my_uuid;
-  apr_size_t my_uuid_len;
+  fs_fs_data_t *ffd = fs->fsap_data;
   const char *uuid_path = path_uuid(fs, pool);
+  svn_stringbuf_t *contents = svn_stringbuf_create_empty(pool);
 
   if (! uuid)
     uuid = svn_uuid_generate(pool);
 
-  /* Make sure we have a copy in FS->POOL, and append a newline. */
-  my_uuid = apr_pstrcat(fs->pool, uuid, "\n", SVN_VA_NULL);
-  my_uuid_len = strlen(my_uuid);
+  if (! instance_id)
+    instance_id = svn_uuid_generate(pool);
+
+  svn_stringbuf_appendcstr(contents, uuid);
+  svn_stringbuf_appendcstr(contents, "\n");
+
+  if (ffd->format >= SVN_FS_FS__MIN_INSTANCE_ID_FORMAT)
+    {
+      svn_stringbuf_appendcstr(contents, instance_id);
+      svn_stringbuf_appendcstr(contents, "\n");
+    }
 
   /* We use the permissions of the 'current' file, because the 'uuid'
      file does not exist during repository creation. */
-  SVN_ERR(svn_io_write_atomic(uuid_path, my_uuid, my_uuid_len,
+  SVN_ERR(svn_io_write_atomic(uuid_path, contents->data, contents->len,
                               svn_fs_fs__path_current(fs, pool) /* perms */,
                               pool));
 
-  /* Remove the newline we added, and stash the UUID. */
-  my_uuid[my_uuid_len - 1] = '\0';
-  fs->uuid = my_uuid;
+  fs->uuid = apr_pstrdup(fs->pool, uuid);
+
+  if (ffd->format >= SVN_FS_FS__MIN_INSTANCE_ID_FORMAT)
+    ffd->instance_id = apr_pstrdup(fs->pool, instance_id);
+  else
+    ffd->instance_id = fs->uuid;
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.h?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/fs_fs.h Wed Aug 20 15:31:32 2014
@@ -115,11 +115,13 @@ svn_error_t *svn_fs_fs__create(svn_fs_t 
                                const char *path,
                                apr_pool_t *pool);
 
-/* Set the uuid of repository FS to UUID, if UUID is not NULL;
-   otherwise, set the uuid of FS to a newly generated UUID.  Perform
-   temporary allocations in POOL. */
+/* Set the uuid of repository FS to UUID and the instance ID to INSTANCE_ID.
+   If any of them is NULL, use a newly generated UUID / ID instead.  Ignore
+   INSTANCE_ID whenever instance IDs are not supported by the FS format.
+   Perform temporary allocations in POOL. */
 svn_error_t *svn_fs_fs__set_uuid(svn_fs_t *fs,
                                  const char *uuid,
+                                 const char *instance_id,
                                  apr_pool_t *pool);
 
 /* Return the path to the 'current' file in FS.

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/hotcopy.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/hotcopy.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/hotcopy.c Wed Aug 20 15:31:32 2014
@@ -1017,7 +1017,8 @@ hotcopy_body(void *baton, apr_pool_t *po
   return SVN_NO_ERROR;
 }
 
-/* Wrapper around hotcopy_body taking out all necessary source repositories.
+/* Wrapper around hotcopy_body taking out all necessary source repository
+ * locks.
  */
 static svn_error_t *
 hotcopy_locking_src_body(void *baton, apr_pool_t *pool)
@@ -1089,9 +1090,10 @@ hotcopy_create_empty_dest(svn_fs_t *src_
                                 ? "0\n" : "0 1 1\n"),
                              pool));
 
-  /* Create lock file and UUID. */
+  /* Create the lock and 'uuid' files.  Hotcopy destination receives a
+     new instance ID, but has the same filesystem UUID as the source. */
   SVN_ERR(svn_io_file_create_empty(svn_fs_fs__path_lock(dst_fs, pool), pool));
-  SVN_ERR(svn_fs_fs__set_uuid(dst_fs, src_fs->uuid, pool));
+  SVN_ERR(svn_fs_fs__set_uuid(dst_fs, src_fs->uuid, NULL, pool));
 
   /* Create the min unpacked rev file. */
   if (dst_ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/id.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/id.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/id.c Wed Aug 20 15:31:32 2014
@@ -48,12 +48,67 @@ typedef struct fs_fs__id_t
 
 
 
+/** Like strtol but with a fixed base of 10, locale independent and limited
+ * to non-negative values.  Overflows are indicated by a FALSE return value
+ * in which case *RESULT_P will not be modified.
+ *
+ * This allows the compiler to generate massively faster code.
+ * (E.g. Avoiding locale specific processing).  ID parsing is one of the
+ * most CPU consuming parts of FSFS data access.  Better be quick.
+ */
+static svn_boolean_t
+locale_independent_strtol(long *result_p,
+                          const char* buffer,
+                          const char** end)
+{
+  /* We allow positive values only.  We use unsigned arithmetics to get
+   * well-defined overflow behavior.  It also happens to allow for a wider
+   * range of compiler-side optimizations. */
+  unsigned long result = 0;
+  while (1)
+    {
+      unsigned long c = (unsigned char)*buffer - (unsigned char)'0';
+      unsigned long next;
+
+      /* This implies the NUL check. */
+      if (c > 9)
+        break;
+
+      /* Overflow check.  Passing this, NEXT can be no more than ULONG_MAX+9
+       * before being truncated to ULONG but it still covers 0 .. ULONG_MAX.
+       */
+      if (result > ULONG_MAX / 10)
+        return FALSE;
+
+      next = result * 10 + c;
+
+      /* Overflow check.  In case of an overflow, NEXT is 0..9.
+       * In the non-overflow case, RESULT is either >= 10 or RESULT and NEXT
+       * are both 0. */
+      if (next < result)
+        return FALSE;
+
+      result = next;
+      ++buffer;
+    }
+
+  *end = buffer;
+  if (result > LONG_MAX)
+    return FALSE;
+
+  *result_p = (long)result;
+
+  return TRUE;
+}
+
 /* Parse the NUL-terminated ID part at DATA and write the result into *PART.
  * Return TRUE if no errors were detected. */
 static svn_boolean_t
 part_parse(svn_fs_fs__id_part_t *part,
            const char *data)
 {
+  const char *end;
+
   /* special case: ID inside some transaction */
   if (data[0] == '_')
     {
@@ -78,12 +133,7 @@ part_parse(svn_fs_fs__id_part_t *part,
       return *data == '\0';
     }
 
-  {
-    const char *end;
-    part->revision = svn__strtol(data+1, &end);
-  }
-
-  return TRUE;
+  return locale_independent_strtol(&part->revision, data+1, &end);
 }
 
 /* Parse the transaction id in DATA and store the result in *TXN_ID.
@@ -94,7 +144,9 @@ txn_id_parse(svn_fs_fs__id_part_t *txn_i
              const char *data)
 {
   const char *end;
-  txn_id->revision = svn__strtol(data, &end);
+  if (!locale_independent_strtol(&txn_id->revision, data, &end))
+    return FALSE;
+
   data = strchr(end, '-');
   if (data == NULL)
     return FALSE;
@@ -489,7 +541,9 @@ svn_fs_fs__id_parse(char *data,
       str = svn_cstring_tokenize("/", &data);
       if (str == NULL)
         return NULL;
-      id->private_id.rev_item.revision = svn__strtol(str, &tmp);
+      if (!locale_independent_strtol(&id->private_id.rev_item.revision,
+                                     str, &tmp))
+        return NULL;
 
       err = svn_cstring_atoi64(&val, data);
       if (err)

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/structure Wed Aug 20 15:31:32 2014
@@ -62,7 +62,7 @@ repository) is:
   write-lock          Empty file, locked to serialise writers
   pack-lock           Empty file, locked to serialise 'svnadmin pack' (f. 7+)
   txn-current-lock    Empty file, locked to serialise 'txn-current'
-  uuid                File containing the UUID of the repository
+  uuid                File containing the repository IDs
   format              File containing the format number of this filesystem
   fsfs.conf           Configuration file
   min-unpacked-rev    File containing the oldest revision not in a pack file
@@ -204,6 +204,10 @@ Addressing:
   Format 7+:  Logical addressing; uses item index that will be translated
     on-the-fly to the actual rev / pack file location
 
+Repository IDs:
+  Format 1+:  The first line of db/uuid contains the repository UUID
+  Format 7+:  The second line contains the instance ID (in UUID formatting)
+
 # Incomplete list.  See SVN_FS_FS__MIN_*_FORMAT
 
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c Wed Aug 20 15:31:32 2014
@@ -1072,7 +1072,7 @@ open_path(parent_path_t **parent_path_p,
 
           if (flags & open_path_node_only)
             {
-              /* Shortcut: the caller only wan'ts the final DAG node. */
+              /* Shortcut: the caller only wants the final DAG node. */
               parent_path->node = child;
             }
           else

Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_fs_x:r1614616-1619125

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c Wed Aug 20 15:31:32 2014
@@ -99,22 +99,17 @@ x_serialized_init(svn_fs_t *fs, apr_pool
       /* POSIX fcntl locks are per-process, so we need a mutex for
          intra-process synchronization when grabbing the repository write
          lock. */
-      SVN_ERR(svn_mutex__init(&ffsd->fs_write_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->fs_write_lock, TRUE, common_pool));
 
       /* ... the pack lock ... */
-      SVN_ERR(svn_mutex__init(&ffsd->fs_pack_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->fs_pack_lock, TRUE, common_pool));
 
       /* ... not to mention locking the txn-current file. */
-      SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
-                              TRUE, TRUE, common_pool));
+      SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock, TRUE, common_pool));
 
       /* We also need a mutex for synchronizing access to the active
-         transaction list and free transaction pointer.  This one is
-         enabled unconditionally. */
-      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock,
-                              TRUE, TRUE, common_pool));
+         transaction list and free transaction pointer. */
+      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock, TRUE, common_pool));
 
       key = apr_pstrdup(common_pool, key);
       status = apr_pool_userdata_set(ffsd, key, NULL, common_pool);

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c?rev=1619127&r1=1619126&r2=1619127&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c Wed Aug 20 15:31:32 2014
@@ -638,10 +638,9 @@ encode_l2p_page(apr_array_header_t *entr
         }
       else
         {
-          apr_uintptr_t idx
-            = (apr_uintptr_t)apr_hash_get(containers, &entry->offset,
-                                          sizeof(entry->offset));
-          if (idx == 0)
+          void *void_idx = apr_hash_get(containers, &entry->offset,
+                                        sizeof(entry->offset));
+          if (void_idx == NULL)
             {
               apr_uint64_t value = entry->offset + container_count;
               SVN_ERR(svn_spillbuf__write(buffer, (const char *)encoded,
@@ -649,6 +648,7 @@ encode_l2p_page(apr_array_header_t *entr
             }
           else
             {
+              apr_uintptr_t idx = (apr_uintptr_t)void_idx;
               apr_uint64_t value = entry->sub_item;
               SVN_ERR(svn_spillbuf__write(buffer, (const char *)encoded,
                                           encode_uint(encoded, idx), pool));
@@ -1638,7 +1638,7 @@ l2p_proto_index_lookup(apr_off_t *offset
       if (!eof && entry.item_index == item_index)
         {
           *offset = (apr_off_t)entry.offset - 1;
-          *sub_item = (apr_off_t)entry.sub_item;
+          *sub_item = entry.sub_item;
           break;
         }
     }



Mime
View raw message