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(None, 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: None, {})
146
self.assertEquals(None, t)
148
def test_empty_root(self):
149
ie = InventoryDirectory('foo', 'foo', None)
150
child_ie = InventoryDirectory('bar', 'bar', 'bar')
151
ie.children['bar'] = child_ie
152
t = directory_to_tree(ie, lambda x: None, {})
153
self.assertEquals(Tree(), t)
155
def test_with_file(self):
156
ie = InventoryDirectory('foo', 'foo', 'foo')
157
child_ie = InventoryFile('bar', 'bar', 'bar')
158
ie.children['bar'] = child_ie
159
b = Blob.from_string("bla")
160
t1 = directory_to_tree(ie, lambda x: b.id, {})
162
t2.add(0100644, "bar", b.id)
163
self.assertEquals(t1, t2)