You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/09/21 17:31:47 UTC
svn commit: r1173713 - in /subversion/branches/1.7.x: ./ STATUS
subversion/libsvn_client/merge.c
subversion/tests/cmdline/merge_reintegrate_tests.py
Author: hwright
Date: Wed Sep 21 15:31:46 2011
New Revision: 1173713
URL: http://svn.apache.org/viewvc?rev=1173713&view=rev
Log:
Merge r1147299, r1162974, r1162995 from trunk:
* r1147299, r1162974, r1162995
Fix issue #3867 'reintegrate merges create mergeinfo for non-existent
paths' and issue #3961 'reintegrate merge of replaced source produces
inaccurate mergeinfo'.
Justification:
Avoid potential confusion which can occur when a reintegrate merge
sets mergeinfo (to describe the merge) which contains non-existent
path-revs, other lines of history, and/or valid path-revs which were
never merged.
Notes:
r1147299 and r1162995 is the addition and tweak of a test for
issue #3961. A test already existed for issue #3867 prior to branching
1.7.x. r1162974 is the fix for both issues.
Votes:
+1: pburba, stsp, rhuijben
Modified:
subversion/branches/1.7.x/ (props changed)
subversion/branches/1.7.x/STATUS
subversion/branches/1.7.x/subversion/libsvn_client/merge.c
subversion/branches/1.7.x/subversion/tests/cmdline/merge_reintegrate_tests.py
Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 21 15:31:46 2011
@@ -64,4 +64,4 @@
/subversion/branches/tree-conflicts:868291-873154
/subversion/branches/tree-conflicts-notify:873926-874008
/subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,115
8193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650,1171708,1173111
+/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,115
8187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650,1171708,1173111
Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1173713&r1=1173712&r2=1173713&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed Sep 21 15:31:46 2011
@@ -128,19 +128,3 @@ Veto-blocked changes:
Approved changes:
=================
-
- * r1147299, r1162974, r1162995
- Fix issue #3867 'reintegrate merges create mergeinfo for non-existent
- paths' and issue #3961 'reintegrate merge of replaced source produces
- inaccurate mergeinfo'.
- Justification:
- Avoid potential confusion which can occur when a reintegrate merge
- sets mergeinfo (to describe the merge) which contains non-existent
- path-revs, other lines of history, and/or valid path-revs which were
- never merged.
- Notes:
- r1147299 and r1162995 is the addition and tweak of a test for
- issue #3961. A test already existed for issue #3867 prior to branching
- 1.7.x. r1162974 is the fix for both issues.
- Votes:
- +1: pburba, stsp, rhuijben
Modified: subversion/branches/1.7.x/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_client/merge.c?rev=1173713&r1=1173712&r2=1173713&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_client/merge.c Wed Sep 21 15:31:46 2011
@@ -7690,19 +7690,38 @@ record_mergeinfo_for_dir_merge(svn_merge
child_merges = apr_hash_make(iterpool);
- /* If CHILD is the merge target we then know that the mergeinfo
- described by MERGE_SOURCE_PATH:MERGED_RANGE->START-
- MERGED_RANGE->END describes existent path-revs in the repository,
- see normalize_merge_sources() and the global comment
+ /* The short story:
+
+ If we are describing a forward merge, then the naive mergeinfo
+ defined by MERGE_SOURCE_PATH:MERGED_RANGE->START:
+ MERGE_SOURCE_PATH:MERGED_RANGE->END may contain non-existent
+ path-revs or may describe other lines of history. We must
+ remove these invalid portion(s) before recording mergeinfo
+ describing the merge.
+
+ The long story:
+
+ If CHILD is the merge target we know that
+ MERGE_SOURCE_PATH:MERGED_RANGE->END exists. Further, if there
+ were no copies in MERGE_SOURCE_PATH's history going back to
+ RANGE->START then we know that
+ MERGE_SOURCE_PATH:MERGED_RANGE->START exists too and the two
+ describe and unbroken line of history and thus
+ MERGE_SOURCE_PATH:MERGED_RANGE->START:
+ MERGE_SOURCE_PATH:MERGED_RANGE->END is a valid description of
+ the merge -- see normalize_merge_sources() and the global comment
'MERGEINFO MERGE SOURCE NORMALIZATION'.
- If CHILD is a subtree of the merge target however, then no such
- guarantee holds. The mergeinfo described by
- (MERGE_SOURCE_PATH + CHILD_REPOS_PATH):MERGED_RANGE->START-
- MERGED_RANGE->END might contain merge sources which don't
- exist or refer to unrelated lines of history. */
- if (i > 0
- && (!merge_b->record_only || merge_b->reintegrate_merge)
+ However, if there *was* a copy, then
+ MERGE_SOURCE_PATH:MERGED_RANGE->START doesn't exist or is
+ unrelated to MERGE_SOURCE_PATH:MERGED_RANGE->END. Also, we
+ don't know if (MERGE_SOURCE_PATH:MERGED_RANGE->START)+1 through
+ (MERGE_SOURCE_PATH:MERGED_RANGE->END)-1 actually exist.
+
+ If CHILD is a subtree of the merge target, then nothing is
+ guaranteed beyond the fact that MERGE_SOURCE_PATH exists at
+ MERGED_RANGE->END. */
+ if ((!merge_b->record_only || merge_b->reintegrate_merge)
&& (!is_rollback))
{
svn_error_t *err;
Modified: subversion/branches/1.7.x/subversion/tests/cmdline/merge_reintegrate_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/merge_reintegrate_tests.py?rev=1173713&r1=1173712&r2=1173713&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/cmdline/merge_reintegrate_tests.py (original)
+++ subversion/branches/1.7.x/subversion/tests/cmdline/merge_reintegrate_tests.py Wed Sep 21 15:31:46 2011
@@ -2239,7 +2239,6 @@ def two_URL_merge_removes_valid_mergeinf
# Test for issue #3867 'reintegrate merges create mergeinfo for
# non-existent paths'.
@Issue(3867)
-@XFail()
def reintegrate_creates_bogus_mergeinfo(sbox):
"reintegrate creates bogus mergeinfo"
@@ -2268,11 +2267,11 @@ def reintegrate_creates_bogus_mergeinfo(
svntest.main.run_svn(None, "cp", A_path_1, A_COPY_path)
svntest.main.run_svn(None, "ci", "-m", "create a branch", wc_dir)
- # Make a text edit on the branch pushing the repo to rev6
+ # Make a text edit on the branch pushing the repo to r5
svntest.main.file_write(A_COPY_psi_path, "Branch edit.\n")
svntest.main.run_svn(None, "ci", "-m", "branch edit", wc_dir)
- # Sync the A_COPY with A in preparation for reintegrate
+ # Sync the A_COPY with A in preparation for reintegrate and commit as r6.
svntest.main.run_svn(None, "up", wc_dir)
svntest.main.run_svn(None, "merge", sbox.repo_url + "/A", A_COPY_path)
svntest.main.run_svn(None, "ci", "-m", "sync A_COPY with A", wc_dir)
@@ -2282,10 +2281,6 @@ def reintegrate_creates_bogus_mergeinfo(
# Reintegrate A_COPY to A. The resulting merginfo on A should be
# /A_COPY:4-10
- #
- # Currently this test fails because the resulting mergeinfo is /A_COPY:2-6.
- # But A_COPY didn't exist unitl r4, so /A_COPY:2-3 describes merge source
- # path-revs which don't exist.
expected_output = wc.State(A_path, {
'D/H/psi' : Item(status='U '),
})
@@ -2423,7 +2418,7 @@ def no_source_subtree_mergeinfo(sbox):
expected_elision = wc.State(os.path.join(wc_dir, 'A', 'B'), {
})
expected_disk = wc.State('', {
- '' : Item(props={SVN_PROP_MERGEINFO : '/A/B2:3-12'}),
+ '' : Item(props={SVN_PROP_MERGEINFO : '/A/B2:4-12'}),
'E' : Item(),
'E/alpha' : Item("AAA\n" +
"BBB\n" +
@@ -2451,7 +2446,132 @@ def no_source_subtree_mergeinfo(sbox):
# None, None, None, None, None,
# 1, 1, '--reintegrate')
+#----------------------------------------------------------------------
+@SkipUnless(server_has_mergeinfo)
+@Issue(3961)
+def reintegrate_replaced_source(sbox):
+ "reintegrate a replaced source branch"
+
+ # Make A_COPY branch in r2, and do a few more commits to A in r3-6.
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ expected_disk, expected_status = set_up_branch(sbox)
+
+ A_path = os.path.join(sbox.wc_dir, "A")
+ A_COPY_path = os.path.join(sbox.wc_dir, "A_COPY")
+ beta_COPY_path = os.path.join(sbox.wc_dir, "A_COPY", "B", "E", "beta")
+ mu_COPY_path = os.path.join(sbox.wc_dir, "A_COPY", "mu")
+ # Using cherrypick merges, simulate a series of sync merges from A to
+ # A_COPY with a replace of A_COPY along the way.
+ #
+ # r6 - Merge r3 from A to A_COPY
+ svntest.main.run_svn(None, 'up', wc_dir)
+ svntest.main.run_svn(None, 'merge', sbox.repo_url + '/A', A_COPY_path,
+ '-c3')
+ svntest.main.run_svn(None, 'ci', '-m', 'Merge r3 from A to A_COPY', wc_dir)
+
+ # r8 - Merge r4 from A to A_COPY
+ svntest.main.run_svn(None, 'up', wc_dir)
+ svntest.main.run_svn(None, 'merge', sbox.repo_url + '/A', A_COPY_path,
+ '-c4')
+ svntest.main.run_svn(None, 'ci', '-m', 'Merge r4 from A to A_COPY', wc_dir)
+
+ # r9 - Merge r5 from A to A_COPY. Make an additional edit to
+ # A_COPY/B/E/beta.
+ svntest.main.run_svn(None, 'up', wc_dir)
+ svntest.main.run_svn(None, 'merge', sbox.repo_url + '/A', A_COPY_path,
+ '-c5')
+ svntest.main.file_write(beta_COPY_path, "Branch edit mistake.\n")
+ svntest.main.run_svn(None, 'ci', '-m', 'Merge r5 from A to A_COPY', wc_dir)
+
+ # r10 - Delete A_COPY and replace it with A_COPY@8. This removes the edit
+ # we made above in r9 to A_COPY/B/E/beta.
+ svntest.main.run_svn(None, 'up', wc_dir)
+ svntest.main.run_svn(None, 'delete', A_COPY_path)
+ svntest.main.run_svn(None, 'copy', sbox.repo_url + '/A_COPY@8',
+ A_COPY_path)
+ svntest.main.run_svn(None, 'ci', '-m', 'Replace A_COPY with A_COPY@8',
+ wc_dir)
+
+ # r11 - Make an edit on A_COPY/mu.
+ svntest.main.file_write(mu_COPY_path, "Branch edit.\n")
+ svntest.main.run_svn(None, 'ci', '-m', 'Branch edit',
+ wc_dir)
+
+ # r12 - Do a final sync merge of A to A_COPY in preparation for
+ # reintegration.
+ svntest.main.run_svn(None, 'up', wc_dir)
+ svntest.main.run_svn(None, 'merge', sbox.repo_url + '/A', A_COPY_path)
+ svntest.main.run_svn(None, 'ci', '-m', 'Sycn A_COPY with A', wc_dir)
+
+ # Reintegrate A_COPY to A. The resulting mergeinfo should be
+ # '/A_COPY:2-8,10-12' because of the replacement which removed /A_COPY:9
+ # from the reintegrate source's history.
+ svntest.main.run_svn(None, 'up', wc_dir)
+ expected_output = wc.State(A_path, {
+ 'mu' : Item(status='U '),
+ })
+ expected_mergeinfo_output = wc.State(A_path, {
+ '' : Item(status=' U'),
+ })
+ expected_elision_output = wc.State(A_path, {
+ })
+ expected_status = wc.State(A_path, {
+ '' : Item(status=' M'),
+ 'B' : Item(status=' '),
+ 'mu' : Item(status='M '),
+ 'B/E' : Item(status=' '),
+ 'B/E/alpha' : Item(status=' '),
+ 'B/E/beta' : Item(status=' '),
+ 'B/lambda' : Item(status=' '),
+ 'B/F' : Item(status=' '),
+ 'C' : Item(status=' '),
+ 'D' : Item(status=' '),
+ 'D/G' : Item(status=' '),
+ 'D/G/pi' : Item(status=' '),
+ 'D/G/rho' : Item(status=' '),
+ 'D/G/tau' : Item(status=' '),
+ 'D/gamma' : Item(status=' '),
+ 'D/H' : Item(status=' '),
+ 'D/H/chi' : Item(status=' '),
+ 'D/H/psi' : Item(status=' '),
+ 'D/H/omega' : Item(status=' '),
+ })
+ expected_status.tweak(wc_rev=12)
+ expected_disk = wc.State('', {
+ '' : Item(props={SVN_PROP_MERGEINFO : '/A_COPY:2-8,10-12'}),
+ 'B' : Item(),
+ 'mu' : Item("Branch edit.\n"),
+ 'B/E' : Item(),
+ 'B/E/alpha' : Item("This is the file 'alpha'.\n"),
+ 'B/E/beta' : Item("New content"),
+ 'B/lambda' : Item("This is the file 'lambda'.\n"),
+ 'B/F' : Item(),
+ 'C' : Item(),
+ 'D' : Item(),
+ 'D/G' : Item(),
+ 'D/G/pi' : Item("This is the file 'pi'.\n"),
+ 'D/G/rho' : Item("New content"),
+ 'D/G/tau' : Item("This is the file 'tau'.\n"),
+ 'D/gamma' : Item("This is the file 'gamma'.\n"),
+ 'D/H' : Item(),
+ 'D/H/chi' : Item("This is the file 'chi'.\n"),
+ 'D/H/psi' : Item("New content"),
+ 'D/H/omega' : Item("New content"),
+ })
+ expected_skip = wc.State(A_path, { })
+ svntest.actions.run_and_verify_merge(A_path, None, None,
+ sbox.repo_url + '/A_COPY', None,
+ expected_output,
+ expected_mergeinfo_output,
+ expected_elision_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ [], None, None, None, None, True, True,
+ '--reintegrate', A_path)
+
########################################################################
# Run the tests
@@ -2474,6 +2594,7 @@ test_list = [ None,
two_URL_merge_removes_valid_mergeinfo_from_target,
reintegrate_creates_bogus_mergeinfo,
no_source_subtree_mergeinfo,
+ reintegrate_replaced_source,
]
if __name__ == '__main__':