115
115
builder.set_file('executable', 'content', True)
116
116
builder.set_link('link', 'broken')
117
117
builder.set_file('subdir/subfile', 'subdir text\n', False)
118
commit_handle = builder.commit('Joe Foo <joe@foo.com>', u'message')
118
commit_handle = builder.commit('Joe Foo <joe@foo.com>', u'message',
119
timestamp=1205433193)
119
120
mapping = builder.finish()
120
121
commit_id = mapping[commit_handle]
124
125
repo = repository.Repository.open('.')
125
126
inv = repo.get_inventory(revid)
126
127
self.assertIsInstance(inv, inventory.Inventory)
127
entries = list(inv.iter_entries())
128
128
printed_inv = '\n'.join(
129
129
repr((path, entry.executable, entry))
130
130
for path, entry in inv.iter_entries())
131
131
self.assertEqualDiff(
133
133
"('', False, InventoryDirectory('TREE_ROOT', u'', parent_id=None,"
134
" revision='git-experimental-r:69c39cfa65962f3cf16b9b3eb08a15954e9d8590'))\n"
135
135
"(u'data', False, InventoryFile('data', u'data',"
136
136
" parent_id='TREE_ROOT',"
137
" sha1='8e27be7d6154a1f68ea9160ef0e18691d20560dc', len=None))\n"
137
" sha1='aa785adca3fcdfe1884ae840e13c6d294a2414e8', len=5))\n"
138
138
"(u'executable', True, InventoryFile('executable', u'executable',"
139
139
" parent_id='TREE_ROOT',"
140
" sha1='6b584e8ece562ebffc15d38808cd6b98fc3d97ea', len=None))\n"
140
" sha1='040f06fd774092478d450774f5ba30c5da78acc8', len=7))\n"
141
141
"(u'link', False, InventoryLink('link', u'link',"
142
" parent_id='TREE_ROOT', revision=None))\n"
142
" parent_id='TREE_ROOT', revision='git-experimental-r:69c39cfa65962f3cf16b9b3eb08a15954e9d8590'))\n"
143
143
"(u'subdir', False, InventoryDirectory('subdir', u'subdir',"
144
" parent_id='TREE_ROOT', revision=None))\n"
144
" parent_id='TREE_ROOT', revision='git-experimental-r:69c39cfa65962f3cf16b9b3eb08a15954e9d8590'))\n"
145
145
"(u'subdir/subfile', False, InventoryFile('subdir/subfile',"
146
146
" u'subfile', parent_id='subdir',"
147
" sha1='0ddb53cbe2dd209f550dd8d7f1287a5ed9b1ee8b', len=None))")
147
" sha1='67b75c3e49f31fcadddbf9df6a1d8be8c3e44290', len=12))")
150
150
class MemoryGitRepository(git_repository.GitRepository):
167
167
_gitdir_class = MemoryGitDir
170
class TestGitRepository(tests.TestCaseWithMemoryTransport):
170
class TestGitRepository(tests.TestCaseWithTransport):
173
tests.TestCaseWithMemoryTransport.setUp(self)
173
tests.TestCaseWithTransport.setUp(self)
174
174
self.transport = self.get_transport()
175
175
self.transport.mkdir('.git')
176
176
self.git_dir = MemoryGitBzrDirFormat().open(self.transport)
217
rev.revision_id, 'git1r-873a8ae0d682b0e63e9795bc53056d32ed3de93f')
216
self.assertEqual(rev.revision_id,
217
'git-experimental-r:873a8ae0d682b0e63e9795bc53056d32ed3de93f')
218
218
self.assertEqual(rev.parent_ids, [])
219
219
self.assertEqual(rev.committer, 'Joe Foo <joe@foo.com>')
220
220
self.assertEqual(repr(rev.timestamp), '1198784532.0')
244
244
# commit base, the following parents are the ordered merged revisions.
245
245
self.assertEqual(
247
['git1r-263ed20f0d4898be994404ca418bafe8e89abb8a',
248
'git1r-546563eb8f3e94a557f3bb779b6e5a2bd9658752',
249
'git1r-3116d42db7b5c5e69e58f651721e179791479c23'])
247
['git-experimental-r:263ed20f0d4898be994404ca418bafe8e89abb8a',
248
'git-experimental-r:546563eb8f3e94a557f3bb779b6e5a2bd9658752',
249
'git-experimental-r:3116d42db7b5c5e69e58f651721e179791479c23'])
251
251
def test_redundant_spaces(self):
252
252
# Redundant spaces in author and committer are preserved.