232
232
expected_added=[('b',), (dest_path,)])
233
233
self.assertContent(branch, revtree2, dest_path, "aaa")
235
def symlink_command_iter(self, src_path, dest_path):
237
author = ['', 'bugs@a.com', time.time(), time.timezone]
238
committer = ['', 'elmer@a.com', time.time(), time.timezone]
240
yield commands.FileModifyCommand(src_path, 'symlink', False,
242
yield commands.CommitCommand('head', '1', author,
243
committer, "commit 1", None, [], files_one)
245
yield commands.FileCopyCommand(src_path, dest_path)
246
yield commands.CommitCommand('head', '2', author,
247
committer, "commit 2", ":1", [], files_two)
250
def assertSymlinkTarget(self, branch, tree, path, target):
251
file_id = tree.inventory.path2id(path)
253
self.addCleanup(branch.unlock)
254
self.assertEqual(tree.get_symlink_target(file_id), target)
256
def test_copy_symlink_in_root(self):
257
handler, branch = self.get_handler()
260
handler.process(self.symlink_command_iter(src_path, dest_path))
261
revtree1, revtree2 = self.assertChanges(branch, 1,
262
expected_added=[(dest_path,)])
263
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa")
264
self.assertEqual(revtree1.get_revision_id(),
265
revtree1.inventory.root.children['a'].revision)
266
self.assertEqual(revtree2.get_revision_id(),
267
revtree2.inventory.root.children['b'].revision)
269
def test_copy_symlink_in_subdir(self):
270
handler, branch = self.get_handler()
273
handler.process(self.symlink_command_iter(src_path, dest_path))
274
revtree1, revtree2 = self.assertChanges(branch, 1,
275
expected_added=[(dest_path,)])
276
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa")
278
def test_copy_symlink_to_new_dir(self):
279
handler, branch = self.get_handler()
282
handler.process(self.symlink_command_iter(src_path, dest_path))
283
revtree1, revtree2 = self.assertChanges(branch, 1,
284
expected_added=[('b',), (dest_path,)])
285
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa")
236
288
class TestFileKinds(TestCaseForGenericProcessor):