184
return dict([(self.generate_file_id(path), mode) for (path, mode) in bencode.bdecode(file_modes.encode("utf-8"))])
184
return dict(bencode.bdecode(file_modes.encode("utf-8")))
186
186
def _generate_git_svn_metadata(self, rev, encoding):
602
602
return object_mode(entry.kind, entry.executable)
605
def directory_to_tree(children, lookup_ie_sha1, unusual_modes, empty_file_name,
607
"""Create a Git Tree object from a Bazaar directory.
609
:param children: Children inventory entries
610
:param lookup_ie_sha1: Lookup the Git SHA1 for a inventory entry
611
:param unusual_modes: Dictionary with unusual file modes by file ids
612
:param empty_file_name: Name to use for dummy files in empty directories,
613
None to ignore empty directories.
615
from dulwich.objects import Blob, Tree
617
for name, value in children.iteritems():
620
mode = unusual_modes[ie.file_id]
622
mode = entry_mode(ie)
623
hexsha = lookup_ie_sha1(ie)
624
if hexsha is not None:
625
tree.add(name.encode("utf-8"), mode, hexsha)
626
if not allow_empty and len(tree) == 0:
627
# Only the root can be an empty tree
628
if empty_file_name is not None:
629
tree.add(empty_file_name, stat.S_IFREG | 0644, Blob().id)
635
605
def extract_unusual_modes(rev):
637
607
foreign_revid, mapping = mapping_registry.parse_revision_id(