Author: hwright
Date: Thu Jan 12 17:23:41 2012
New Revision: 1230651
URL: http://svn.apache.org/viewvc?rev=1230651&view=rev
Log:
Ev2 shims: When finding the base revision for a text delta on commit,
use the provided base revision, rather than whatever the txn is rooted on.
Also, in the case of an added file, don't bother finding the base for a
pure add (it won't exist), and look at the copyfrom_path on a copy (since
the text delta will be based on that content).
Current number of Ev2 test failures: 144
* subversion/libsvn_repos/commit.c
(fetch_base_func): If the path is a url, it's a copyfrom path, so calculate
the fs path differently.
* subversion/libsvn_delta/compat.c
(ev2_add_file): Don't both fetching the base for an added file, but do
fetch the copyfrom contents in the case of a copy.
Modified:
subversion/trunk/subversion/libsvn_delta/compat.c
subversion/trunk/subversion/libsvn_repos/commit.c
Modified: subversion/trunk/subversion/libsvn_delta/compat.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1230651&r1=1230650&r2=1230651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Thu Jan 12 17:23:41 2012
@@ -570,16 +570,14 @@ ev2_add_file(const char *path,
fb->base_revision = pb->base_revision;
*file_baton = fb;
- SVN_ERR(fb->eb->fetch_base_func(&fb->delta_base,
- fb->eb->fetch_base_baton,
- path, fb->base_revision,
- result_pool, result_pool));
-
if (!copyfrom_path)
{
/* A simple add. */
svn_kind_t *kind = apr_palloc(pb->eb->edit_pool, sizeof(*kind));
+ /* Don't bother fetching the base, as in an add we don't have a base. */
+ fb->delta_base = NULL;
+
*kind = svn_kind_file;
SVN_ERR(add_action(pb->eb, path, ACTION_ADD, kind));
}
@@ -588,6 +586,11 @@ ev2_add_file(const char *path,
/* A copy */
struct copy_args *args = apr_palloc(pb->eb->edit_pool, sizeof(*args));
+ SVN_ERR(fb->eb->fetch_base_func(&fb->delta_base,
+ fb->eb->fetch_base_baton,
+ copyfrom_path, copyfrom_revision,
+ result_pool, result_pool));
+
args->copyfrom_path = apr_pstrdup(pb->eb->edit_pool, copyfrom_path);
args->copyfrom_rev = copyfrom_revision;
SVN_ERR(add_action(pb->eb, path, ACTION_COPY, args));
Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1230651&r1=1230650&r2=1230651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Thu Jan 12 17:23:41 2012
@@ -848,13 +848,26 @@ fetch_base_func(const char **filename,
svn_fs_root_t *fs_root;
svn_error_t *err;
- if (path[0] != '/')
- /* Get an absolute path for use in the FS. */
- path = svn_fspath__join(eb->base_path, path, scratch_pool);
-
- SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs,
- svn_fs_txn_base_revision(eb->txn),
- scratch_pool));
+ if (!SVN_IS_VALID_REVNUM(base_revision))
+ {
+ *filename = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ if (svn_path_is_url(path))
+ {
+ /* This is a copyfrom URL. */
+ path = svn_uri_skip_ancestor(eb->repos_url, path, scratch_pool);
+ }
+ else
+ {
+ /* This is a base-relative path. */
+ if (path[0] != '/')
+ /* Get an absolute path for use in the FS. */
+ path = svn_fspath__join(eb->base_path, path, scratch_pool);
+ }
+
+ SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool);
if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)