You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/02/11 17:33:02 UTC

svn commit: r1567211 - /subversion/trunk/subversion/libsvn_fs_x/tree.c

Author: stefan2
Date: Tue Feb 11 16:33:01 2014
New Revision: 1567211

URL: http://svn.apache.org/r1567211
Log:
In FSX, remove node origin detection legacy code carried over from FSFS.

* subversion/libsvn_fs_x/tree.c
  (prev_location): Drop obsolete function.
  (x_node_origin_rev): The creation rev is always given in FSX by the node_id.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1567211&r1=1567210&r2=1567211&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Tue Feb 11 16:33:01 2014
@@ -3519,172 +3519,22 @@ svn_error_t *x_closest_copy(svn_fs_root_
 }
 
 
-/* Set *PREV_PATH and *PREV_REV to the path and revision which
-   represent the location at which PATH in FS was located immediately
-   prior to REVISION iff there was a copy operation (to PATH or one of
-   its parent directories) between that previous location and
-   PATH@REVISION.
-
-   If there was no such copy operation in that portion of PATH's
-   history, set *PREV_PATH to NULL and *PREV_REV to SVN_INVALID_REVNUM.  */
-static svn_error_t *
-prev_location(const char **prev_path,
-              svn_revnum_t *prev_rev,
-              svn_fs_t *fs,
-              svn_fs_root_t *root,
-              const char *path,
-              apr_pool_t *pool)
-{
-  const char *copy_path, *copy_src_path, *remainder_path;
-  svn_fs_root_t *copy_root;
-  svn_revnum_t copy_src_rev;
-
-  /* Ask about the most recent copy which affected PATH@REVISION.  If
-     there was no such copy, we're done.  */
-  SVN_ERR(x_closest_copy(&copy_root, &copy_path, root, path, pool));
-  if (! copy_root)
-    {
-      *prev_rev = SVN_INVALID_REVNUM;
-      *prev_path = NULL;
-      return SVN_NO_ERROR;
-    }
-
-  /* Ultimately, it's not the path of the closest copy's source that
-     we care about -- it's our own path's location in the copy source
-     revision.  So we'll tack the relative path that expresses the
-     difference between the copy destination and our path in the copy
-     revision onto the copy source path to determine this information.
-
-     In other words, if our path is "/branches/my-branch/foo/bar", and
-     we know that the closest relevant copy was a copy of "/trunk" to
-     "/branches/my-branch", then that relative path under the copy
-     destination is "/foo/bar".  Tacking that onto the copy source
-     path tells us that our path was located at "/trunk/foo/bar"
-     before the copy.
-  */
-  SVN_ERR(x_copied_from(&copy_src_rev, &copy_src_path,
-                        copy_root, copy_path, pool));
-  remainder_path = svn_fspath__skip_ancestor(copy_path, path);
-  *prev_path = svn_fspath__join(copy_src_path, remainder_path, pool);
-  *prev_rev = copy_src_rev;
-  return SVN_NO_ERROR;
-}
-
-
 static svn_error_t *
 x_node_origin_rev(svn_revnum_t *revision,
                   svn_fs_root_t *root,
                   const char *path,
                   apr_pool_t *pool)
 {
-  svn_fs_t *fs = root->fs;
-  const svn_fs_id_t *given_noderev_id, *cached_origin_id;
+  const svn_fs_id_t *given_noderev_id;
   const svn_fs_x__id_part_t *node_id;
 
   path = svn_fs__canonicalize_abspath(path, pool);
 
-  /* Check the cache first. */
   SVN_ERR(svn_fs_x__node_id(&given_noderev_id, root, path, pool));
   node_id = svn_fs_x__id_node_id(given_noderev_id);
+  *revision = node_id->revision;
 
-  /* Is it a brand new uncommitted node or a new-style one?
-   * (committed old-style nodes will have a 0 revision value;
-   * rev 0, number 0 is rev 0 root node) */
-  if (node_id->revision != 0 || node_id->number == 0)
-    {
-      *revision = node_id->revision;
-      return SVN_NO_ERROR;
-    }
-
-  /* The root node always has ID 0, created in revision 0 and will never
-     use the new-style ID format. */
-  if (node_id->number == 0)
-    {
-      *revision = 0;
-      return SVN_NO_ERROR;
-    }
-
-  /* OK, it's an old-style ID?  Maybe it's cached. */
-  SVN_ERR(svn_fs_x__get_node_origin(&cached_origin_id, fs, node_id, pool));
-  if (cached_origin_id != NULL)
-    {
-      *revision = svn_fs_x__id_rev(cached_origin_id);
-      return SVN_NO_ERROR;
-    }
-
-  {
-    /* Ah well, the answer isn't in the ID itself or in the cache.
-       Let's actually calculate it, then. */
-    svn_fs_root_t *curroot = root;
-    apr_pool_t *subpool = svn_pool_create(pool);
-    apr_pool_t *predidpool = svn_pool_create(pool);
-    svn_stringbuf_t *lastpath = svn_stringbuf_create(path, pool);
-    svn_revnum_t lastrev = SVN_INVALID_REVNUM;
-    dag_node_t *node;
-    const svn_fs_id_t *pred_id;
-
-    /* Walk the closest-copy chain back to the first copy in our history.
-
-       NOTE: We merely *assume* that this is faster than walking the
-       predecessor chain, because we *assume* that copies of parent
-       directories happen less often than modifications to a given item. */
-    while (1)
-      {
-        svn_revnum_t currev;
-        const char *curpath = lastpath->data;
-
-        svn_pool_clear(subpool);
-
-        /* Get a root pointing to LASTREV.  (The first time around,
-           LASTREV is invalid, but that's cool because CURROOT is
-           already initialized.)  */
-        if (SVN_IS_VALID_REVNUM(lastrev))
-          SVN_ERR(svn_fs_x__revision_root(&curroot, fs, lastrev, subpool));
-
-        /* Find the previous location using the closest-copy shortcut. */
-        SVN_ERR(prev_location(&curpath, &currev, fs, curroot, curpath,
-                              subpool));
-        if (! curpath)
-          break;
-
-        /* Update our LASTPATH and LASTREV variables (which survive
-           SUBPOOL). */
-        svn_stringbuf_set(lastpath, curpath);
-        lastrev = currev;
-      }
-
-    /* Walk the predecessor links back to origin. */
-    SVN_ERR(svn_fs_x__node_id(&pred_id, curroot, lastpath->data, predidpool));
-    do
-      {
-        svn_pool_clear(subpool);
-        SVN_ERR(svn_fs_x__dag_get_node(&node, fs, pred_id, subpool));
-
-        /* Why not just fetch the predecessor ID in PREDIDPOOL?
-           Because svn_fs_x__dag_get_predecessor_id() doesn't
-           necessarily honor the passed-in pool, and might return a
-           value cached in the node (which is allocated in
-           SUBPOOL... maybe). */
-        svn_pool_clear(predidpool);
-        SVN_ERR(svn_fs_x__dag_get_predecessor_id(&pred_id, node));
-        pred_id = pred_id ? svn_fs_x__id_copy(pred_id, predidpool) : NULL;
-      }
-    while (pred_id);
-
-    /* When we get here, NODE should be the first node-revision in our
-       chain. */
-    SVN_ERR(svn_fs_x__dag_get_revision(revision, node, pool));
-
-    /* Wow, I don't want to have to do all that again.  Let's cache
-       the result. */
-    if (node_id->revision != SVN_INVALID_REVNUM)
-      SVN_ERR(svn_fs_x__set_node_origin(fs, node_id,
-                                        svn_fs_x__dag_get_id(node), pool));
-
-    svn_pool_destroy(subpool);
-    svn_pool_destroy(predidpool);
-    return SVN_NO_ERROR;
-  }
+  return SVN_NO_ERROR;
 }