Example #1
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)
Example #2
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)
Example #3
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)
Example #4
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)
Example #5
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)
Example #6
0
def lock_admin_dir(wc_dir):
    "Lock a SVN administrative directory"

    path = os.path.join(wc_dir, main.get_admin_name(), 'lock')
    main.file_append(path, "stop looking!")
Example #7
0
def lock_admin_dir(wc_dir):
  "Lock a SVN administrative directory"

  path = os.path.join(wc_dir, main.get_admin_name(), 'lock')
  main.file_append(path, "stop looking!")