def automatic_merge(sbox,
                    source,
                    target,
                    args=[],
                    expect_changes=None,
                    expect_mi=None,
                    expect_3ways=None):
    """Do a complete, automatic merge from path SOURCE to path TARGET, and
  commit.  Verify the output and that there is no error.
  ### TODO: Verify the changes made.

  ARGS are additional arguments passed to svn merge."""

    source = local_path(source)
    target = local_path(target)

    # First, update the WC target because mixed-rev is not fully supported.
    sbox.simple_update(target)

    before_changes = logical_changes_in_branch(sbox, target)

    exp_out = expected_automatic_merge_output(target, expect_3ways)
    exit, out, err = svntest.actions.run_and_verify_svn(
        exp_out, [], 'merge', '^/' + source, target, *args)

    if expect_changes is not None:
        after_changes = logical_changes_in_branch(sbox, target)
        merged_changes = after_changes - before_changes
        assert_equal(merged_changes, set(expect_changes))
        reversed_changes = before_changes - after_changes
        assert_equal(reversed_changes, set())

    if expect_mi is not None:
        actual_mi_change = get_mergeinfo_change(sbox, target)
        assert_equal(actual_mi_change, expect_mi)

    if expect_3ways is not None:
        ### actual_3ways = get_3ways_from_output(out)
        ### assert_equal(actual_3ways, expect_3ways)
        pass

    sbox.simple_commit()
def automatic_merge(sbox, source, target, args=[],
                    expect_changes=None, expect_mi=None, expect_3ways=None):
  """Do a complete, automatic merge from path SOURCE to path TARGET, and
  commit.  Verify the output and that there is no error.
  ### TODO: Verify the changes made.

  ARGS are additional arguments passed to svn merge."""

  source = local_path(source)
  target = local_path(target)

  # First, update the WC target because mixed-rev is not fully supported.
  sbox.simple_update(target)

  before_changes = logical_changes_in_branch(sbox, target)

  exp_out = expected_automatic_merge_output(target, expect_3ways)
  exit, out, err = svntest.actions.run_and_verify_svn(None, exp_out, [],
                                     'merge',
                                     '^/' + source, target,
                                     *args)

  if expect_changes is not None:
    after_changes = logical_changes_in_branch(sbox, target)
    merged_changes = after_changes - before_changes
    assert_equal(merged_changes, set(expect_changes))
    reversed_changes = before_changes - after_changes
    assert_equal(reversed_changes, set())

  if expect_mi is not None:
    actual_mi_change = get_mergeinfo_change(sbox, target)
    assert_equal(actual_mi_change, expect_mi)

  if expect_3ways is not None:
    ### actual_3ways = get_3ways_from_output(out)
    ### assert_equal(actual_3ways, expect_3ways)
    pass

  sbox.simple_commit()