def parse_ls_tree(rev):
 output = []
 lines = git.ls_tree(rev, r=True)[STDOUT].splitlines()
 regex = re.compile(u'^(\\d+)\\W(\\w+)\\W(\\w+)[ \\t]+(.*)$')
 for line in lines:
  match = regex.match(line)
  if match:
   mode = match.group(1)
   objtype = match.group(2)
   oid = match.group(3)
   filename = match.group(4)
   output.append((mode, objtype, oid, filename))
 return output

def parse_ls_tree ( rev ) : output = [ ] lines = git . ls_tree ( rev , r = True ) [ STDOUT ] . splitlines ( ) regex = re . compile ( u'^(\\d+)\\W(\\w+)\\W(\\w+)[ \\t]+(.*)$' ) for line in lines : match = regex . match ( line ) if match : mode = match . group ( 1 ) objtype = match . group ( 2 ) oid = match . group ( 3 ) filename = match . group ( 4 ) output . append ( ( mode , objtype , oid , filename ) ) return output
return a list of tuples .