103
103
assert revision_lines == ['']
105
105
def get_inventory(self, tree_id):
106
for line in self.cat_file('tree', tree_id, True):
107
sections = line.split(' ', 2)
108
obj_id, name = sections[2].split('\t', 1)
109
name = name.rstrip('\n')
106
for line in self.git_lines('ls-tree', ['-r', '-t', tree_id]):
107
# Ideally, we would use -z so we would not have to handle escaped
108
# file names. But then we could not use readlines() to split the
109
# data as it is read.
110
permissions, type, hash_and_path = line.split(' ', 2)
111
hash, name = hash_and_path.split('\t', 1)
112
name = name[:-1] # strip trailing newline
110
113
if name.startswith('"'):
111
name = name[1:-1].decode('string_escape').decode('utf-8')
112
yield (sections[0], sections[1], obj_id, name)
114
name = name[1:-1].decode('string_escape')
115
name = name.decode('utf-8')
116
yield permissions, type, hash, name