##// END OF EJS Templates
fixes #591 git backend was causing encoding errors when handling binary files...
marcink -
r2894:2654edfb beta
parent child Browse files
Show More
@@ -63,10 +63,16 b' class GitInMemoryChangeset(BaseInMemoryC'
63 # If found, updates parent
63 # If found, updates parent
64 parent = self.repository._repo[dir_id]
64 parent = self.repository._repo[dir_id]
65 ancestors.append((curdir, parent))
65 ancestors.append((curdir, parent))
66 # Now parent is deepest exising tree and we need to create subtrees
66 # Now parent is deepest existing tree and we need to create subtrees
67 # for dirnames (in reverse order) [this only applies for nodes from added]
67 # for dirnames (in reverse order) [this only applies for nodes from added]
68 new_trees = []
68 new_trees = []
69 blob = objects.Blob.from_string(node.content.encode(ENCODING))
69
70 if not node.is_binary:
71 content = node.content.encode(ENCODING)
72 else:
73 content = node.content
74 blob = objects.Blob.from_string(content)
75
70 node_path = node.name.encode(ENCODING)
76 node_path = node.name.encode(ENCODING)
71 if dirnames:
77 if dirnames:
72 # If there are trees which should be created we need to build
78 # If there are trees which should be created we need to build
@@ -44,6 +44,7 b' class InMemoryChangesetTestMixin(object)'
44 FileNode('foobar2', content='Foo & bar, doubled!'),
44 FileNode('foobar2', content='Foo & bar, doubled!'),
45 FileNode('foo bar with spaces', content=''),
45 FileNode('foo bar with spaces', content=''),
46 FileNode('foo/bar/baz', content='Inside'),
46 FileNode('foo/bar/baz', content='Inside'),
47 FileNode('foo/bar/file.bin', content='\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x03\x00\xfe\xff\t\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x18\x00\x00\x00\x01\x00\x00\x00\xfe\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'),
47 ]
48 ]
48
49
49 def test_add(self):
50 def test_add(self):
General Comments 0
You need to be logged in to leave comments. Login now