Rev 1503: Add tests for newlines in symlink targets. (marked KnownFailure atm because it breaks bzr) in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Mon Jul 28 23:56:43 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1503
revision-id: jelmer at samba.org-20080728225642-51rt81xv71qb9thf
parent: jelmer at samba.org-20080728225552-35dhtyq5oiycxj4f
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-07-29 00:56:42 +0200
message:
Add tests for newlines in symlink targets. (marked KnownFailure atm because it breaks bzr)
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
tests/test_fetch.py test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
=== modified file 'fetch.py'
--- a/fetch.py 2008-07-23 19:35:24 +0000
+++ b/fetch.py 2008-07-28 22:56:42 +0000
@@ -415,7 +415,7 @@
if self.is_symlink:
ie = self.editor.inventory.add_path(self.path, 'symlink', self.file_id)
- ie.symlink_target = lines[0][len("link "):]
+ ie.symlink_target = "".join(lines)[len("link "):]
ie.text_sha1 = None
ie.text_size = None
ie.executable = False
=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py 2008-07-15 14:06:23 +0000
+++ b/tests/test_fetch.py 2008-07-28 22:56:42 +0000
@@ -1637,6 +1637,31 @@
self.assertEqual('symlink', inv1[inv1.path2id("mylink")].kind)
self.assertEqual('bla', inv1[inv1.path2id("mylink")].symlink_target)
+ def test_fetch_symlink_with_newlines(self):
+ if not has_symlinks():
+ return
+ raise KnownFailure("Bazaar doesn't support newlines in symlink targets")
+ repos_url = self.make_repository('d')
+
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("bla").modify("data")
+ l = dc.add_file("mylink")
+ l.modify("link bla\nbar\nbla")
+ l.change_prop("svn:special", "*")
+ dc.close()
+
+ oldrepos = Repository.open("svn+"+repos_url)
+ dir = BzrDir.create("f", format.get_rich_root_format())
+ newrepos = dir.create_repository()
+ oldrepos.copy_content_into(newrepos)
+ mapping = oldrepos.get_mapping()
+ self.assertTrue(newrepos.has_revision(
+ oldrepos.generate_revision_id(1, "", mapping)))
+ inv1 = newrepos.get_inventory(
+ oldrepos.generate_revision_id(1, "", mapping))
+ self.assertEqual('symlink', inv1[inv1.path2id("mylink")].kind)
+ self.assertEqual('bla\nbar\nbla', inv1[inv1.path2id("mylink")].symlink_target)
+
def test_fetch_special_non_symlink(self):
repos_url = self.make_repository('d')
=== modified file 'tests/test_tree.py'
--- a/tests/test_tree.py 2008-07-08 19:09:33 +0000
+++ b/tests/test_tree.py 2008-07-28 22:56:42 +0000
@@ -72,6 +72,22 @@
self.assertEqual("target",
tree.inventory[tree.inventory.path2id("file")].symlink_target)
+ def test_symlink_with_newlines_in_target(self):
+ repos_url = self.make_client("d", "dc")
+
+ dc = self.get_commit_editor(repos_url)
+ file = dc.add_file("file")
+ file.modify("link target\nbar\nbla")
+ file.change_prop("svn:special", "*")
+ dc.close()
+
+ self.client_update("dc")
+ tree = SvnBasisTree(self.open_checkout("dc"))
+ self.assertEqual('symlink',
+ tree.inventory[tree.inventory.path2id("file")].kind)
+ self.assertEqual("target\nbar\nbla",
+ tree.inventory[tree.inventory.path2id("file")].symlink_target)
+
def test_symlink_not_special(self):
repos_url = self.make_client("d", "dc")
More information about the bazaar-commits
mailing list