Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/tests/cmdline/merge_tests.py  view on Meta::CPAN

  # The 'match_all=False' is because we also expect some
  # 'Resolved conflicted state of ...' lines.
  return RegexListOutput(lines, match_all=False)

def expected_out_and_err(tgt_ospath,
                           recorded_ranges,
                           merged_ranges=None,
                           prop_conflicts=0,
                           prop_resolved=0,
                           expect_error=True):
  """Return a tuple (expected_out, expected_err) giving the expected
     output and expected error output for a merge into TGT_OSPATH. See
     expected_merge_output2() for details of RECORDED_RANGES and
     MERGED_RANGES and PROP_CONFLICTS.  EXPECT_ERROR should be true iff
     we expect the merge to abort with an error about conflicts being
     raised.
  """
  expected_out = expected_merge_output2(tgt_ospath, recorded_ranges,
                                        merged_ranges,
                                        prop_conflicts, prop_resolved)
  if expect_error:
    expected_err = RegexListOutput([
                     '^svn: E155015: .* conflicts were produced .* into$',
                     "^'.*" + re.escape(tgt_ospath) + "' --$",
                     '^resolve all conflicts .* remaining$',
                     '^unmerged revisions$'],
                     match_all=False)
  else:
    expected_err = []

  return expected_out, expected_err

def check_mergeinfo(expected_mergeinfo, tgt_ospath):
  """Read the mergeinfo on TGT_OSPATH; verify that it matches
     EXPECTED_MERGEINFO (list of lines).
  """
  svntest.actions.run_and_verify_svn(
    None, expected_mergeinfo, [], 'pg', SVN_PROP_MERGEINFO, tgt_ospath)

def simple_merge(src_path, tgt_ospath, rev_args):
  """Merge from ^/SRC_PATH to TGT_OSPATH using revision arguments REV_ARGS
     (list of '-r...' or '-c...' strings); expect a single-target merge
     with no conflicts or errors.
  """
  rev_ranges = RangeList(rev_args)

  expected_out = expected_merge_output(rev_ranges,
                                       [' U   ' + tgt_ospath + '\n',
                                        ' [UG]   ' + tgt_ospath + '\n'],
                                       target=tgt_ospath)
  src_url = '^/' + src_path
  svntest.actions.run_and_verify_svn(
    None, expected_out, [],
    'merge', src_url, tgt_ospath, '--accept', 'postpone', *rev_args)

@SkipUnless(server_has_mergeinfo)
@Issue(4306)
# Test for issue #4306 'multiple editor drive file merges record wrong
# mergeinfo during conflicts'
def conflict_aborted_mergeinfo_described_partial_merge(sbox):
  "conflicted split merge can be repeated"

  sbox.build()
  os.chdir(sbox.wc_dir)
  sbox.wc_dir = ''

  trunk = 'A'
  branch = 'A2'
  file = 'mu'
  dir = 'B'
  trunk_file = 'A/mu'
  trunk_dir = 'A/B'

  # r2: initial state
  for rev in range(4, 11):
    sbox.simple_propset('prop-' + str(rev), 'Old pval ' + str(rev),
                        trunk_file, trunk_dir)
  sbox.simple_commit()

  # r3: branch
  sbox.simple_copy(trunk, branch)
  sbox.simple_commit()

  zero_rev = 3

  def edit_file_or_dir(path, rev, val):
    """Make a local edit to the file at PATH."""
    sbox.simple_propset('prop-' + str(rev), val + ' pval ' + str(rev), path)

  # r4 through r10: simple edits
  for rev in range(4, 11):
    edit_file_or_dir(trunk_file, rev, 'Edited')
    edit_file_or_dir(trunk_dir, rev, 'Edited')
    sbox.simple_commit()

  # r14: merge some changes to the branch so that later merges will be split
  svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-c5,9',
                                     '^/' + trunk, sbox.ospath(branch),
                                     '--accept', 'theirs-conflict')
  sbox.simple_commit()
  sbox.simple_update()

  def revert_branch():
    svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R',
                                       sbox.ospath(branch))

  def try_merge(relpath, conflict_rev, rev_args,
                expected_out_err, expected_mi):
    """Revert RELPATH in the branch; make a change that will conflict
       with CONFLICT_REV if not None; merge RELPATH in the trunk
       to RELPATH in the branch using revision arguments REV_ARGS (list of
       '-r...' or '-c...' strings).

       EXPECTED_OUT_ERR_MI is a tuple: (expected_out, expected_err,
       expected_mi).  EXPECTED_OUT and EXPECTED_ERR are instances of
       ExpectedOutput.

       Expect to find mergeinfo EXPECTED_MI if not None.  EXPECTED_MI is
       a single mergeinfo-string.
    """
    src_path = trunk + '/' + relpath

src/subversion/subversion/tests/cmdline/merge_tests.py  view on Meta::CPAN

  #    U   A_COPY\D
  #   --- Eliding mergeinfo from 'A_COPY\D':
  #    U   A_COPY\D
  #
  # The order of 'beta' and 'omega' can vary, so use UnorderedOutput.  This
  # raises the possibility that the test could spuriously pass if the 'U'pdate
  # notifications aren't grouped with the correct headers, but that's not what
  # is being tested here.
  expected_output = svntest.verify.UnorderedOutput(
    ["--- Merging r2 through r3 into '" + A_copy_path + "':\n",
     "U    " + psi_copy_path + "\n",
     "--- Merging r4 through r7 into '" + A_copy_path + "':\n",
     "U    " + omega_copy_path + "\n",
     "U    " + beta_copy_path + "\n",
     "--- Recording mergeinfo for merge of r2 through r7 into '" +
     A_copy_path + "':\n",
     " U   " + A_copy_path + "\n",
     "--- Recording mergeinfo for merge of r2 through r7 into '" +
     D_copy_path + "':\n",
     " U   " + D_copy_path + "\n",
     "--- Eliding mergeinfo from '" + D_copy_path + "':\n",
     " U   " + D_copy_path + "\n"])
  svntest.actions.run_and_verify_svn(None, expected_output, [], 'merge',
                                     sbox.repo_url + '/A', A_copy_path)

  # r8 and r9 - Commit and do reverse subtree merge.
  sbox.simple_commit()
  sbox.simple_update()
  svntest.actions.run_and_verify_svn(None, None, [], 'merge', '^/A/D',
                                     '-c-4', D_copy_path)
  sbox.simple_commit()

  # Now try a reverse merge.  There should only be one notification for
  # r7-5:
  sbox.simple_update()
  expected_output = svntest.verify.UnorderedOutput(
    ["--- Reverse-merging r7 through r5 into '" + A_copy_path + "':\n",
     "U    " + beta_copy_path + "\n",
     "U    " + omega_copy_path + "\n",
     "--- Reverse-merging r4 through r3 into '" + A_copy_path + "':\n",
     "U    " + psi_copy_path + "\n",
     "--- Recording mergeinfo for reverse merge of r7 through r3 into '" +
     A_copy_path + "':\n",
     " U   " + A_copy_path + "\n",
     "--- Recording mergeinfo for reverse merge of r7 through r3 into '" +
     D_copy_path + "':\n",
     " U   " + D_copy_path + "\n",
     "--- Eliding mergeinfo from '" + D_copy_path + "':\n",
     " U   " + D_copy_path + "\n"])
  svntest.actions.run_and_verify_svn(None, expected_output, [], 'merge',
                                     '-r9:2', sbox.repo_url + '/A',
                                     A_copy_path)

@SkipUnless(server_has_mergeinfo)
@Issue(4316)  # 'Merge errors out after resolving conflicts'
# Very similar to conflict_aborted_mergeinfo_described_partial_merge()
# (test number 135), except here we tell the merge to resolve the
# conflicts that are generated part way through a multi-revision-range
# merge, and we expect it to continue with the rest of the merge.
def conflicted_split_merge_with_resolve(sbox):
  "conflicted split merge with resolve"

  sbox.build()
  os.chdir(sbox.wc_dir)
  sbox.wc_dir = ''

  trunk = 'A'
  branch = 'A2'
  file = 'mu'
  dir = 'B'
  trunk_file = 'A/mu'
  trunk_dir = 'A/B'

  # r2: initial state
  for rev in range(4, 11):
    sbox.simple_propset('prop-' + str(rev), 'Old pval ' + str(rev),
                        trunk_file, trunk_dir)
  sbox.simple_commit()

  # r3: branch
  sbox.simple_update()
  sbox.simple_copy(trunk, branch)
  sbox.simple_commit()

  zero_rev = 3

  def edit_file_or_dir(path, rev, val):
    """Make a local edit to the file at PATH."""
    sbox.simple_propset('prop-' + str(rev), val + ' pval ' + str(rev), path)

  # r4 through r10: simple edits
  for rev in range(4, 11):
    edit_file_or_dir(trunk_file, rev, 'Edited')
    edit_file_or_dir(trunk_dir, rev, 'Edited')
    sbox.simple_commit()

  # r14: merge some changes to the branch so that later merges will be split
  svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-c5,9',
                                     '^/' + trunk, sbox.ospath(branch),
                                     '--accept', 'theirs-conflict')
  sbox.simple_commit()
  sbox.simple_update()

  def revert_branch():
    svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R',
                                       sbox.ospath(branch))

  def try_merge(relpath, conflict_rev, rev_args,
                expected_out_err, expected_mi):
    """Revert RELPATH in the branch; make a change that will conflict
       with CONFLICT_REV if not None; merge RELPATH in the trunk
       to RELPATH in the branch using revision arguments REV_ARGS (list of
       '-r...' or '-c...' strings).

       EXPECTED_OUT_ERR_MI is a tuple: (expected_out, expected_err,
       expected_mi).  EXPECTED_OUT and EXPECTED_ERR are instances of
       ExpectedOutput.

       Expect to find mergeinfo EXPECTED_MI if not None.  EXPECTED_MI is
       a single mergeinfo-string.
    """



( run in 0.761 second using v1.01-cache-2.11-cpan-efa8479b9fe )