#NEWLINE# def run_git_log( git_dir = None ) : #NEWLINE# #INDENT# 'run_git_log([git_dir]) -> File\n\n    Run `git log --numstat --pretty=raw` on the specified\n    git repository and return its stdout as a pseudo-File.' #NEWLINE# import subprocess #NEWLINE# if git_dir : #NEWLINE# #INDENT# command = [ 'git' , ( '--git-dir=' + command ) , 'log' , '--numstat' , '--pretty=raw' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# command = [ 'git' , 'log' , '--numstat' , '--pretty=raw' ] #NEWLINE# #UNINDENT# raw_git_log = subprocess . Popen ( command , stdout = subprocess . PIPE ) #NEWLINE# if ( sys . version_info < ( 3 , 0 ) ) : #NEWLINE# #INDENT# return raw_git_log . stdout #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return raw_git_log . stdout . read ( ) . decode ( 'utf-8' , 'ignore' )