Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 76C0B200CC6 for ; Tue, 18 Jul 2017 18:01:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7535E16715C; Tue, 18 Jul 2017 16:01:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 94250167155 for ; Tue, 18 Jul 2017 18:01:15 +0200 (CEST) Received: (qmail 28322 invoked by uid 500); 18 Jul 2017 16:01:14 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 28312 invoked by uid 99); 18 Jul 2017 16:01:14 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2017 16:01:14 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id CC8063A010E for ; Tue, 18 Jul 2017 16:01:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1802316 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/export.c tests/cmdline/export_tests.py Date: Tue, 18 Jul 2017 16:01:11 -0000 To: commits@subversion.apache.org From: philip@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170718160113.CC8063A010E@svn01-us-west.apache.org> archived-at: Tue, 18 Jul 2017 16:01:16 -0000 Author: philip Date: Tue Jul 18 16:01:11 2017 New Revision: 1802316 URL: http://svn.apache.org/viewvc?rev=1802316&view=rev Log: Make svn_client_export5 only deal with the repository URL in cases where a revision is supplied. This resolves an assertion failure if a working copy path was supplied and there are relative externals. * subversion/include/svn_client.h (svn_client_export5): Update documentation to indicate that revision is no longer only used when exporting from a repository URL. * subversion/libsvn_client/export.c (export_file_ev2, export_file, export_directory): Change to only handle URLs and assert that the supplied from_url parameter is actually a URL. (svn_client_export5): If exporting a working copy requires a URL, convert the working copy path to a URL prior to passing it to the export_* functions mentioned above. * subversion/tests/cmdline/export_tests.py (export_revision_with_root_relative_external): Remove XFail tag, and update the test to check for correct output and export results Modified: subversion/trunk/subversion/include/svn_client.h subversion/trunk/subversion/libsvn_client/export.c subversion/trunk/subversion/tests/cmdline/export_tests.py Modified: subversion/trunk/subversion/include/svn_client.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1802316&r1=1802315&r2=1802316&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_client.h (original) +++ subversion/trunk/subversion/include/svn_client.h Tue Jul 18 16:01:11 2017 @@ -6251,8 +6251,7 @@ svn_client_revprop_list(apr_hash_t **pro * #svn_opt_revision_unspecified, then it defaults to #svn_opt_revision_head * for URLs or #svn_opt_revision_working for WC targets. * - * @a revision is the revision that should be exported, which is only used - * when exporting from a repository. + * @a revision is the revision that should be exported. * * @a peg_revision and @a revision must not be @c NULL. * Modified: subversion/trunk/subversion/libsvn_client/export.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1802316&r1=1802315&r2=1802316&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/export.c (original) +++ subversion/trunk/subversion/libsvn_client/export.c Tue Jul 18 16:01:11 2017 @@ -1148,7 +1148,7 @@ get_editor_ev2(const svn_delta_editor_t } static svn_error_t * -export_file_ev2(const char *from_path_or_url, +export_file_ev2(const char *from_url, const char *to_path, struct edit_baton *eb, svn_client__pathrev_t *loc, @@ -1156,23 +1156,21 @@ export_file_ev2(const char *from_path_or svn_boolean_t overwrite, apr_pool_t *scratch_pool) { - svn_boolean_t from_is_url = svn_path_is_url(from_path_or_url); apr_hash_t *props; svn_stream_t *tmp_stream; svn_node_kind_t to_kind; + SVN_ERR_ASSERT(svn_path_is_url(from_url)); + if (svn_path_is_empty(to_path)) { - if (from_is_url) - to_path = svn_uri_basename(from_path_or_url, scratch_pool); - else - to_path = svn_dirent_basename(from_path_or_url, NULL); + to_path = svn_uri_basename(from_url, scratch_pool); eb->root_path = to_path; } else { - SVN_ERR(append_basename_if_dir(&to_path, from_path_or_url, - from_is_url, scratch_pool)); + SVN_ERR(append_basename_if_dir(&to_path, from_url, + TRUE, scratch_pool)); eb->root_path = to_path; } @@ -1204,7 +1202,7 @@ export_file_ev2(const char *from_path_or } static svn_error_t * -export_file(const char *from_path_or_url, +export_file(const char *from_url, const char *to_path, struct edit_baton *eb, svn_client__pathrev_t *loc, @@ -1216,20 +1214,18 @@ export_file(const char *from_path_or_url apr_hash_index_t *hi; struct file_baton *fb = apr_pcalloc(scratch_pool, sizeof(*fb)); svn_node_kind_t to_kind; - svn_boolean_t from_is_url = svn_path_is_url(from_path_or_url); + + SVN_ERR_ASSERT(svn_path_is_url(from_url)); if (svn_path_is_empty(to_path)) { - if (from_is_url) - to_path = svn_uri_basename(from_path_or_url, scratch_pool); - else - to_path = svn_dirent_basename(from_path_or_url, NULL); + to_path = svn_uri_basename(from_url, scratch_pool); eb->root_path = to_path; } else { - SVN_ERR(append_basename_if_dir(&to_path, from_path_or_url, - from_is_url, scratch_pool)); + SVN_ERR(append_basename_if_dir(&to_path, from_url, + TRUE, scratch_pool)); eb->root_path = to_path; } @@ -1288,7 +1284,7 @@ export_file(const char *from_path_or_url } static svn_error_t * -export_directory(const char *from_path_or_url, +export_directory(const char *from_url, const char *to_path, struct edit_baton *eb, svn_client__pathrev_t *loc, @@ -1307,6 +1303,8 @@ export_directory(const char *from_path_o void *report_baton; svn_node_kind_t kind; + SVN_ERR_ASSERT(svn_path_is_url(from_url)); + if (!ENABLE_EV2_IMPL) SVN_ERR(get_editor_ev1(&export_editor, &edit_baton, eb, ctx, scratch_pool, scratch_pool)); @@ -1355,7 +1353,7 @@ export_directory(const char *from_path_o SVN_ERR(svn_dirent_get_absolute(&to_abspath, to_path, scratch_pool)); SVN_ERR(svn_client__export_externals(eb->externals, - from_path_or_url, + from_url, to_abspath, eb->repos_root_url, depth, native_eol, ignore_keywords, @@ -1402,8 +1400,12 @@ svn_client_export5(svn_revnum_t *result_ svn_client__pathrev_t *loc; svn_ra_session_t *ra_session; svn_node_kind_t kind; + const char *from_url; struct edit_baton *eb = apr_pcalloc(pool, sizeof(*eb)); + SVN_ERR(svn_client_url_from_path2(&from_url, from_path_or_url, + ctx, pool, pool)); + /* Get the RA connection. */ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc, from_path_or_url, NULL, @@ -1428,15 +1430,15 @@ svn_client_export5(svn_revnum_t *result_ if (kind == svn_node_file) { if (!ENABLE_EV2_IMPL) - SVN_ERR(export_file(from_path_or_url, to_path, eb, loc, ra_session, + SVN_ERR(export_file(from_url, to_path, eb, loc, ra_session, overwrite, pool)); else - SVN_ERR(export_file_ev2(from_path_or_url, to_path, eb, loc, + SVN_ERR(export_file_ev2(from_url, to_path, eb, loc, ra_session, overwrite, pool)); } else if (kind == svn_node_dir) { - SVN_ERR(export_directory(from_path_or_url, to_path, + SVN_ERR(export_directory(from_url, to_path, eb, loc, ra_session, overwrite, ignore_externals, ignore_keywords, depth, native_eol, ctx, pool)); Modified: subversion/trunk/subversion/tests/cmdline/export_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/export_tests.py?rev=1802316&r1=1802315&r2=1802316&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/export_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/export_tests.py Tue Jul 18 16:01:11 2017 @@ -1070,7 +1070,6 @@ def export_file_externals2(sbox): expected_output, expected_disk) -@XFail() def export_revision_with_root_relative_external(sbox): "export a revision with root-relative external" sbox.build() @@ -1089,18 +1088,37 @@ def export_revision_with_root_relative_e # Update the working copy to receive file external svntest.main.run_svn(None, 'up', wc_dir) + # Update the expected disk tree to include the external. + expected_disk = svntest.main.greek_state.copy() + expected_disk.add({ + 'A/C/exfile_alpha' : Item("This is the file 'alpha'.\n"), + }) + + # Update the expected output to include the external. + expected_output = svntest.main.greek_state.copy() + expected_output.add({ + 'A/C/exfile_alpha' : Item("This is the file 'alpha'.\r"), + }) + expected_output.desc[''] = Item() + expected_output.tweak(contents=None, status='A ') + # Export revision 2 from URL export_target = sbox.add_wc_path('export_url') - svntest.actions.run_and_verify_svn(None, [], - 'export', sbox.repo_url, export_target, - '-r', 2) + expected_output.wc_dir = export_target + svntest.actions.run_and_verify_export(sbox.repo_url, + export_target, + expected_output, + expected_disk, + '-r', 2) # Export revision 2 from WC - # Fails (canonicalize: Assertion `*src != '/'' failed) export_target = sbox.add_wc_path('export_wc') - svntest.actions.run_and_verify_svn(None, [], - 'export', sbox.wc_dir, export_target, - '-r', 2) + expected_output.wc_dir = export_target + svntest.actions.run_and_verify_export(sbox.wc_dir, + export_target, + expected_output, + expected_disk, + '-r', 2) ########################################################################