def parse_commits(head, name):
 for commit in head.traverse():
  (yield {'_id': commit.hexsha, '_parent': name, 'committed_date': datetime.fromtimestamp(commit.committed_date), 'committer': {'name': commit.committer.name, 'email': commit.committer.email}, 'authored_date': datetime.fromtimestamp(commit.authored_date), 'author': {'name': commit.author.name, 'email': commit.author.email}, 'description': commit.message, 'parent_shas': [p.hexsha for p in commit.parents], 'files': list(commit.stats.files), 'stats': commit.stats.total})

def parse_commits ( head , name ) : for commit in head . traverse ( ) : ( yield { '_id' : commit . hexsha , '_parent' : name , 'committed_date' : datetime . fromtimestamp ( commit . committed_date ) , 'committer' : { 'name' : commit . committer . name , 'email' : commit . committer . email } , 'authored_date' : datetime . fromtimestamp ( commit . authored_date ) , 'author' : { 'name' : commit . author . name , 'email' : commit . author . email } , 'description' : commit . message , 'parent_shas' : [ p . hexsha for p in commit . parents ] , 'files' : list ( commit . stats . files ) , 'stats' : commit . stats . total } )
go through the git repository log and generate a document per commit containing all the metadata .