| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Subversion
Revision: 32907
Author: julianfoad
Date: 04 Sep 2008 15:44:17
Changes:Add a test for a problem whereby a merge fails with the error "Inconsistent
line ending style" if the source change consists of unifying the EOL style
and then setting svn:eol-style=native.
* subversion/tests/cmdline/merge_tests.py
(svn_merge): Allow a revision specifier string as an alternative to a
single revision number.
(merge_an_eol_unification_and_set_svn_eol_style): New test function.
(test_list): Add the new test.
| ... | ...@@ -12069,18 +12069,20 @@ | |
| 12069 | 12069 | svn_commit.repo_rev += 1 |
| 12070 | 12070 | return svn_commit.repo_rev |
| 12071 | 12071 | |
| 12072 | def svn_merge(src_change_num, source, target, exp_out=None): | |
| 12073 | "Merge a single change from path 'source' to path 'target'" | |
| 12072 | def svn_merge(rev_spec, source, target, exp_out=None): | |
| 12073 | """Merge a single change from path 'source' to path 'target'. | |
| 12074 | SRC_CHANGE_NUM is either a number (to cherry-pick that specific change) | |
| 12075 | or a command-line option revision range string such as '-r10:20'.""" | |
| 12074 | 12076 | source = local_path(source) |
| 12075 | 12077 | target = local_path(target) |
| 12078 | if isinstance(rev_spec, type(0)): | |
| 12079 | rev_spec = '-c' + str(rev_spec) | |
| 12076 | 12080 | if exp_out is None: |
| 12077 | exp_1 = "--- Merging r" + str(src_change_num) | |
| 12078 | exp_1 += " into '" + target + ".*':" | |
| 12081 | exp_1 = "--- Merging r.* into '" + target + ".*':" | |
| 12079 | 12082 | exp_2 = "(A |D |[UG] | [UG]|[UG][UG]) " + target + ".*" |
| 12080 | 12083 | exp_out = svntest.verify.RegexOutput(exp_1 + "|" + exp_2) |
| 12081 | 12084 | svntest.actions.run_and_verify_svn(None, exp_out, [], |
| 12082 | 'merge', '-c', src_change_num, | |
| 12083 | source, target) | |
| 12085 | 'merge', rev_spec, source, target) | |
| 12084 | 12086 | |
| 12085 | 12087 | def svn_propset(pname, pvalue, *paths): |
| 12086 | 12088 | "Set property 'pname' to value 'pvalue' on each path in 'paths'" |
| ... | ...@@ -12586,6 +12588,51 @@ | |
| 12586 | 12588 | |
| 12587 | 12589 | os.chdir(was_cwd) |
| 12588 | 12590 | |
| 12591 | def merge_an_eol_unification_and_set_svn_eol_style(sbox): | |
| 12592 | "merge an EOL unification and set svn:eol-style" | |
| 12593 | # In svn 1.5.2, merging the two changes between these three states: | |
| 12594 | # r1. inconsistent EOLs and no svn:eol-style | |
| 12595 | # r2. consistent EOLs and no svn:eol-style | |
| 12596 | # r3. consistent EOLs and svn:eol-style=native | |
| 12597 | # fails if attempted as a single merge (e.g. "svn merge r1:3") though it | |
| 12598 | # succeeds if attempted in two phases (e.g. "svn merge -c2,3"). | |
| 12599 | ||
| 12600 | sbox.build() | |
| 12601 | wc_dir = sbox.wc_dir | |
| 12602 | ||
| 12603 | # Make a branch to merge to. (This will be r6.) | |
| 12604 | wc_disk, wc_status = set_up_branch(sbox, False, 1) | |
| 12605 | svn_commit.repo_rev = 6 | |
| 12606 | ||
| 12607 | # Change into the WC dir for convenience | |
| 12608 | was_cwd = os.getcwd() | |
| 12609 | os.chdir(sbox.wc_dir) | |
| 12610 | wc_disk.wc_dir = '' | |
| 12611 | wc_status.wc_dir = '' | |
| 12612 | ||
| 12613 | content1 = 'Line1\nLine2\r\n' | |
| 12614 | content2 = 'Line1' + os.linesep + 'Line2' + os.linesep | |
| 12615 | ||
| 12616 | # In the source branch, create initial state and two successive changes | |
| 12617 | svntest.main.file_write('A/mu', content1) | |
| 12618 | rev1 = svn_commit('A/mu') | |
| 12619 | svntest.main.file_write('A/mu', content2) | |
| 12620 | rev2 = svn_commit('A/mu') | |
| 12621 | svn_propset('svn:eol-style', 'native', 'A/mu') | |
| 12622 | rev3 = svn_commit('A/mu') | |
| 12623 | ||
| 12624 | # Merge the initial state (inconsistent EOLs) to the target branch. | |
| 12625 | svn_merge(rev1, 'A', 'A_COPY') | |
| 12626 | svn_commit('A_COPY') | |
| 12627 | ||
| 12628 | # Merge the two changes together to the target branch. | |
| 12629 | svn_merge('-r'+str(rev1)+':'+str(rev3), 'A', 'A_COPY') | |
| 12630 | ||
| 12631 | # That merge should succeed. | |
| 12632 | # Surprise: setting svn:eol-style='LF' instead of 'native' doesn't fail. | |
| 12633 | # Surprise: if we don't merge the file's 'rev1' state first, it doesn't fail | |
| 12634 | # nor even raise a conflict. | |
| 12635 | ||
| 12589 | 12636 | ######################################################################## |
| 12590 | 12637 | # Run the tests |
| 12591 | 12638 | |
| ... | ...@@ -12768,6 +12815,7 @@ | |
| 12768 | 12815 | SkipUnless(merge_target_and_subtrees_need_nonintersecting_ranges, |
| 12769 | 12816 | server_has_mergeinfo), |
| 12770 | 12817 | XFail(merge_two_edits_to_same_prop), |
| 12818 | XFail(merge_an_eol_unification_and_set_svn_eol_style), | |
| 12771 | 12819 | ] |
| 12772 | 12820 | |
| 12773 | 12821 | if __name__ == '__main__': |