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 2015/01/28 14:53:08 UTC
svn commit: r1655324 - in /subversion/branches/pin-externals/subversion:
libsvn_client/copy.c tests/cmdline/externals_tests.py
Author: stsp
Date: Wed Jan 28 13:53:08 2015
New Revision: 1655324
URL: http://svn.apache.org/r1655324
Log:
On the pin-externals branch, change the way peg revisions are used in
pinned externals. Always use the current HEAD revision of the external
repository as peg revision, instead of the last-changed revision.
This avoids the need to resolve path differences between HEAD and the
last-changed revisions, and also fixes the problem where relative URLs
where made absolute in some cases.
* subversion/libsvn_client/copy.c
(external_location_segments_receiver_baton,
external_location_segments_receiver): Remove, not needed anymore.
(pin_externals_prop): Pin externals with HEAD as peg revision.
* subversion/tests/cmdline/externals_tests.py
(copy_pin_externals): Adjust expected output accordingly.
Suggested by: brane
rhuijben
Modified:
subversion/branches/pin-externals/subversion/libsvn_client/copy.c
subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py
Modified: subversion/branches/pin-externals/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_client/copy.c?rev=1655324&r1=1655323&r2=1655324&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_client/copy.c Wed Jan 28 13:53:08 2015
@@ -177,27 +177,6 @@ get_copy_pair_ancestors(const apr_array_
return SVN_NO_ERROR;
}
-struct external_location_segments_receiver_baton {
- svn_revnum_t last_changed_rev;
- const char *last_changed_repos_relpath;
- apr_pool_t *result_pool;
-} external_location_segments_receiver_baton;
-
-/* Implements svn_location_segment_receiver_t. */
-static svn_error_t *
-external_location_segments_receiver(svn_location_segment_t *segment,
- void *baton,
- apr_pool_t *pool)
-{
- struct external_location_segments_receiver_baton *b = baton;
-
- if (segment->range_start <= b->last_changed_rev &&
- segment->range_end >= b->last_changed_rev)
- b->last_changed_repos_relpath = apr_pstrdup(b->result_pool, segment->path);
-
- return SVN_NO_ERROR;
-}
-
/* Pin all externals listed in EXTERNALS_PROP_VAL to their last-changed
* revision. Return a new property value in *PINNED_EXTERNALS allocated
* in RESULT_POOL. LOCAL_ABSPATH_OR_URL is the path defining the
@@ -285,49 +264,9 @@ pin_externals_prop(svn_string_t **pinned
iterpool));
if (dirent == NULL)
return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
- _("Cannot determine last-changed revision "
- "of '%s'"), resolved_url);
-
- if (external_youngest_rev > dirent->created_rev)
- {
- struct external_location_segments_receiver_baton b;
-
- /* Find the item's URL location as of the last-changed revision. */
- b.last_changed_rev = dirent->created_rev;
- b.last_changed_repos_relpath = NULL;
- b.result_pool = iterpool;
- SVN_ERR(svn_ra_get_location_segments(
- external_ra_session, "", external_youngest_rev,
- external_youngest_rev, dirent->created_rev,
- external_location_segments_receiver, &b, iterpool));
- if (b.last_changed_repos_relpath)
- {
- const char *external_repos_root_url;
- const char *last_changed_url;
-
- SVN_ERR(svn_ra_get_repos_root2(external_ra_session,
- &external_repos_root_url,
- iterpool));
-
-
- last_changed_url = svn_uri_canonicalize(
- apr_pstrcat(iterpool,
- external_repos_root_url, "/",
- b.last_changed_repos_relpath,
- SVN_VA_NULL),
- iterpool);
- if (strcmp(resolved_url, last_changed_url) != 0)
- {
- /* The external was at a different location at its
- * last-changed revision so we must fix up ITEM->URL.
- * ### BUG: Even if the external's URL was relative the
- * ### pinned URL will be absolute because we have no good
- * ### way of transforming the resolved last-changed URL
- * ### into a relative one. */
- item->url = last_changed_url;
- }
- }
- }
+ _("Cannot pin external URL '%s' since it "
+ "does not exist at revision %lu"),
+ resolved_url, external_youngest_rev);
if (item->revision.kind == svn_opt_revision_date)
{
@@ -356,7 +295,7 @@ pin_externals_prop(svn_string_t **pinned
pinned_desc = apr_psprintf(iterpool, "-r%lu %s@%lu %s\n",
item->revision.value.number,
item->url,
- item->peg_revision.value.number,
+ external_youngest_rev,
item->target_dir);
svn_stringbuf_appendcstr(buf, pinned_desc);
}
Modified: subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py?rev=1655324&r1=1655323&r2=1655324&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py Wed Jan 28 13:53:08 2015
@@ -3554,7 +3554,12 @@ def copy_pin_externals(sbox):
wc_dir = sbox.wc_dir
repo_url = sbox.repo_url
+ repo_dir = sbox.repo_dir
other_repo_url = repo_url + ".other"
+ other_repo_dir = repo_dir + ".other"
+
+ external_youngest_rev = svntest.main.youngest(repo_dir)
+ other_external_youngest_rev = svntest.main.youngest(other_repo_dir)
# Perform a repos->repos copy, pinning externals
svntest.actions.run_and_verify_svn(None, None, [],
@@ -3572,7 +3577,7 @@ def copy_pin_externals(sbox):
expected_output = [
'-r%d %s@%d gamma\n' % (last_changed_rev_gamma,
external_url_for["A/B/gamma"],
- last_changed_rev_gamma),
+ external_youngest_rev),
'\n',
]
if svntest.sandbox.is_url(base_path_or_url):
@@ -3583,7 +3588,8 @@ def copy_pin_externals(sbox):
'propget', 'svn:externals',
target)
expected_output = [
- '-r3 %s@3 exdir_G\n' % external_url_for["A/C/exdir_G"],
+ '-r3 %s@%d exdir_G\n' % (external_url_for["A/C/exdir_G"],
+ other_external_youngest_rev),
# Note: A/D/H was last changed in r5, but exdir_H's external
# definition's URL is already pinned to r1.
'-r1 %s exdir_H\n' % external_url_for["A/C/exdir_H"],
@@ -3598,11 +3604,13 @@ def copy_pin_externals(sbox):
target)
expected_output = [
'-r%d %s@%d exdir_A\n' % (last_changed_rev_A,
- external_url_for["A/D/exdir_A"],
- last_changed_rev_A),
- '-r3 %s@3 exdir_A/G\n' % external_url_for["A/D/exdir_A/G/"],
+ external_url_for["A/D/exdir_A"],
+ other_external_youngest_rev),
+ '-r3 %s@%d exdir_A/G\n' % (external_url_for["A/D/exdir_A/G/"],
+ other_external_youngest_rev),
'-r1 %s@1 exdir_A/H\n' % external_url_for["A/D/exdir_A/H"],
- '-r4 %s@4 x/y/z/blah\n' % external_url_for["A/D/x/y/z/blah"],
+ '-r4 %s@%d x/y/z/blah\n' % (external_url_for["A/D/x/y/z/blah"],
+ other_external_youngest_rev),
'\n',
]
if svntest.sandbox.is_url(base_path_or_url):
@@ -3626,6 +3634,7 @@ def copy_pin_externals(sbox):
repo_url, wc_dir)
# Perform a repos->wc copy, pinning externals
+ external_youngest_rev = svntest.main.youngest(repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
repo_url + '/A',
@@ -3653,6 +3662,7 @@ def copy_pin_externals(sbox):
'-m', 'remove A_copy')
# Perform a wc->wc copy, pinning externals
+ external_youngest_rev = svntest.main.youngest(repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
os.path.join(wc_dir, 'A'),
@@ -3671,6 +3681,7 @@ def copy_pin_externals(sbox):
sbox.simple_commit()
change_external(sbox.ospath('A/B'), '^/A/D/gamma-moved gamma', commit=True)
sbox.simple_update()
+ external_youngest_rev = svntest.main.youngest(repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
os.path.join(wc_dir, 'A'),
@@ -3691,6 +3702,7 @@ def copy_pin_externals(sbox):
change_external(sbox.ospath('A/B'), '^/A/D-moved/gamma-moved gamma', commit=False)
sbox.simple_commit()
sbox.simple_update()
+ external_youngest_rev = svntest.main.youngest(repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
os.path.join(wc_dir, 'A'),
@@ -3698,13 +3710,8 @@ def copy_pin_externals(sbox):
'--pin-externals')
# While gamma's path has changed by virtue of being moved along with
# its parent A/D, gamma's last-changed rev should not have changed.
- # Therefore, the pinned external should resolve to the pre-move path,
- # ie. '^/A/D/gamma-moved@11' instead of '^/A/D-moved/gamma-moved@11'.
- #
- # Note that the pinned external will use an absolute URLs in this case.
- # See the "BUG:" comment in libsvn_client's pin_externals_prop() function.
- external_url_for["A/B/gamma"] = ('%s/A/D/gamma-moved' % repo_url)
A_copy_D_path = 'A_copy/D-moved'
+ external_url_for["A/B/gamma"] = '^/A/D-moved/gamma-moved'
verify_pinned_externals(wc_dir)
# Clean up.
@@ -3718,6 +3725,8 @@ def copy_pin_externals(sbox):
other_repo_url + '/A/D/H',
'-m', 'remove A/D/H')
sbox.simple_update()
+ external_youngest_rev = svntest.main.youngest(repo_dir)
+ other_external_youngest_rev = svntest.main.youngest(other_repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
os.path.join(wc_dir, 'A'),
@@ -3739,6 +3748,7 @@ def copy_pin_externals(sbox):
repo_url + '/A/D',
'--pin-externals')
# Test a copy from an old revision with pinning.
+ external_youngest_rev = svntest.main.youngest(repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy',
os.path.join(wc_dir, 'A@6'),