#NEWLINE# @ require_http_methods ( [ 'GET' ] ) #NEWLINE# @ require_access #NEWLINE# @ require_existing_repo #NEWLINE# @ require_ajax #NEWLINE# def commits_stats( request , username , repository ) : #NEWLINE# #INDENT# '\n        Returns number of commits for the given repository.\n    ' #NEWLINE# repo = Repo ( Repo . get_repository_location ( request , repository ) ) #NEWLINE# stats = GitStatistics ( repo , repo . get_head ( ) ) #NEWLINE# return HttpResponse ( json . dumps ( { #NEWLINE# #INDENT# 'weekly' : stats . for_commits ( weekly , js ) , #NEWLINE# 'monthly' : stats . for_commits ( monthly , js ) , #NEWLINE# #UNINDENT# } ) )