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)
def do_add_file(sbox, dst, dst_cmdline, expected_stderr=None, empty_sandbox=False): expected_status = build_sandbox(sbox, empty_sandbox, expected_stderr) if expected_status is not None: expected_status.add({dst: Item(status='A ', wc_rev='-')}) main.file_write(sbox.ospath(dst), "This is file '" + dst + "'.") run_svn(sbox, expected_status, expected_stderr, 'add', dst_cmdline)
def modify(modaction, paths): F1 = paths["F1"] # existing file to copy from F = paths["F"] # target file F2 = paths["F2"] # non-existing file to copy/move to D1 = paths["D1"] # existing dir to copy from D = paths["D"] # target dir D2 = paths["D2"] # non-existing dir to copy/move to # print " Mod: '" + modaction + "' '" + P + "'" if modaction == "ft": # file text-mod assert os.path.exists(F) main.file_append(F, "This is a text-mod of file F.\n") elif modaction == "fP": # file Prop-mod assert os.path.exists(F) main.run_svn(None, "pset", "fprop1", "A prop set on file F.", F) elif modaction == "dP": # dir Prop-mod assert os.path.exists(D) main.run_svn(None, "pset", "dprop1", "A prop set on dir D.", D) elif modaction == "fD": # file Delete assert os.path.exists(F) main.run_svn(None, "del", F) elif modaction == "dD": # dir Delete assert os.path.exists(D) main.run_svn(None, "del", D) elif modaction == "fA": # file Add (new) assert os.path.exists(F) main.run_svn(None, "add", F) main.run_svn(None, "pset", "fprop2", "A prop of added file F.", F) elif modaction == "dA": # dir Add (new) assert os.path.exists(D) main.run_svn(None, "add", D) main.run_svn(None, "pset", "dprop2", "A prop of added dir D.", D) elif modaction == "fC": # file Copy (from F1) main.run_svn(None, "copy", F1, F) elif modaction == "dC": # dir Copy (from D1) main.run_svn(None, "copy", D1, D) elif modaction == "fM": # file Move (to F2) main.run_svn(None, "rename", F, F2) elif modaction == "dM": # dir Move (to D2) main.run_svn(None, "rename", D, D2) elif modaction == "fa": # file add (new) on disk assert not os.path.exists(F) main.file_write(F, "This is file F.\n") elif modaction == "da": # dir add (new) on disk assert not os.path.exists(D) os.mkdir(D) elif modaction == "fd": # file delete from disk assert os.path.exists(F) os.remove(F) elif modaction == "dd": # dir delete from disk assert os.path.exists(D) os.remove(D) else: raise Exception("unknown modaction: '" + modaction + "'")
def file_modify(self, rpath, content=None, props=None): "Make text and property mods to a WC file." lpath = local_path(rpath) if content is not None: #main.file_append(lpath, "An extra line.\n") #actions.run_and_verify_svn(None, None, [], 'propset', # 'newprop', 'v', lpath) main.file_write(lpath, content) self.state.tweak(rpath, content=content) if props is not None: self.set_props(rpath, props) self.state.tweak(rpath, props=props)
def noninheritable_mergeinfo_test_set_up(sbox): '''Starting with standard greek tree, copy 'A' to 'branch' in r2 and then made a file edit to A/B/lambda in r3. Return (expected_output, expected_mergeinfo_output, expected_elision_output, expected_status, expected_disk, expected_skip) for a merge of r3 from ^/A/B to branch/B.''' sbox.build() wc_dir = sbox.wc_dir lambda_path = sbox.ospath('A/B/lambda') B_branch_path = sbox.ospath('branch/B') # r2 - Branch ^/A to ^/branch. main.run_svn(None, 'copy', sbox.repo_url + '/A', sbox.repo_url + '/branch', '-m', 'make a branch') # r3 - Make an edit to A/B/lambda. main.file_write(lambda_path, "trunk edit.\n") main.run_svn(None, 'commit', '-m', 'file edit', wc_dir) main.run_svn(None, 'up', wc_dir) expected_output = wc.State(B_branch_path, { 'lambda' : Item(status='U '), }) expected_mergeinfo_output = wc.State(B_branch_path, { '' : Item(status=' U'), 'lambda' : Item(status=' U'), }) expected_elision_output = wc.State(B_branch_path, { 'lambda' : Item(status=' U'), }) expected_status = wc.State(B_branch_path, { '' : Item(status=' M'), 'lambda' : Item(status='M '), 'E' : Item(status=' '), 'E/alpha' : Item(status=' '), 'E/beta' : Item(status=' '), 'F' : Item(status=' '), }) expected_status.tweak(wc_rev='3') expected_disk = wc.State('', { '' : Item(props={SVN_PROP_MERGEINFO : '/A/B:3'}), 'lambda' : Item("trunk edit.\n"), 'E' : Item(), 'E/alpha' : Item("This is the file 'alpha'.\n"), 'E/beta' : Item("This is the file 'beta'.\n"), 'F' : Item(), }) expected_skip = wc.State(B_branch_path, {}) return expected_output, expected_mergeinfo_output, expected_elision_output, \ expected_status, expected_disk, expected_skip
def file_modify(self, rpath, content=None, props=None): "Make text and property mods to a WC file." lpath = local_path(rpath) if content is not None: #main.file_append(lpath, "An extra line.\n") #actions.run_and_verify_svn(None, [], 'propset', # 'newprop', 'v', lpath) main.file_write(lpath, content) self.state.tweak(rpath, content=content) if props is not None: self.set_props(rpath, props) self.state.tweak(rpath, props=props)
def dump(self, output_dir): """Dump the repository into the directory OUTPUT_DIR""" ldir = local_path(output_dir) os.mkdir(ldir) """Run a BDB dump on the repository""" if self.db_dump_name != 'none': dump_bdb(self.db_dump_name, self.repo_absdir, ldir) """Run 'svnadmin dump' on the repository.""" exit_code, stdout, stderr = \ actions.run_and_verify_svnadmin(None, None, 'dump', self.repo_absdir) ldumpfile = local_path(output_dir + "/svnadmin.dump") main.file_write(ldumpfile, ''.join(stderr)) main.file_append(ldumpfile, ''.join(stdout))
def update_symlink(sbox): "update a symlink" svntest.actions.do_sleep_for_timestamps() sbox.build() wc_dir = sbox.wc_dir mu_path = sbox.ospath('A/mu') iota_path = sbox.ospath('iota') symlink_path = sbox.ospath('symlink') # create a symlink to /A/mu sbox.simple_add_symlink("A/mu", 'symlink') sbox.simple_commit() # change the symlink to /iota os.remove(symlink_path) if svntest.main.is_posix_os(): os.symlink("iota", symlink_path) else: file_write(symlink_path, 'link iota') sbox.simple_commit() # update back to r2 svntest.main.run_svn(False, 'update', '-r', '2', wc_dir) # now update to head; 1.7.0 throws an assertion here expected_output = svntest.wc.State(wc_dir, { 'symlink': Item(status='U '), }) expected_disk = svntest.main.greek_state.copy() expected_disk.add({ 'symlink': Item(contents="This is the file 'iota'.\n", props={'svn:special': '*'}) }) expected_status = svntest.actions.get_virginal_state(wc_dir, 3) expected_status.add({ 'symlink': Item(status=' ', wc_rev='3'), }) if not svntest.main.is_posix_os(): expected_disk = None svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, check_props=True)
def dump(self, output_dir): """Dump the repository into the directory OUTPUT_DIR""" ldir = local_path(output_dir) os.mkdir(ldir) """Run a BDB dump on the repository""" if self.db_dump_name != 'none': dump_bdb(self.db_dump_name, self.repo_absdir, ldir) """Run 'svnadmin dump' on the repository.""" exit_code, stdout, stderr = \ actions.run_and_verify_svnadmin(None, None, None, 'dump', self.repo_absdir) ldumpfile = local_path(output_dir + "/svnadmin.dump") main.file_write(ldumpfile, ''.join(stderr)) main.file_append(ldumpfile, ''.join(stdout))
def svn_file_create_add(self, rpath, content=None, props=None): "Make and add a file with some default content, and keyword expansion." lpath = local_path(rpath) ldirname, filename = os.path.split(lpath) if content is None: # Default content content = "This is the file '" + filename + "'.\n" + \ "Last changed in '$Revision$'.\n" main.file_write(lpath, content) actions.run_and_verify_svn(None, [], 'add', lpath) self.state.add({rpath: wc.StateItem(status='A ')}) if props is None: # Default props props = {'svn:keywords': 'Revision'} self.svn_set_props(rpath, props)
def update_symlink(sbox): "update a symlink" svntest.actions.do_sleep_for_timestamps() sbox.build() wc_dir = sbox.wc_dir mu_path = sbox.ospath('A/mu') iota_path = sbox.ospath('iota') symlink_path = sbox.ospath('symlink') # create a symlink to /A/mu sbox.simple_add_symlink("A/mu", 'symlink') sbox.simple_commit() # change the symlink to /iota os.remove(symlink_path) if svntest.main.is_posix_os(): os.symlink("iota", symlink_path) else: file_write(symlink_path, 'link iota') sbox.simple_commit() # update back to r2 svntest.main.run_svn(False, 'update', '-r', '2', wc_dir) # now update to head; 1.7.0 throws an assertion here expected_output = svntest.wc.State(wc_dir, { 'symlink' : Item(status='U '), }) expected_disk = svntest.main.greek_state.copy() expected_disk.add({'symlink': Item(contents="This is the file 'iota'.\n", props={'svn:special' : '*'})}) expected_status = svntest.actions.get_virginal_state(wc_dir, 3) expected_status.add({ 'symlink' : Item(status=' ', wc_rev='3'), }) if not svntest.main.is_posix_os(): expected_disk = None svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 1)
def svn_file_create_add(self, rpath, content=None, props=None): "Make and add a file with some default content, and keyword expansion." lpath = local_path(rpath) ldirname, filename = os.path.split(lpath) if content is None: # Default content content = "This is the file '" + filename + "'.\n" + \ "Last changed in '$Revision$'.\n" main.file_write(lpath, content) actions.run_and_verify_svn(None, None, [], 'add', lpath) self.state.add({ rpath : wc.StateItem(status='A ') }) if props is None: # Default props props = { 'svn:keywords': 'Revision' } self.svn_set_props(rpath, props)
def set_up_repos(wc_dir, br_dir, scenarios): if not os.path.exists(br_dir): main.run_svn(None, "mkdir", "--parents", br_dir) # create the file F1 and dir D1 which the tests regard as pre-existing paths = incoming_paths(wc_dir, wc_dir) # second arg is bogus but unimportant F1 = paths['F1'] # existing file to copy from main.file_write(F1, "This is initially file F1.\n") main.run_svn(None, 'add', F1) D1 = paths['D1'] # existing dir to copy from main.run_svn(None, 'mkdir', D1) # create the initial parent dirs, and each file or dir unless to-be-added for init_mods, action_mods in scenarios: path = "_".join(action_mods) P = os.path.join(br_dir, path) # parent of items to be tested main.run_svn(None, 'mkdir', '--parents', P) for modaction in init_mods: modify(modaction, incoming_paths(wc_dir, P)) run_and_verify_svn(None, AnyOutput, [], 'commit', '-m', 'Initial set-up.', wc_dir) # Capture the revision number init_rev = 2 ### hard-coded # modify all files and dirs in their various ways for _path, action_mods in scenarios: path = "_".join(action_mods) P = os.path.join(br_dir, path) # parent for modaction in action_mods: modify(modaction, incoming_paths(wc_dir, P)) # commit all the modifications run_and_verify_svn(None, AnyOutput, [], 'commit', '-m', 'Action.', wc_dir) # Capture the revision number changed_rev = 3 ### hard-coded return (init_rev, changed_rev)
def set_up_repos(wc_dir, br_dir, scenarios): if not os.path.exists(br_dir): main.run_svn(None, "mkdir", "--parents", br_dir) # create the file F1 and dir D1 which the tests regard as pre-existing paths = incoming_paths(wc_dir, wc_dir) # second arg is bogus but unimportant F1 = paths["F1"] # existing file to copy from main.file_write(F1, "This is initially file F1.\n") main.run_svn(None, "add", F1) D1 = paths["D1"] # existing dir to copy from main.run_svn(None, "mkdir", D1) # create the initial parent dirs, and each file or dir unless to-be-added for init_mods, action_mods in scenarios: path = "_".join(action_mods) P = os.path.join(br_dir, path) # parent of items to be tested main.run_svn(None, "mkdir", "--parents", P) for modaction in init_mods: modify(modaction, incoming_paths(wc_dir, P)) run_and_verify_svn(None, AnyOutput, [], "commit", "-m", "Initial set-up.", wc_dir) # Capture the revision number init_rev = 2 ### hard-coded # modify all files and dirs in their various ways for _path, action_mods in scenarios: path = "_".join(action_mods) P = os.path.join(br_dir, path) # parent for modaction in action_mods: modify(modaction, incoming_paths(wc_dir, P)) # commit all the modifications run_and_verify_svn(None, AnyOutput, [], "commit", "-m", "Action.", wc_dir) # Capture the revision number changed_rev = 3 ### hard-coded return (init_rev, changed_rev)
def set_up_branch(sbox, branch_only = False, nbr_of_branches = 1): '''Starting with standard greek tree, copy 'A' NBR_OF_BRANCHES times to A_COPY, A_COPY_2, A_COPY_3, and so on. Then, unless BRANCH_ONLY is true, make four modifications (setting file contents to "New content") under A: r(2 + NBR_OF_BRANCHES) - A/D/H/psi r(3 + NBR_OF_BRANCHES) - A/D/G/rho r(4 + NBR_OF_BRANCHES) - A/B/E/beta r(5 + NBR_OF_BRANCHES) - A/D/H/omega Return (expected_disk, expected_status).''' # With the default parameters, the branching looks like this: # # A -1-----3-4-5-6-- # \ # A_COPY 2----------- wc_dir = sbox.wc_dir expected_status = actions.get_virginal_state(wc_dir, 1) expected_disk = main.greek_state.copy() def path_join(head, tail): if not head: return tail if not tail: return head return head + '/' + tail def greek_file_item(path): if path[-1:].islower(): basename = re.sub('.*/', '', path) return Item("This is the file '" + basename + "'.\n") return Item() A_paths = [ "", "B", "B/lambda", "B/E", "B/E/alpha", "B/E/beta", "B/F", "mu", "C", "D", "D/gamma", "D/G", "D/G/pi", "D/G/rho", "D/G/tau", "D/H", "D/H/chi", "D/H/omega", "D/H/psi", ] def copy_A(dest_name, rev): expected = verify.UnorderedOutput( [ "A " + sbox.ospath(path_join(dest_name, p)) + "\n" for p in A_paths ]) expected_status.add( { path_join(dest_name, p) : Item(status=' ', wc_rev=rev) for p in A_paths }) expected_disk.add( { path_join(dest_name, p) : greek_file_item(p) for p in A_paths }) # Make a branch A_COPY to merge into. actions.run_and_verify_svn(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) for i in range(nbr_of_branches): if i == 0: copy_A('A_COPY', i + 2) else: copy_A('A_COPY_' + str(i + 1), i + 2) if branch_only: return expected_disk, expected_status # Make some changes under A which we'll later merge under A_COPY: # r(nbr_of_branches + 2) - modify and commit A/D/H/psi main.file_write(sbox.ospath('A/D/H/psi'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/psi' : Item(verb='Sending')}) expected_status.tweak('A/D/H/psi', wc_rev=nbr_of_branches + 2) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/psi', contents="New content") # r(nbr_of_branches + 3) - modify and commit A/D/G/rho main.file_write(sbox.ospath('A/D/G/rho'), "New content") expected_output = wc.State(wc_dir, {'A/D/G/rho' : Item(verb='Sending')}) expected_status.tweak('A/D/G/rho', wc_rev=nbr_of_branches + 3) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/G/rho', contents="New content") # r(nbr_of_branches + 4) - modify and commit A/B/E/beta main.file_write(sbox.ospath('A/B/E/beta'), "New content") expected_output = wc.State(wc_dir, {'A/B/E/beta' : Item(verb='Sending')}) expected_status.tweak('A/B/E/beta', wc_rev=nbr_of_branches + 4) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/B/E/beta', contents="New content") # r(nbr_of_branches + 5) - modify and commit A/D/H/omega main.file_write(sbox.ospath('A/D/H/omega'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/omega' : Item(verb='Sending')}) expected_status.tweak('A/D/H/omega', wc_rev=nbr_of_branches + 5) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/omega', contents="New content") return expected_disk, expected_status
def set_up_branch(sbox, branch_only=False, nbr_of_branches=1): '''Starting with standard greek tree, copy 'A' NBR_OF_BRANCHES times to A_COPY, A_COPY_2, A_COPY_3, and so on. Then, unless BRANCH_ONLY is true, make four modifications (setting file contents to "New content") under A: r(2 + NBR_OF_BRANCHES) - A/D/H/psi r(3 + NBR_OF_BRANCHES) - A/D/G/rho r(4 + NBR_OF_BRANCHES) - A/B/E/beta r(5 + NBR_OF_BRANCHES) - A/D/H/omega Return (expected_disk, expected_status).''' # With the default parameters, the branching looks like this: # # A -1-----3-4-5-6-- # \ # A_COPY 2----------- wc_dir = sbox.wc_dir expected_status = actions.get_virginal_state(wc_dir, 1) expected_disk = main.greek_state.copy() 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(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) for i in range(nbr_of_branches): if i == 0: copy_A('A_COPY', i + 2) else: copy_A('A_COPY_' + str(i + 1), i + 2) if branch_only: return expected_disk, expected_status # Make some changes under A which we'll later merge under A_COPY: # r(nbr_of_branches + 2) - modify and commit A/D/H/psi main.file_write(sbox.ospath('A/D/H/psi'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/psi': Item(verb='Sending')}) expected_status.tweak('A/D/H/psi', wc_rev=nbr_of_branches + 2) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/psi', contents="New content") # r(nbr_of_branches + 3) - modify and commit A/D/G/rho main.file_write(sbox.ospath('A/D/G/rho'), "New content") expected_output = wc.State(wc_dir, {'A/D/G/rho': Item(verb='Sending')}) expected_status.tweak('A/D/G/rho', wc_rev=nbr_of_branches + 3) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/G/rho', contents="New content") # r(nbr_of_branches + 4) - modify and commit A/B/E/beta main.file_write(sbox.ospath('A/B/E/beta'), "New content") expected_output = wc.State(wc_dir, {'A/B/E/beta': Item(verb='Sending')}) expected_status.tweak('A/B/E/beta', wc_rev=nbr_of_branches + 4) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/B/E/beta', contents="New content") # r(nbr_of_branches + 5) - modify and commit A/D/H/omega main.file_write(sbox.ospath('A/D/H/omega'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/omega': Item(verb='Sending')}) expected_status.tweak('A/D/H/omega', wc_rev=nbr_of_branches + 5) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/omega', contents="New content") return expected_disk, expected_status
def set_up_branch(sbox, branch_only=False, nbr_of_branches=1): '''Starting with standard greek tree, copy 'A' NBR_OF_BRANCHES times to A_COPY, A_COPY_2, A_COPY_3, and so on. Then, unless BRANCH_ONLY is true, make four modifications (setting file contents to "New content") under A: r(2 + NBR_OF_BRANCHES) - A/D/H/psi r(3 + NBR_OF_BRANCHES) - A/D/G/rho r(4 + NBR_OF_BRANCHES) - A/B/E/beta r(5 + NBR_OF_BRANCHES) - A/D/H/omega Return (expected_disk, expected_status).''' # With the default parameters, the branching looks like this: # # A -1-----3-4-5-6-- # \ # A_COPY 2----------- wc_dir = sbox.wc_dir expected_status = actions.get_virginal_state(wc_dir, 1) expected_disk = main.greek_state.copy() def path_join(head, tail): if not head: return tail if not tail: return head return head + '/' + tail def greek_file_item(path): if path[-1:].islower(): basename = re.sub('.*/', '', path) return Item("This is the file '" + basename + "'.\n") return Item() A_paths = [ "", "B", "B/lambda", "B/E", "B/E/alpha", "B/E/beta", "B/F", "mu", "C", "D", "D/gamma", "D/G", "D/G/pi", "D/G/rho", "D/G/tau", "D/H", "D/H/chi", "D/H/omega", "D/H/psi", ] def copy_A(dest_name, rev): expected = verify.UnorderedOutput([ "A " + sbox.ospath(path_join(dest_name, p)) + "\n" for p in A_paths ]) expected_status.add({ path_join(dest_name, p): Item(status=' ', wc_rev=rev) for p in A_paths }) expected_disk.add( {path_join(dest_name, p): greek_file_item(p) for p in A_paths}) # Make a branch A_COPY to merge into. actions.run_and_verify_svn(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) for i in range(nbr_of_branches): if i == 0: copy_A('A_COPY', i + 2) else: copy_A('A_COPY_' + str(i + 1), i + 2) if branch_only: return expected_disk, expected_status # Make some changes under A which we'll later merge under A_COPY: # r(nbr_of_branches + 2) - modify and commit A/D/H/psi main.file_write(sbox.ospath('A/D/H/psi'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/psi': Item(verb='Sending')}) expected_status.tweak('A/D/H/psi', wc_rev=nbr_of_branches + 2) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/psi', contents="New content") # r(nbr_of_branches + 3) - modify and commit A/D/G/rho main.file_write(sbox.ospath('A/D/G/rho'), "New content") expected_output = wc.State(wc_dir, {'A/D/G/rho': Item(verb='Sending')}) expected_status.tweak('A/D/G/rho', wc_rev=nbr_of_branches + 3) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/G/rho', contents="New content") # r(nbr_of_branches + 4) - modify and commit A/B/E/beta main.file_write(sbox.ospath('A/B/E/beta'), "New content") expected_output = wc.State(wc_dir, {'A/B/E/beta': Item(verb='Sending')}) expected_status.tweak('A/B/E/beta', wc_rev=nbr_of_branches + 4) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/B/E/beta', contents="New content") # r(nbr_of_branches + 5) - modify and commit A/D/H/omega main.file_write(sbox.ospath('A/D/H/omega'), "New content") expected_output = wc.State(wc_dir, {'A/D/H/omega': Item(verb='Sending')}) expected_status.tweak('A/D/H/omega', wc_rev=nbr_of_branches + 5) actions.run_and_verify_commit(wc_dir, expected_output, expected_status) expected_disk.tweak('A/D/H/omega', contents="New content") return expected_disk, expected_status
def replace_symlinks(sbox): "replace symlinks" sbox.build() wc = sbox.ospath # Some of these tests are implemented for git (in test script # t/t9100-git-svn-basic.sh) using the Perl bindings for Subversion. # Our issue #4091 is about 'svn update' failures in the git tests. sbox.simple_mkdir('A/D/G/Z') sbox.simple_mkdir('A/D/Gx') sbox.simple_mkdir('A/D/Gx/Z') sbox.simple_mkdir('A/D/Hx') sbox.simple_mkdir('A/D/Y') sbox.simple_mkdir('Ax') os.symlink('../Y', wc('A/D/H/Z')) os.symlink('../Y', wc('A/D/Hx/Z')) sbox.simple_add('A/D/H/Z', 'A/D/Hx/Z') for p in ['Ax/mu', 'A/D/Gx/pi', 'A/D/Hx/chi', ]: file_write(wc(p), 'This starts as a normal file.\n') sbox.simple_add(p) for p in ['iota.sh', 'A/mu.sh', 'Ax/mu.sh', 'A/D/gamma.sh', 'A/B/E/beta.sh', 'A/D/G/rho.sh', 'A/D/Gx/rho.sh', 'A/D/H/psi.sh', 'A/D/Hx/psi.sh', ]: file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n') os.chmod(wc(p), 0775) sbox.simple_add(p) sbox.simple_commit() # r2 # Failing git-svn test: 'new symlink is added to a file that was # also just made executable', i.e., in the same revision. sbox.simple_propset("svn:executable", "*", 'A/B/E/alpha') os.symlink('alpha', wc('A/B/E/sym-alpha')) sbox.simple_add('A/B/E/sym-alpha') # Add a symlink to a file made non-executable in the same revision. sbox.simple_propdel("svn:executable", 'A/B/E/beta.sh') os.symlink('beta.sh', wc('A/B/E/sym-beta.sh')) sbox.simple_add('A/B/E/sym-beta.sh') # Replace a normal {file, exec, dir} with a symlink to the same kind # via Subversion replacement. sbox.simple_rm('A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', # Ooops, not compatible with --bin=svn1.6. ) os.symlink(wc('../gamma'), wc('A/D/G/pi')) os.symlink(wc('../gamma.sh'), wc('A/D/G/rho.sh')) #os.symlink(wc('../Y'), wc('A/D/G/Z')) sbox.simple_add('A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', ) # Replace a symlink to {file, exec, dir} with a normal item of the # same kind via Subversion replacement. sbox.simple_rm('A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) os.symlink(wc('../gamma'), wc('A/D/H/chi')) os.symlink(wc('../gamma.sh'), wc('A/D/H/psi.sh')) #os.symlink(wc('../Y'), wc('A/D/H/Z')) sbox.simple_add('A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) # Replace a normal {file, exec} with a symlink to {exec, file} via # Subversion replacement. sbox.simple_rm('A/mu', 'A/mu.sh') os.symlink('../iota2', wc('A/mu')) os.symlink('../iota', wc('A/mu.sh')) sbox.simple_add('A/mu', 'A/mu.sh') # Ditto, without the Subversion replacement. Failing git-svn test # 'executable file becomes a symlink to bar/zzz (file)'. os.remove(wc('Ax/mu')) os.remove(wc('Ax/mu.sh')) os.symlink('../iota2', wc('Ax/mu')) os.symlink('../iota', wc('Ax/mu.sh')) sbox.simple_propset('svn:special', '*', 'Ax/mu', 'Ax/mu.sh') sbox.simple_propdel('svn:executable', 'Ax/mu.sh') ### TODO Replace a normal {file, exec, dir, dir} with a symlink to ### {dir, dir, file, exec}. And the same symlink-to-normal. ### Commit fails as of r1226697 with either "svn: E145001: Entry ### '.../A/D/Gx/Z' has unexpectedly changed special status" or "svn: ### E155010: The node '.../Ax/mu' was not found". sbox.simple_commit() # r3 # Try updating from HEAD-1 to HEAD. run_svn(None, 'up', '-r2', sbox.wc_dir) sbox.simple_update()
def replace_symlinks(sbox): "replace symlinks" sbox.build() wc = sbox.ospath # Some of these tests are implemented for git (in test script # t/t9100-git-svn-basic.sh) using the Perl bindings for Subversion. # Our issue #4091 is about 'svn update' failures in the git tests. sbox.simple_mkdir('A/D/G/Z') sbox.simple_mkdir('A/D/Gx') sbox.simple_mkdir('A/D/Gx/Z') sbox.simple_mkdir('A/D/Hx') sbox.simple_mkdir('A/D/Y') sbox.simple_mkdir('Ax') sbox.simple_add_symlink('../Y', 'A/D/H/Z') sbox.simple_add_symlink('../Y', 'A/D/Hx/Z') for p in [ 'Ax/mu', 'A/D/Gx/pi', 'A/D/Hx/chi', ]: file_write(wc(p), 'This starts as a normal file.\n') sbox.simple_add(p) for p in [ 'iota.sh', 'A/mu.sh', 'Ax/mu.sh', 'A/D/gamma.sh', 'A/B/E/beta.sh', 'A/D/G/rho.sh', 'A/D/Gx/rho.sh', 'A/D/H/psi.sh', 'A/D/Hx/psi.sh', ]: file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n') os.chmod(wc(p), svntest.main.S_ALL_RW | stat.S_IXUSR) sbox.simple_add(p) if not svntest.main.is_posix_os(): sbox.simple_propset('svn:executable', 'X', p) sbox.simple_commit() # r2 sbox.simple_update() expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 2) expected_status.add({ 'A/D/Y': Item(status=' ', wc_rev=2), 'A/D/G/Z': Item(status=' ', wc_rev=2), 'A/D/G/rho.sh': Item(status=' ', wc_rev=2), 'A/D/Hx': Item(status=' ', wc_rev=2), 'A/D/Hx/Z': Item(status=' ', wc_rev=2), 'A/D/Hx/chi': Item(status=' ', wc_rev=2), 'A/D/Hx/psi.sh': Item(status=' ', wc_rev=2), 'A/D/H/psi.sh': Item(status=' ', wc_rev=2), 'A/D/H/Z': Item(status=' ', wc_rev=2), 'A/D/Gx': Item(status=' ', wc_rev=2), 'A/D/Gx/Z': Item(status=' ', wc_rev=2), 'A/D/Gx/pi': Item(status=' ', wc_rev=2), 'A/D/Gx/rho.sh': Item(status=' ', wc_rev=2), 'A/D/gamma.sh': Item(status=' ', wc_rev=2), 'A/B/E/beta.sh': Item(status=' ', wc_rev=2), 'Ax': Item(status=' ', wc_rev=2), 'Ax/mu': Item(status=' ', wc_rev=2), 'Ax/mu.sh': Item(status=' ', wc_rev=2), 'A/mu.sh': Item(status=' ', wc_rev=2), 'iota.sh': Item(status=' ', wc_rev=2), }) expected_status_r2 = copy.deepcopy(expected_status) svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r2) # Failing git-svn test: 'new symlink is added to a file that was # also just made executable', i.e., in the same revision. sbox.simple_propset("svn:executable", "X", 'A/B/E/alpha') sbox.simple_add_symlink('alpha', 'A/B/E/sym-alpha') # Add a symlink to a file made non-executable in the same revision. sbox.simple_propdel("svn:executable", 'A/B/E/beta.sh') sbox.simple_add_symlink('beta.sh', 'A/B/E/sym-beta.sh') # Replace a normal {file, exec, dir} with a symlink to the same kind # via Subversion replacement. sbox.simple_rm( 'A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', # Ooops, not compatible with --bin=svn1.6. ) sbox.simple_add_symlink('../gamma', 'A/D/G/pi') sbox.simple_add_symlink('../gamma.sh', 'A/D/G/rho.sh') #sbox.simple_add_symlink('../Y', 'A/D/G/Z') # Replace a symlink to {file, exec, dir} with a normal item of the # same kind via Subversion replacement. sbox.simple_rm( 'A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) sbox.simple_add_symlink('../gamma', 'A/D/H/chi') sbox.simple_add_symlink('../gamma.sh', 'A/D/H/psi.sh') #sbox.simple_add_symlink('../Y', 'A/D/H/Z') # Replace a normal {file, exec} with a symlink to {exec, file} via # Subversion replacement. sbox.simple_rm('A/mu', 'A/mu.sh') sbox.simple_add_symlink('../iota2', 'A/mu') sbox.simple_add_symlink('../iota', 'A/mu.sh') # Ditto, without the Subversion replacement. Failing git-svn test # 'executable file becomes a symlink to bar/zzz (file)'. if svntest.main.is_posix_os(): os.remove(wc('Ax/mu')) os.remove(wc('Ax/mu.sh')) os.symlink('../iota2', wc('Ax/mu')) os.symlink('../iota', wc('Ax/mu.sh')) else: # At least modify the file a bit # ### Somehow this breaks the test when using multiline data? # ### Is that intended behavior? file_write(sbox.ospath('Ax/mu'), 'Link to iota2') file_write(sbox.ospath('Ax/mu.sh'), 'Link to iota') sbox.simple_propset('svn:special', 'X', 'Ax/mu', 'Ax/mu.sh') sbox.simple_propdel('svn:executable', 'Ax/mu.sh') ### TODO Replace a normal {file, exec, dir, dir} with a symlink to ### {dir, dir, file, exec}. And the same symlink-to-normal. expected_status.tweak('A/D/G/pi', 'A/D/G/rho.sh', 'A/D/H/psi.sh', 'A/D/H/chi', 'A/mu', 'A/mu.sh', status='RM') expected_status.tweak('A/B/E/beta.sh', 'A/B/E/alpha', status=' M') expected_status.tweak('Ax/mu', 'Ax/mu.sh', status='MM') expected_status.add({ 'A/B/E/sym-alpha': Item(status='A ', wc_rev=0), 'A/B/E/sym-beta.sh': Item(status='A ', wc_rev=0), }) svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status) sbox.simple_commit() # r3 sbox.simple_update() expected_status.tweak(status=' ', wc_rev=3) expected_status_r3 = expected_status svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r3) # Try updating from HEAD-1 to HEAD. This is currently XFAIL as the # update to HEAD-1 produces a tree conflict. run_svn(None, 'up', '-r2', sbox.wc_dir) svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r2) sbox.simple_update() svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r3)
def replace_symlinks(sbox): "replace symlinks" sbox.build() wc = sbox.ospath # Some of these tests are implemented for git (in test script # t/t9100-git-svn-basic.sh) using the Perl bindings for Subversion. # Our issue #4091 is about 'svn update' failures in the git tests. sbox.simple_mkdir('A/D/G/Z') sbox.simple_mkdir('A/D/Gx') sbox.simple_mkdir('A/D/Gx/Z') sbox.simple_mkdir('A/D/Hx') sbox.simple_mkdir('A/D/Y') sbox.simple_mkdir('Ax') os.symlink('../Y', wc('A/D/H/Z')) os.symlink('../Y', wc('A/D/Hx/Z')) sbox.simple_add('A/D/H/Z', 'A/D/Hx/Z') for p in [ 'Ax/mu', 'A/D/Gx/pi', 'A/D/Hx/chi', ]: file_write(wc(p), 'This starts as a normal file.\n') sbox.simple_add(p) for p in [ 'iota.sh', 'A/mu.sh', 'Ax/mu.sh', 'A/D/gamma.sh', 'A/B/E/beta.sh', 'A/D/G/rho.sh', 'A/D/Gx/rho.sh', 'A/D/H/psi.sh', 'A/D/Hx/psi.sh', ]: file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n') os.chmod(wc(p), 0775) sbox.simple_add(p) sbox.simple_commit() # r2 # Failing git-svn test: 'new symlink is added to a file that was # also just made executable', i.e., in the same revision. sbox.simple_propset("svn:executable", "*", 'A/B/E/alpha') os.symlink('alpha', wc('A/B/E/sym-alpha')) sbox.simple_add('A/B/E/sym-alpha') # Add a symlink to a file made non-executable in the same revision. sbox.simple_propdel("svn:executable", 'A/B/E/beta.sh') os.symlink('beta.sh', wc('A/B/E/sym-beta.sh')) sbox.simple_add('A/B/E/sym-beta.sh') # Replace a normal {file, exec, dir} with a symlink to the same kind # via Subversion replacement. sbox.simple_rm( 'A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', # Ooops, not compatible with --bin=svn1.6. ) os.symlink(wc('../gamma'), wc('A/D/G/pi')) os.symlink(wc('../gamma.sh'), wc('A/D/G/rho.sh')) #os.symlink(wc('../Y'), wc('A/D/G/Z')) sbox.simple_add( 'A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', ) # Replace a symlink to {file, exec, dir} with a normal item of the # same kind via Subversion replacement. sbox.simple_rm( 'A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) os.symlink(wc('../gamma'), wc('A/D/H/chi')) os.symlink(wc('../gamma.sh'), wc('A/D/H/psi.sh')) #os.symlink(wc('../Y'), wc('A/D/H/Z')) sbox.simple_add( 'A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) # Replace a normal {file, exec} with a symlink to {exec, file} via # Subversion replacement. sbox.simple_rm('A/mu', 'A/mu.sh') os.symlink('../iota2', wc('A/mu')) os.symlink('../iota', wc('A/mu.sh')) sbox.simple_add('A/mu', 'A/mu.sh') # Ditto, without the Subversion replacement. Failing git-svn test # 'executable file becomes a symlink to bar/zzz (file)'. os.remove(wc('Ax/mu')) os.remove(wc('Ax/mu.sh')) os.symlink('../iota2', wc('Ax/mu')) os.symlink('../iota', wc('Ax/mu.sh')) sbox.simple_propset('svn:special', '*', 'Ax/mu', 'Ax/mu.sh') sbox.simple_propdel('svn:executable', 'Ax/mu.sh') ### TODO Replace a normal {file, exec, dir, dir} with a symlink to ### {dir, dir, file, exec}. And the same symlink-to-normal. ### Commit fails as of r1226697 with either "svn: E145001: Entry ### '.../A/D/Gx/Z' has unexpectedly changed special status" or "svn: ### E155010: The node '.../Ax/mu' was not found". sbox.simple_commit() # r3 # Try updating from HEAD-1 to HEAD. run_svn(None, 'up', '-r2', sbox.wc_dir) sbox.simple_update()
def replace_symlinks(sbox): "replace symlinks" sbox.build() wc = sbox.ospath # Some of these tests are implemented for git (in test script # t/t9100-git-svn-basic.sh) using the Perl bindings for Subversion. # Our issue #4091 is about 'svn update' failures in the git tests. sbox.simple_mkdir('A/D/G/Z') sbox.simple_mkdir('A/D/Gx') sbox.simple_mkdir('A/D/Gx/Z') sbox.simple_mkdir('A/D/Hx') sbox.simple_mkdir('A/D/Y') sbox.simple_mkdir('Ax') os.symlink('../Y', wc('A/D/H/Z')) os.symlink('../Y', wc('A/D/Hx/Z')) sbox.simple_add('A/D/H/Z', 'A/D/Hx/Z') for p in ['Ax/mu', 'A/D/Gx/pi', 'A/D/Hx/chi', ]: file_write(wc(p), 'This starts as a normal file.\n') sbox.simple_add(p) for p in ['iota.sh', 'A/mu.sh', 'Ax/mu.sh', 'A/D/gamma.sh', 'A/B/E/beta.sh', 'A/D/G/rho.sh', 'A/D/Gx/rho.sh', 'A/D/H/psi.sh', 'A/D/Hx/psi.sh', ]: file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n') os.chmod(wc(p), 0775) sbox.simple_add(p) sbox.simple_commit() # r2 sbox.simple_update() expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 2) expected_status.add({ 'A/D/Y' : Item(status=' ', wc_rev=2), 'A/D/G/Z' : Item(status=' ', wc_rev=2), 'A/D/G/rho.sh' : Item(status=' ', wc_rev=2), 'A/D/Hx' : Item(status=' ', wc_rev=2), 'A/D/Hx/Z' : Item(status=' ', wc_rev=2), 'A/D/Hx/chi' : Item(status=' ', wc_rev=2), 'A/D/Hx/psi.sh' : Item(status=' ', wc_rev=2), 'A/D/H/psi.sh' : Item(status=' ', wc_rev=2), 'A/D/H/Z' : Item(status=' ', wc_rev=2), 'A/D/Gx' : Item(status=' ', wc_rev=2), 'A/D/Gx/Z' : Item(status=' ', wc_rev=2), 'A/D/Gx/pi' : Item(status=' ', wc_rev=2), 'A/D/Gx/rho.sh' : Item(status=' ', wc_rev=2), 'A/D/gamma.sh' : Item(status=' ', wc_rev=2), 'A/B/E/beta.sh' : Item(status=' ', wc_rev=2), 'Ax' : Item(status=' ', wc_rev=2), 'Ax/mu' : Item(status=' ', wc_rev=2), 'Ax/mu.sh' : Item(status=' ', wc_rev=2), 'A/mu.sh' : Item(status=' ', wc_rev=2), 'iota.sh' : Item(status=' ', wc_rev=2), }) expected_status_r2 = expected_status svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r2) # Failing git-svn test: 'new symlink is added to a file that was # also just made executable', i.e., in the same revision. sbox.simple_propset("svn:executable", "*", 'A/B/E/alpha') os.symlink('alpha', wc('A/B/E/sym-alpha')) sbox.simple_add('A/B/E/sym-alpha') # Add a symlink to a file made non-executable in the same revision. sbox.simple_propdel("svn:executable", 'A/B/E/beta.sh') os.symlink('beta.sh', wc('A/B/E/sym-beta.sh')) sbox.simple_add('A/B/E/sym-beta.sh') # Replace a normal {file, exec, dir} with a symlink to the same kind # via Subversion replacement. sbox.simple_rm('A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', # Ooops, not compatible with --bin=svn1.6. ) os.symlink(wc('../gamma'), wc('A/D/G/pi')) os.symlink(wc('../gamma.sh'), wc('A/D/G/rho.sh')) #os.symlink(wc('../Y'), wc('A/D/G/Z')) sbox.simple_add('A/D/G/pi', 'A/D/G/rho.sh', #'A/D/G/Z', ) # Replace a symlink to {file, exec, dir} with a normal item of the # same kind via Subversion replacement. sbox.simple_rm('A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) os.symlink(wc('../gamma'), wc('A/D/H/chi')) os.symlink(wc('../gamma.sh'), wc('A/D/H/psi.sh')) #os.symlink(wc('../Y'), wc('A/D/H/Z')) sbox.simple_add('A/D/H/chi', 'A/D/H/psi.sh', #'A/D/H/Z', ) # Replace a normal {file, exec} with a symlink to {exec, file} via # Subversion replacement. sbox.simple_rm('A/mu', 'A/mu.sh') os.symlink('../iota2', wc('A/mu')) os.symlink('../iota', wc('A/mu.sh')) sbox.simple_add('A/mu', 'A/mu.sh') # Ditto, without the Subversion replacement. Failing git-svn test # 'executable file becomes a symlink to bar/zzz (file)'. os.remove(wc('Ax/mu')) os.remove(wc('Ax/mu.sh')) os.symlink('../iota2', wc('Ax/mu')) os.symlink('../iota', wc('Ax/mu.sh')) sbox.simple_propset('svn:special', '*', 'Ax/mu', 'Ax/mu.sh') sbox.simple_propdel('svn:executable', 'Ax/mu.sh') ### TODO Replace a normal {file, exec, dir, dir} with a symlink to ### {dir, dir, file, exec}. And the same symlink-to-normal. expected_status.tweak('A/D/G/pi', 'A/D/G/rho.sh', 'A/D/H/psi.sh', 'A/D/H/chi', 'A/mu', 'A/mu.sh', status='RM') expected_status.tweak('A/B/E/beta.sh', 'A/B/E/alpha', status=' M') expected_status.tweak('Ax/mu', 'Ax/mu.sh', status='MM') expected_status.add({ 'A/B/E/sym-alpha' : Item(status='A ', wc_rev=0), 'A/B/E/sym-beta.sh' : Item(status='A ', wc_rev=0), }) svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status) sbox.simple_commit() # r3 sbox.simple_update() expected_status.tweak(status=' ', wc_rev=3) expected_status_r3 = expected_status svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r3) # Try updating from HEAD-1 to HEAD. This is currently XFAIL as the # update to HEAD-1 produces a tree conflict. run_svn(None, 'up', '-r2', sbox.wc_dir) svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r2) sbox.simple_update() svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status_r3)