Exemple #1
0
def svn_mkfile(path):
    "Make and add a file with some default content, and keyword expansion."
    path = local_path(path)
    dirname, filename = os.path.split(path)
    main.file_write(path, "This is the file '" + filename + "'.\n" + "Last changed in '$Revision$'.\n")
    actions.run_and_verify_svn(None, [], "add", path)
    actions.run_and_verify_svn(None, [], "propset", "svn:keywords", "Revision", path)
Exemple #2
0
def svn_merge(
    rev_range,
    source,
    target,
    lines=None,
    elides=[],
    text_conflicts=0,
    prop_conflicts=0,
    tree_conflicts=0,
    text_resolved=0,
    prop_resolved=0,
    tree_resolved=0,
    args=[],
):
    """Merge a single change from path SOURCE to path TARGET and verify the
  output and that there is no error.  (The changes made are not verified.)

  REV_RANGE is either a number (to cherry-pick that specific change) or a
  two-element list [X,Y] to pick the revision range '-r(X-1):Y'.

  LINES is a list of regular expressions to match other lines of output; if
  LINES is 'None' then match all normal (non-conflicting) merges.

  ELIDES is a list of paths on which mergeinfo elision should be reported.

  TEXT_CONFLICTS, PROP_CONFLICTS and TREE_CONFLICTS specify the number of
  each kind of conflict to expect.

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

    source = local_path(source)
    target = local_path(target)
    elides = [local_path(p) for p in elides]
    if isinstance(rev_range, int):
        mi_rev_range = [rev_range]
        rev_arg = "-c" + str(rev_range)
    else:
        mi_rev_range = rev_range
        rev_arg = "-r" + str(rev_range[0] - 1) + ":" + str(rev_range[1])
    if lines is None:
        lines = ["(A |D |[UG] | [UG]|[UG][UG])   " + target + ".*\n"]
    else:
        # Expect mergeinfo on the target; caller must supply matches for any
        # subtree mergeinfo paths.
        lines.append(" [UG]   " + target + "\n")
    exp_out = expected_merge_output(
        [mi_rev_range],
        lines,
        target=target,
        elides=elides,
        text_conflicts=text_conflicts,
        prop_conflicts=prop_conflicts,
        tree_conflicts=tree_conflicts,
        text_resolved=text_resolved,
        prop_resolved=prop_resolved,
        tree_resolved=tree_resolved,
    )
    actions.run_and_verify_svn(exp_out, [], "merge", rev_arg, source, target, *args)
Exemple #3
0
def check_mergeinfo_recursively(root_path, subpaths_mergeinfo):
  """Check that the mergeinfo properties on and under ROOT_PATH are those in
     SUBPATHS_MERGEINFO, a {path: mergeinfo-prop-val} dictionary."""
  expected = verify.UnorderedOutput(
    [path + ' - ' + subpaths_mergeinfo[path] + '\n'
     for path in subpaths_mergeinfo])
  actions.run_and_verify_svn(None, expected, [],
                                     'propget', '-R', SVN_PROP_MERGEINFO,
                                     root_path)
Exemple #4
0
def check_mergeinfo_recursively(root_path, subpaths_mergeinfo):
    """Check that the mergeinfo properties on and under ROOT_PATH are those in
     SUBPATHS_MERGEINFO, a {path: mergeinfo-prop-val} dictionary."""
    expected = verify.UnorderedOutput([
        path + ' - ' + subpaths_mergeinfo[path] + '\n'
        for path in subpaths_mergeinfo
    ])
    actions.run_and_verify_svn(None, expected, [], 'propget', '-R',
                               SVN_PROP_MERGEINFO, root_path)
Exemple #5
0
def svn_mkfile(path):
  "Make and add a file with some default content, and keyword expansion."
  path = local_path(path)
  dirname, filename = os.path.split(path)
  main.file_write(path, "This is the file '" + filename + "'.\n" +
                                "Last changed in '$Revision$'.\n")
  actions.run_and_verify_svn(None, [], 'add', path)
  actions.run_and_verify_svn(None, [], 'propset',
                                     'svn:keywords', 'Revision', path)
Exemple #6
0
def svn_merge(rev_range,
              source,
              target,
              lines=None,
              elides=[],
              text_conflicts=0,
              prop_conflicts=0,
              tree_conflicts=0,
              text_resolved=0,
              prop_resolved=0,
              tree_resolved=0,
              args=[]):
    """Merge a single change from path SOURCE to path TARGET and verify the
  output and that there is no error.  (The changes made are not verified.)

  REV_RANGE is either a number (to cherry-pick that specific change) or a
  two-element list [X,Y] to pick the revision range '-r(X-1):Y'.

  LINES is a list of regular expressions to match other lines of output; if
  LINES is 'None' then match all normal (non-conflicting) merges.

  ELIDES is a list of paths on which mergeinfo elision should be reported.

  TEXT_CONFLICTS, PROP_CONFLICTS and TREE_CONFLICTS specify the number of
  each kind of conflict to expect.

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

    source = local_path(source)
    target = local_path(target)
    elides = [local_path(p) for p in elides]
    if isinstance(rev_range, int):
        mi_rev_range = [rev_range]
        rev_arg = '-c' + str(rev_range)
    else:
        mi_rev_range = rev_range
        rev_arg = '-r' + str(rev_range[0] - 1) + ':' + str(rev_range[1])
    if lines is None:
        lines = ["(A |D |[UG] | [UG]|[UG][UG])   " + target + ".*\n"]
    else:
        # Expect mergeinfo on the target; caller must supply matches for any
        # subtree mergeinfo paths.
        lines.append(" [UG]   " + target + "\n")
    exp_out = expected_merge_output([mi_rev_range],
                                    lines,
                                    target=target,
                                    elides=elides,
                                    text_conflicts=text_conflicts,
                                    prop_conflicts=prop_conflicts,
                                    tree_conflicts=tree_conflicts,
                                    text_resolved=text_resolved,
                                    prop_resolved=prop_resolved,
                                    tree_resolved=tree_resolved)
    actions.run_and_verify_svn(None, exp_out, [], 'merge', rev_arg, source,
                               target, *args)
Exemple #7
0
def svn_copy(s_rev, path1, path2):
  "Copy a WC path locally."
  path1 = local_path(path1)
  path2 = local_path(path2)
  actions.run_and_verify_svn(None, None, [], 'copy', '--parents',
                                     '-r', s_rev, path1, path2)
Exemple #8
0
def svn_modfile(path):
  "Make text and property mods to a WC file."
  path = local_path(path)
  main.file_append(path, "An extra line.\n")
  actions.run_and_verify_svn(None, None, [], 'propset',
                                     'newprop', 'v', path)
Exemple #9
0
  def copy_A(dest_name, rev):
    expected = verify.UnorderedOutput(
      ["A    " + os.path.join(wc_dir, dest_name, "B") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "B", "lambda") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "B", "E") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "B", "E", "alpha") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "B", "E", "beta") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "B", "F") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "mu") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "C") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "gamma") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "G") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "G", "pi") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "G", "rho") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "G", "tau") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "H") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "H", "chi") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "H", "omega") + "\n",
       "A    " + os.path.join(wc_dir, dest_name, "D", "H", "psi") + "\n",
       "Checked out revision " + str(rev - 1) + ".\n",
       "A         " + os.path.join(wc_dir, dest_name) + "\n"])
    expected_status.add({
      dest_name + "/B"         : Item(status='  ', wc_rev=rev),
      dest_name + "/B/lambda"  : Item(status='  ', wc_rev=rev),
      dest_name + "/B/E"       : Item(status='  ', wc_rev=rev),
      dest_name + "/B/E/alpha" : Item(status='  ', wc_rev=rev),
      dest_name + "/B/E/beta"  : Item(status='  ', wc_rev=rev),
      dest_name + "/B/F"       : Item(status='  ', wc_rev=rev),
      dest_name + "/mu"        : Item(status='  ', wc_rev=rev),
      dest_name + "/C"         : Item(status='  ', wc_rev=rev),
      dest_name + "/D"         : Item(status='  ', wc_rev=rev),
      dest_name + "/D/gamma"   : Item(status='  ', wc_rev=rev),
      dest_name + "/D/G"       : Item(status='  ', wc_rev=rev),
      dest_name + "/D/G/pi"    : Item(status='  ', wc_rev=rev),
      dest_name + "/D/G/rho"   : Item(status='  ', wc_rev=rev),
      dest_name + "/D/G/tau"   : Item(status='  ', wc_rev=rev),
      dest_name + "/D/H"       : Item(status='  ', wc_rev=rev),
      dest_name + "/D/H/chi"   : Item(status='  ', wc_rev=rev),
      dest_name + "/D/H/omega" : Item(status='  ', wc_rev=rev),
      dest_name + "/D/H/psi"   : Item(status='  ', wc_rev=rev),
      dest_name                : Item(status='  ', wc_rev=rev)})
    expected_disk.add({
      dest_name                : Item(),
      dest_name + '/B'         : Item(),
      dest_name + '/B/lambda'  : Item("This is the file 'lambda'.\n"),
      dest_name + '/B/E'       : Item(),
      dest_name + '/B/E/alpha' : Item("This is the file 'alpha'.\n"),
      dest_name + '/B/E/beta'  : Item("This is the file 'beta'.\n"),
      dest_name + '/B/F'       : Item(),
      dest_name + '/mu'        : Item("This is the file 'mu'.\n"),
      dest_name + '/C'         : Item(),
      dest_name + '/D'         : Item(),
      dest_name + '/D/gamma'   : Item("This is the file 'gamma'.\n"),
      dest_name + '/D/G'       : Item(),
      dest_name + '/D/G/pi'    : Item("This is the file 'pi'.\n"),
      dest_name + '/D/G/rho'   : Item("This is the file 'rho'.\n"),
      dest_name + '/D/G/tau'   : Item("This is the file 'tau'.\n"),
      dest_name + '/D/H'       : Item(),
      dest_name + '/D/H/chi'   : Item("This is the file 'chi'.\n"),
      dest_name + '/D/H/omega' : Item("This is the file 'omega'.\n"),
      dest_name + '/D/H/psi'   : Item("This is the file 'psi'.\n"),
      })

    # Make a branch A_COPY to merge into.
    actions.run_and_verify_svn(None, expected, [], 'copy',
                                       sbox.repo_url + "/A",
                                       os.path.join(wc_dir,
                                                    dest_name))

    expected_output = wc.State(wc_dir, {dest_name : Item(verb='Adding')})
    actions.run_and_verify_commit(wc_dir,
                                          expected_output,
                                          expected_status,
                                          None,
                                          wc_dir)
Exemple #10
0
def set_up_dir_replace(sbox):
  """Set up the working copy for directory replace tests, creating
  directory 'A/B/F/foo' with files 'new file' and 'new file2' within
  it (r2), and merging 'foo' onto 'C' (r3), then deleting 'A/B/F/foo'
  (r4)."""

  sbox.build()
  wc_dir = sbox.wc_dir

  C_path = sbox.ospath('A/C')
  F_path = sbox.ospath('A/B/F')
  F_url = sbox.repo_url + '/A/B/F'

  foo_path = os.path.join(F_path, 'foo')
  new_file = os.path.join(foo_path, "new file")
  new_file2 = os.path.join(foo_path, "new file 2")

  # Make directory foo in F, and add some files within it.
  actions.run_and_verify_svn(None, None, [], 'mkdir', foo_path)
  main.file_append(new_file, "Initial text in new file.\n")
  main.file_append(new_file2, "Initial text in new file 2.\n")
  main.run_svn(None, "add", new_file)
  main.run_svn(None, "add", new_file2)

  # Commit all the new content, creating r2.
  expected_output = wc.State(wc_dir, {
    'A/B/F/foo'            : Item(verb='Adding'),
    'A/B/F/foo/new file'   : Item(verb='Adding'),
    'A/B/F/foo/new file 2' : Item(verb='Adding'),
    })
  expected_status = actions.get_virginal_state(wc_dir, 1)
  expected_status.add({
    'A/B/F/foo'             : Item(status='  ', wc_rev=2),
    'A/B/F/foo/new file'    : Item(status='  ', wc_rev=2),
    'A/B/F/foo/new file 2'  : Item(status='  ', wc_rev=2),
    })
  actions.run_and_verify_commit(wc_dir,
                                        expected_output,
                                        expected_status,
                                        None, wc_dir)

  # Merge foo onto C
  expected_output = wc.State(C_path, {
    'foo' : Item(status='A '),
    'foo/new file'   : Item(status='A '),
    'foo/new file 2' : Item(status='A '),
    })
  expected_mergeinfo_output = wc.State(C_path, {
    '' : Item(status=' U'),
    })
  expected_elision_output = wc.State(C_path, {
    })
  expected_disk = wc.State('', {
    ''               : Item(props={SVN_PROP_MERGEINFO : '/A/B/F:2'}),
    'foo' : Item(),
    'foo/new file'   : Item("Initial text in new file.\n"),
    'foo/new file 2' : Item("Initial text in new file 2.\n"),
    })
  expected_status = wc.State(C_path, {
    ''    : Item(status=' M', wc_rev=1),
    'foo' : Item(status='A ', wc_rev='-', copied='+'),
    'foo/new file'   : Item(status='  ', wc_rev='-', copied='+'),
    'foo/new file 2' : Item(status='  ', wc_rev='-', copied='+'),
    })
  expected_skip = wc.State(C_path, { })
  actions.run_and_verify_merge(C_path, '1', '2', F_url, None,
                                       expected_output,
                                       expected_mergeinfo_output,
                                       expected_elision_output,
                                       expected_disk,
                                       expected_status,
                                       expected_skip,
                                       None, None, None, None, None, 1)
  # Commit merge of foo onto C, creating r3.
  expected_output = wc.State(wc_dir, {
    'A/C'        : Item(verb='Sending'),
    'A/C/foo'    : Item(verb='Adding'),
    })
  expected_status = actions.get_virginal_state(wc_dir, 1)
  expected_status.add({
    'A/B/F/foo'  : Item(status='  ', wc_rev=2),
    'A/C'        : Item(status='  ', wc_rev=3),
    'A/B/F/foo/new file'      : Item(status='  ', wc_rev=2),
    'A/B/F/foo/new file 2'    : Item(status='  ', wc_rev=2),
    'A/C/foo'    : Item(status='  ', wc_rev=3),
    'A/C/foo/new file'      : Item(status='  ', wc_rev=3),
    'A/C/foo/new file 2'    : Item(status='  ', wc_rev=3),

    })
  actions.run_and_verify_commit(wc_dir,
                                        expected_output,
                                        expected_status,
                                        None, wc_dir)

  # Delete foo on F, creating r4.
  actions.run_and_verify_svn(None, None, [], 'rm', foo_path)
  expected_output = wc.State(wc_dir, {
    'A/B/F/foo'   : Item(verb='Deleting'),
    })
  expected_status = actions.get_virginal_state(wc_dir, 1)
  expected_status.add({
    'A/C'         : Item(status='  ', wc_rev=3),
    'A/C/foo'     : Item(status='  ', wc_rev=3),
    'A/C/foo/new file'      : Item(status='  ', wc_rev=3),
    'A/C/foo/new file 2'    : Item(status='  ', wc_rev=3),
    })
  actions.run_and_verify_commit(wc_dir,
                                        expected_output,
                                        expected_status,
                                        None, wc_dir)
Exemple #11
0
def svn_copy(s_rev, path1, path2):
    "Copy a WC path locally."
    path1 = local_path(path1)
    path2 = local_path(path2)
    actions.run_and_verify_svn(None, [], "copy", "--parents", "-r", s_rev, path1, path2)
Exemple #12
0
def set_up_dir_replace(sbox):
    """Set up the working copy for directory replace tests, creating
  directory 'A/B/F/foo' with files 'new file' and 'new file2' within
  it (r2), and merging 'foo' onto 'C' (r3), then deleting 'A/B/F/foo'
  (r4)."""

    sbox.build()
    wc_dir = sbox.wc_dir

    C_path = sbox.ospath("A/C")
    F_path = sbox.ospath("A/B/F")
    F_url = sbox.repo_url + "/A/B/F"

    foo_path = os.path.join(F_path, "foo")
    new_file = os.path.join(foo_path, "new file")
    new_file2 = os.path.join(foo_path, "new file 2")

    # Make directory foo in F, and add some files within it.
    actions.run_and_verify_svn(None, [], "mkdir", foo_path)
    main.file_append(new_file, "Initial text in new file.\n")
    main.file_append(new_file2, "Initial text in new file 2.\n")
    main.run_svn(None, "add", new_file)
    main.run_svn(None, "add", new_file2)

    # Commit all the new content, creating r2.
    expected_output = wc.State(
        wc_dir,
        {
            "A/B/F/foo": Item(verb="Adding"),
            "A/B/F/foo/new file": Item(verb="Adding"),
            "A/B/F/foo/new file 2": Item(verb="Adding"),
        },
    )
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add(
        {
            "A/B/F/foo": Item(status="  ", wc_rev=2),
            "A/B/F/foo/new file": Item(status="  ", wc_rev=2),
            "A/B/F/foo/new file 2": Item(status="  ", wc_rev=2),
        }
    )
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status)

    # Merge foo onto C
    expected_output = wc.State(
        C_path, {"foo": Item(status="A "), "foo/new file": Item(status="A "), "foo/new file 2": Item(status="A ")}
    )
    expected_mergeinfo_output = wc.State(C_path, {"": Item(status=" U")})
    expected_elision_output = wc.State(C_path, {})
    expected_disk = wc.State(
        "",
        {
            "": Item(props={SVN_PROP_MERGEINFO: "/A/B/F:2"}),
            "foo": Item(),
            "foo/new file": Item("Initial text in new file.\n"),
            "foo/new file 2": Item("Initial text in new file 2.\n"),
        },
    )
    expected_status = wc.State(
        C_path,
        {
            "": Item(status=" M", wc_rev=1),
            "foo": Item(status="A ", wc_rev="-", copied="+"),
            "foo/new file": Item(status="  ", wc_rev="-", copied="+"),
            "foo/new file 2": Item(status="  ", wc_rev="-", copied="+"),
        },
    )
    expected_skip = wc.State(C_path, {})
    actions.run_and_verify_merge(
        C_path,
        "1",
        "2",
        F_url,
        None,
        expected_output,
        expected_mergeinfo_output,
        expected_elision_output,
        expected_disk,
        expected_status,
        expected_skip,
        check_props=True,
    )
    # Commit merge of foo onto C, creating r3.
    expected_output = wc.State(wc_dir, {"A/C": Item(verb="Sending"), "A/C/foo": Item(verb="Adding")})
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add(
        {
            "A/B/F/foo": Item(status="  ", wc_rev=2),
            "A/C": Item(status="  ", wc_rev=3),
            "A/B/F/foo/new file": Item(status="  ", wc_rev=2),
            "A/B/F/foo/new file 2": Item(status="  ", wc_rev=2),
            "A/C/foo": Item(status="  ", wc_rev=3),
            "A/C/foo/new file": Item(status="  ", wc_rev=3),
            "A/C/foo/new file 2": Item(status="  ", wc_rev=3),
        }
    )
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status)

    # Delete foo on F, creating r4.
    actions.run_and_verify_svn(None, [], "rm", foo_path)
    expected_output = wc.State(wc_dir, {"A/B/F/foo": Item(verb="Deleting")})
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add(
        {
            "A/C": Item(status="  ", wc_rev=3),
            "A/C/foo": Item(status="  ", wc_rev=3),
            "A/C/foo/new file": Item(status="  ", wc_rev=3),
            "A/C/foo/new file 2": Item(status="  ", wc_rev=3),
        }
    )
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status)
Exemple #13
0
def svn_copy(s_rev, path1, path2):
    "Copy a WC path locally."
    path1 = local_path(path1)
    path2 = local_path(path2)
    actions.run_and_verify_svn(None, None, [], 'copy', '--parents', '-r',
                               s_rev, path1, path2)
Exemple #14
0
def svn_modfile(path):
    "Make text and property mods to a WC file."
    path = local_path(path)
    main.file_append(path, "An extra line.\n")
    actions.run_and_verify_svn(None, None, [], 'propset', 'newprop', 'v', path)
Exemple #15
0
    def copy_A(dest_name, rev):
        expected = verify.UnorderedOutput([
            "A    " + os.path.join(wc_dir, dest_name, "B") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "B", "lambda") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "B", "E") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "B", "E", "alpha") +
            "\n", "A    " + os.path.join(wc_dir, dest_name, "B", "E", "beta") +
            "\n", "A    " + os.path.join(wc_dir, dest_name, "B", "F") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "mu") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "C") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "gamma") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "G") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "G", "pi") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "G", "rho") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "G", "tau") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "H") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "H", "chi") + "\n",
            "A    " + os.path.join(wc_dir, dest_name, "D", "H", "omega") +
            "\n", "A    " + os.path.join(wc_dir, dest_name, "D", "H", "psi") +
            "\n", "Checked out revision " + str(rev - 1) + ".\n",
            "A         " + os.path.join(wc_dir, dest_name) + "\n"
        ])
        expected_status.add({
            dest_name + "/B":
            Item(status='  ', wc_rev=rev),
            dest_name + "/B/lambda":
            Item(status='  ', wc_rev=rev),
            dest_name + "/B/E":
            Item(status='  ', wc_rev=rev),
            dest_name + "/B/E/alpha":
            Item(status='  ', wc_rev=rev),
            dest_name + "/B/E/beta":
            Item(status='  ', wc_rev=rev),
            dest_name + "/B/F":
            Item(status='  ', wc_rev=rev),
            dest_name + "/mu":
            Item(status='  ', wc_rev=rev),
            dest_name + "/C":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/gamma":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/G":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/G/pi":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/G/rho":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/G/tau":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/H":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/H/chi":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/H/omega":
            Item(status='  ', wc_rev=rev),
            dest_name + "/D/H/psi":
            Item(status='  ', wc_rev=rev),
            dest_name:
            Item(status='  ', wc_rev=rev)
        })
        expected_disk.add({
            dest_name:
            Item(),
            dest_name + '/B':
            Item(),
            dest_name + '/B/lambda':
            Item("This is the file 'lambda'.\n"),
            dest_name + '/B/E':
            Item(),
            dest_name + '/B/E/alpha':
            Item("This is the file 'alpha'.\n"),
            dest_name + '/B/E/beta':
            Item("This is the file 'beta'.\n"),
            dest_name + '/B/F':
            Item(),
            dest_name + '/mu':
            Item("This is the file 'mu'.\n"),
            dest_name + '/C':
            Item(),
            dest_name + '/D':
            Item(),
            dest_name + '/D/gamma':
            Item("This is the file 'gamma'.\n"),
            dest_name + '/D/G':
            Item(),
            dest_name + '/D/G/pi':
            Item("This is the file 'pi'.\n"),
            dest_name + '/D/G/rho':
            Item("This is the file 'rho'.\n"),
            dest_name + '/D/G/tau':
            Item("This is the file 'tau'.\n"),
            dest_name + '/D/H':
            Item(),
            dest_name + '/D/H/chi':
            Item("This is the file 'chi'.\n"),
            dest_name + '/D/H/omega':
            Item("This is the file 'omega'.\n"),
            dest_name + '/D/H/psi':
            Item("This is the file 'psi'.\n"),
        })

        # Make a branch A_COPY to merge into.
        actions.run_and_verify_svn(None, expected, [], 'copy',
                                   sbox.repo_url + "/A",
                                   os.path.join(wc_dir, dest_name))

        expected_output = wc.State(wc_dir, {dest_name: Item(verb='Adding')})
        actions.run_and_verify_commit(wc_dir, expected_output, expected_status,
                                      None, wc_dir)
Exemple #16
0
def set_up_dir_replace(sbox):
    """Set up the working copy for directory replace tests, creating
  directory 'A/B/F/foo' with files 'new file' and 'new file2' within
  it (r2), and merging 'foo' onto 'C' (r3), then deleting 'A/B/F/foo'
  (r4)."""

    sbox.build()
    wc_dir = sbox.wc_dir

    C_path = sbox.ospath('A/C')
    F_path = sbox.ospath('A/B/F')
    F_url = sbox.repo_url + '/A/B/F'

    foo_path = os.path.join(F_path, 'foo')
    new_file = os.path.join(foo_path, "new file")
    new_file2 = os.path.join(foo_path, "new file 2")

    # Make directory foo in F, and add some files within it.
    actions.run_and_verify_svn(None, None, [], 'mkdir', foo_path)
    main.file_append(new_file, "Initial text in new file.\n")
    main.file_append(new_file2, "Initial text in new file 2.\n")
    main.run_svn(None, "add", new_file)
    main.run_svn(None, "add", new_file2)

    # Commit all the new content, creating r2.
    expected_output = wc.State(
        wc_dir, {
            'A/B/F/foo': Item(verb='Adding'),
            'A/B/F/foo/new file': Item(verb='Adding'),
            'A/B/F/foo/new file 2': Item(verb='Adding'),
        })
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add({
        'A/B/F/foo': Item(status='  ', wc_rev=2),
        'A/B/F/foo/new file': Item(status='  ', wc_rev=2),
        'A/B/F/foo/new file 2': Item(status='  ', wc_rev=2),
    })
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status,
                                  None, wc_dir)

    # Merge foo onto C
    expected_output = wc.State(
        C_path, {
            'foo': Item(status='A '),
            'foo/new file': Item(status='A '),
            'foo/new file 2': Item(status='A '),
        })
    expected_mergeinfo_output = wc.State(C_path, {
        '': Item(status=' U'),
    })
    expected_elision_output = wc.State(C_path, {})
    expected_disk = wc.State(
        '', {
            '': Item(props={SVN_PROP_MERGEINFO: '/A/B/F:2'}),
            'foo': Item(),
            'foo/new file': Item("Initial text in new file.\n"),
            'foo/new file 2': Item("Initial text in new file 2.\n"),
        })
    expected_status = wc.State(
        C_path, {
            '': Item(status=' M', wc_rev=1),
            'foo': Item(status='A ', wc_rev='-', copied='+'),
            'foo/new file': Item(status='  ', wc_rev='-', copied='+'),
            'foo/new file 2': Item(status='  ', wc_rev='-', copied='+'),
        })
    expected_skip = wc.State(C_path, {})
    actions.run_and_verify_merge(C_path, '1', '2', F_url, None,
                                 expected_output, expected_mergeinfo_output,
                                 expected_elision_output, expected_disk,
                                 expected_status, expected_skip, None, None,
                                 None, None, None, 1)
    # Commit merge of foo onto C, creating r3.
    expected_output = wc.State(wc_dir, {
        'A/C': Item(verb='Sending'),
        'A/C/foo': Item(verb='Adding'),
    })
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add({
        'A/B/F/foo': Item(status='  ', wc_rev=2),
        'A/C': Item(status='  ', wc_rev=3),
        'A/B/F/foo/new file': Item(status='  ', wc_rev=2),
        'A/B/F/foo/new file 2': Item(status='  ', wc_rev=2),
        'A/C/foo': Item(status='  ', wc_rev=3),
        'A/C/foo/new file': Item(status='  ', wc_rev=3),
        'A/C/foo/new file 2': Item(status='  ', wc_rev=3),
    })
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status,
                                  None, wc_dir)

    # Delete foo on F, creating r4.
    actions.run_and_verify_svn(None, None, [], 'rm', foo_path)
    expected_output = wc.State(wc_dir, {
        'A/B/F/foo': Item(verb='Deleting'),
    })
    expected_status = actions.get_virginal_state(wc_dir, 1)
    expected_status.add({
        'A/C': Item(status='  ', wc_rev=3),
        'A/C/foo': Item(status='  ', wc_rev=3),
        'A/C/foo/new file': Item(status='  ', wc_rev=3),
        'A/C/foo/new file 2': Item(status='  ', wc_rev=3),
    })
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status,
                                  None, wc_dir)