#NEWLINE# def traverse_trees_recursive( odb , tree_shas , path_prefix ) : #NEWLINE# #INDENT# "\n    :return: list with entries according to the given binary tree-shas.\n        The result is encoded in a list\n        of n tuple|None per blob/commit, (n == len(tree_shas)), where\n        * [0] == 20 byte sha\n        * [1] == mode as int\n        * [2] == path relative to working tree root\n        The entry tuple is None if the respective blob/commit did not\n        exist in the given tree.\n    :param tree_shas: iterable of shas pointing to trees. All trees must\n        be on the same level. A tree-sha may be None in which case None\n    :param path_prefix: a prefix to be added to the returned paths on this level,\n        set it '' for the first iteration\n    :note: The ordering of the returned items will be partially lost" #NEWLINE# trees_data = list ( ) #NEWLINE# nt = len ( tree_shas ) #NEWLINE# for tree_sha in tree_shas : #NEWLINE# #INDENT# if ( tree_sha is None ) : #NEWLINE# #INDENT# data = list ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data = tree_entries_from_data ( odb . stream ( tree_sha ) . read ( ) ) #NEWLINE# #UNINDENT# trees_data . append ( data ) #NEWLINE# #UNINDENT# out = list ( ) #NEWLINE# out_append = out . append #NEWLINE# for ( ti , tree_data ) in enumerate ( trees_data ) : #NEWLINE# #INDENT# for ( ii , item ) in enumerate ( tree_data ) : #NEWLINE# #INDENT# if ( not item ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# entries = [ None for n in range ( nt ) ] #NEWLINE# entries [ ti ] = item #NEWLINE# ( sha , mode , name ) = item #NEWLINE# is_dir = S_ISDIR ( mode ) #NEWLINE# for tio in range ( ( ti + 1 ) , ( ti + nt ) ) : #NEWLINE# #INDENT# tio = ( tio % nt ) #NEWLINE# entries [ tio ] = _find_by_name ( trees_data [ tio ] , name , is_dir , ii ) #NEWLINE# #UNINDENT# if is_dir : #NEWLINE# #INDENT# out . extend ( traverse_trees_recursive ( odb , [ ( ( ei and ei [ 0 ] ) or None ) for ei in entries ] , ( ( path_prefix + name ) + '/' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out_append ( tuple ( ( _to_full_path ( e , path_prefix ) for e in entries ) ) ) #NEWLINE# #UNINDENT# tree_data [ ii ] = None #NEWLINE# #UNINDENT# del tree_data [ : ] #NEWLINE# #UNINDENT# return out