#NEWLINE# def run( self , vcs_revision , project , search_limit = 10 ) : #NEWLINE# #INDENT# '\n        Get build number for a SHA in project.\n        ' #NEWLINE# path = ( 'project/' + project ) #NEWLINE# response = self . _perform_request ( path , method = 'GET' , extra_headers = { #NEWLINE# #INDENT# 'limit' : int ( search_limit ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( response . status_code != httplib . OK ) : #NEWLINE# #INDENT# raise Exception ( ( 'Project %s not found.' % project ) ) #NEWLINE# #UNINDENT# for build in response . json ( ) : #NEWLINE# #INDENT# if ( build [ 'vcs_revision' ] == vcs_revision ) : #NEWLINE# #INDENT# build_num = build . get ( 'build_num' , None ) #NEWLINE# if ( not build_num ) : #NEWLINE# #INDENT# raise Exception ( 'API must have changed. build_num not found.' ) #NEWLINE# #UNINDENT# return build_num