14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from bzrlib.inventory import (
17
22
from dulwich.objects import (
21
28
from bzrlib.plugins.git import tests
22
29
from bzrlib.plugins.git.mapping import (
25
33
revision_to_commit,
122
130
c.author = "Author <author>"
123
131
self.assertRoundtripCommit(c)
134
class DirectoryToTreeTests(tests.TestCase):
136
def test_empty(self):
137
ie = InventoryDirectory('foo', 'foo', 'foo')
138
t = directory_to_tree(ie, None, {})
139
self.assertEquals(Tree(), t)
141
def test_empty_dir(self):
142
ie = InventoryDirectory('foo', 'foo', 'foo')
143
child_ie = InventoryDirectory('bar', 'bar', 'bar')
144
ie.children['bar'] = child_ie
145
t = directory_to_tree(ie, lambda x: Tree().id, {})
146
self.assertEquals(Tree(), t)
148
def test_with_file(self):
149
ie = InventoryDirectory('foo', 'foo', 'foo')
150
child_ie = InventoryFile('bar', 'bar', 'bar')
151
ie.children['bar'] = child_ie
152
b = Blob.from_string("bla")
153
t1 = directory_to_tree(ie, lambda x: b.id, {})
155
t2.add(0100644, "bar", b.id)
156
self.assertEquals(t1, t2)