You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2014/03/07 18:13:28 UTC
svn commit: r1575330 - in /subversion/branches/1.8.x-r1574868: ./
subversion/libsvn_repos/dump.c subversion/tests/libsvn_repos/repos-test.c
Author: julianfoad
Date: Fri Mar 7 17:13:28 2014
New Revision: 1575330
URL: http://svn.apache.org/r1575330
Log:
On the 1.8.x-r1574868 branch: merge r1574868 from trunk.
Modified:
subversion/branches/1.8.x-r1574868/ (props changed)
subversion/branches/1.8.x-r1574868/subversion/libsvn_repos/dump.c
subversion/branches/1.8.x-r1574868/subversion/tests/libsvn_repos/repos-test.c
Propchange: subversion/branches/1.8.x-r1574868/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1574868
Modified: subversion/branches/1.8.x-r1574868/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1574868/subversion/libsvn_repos/dump.c?rev=1575330&r1=1575329&r2=1575330&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1574868/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/1.8.x-r1574868/subversion/libsvn_repos/dump.c Fri Mar 7 17:13:28 2014
@@ -217,6 +217,49 @@ make_dir_baton(const char *path,
}
+/* If the mergeinfo in MERGEINFO_STR refers to any revisions older than
+ * OLDEST_DUMPED_REV, issue a warning and set *FOUND_OLD_MERGEINFO to TRUE,
+ * otherwise leave *FOUND_OLD_MERGEINFO unchanged.
+ */
+static svn_error_t *
+verify_mergeinfo_revisions(svn_boolean_t *found_old_mergeinfo,
+ const char *mergeinfo_str,
+ svn_revnum_t oldest_dumped_rev,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
+ apr_pool_t *pool)
+{
+ svn_mergeinfo_t mergeinfo, old_mergeinfo;
+
+ SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str, pool));
+ SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
+ &old_mergeinfo, mergeinfo,
+ oldest_dumped_rev - 1, 0,
+ TRUE, pool, pool));
+
+ if (apr_hash_count(old_mergeinfo))
+ {
+ svn_repos_notify_t *notify =
+ svn_repos_notify_create(svn_repos_notify_warning, pool);
+
+ notify->warning = svn_repos_notify_warning_found_old_mergeinfo;
+ notify->warning_str = apr_psprintf(
+ pool,
+ _("Mergeinfo referencing revision(s) prior "
+ "to the oldest dumped revision (r%ld). "
+ "Loading this dump may result in invalid "
+ "mergeinfo."),
+ oldest_dumped_rev);
+
+ if (found_old_mergeinfo)
+ *found_old_mergeinfo = TRUE;
+ notify_func(notify_baton, notify, pool);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
/* This helper is the main "meat" of the editor -- it does all the
work of writing a node record.
@@ -475,32 +518,13 @@ dump_node(struct edit_baton *eb,
SVN_PROP_MERGEINFO);
if (mergeinfo_str)
{
- svn_mergeinfo_t mergeinfo, old_mergeinfo;
-
- SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str->data,
- pool));
- SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
- &old_mergeinfo, mergeinfo,
- eb->oldest_dumped_rev - 1, 0,
- TRUE, pool, pool));
- if (apr_hash_count(old_mergeinfo))
- {
- svn_repos_notify_t *notify =
- svn_repos_notify_create(svn_repos_notify_warning, pool);
-
- notify->warning = svn_repos_notify_warning_found_old_mergeinfo;
- notify->warning_str = apr_psprintf(
- pool,
- _("Mergeinfo referencing revision(s) prior "
- "to the oldest dumped revision (r%ld). "
- "Loading this dump may result in invalid "
- "mergeinfo."),
- eb->oldest_dumped_rev);
-
- if (eb->found_old_mergeinfo)
- *eb->found_old_mergeinfo = TRUE;
- eb->notify_func(eb->notify_baton, notify, pool);
- }
+ /* An error in verifying the mergeinfo must not prevent dumping
+ the data. Ignore any such error. */
+ svn_error_clear(verify_mergeinfo_revisions(
+ eb->found_old_mergeinfo,
+ mergeinfo_str->data, eb->oldest_dumped_rev,
+ eb->notify_func, eb->notify_baton,
+ pool));
}
}
Modified: subversion/branches/1.8.x-r1574868/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1574868/subversion/tests/libsvn_repos/repos-test.c?rev=1575330&r1=1575329&r2=1575330&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1574868/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/1.8.x-r1574868/subversion/tests/libsvn_repos/repos-test.c Fri Mar 7 17:13:28 2014
@@ -3261,6 +3261,65 @@ filename_with_control_chars(const svn_te
}
+/* Notification receiver for test_dump_bad_mergeinfo(). This does not
+ need to do anything, it just needs to exist.
+ */
+static void
+dump_r0_mergeinfo_notifier(void *baton,
+ const svn_repos_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+}
+
+/* Regression test for part the 'dump' part of issue #4476 "Mergeinfo
+ containing r0 makes svnsync and svnadmin dump fail". */
+static svn_error_t *
+test_dump_r0_mergeinfo(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_repos_t *repos;
+ svn_fs_t *fs;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root;
+ svn_revnum_t youngest_rev = 0;
+ const svn_string_t *bad_mergeinfo = svn_string_create("/foo:0", pool);
+
+ SVN_ERR(svn_test__create_repos(&repos, "test-repo-dump-r0-mergeinfo",
+ opts, pool));
+ fs = svn_repos_fs(repos);
+
+ /* Revision 1: Any commit will do, here */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "/bar", pool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+
+ /* Revision 2: Add bad mergeinfo */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_fs_change_node_prop(txn_root, "/bar", "svn:mergeinfo", bad_mergeinfo, pool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+
+ /* Test that a dump completes without error. In order to exercise the
+ functionality under test -- that is, in order for the dump to try to
+ parse the mergeinfo it is dumping -- the dump must start from a
+ revision greater than 1 and must take a notification callback. */
+ {
+ svn_stringbuf_t *stringbuf = svn_stringbuf_create_empty(pool);
+ svn_stream_t *stream = svn_stream_from_stringbuf(stringbuf, pool);
+
+ SVN_ERR(svn_repos_dump_fs3(repos, stream, 2, SVN_INVALID_REVNUM,
+ FALSE, FALSE,
+ dump_r0_mergeinfo_notifier, NULL,
+ NULL, NULL,
+ pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
struct svn_test_descriptor_t test_funcs[] =
@@ -3306,5 +3365,7 @@ struct svn_test_descriptor_t test_funcs[
"test svn_repos_delete"),
SVN_TEST_OPTS_PASS(filename_with_control_chars,
"test filenames with control characters"),
+ SVN_TEST_OPTS_PASS(test_dump_r0_mergeinfo,
+ "test dumping with r0 mergeinfo"),
SVN_TEST_NULL
};