| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Subversion
Revision: 32906
Author: julianfoad
Date: 04 Sep 2008 14:35:18
Changes:Add a test for a problem whereby a merge fails to apply two successive edits
to the same property, because it doesn't like the fact that the property is
"locally modified" after the first edit. This can occur within a single
merge-tracking merge that internally operates with multiple phases, as well
as in a sequence of cherry-picking or 2-URL merges.
* subversion/tests/cmdline/merge_tests.py
(set_up_branch): Tweak the doc string.
(svn_merge): If the expected output is not supplied, construct a reasonable
expectation rather than accepting any output.
(svn_propset): New function.
(merge_two_edits_to_same_prop): New test function.
(test_list): Add the new test as XFail.
| ... | ...@@ -4535,10 +4535,11 @@ | |
| 4535 | 4535 | '''Starting with standard greek tree, copy 'A' NBR_OF_BRANCHES times |
| 4536 | 4536 | to A_COPY, A_COPY_2, A_COPY_3, and so on. Then make four modifications |
| 4537 | 4537 | (setting file contents to "New content") under A: |
| 4538 | r(2 + NBR_OF_BRANCHES) - A/D/H/psi | |
| 4539 | r(3 + NBR_OF_BRANCHES) - A/D/G/rho | |
| 4540 | r(4 + NBR_OF_BRANCHES) - A/B/E/beta | |
| 4541 | r(5 + NBR_OF_BRANCHES) - A/D/H/omega''' | |
| 4538 | r(2 + NBR_OF_BRANCHES) - A/D/H/psi | |
| 4539 | r(3 + NBR_OF_BRANCHES) - A/D/G/rho | |
| 4540 | r(4 + NBR_OF_BRANCHES) - A/B/E/beta | |
| 4541 | r(5 + NBR_OF_BRANCHES) - A/D/H/omega | |
| 4542 | Return (expected_disk, expected_status).''' | |
| 4542 | 4543 | |
| 4543 | 4544 | wc_dir = sbox.wc_dir |
| 4544 | 4545 | |
| ... | ...@@ -12068,14 +12069,24 @@ | |
| 12068 | 12069 | svn_commit.repo_rev += 1 |
| 12069 | 12070 | return svn_commit.repo_rev |
| 12070 | 12071 | |
| 12071 | def svn_merge(src_change_num, source, target, exp_out=svntest.verify.AnyOutput): | |
| 12072 | def svn_merge(src_change_num, source, target, exp_out=None): | |
| 12072 | 12073 | "Merge a single change from path 'source' to path 'target'" |
| 12073 | 12074 | source = local_path(source) |
| 12074 | 12075 | target = local_path(target) |
| 12076 | if exp_out is None: | |
| 12077 | exp_1 = "--- Merging r" + str(src_change_num) | |
| 12078 | exp_1 += " into '" + target + ".*':" | |
| 12079 | exp_2 = "(A |D |[UG] | [UG]|[UG][UG]) " + target + ".*" | |
| 12080 | exp_out = svntest.verify.RegexOutput(exp_1 + "|" + exp_2) | |
| 12075 | 12081 | svntest.actions.run_and_verify_svn(None, exp_out, [], |
| 12076 | 12082 | 'merge', '-c', src_change_num, |
| 12077 | 12083 | source, target) |
| 12078 | 12084 | |
| 12085 | def svn_propset(pname, pvalue, *paths): | |
| 12086 | "Set property 'pname' to value 'pvalue' on each path in 'paths'" | |
| 12087 | svntest.actions.run_and_verify_svn(None, None, [], 'propset', pname, pvalue, | |
| 12088 | *(local_path(path) for path in paths)) | |
| 12089 | ||
| 12079 | 12090 | #---------------------------------------------------------------------- |
| 12080 | 12091 | # Tests for merging the deletion of a node, where the node to be deleted |
| 12081 | 12092 | # is the same as or different from the node that was deleted. |
| ... | ...@@ -12537,6 +12548,44 @@ | |
| 12537 | 12548 | None, None, None, None, |
| 12538 | 12549 | None, 1) |
| 12539 | 12550 | |
| 12551 | def merge_two_edits_to_same_prop(sbox): | |
| 12552 | "merge two successive edits to the same property" | |
| 12553 | ||
| 12554 | sbox.build() | |
| 12555 | wc_dir = sbox.wc_dir | |
| 12556 | ||
| 12557 | # Make a branch to merge to. (This is r6.) | |
| 12558 | wc_disk, wc_status = set_up_branch(sbox, False, 1) | |
| 12559 | svn_commit.repo_rev = 6 | |
| 12560 | ||
| 12561 | # Change into the WC dir for convenience | |
| 12562 | was_cwd = os.getcwd() | |
| 12563 | os.chdir(sbox.wc_dir) | |
| 12564 | wc_disk.wc_dir = '' | |
| 12565 | wc_status.wc_dir = '' | |
| 12566 | ||
| 12567 | # In the source, make two successive changes to the same property | |
| 12568 | svn_propset('p', 'new-val-1', 'A/mu') | |
| 12569 | rev1 = svn_commit('A/mu') | |
| 12570 | svn_propset('p', 'new-val-2', 'A/mu') | |
| 12571 | rev2 = svn_commit('A/mu') | |
| 12572 | ||
| 12573 | # Merge the first change, then the second, to a target branch. | |
| 12574 | svn_merge(rev1, 'A', 'A_COPY') | |
| 12575 | svn_merge(rev2, 'A', 'A_COPY') | |
| 12576 | ||
| 12577 | # Both changes should merge automatically: the second one should not | |
| 12578 | # complain about the local mod which the first one caused. The starting | |
| 12579 | # value in the target ("mine") for the second merge is exactly equal to | |
| 12580 | # the merge-left source value. | |
| 12581 | ||
| 12582 | # A merge-tracking version of this problem is when the merge-tracking | |
| 12583 | # algorithm breaks a single requested merge into two phases because of | |
| 12584 | # some other target within the same merge requiring only a part of the | |
| 12585 | # revision range. | |
| 12586 | ||
| 12587 | os.chdir(was_cwd) | |
| 12588 | ||
| 12540 | 12589 | ######################################################################## |
| 12541 | 12590 | # Run the tests |
| 12542 | 12591 | |
| ... | ...@@ -12718,6 +12767,7 @@ | |
| 12718 | 12767 | server_has_mergeinfo), |
| 12719 | 12768 | SkipUnless(merge_target_and_subtrees_need_nonintersecting_ranges, |
| 12720 | 12769 | server_has_mergeinfo), |
| 12770 | XFail(merge_two_edits_to_same_prop), | |
| 12721 | 12771 | ] |
| 12722 | 12772 | |
| 12723 | 12773 | if __name__ == '__main__': |