Author: pburba
Date: Thu Dec 3 21:20:17 2009
New Revision: 886924
URL: http://svn.apache.org/viewvc?rev=886924&view=rev
Log:
Fix issue #3180 'svn mergeinfo ignores peg rev for WC target'.
* subversion/libsvn_client/mergeinfo.c
(get_mergeinfo): Actually use the provided peg rev argument when
getting mergeinfo on a WC path.
* subversion/tests/cmdline/mergeinfo_tests.py
(mergeinfo_on_pegged_wc_path): Remove comments re XFail.
(test_list): Remove XFail from mergeinfo_on_pegged_wc_path.
Modified:
subversion/trunk/subversion/libsvn_client/mergeinfo.c
subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py
Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=886924&r1=886923&r2=886924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Thu Dec 3 21:20:17
2009
@@ -958,8 +958,61 @@
{
svn_ra_session_t *ra_session;
svn_revnum_t rev;
+ const char *local_abspath;
+ const char *url;
+ svn_boolean_t is_url = svn_path_is_url(path_or_url);
+ svn_opt_revision_t peg_rev;
+
+ peg_rev.kind = peg_revision->kind;
+ peg_rev.value = peg_revision->value;
+
+ /* If PATH_OR_URL is as working copy path determine if we will need to
+ contact the repository for the requested PEG_REVISION. */
+ if (!is_url)
+ {
+ SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
+ scratch_pool));
+
+ if (peg_rev.kind == svn_opt_revision_date
+ || peg_rev.kind == svn_opt_revision_head)
+ {
+ /* If a working copy path is pegged at head or a date then
+ we know we must contact the repository for the revision.
+ So get only the url for PATH_OR_URL... */
+ SVN_ERR(svn_client__entry_location(&url, NULL, ctx->wc_ctx,
+ local_abspath,
+ svn_opt_revision_working,
+ result_pool, scratch_pool));
+ }
+ else
+ {
+ /* ...Otherwise get the revision too. */
+ SVN_ERR(svn_client__entry_location(&url, &rev, ctx->wc_ctx,
+ local_abspath,
+ peg_rev.kind,
+ result_pool, scratch_pool));
+ }
+
+
+ if (peg_rev.kind == svn_opt_revision_date
+ || peg_rev.kind == svn_opt_revision_head
+ || peg_rev.kind == svn_opt_revision_previous
+ || (peg_rev.kind == svn_opt_revision_number
+ && peg_rev.value.number != rev))
+ {
+ /* This working copy path PATH_OR_URL is pegged at a value
+ which requires we contact the repository. */
+ path_or_url = url;
+ is_url = TRUE;
+ if (peg_rev.kind == svn_opt_revision_previous)
+ {
+ peg_rev.kind = svn_opt_revision_number;
+ peg_rev.value.number = rev;
+ }
+ }
+ }
- if (svn_path_is_url(path_or_url))
+ if (is_url)
{
const char *repos_rel_path;
const char *local_abspath;
@@ -970,7 +1023,7 @@
TRUE, ctx, scratch_pool));
SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
local_abspath, ra_session,
- peg_revision, scratch_pool));
+ &peg_rev, scratch_pool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, scratch_pool));
SVN_ERR(svn_client__path_relative_to_root(&repos_rel_path, ctx->wc_ctx,
path_or_url, *repos_root,
@@ -988,19 +1041,9 @@
}
else /* ! svn_path_is_url() */
{
- const char *url;
svn_boolean_t indirect;
- const char *local_abspath;
-
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
- scratch_pool));
/* Check server Merge Tracking capability. */
- SVN_ERR(svn_client__entry_location(&url, &rev, ctx->wc_ctx,
- local_abspath,
- svn_opt_revision_working,
- result_pool, scratch_pool));
-
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
NULL, NULL, FALSE,
TRUE, ctx, scratch_pool));
@@ -1009,7 +1052,7 @@
/* Acquire return values. */
SVN_ERR(svn_client__get_repos_root(repos_root, local_abspath,
- peg_revision, ctx, result_pool,
+ &peg_rev, ctx, result_pool,
scratch_pool));
SVN_ERR(svn_client__get_wc_or_repos_mergeinfo_catalog(
mergeinfo_catalog, &indirect, include_descendants, FALSE,
Modified: subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py?rev=886924&r1=886923&r2=886924&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/mergeinfo_tests.py Thu Dec 3
21:20:17 2009
@@ -346,8 +346,6 @@
'--depth', 'infinity')
# Test for issue #3180 'svn mergeinfo ignores peg rev for WC target'.
-#
-# This test is marked as XFail until this issue is fixed.
def mergeinfo_on_pegged_wc_path(sbox):
"svn mergeinfo on pegged working copy target"
@@ -386,8 +384,7 @@
'-m', 'Merge r5')
# Ask for merged revisions to A_COPY pegged at various values.
- # This currently fails as the pegged revision is ignored and
- # the working rev is always used.
+ # Prior to issue #3180 fix the peg revision was ignored.
#
# A_COPY pegged to non-existent revision
svntest.actions.run_and_verify_mergeinfo(
@@ -433,8 +430,8 @@
mergeinfo_on_unknown_url,
non_inheritable_mergeinfo,
SkipUnless(recursive_mergeinfo, server_has_mergeinfo),
- XFail(SkipUnless(mergeinfo_on_pegged_wc_path,
- server_has_mergeinfo)),
+ SkipUnless(mergeinfo_on_pegged_wc_path,
+ server_has_mergeinfo),
]
if __name__ == '__main__':