#NEWLINE# def get_repository_by_callsign( callsign ) : #NEWLINE# #INDENT# item_id_list = db . session . query ( ItemOption . item_id ) . filter ( ( ItemOption . name == 'phabricator.callsign' ) , ( ItemOption . value == callsign ) ) #NEWLINE# repo_list = list ( Repository . query . filter ( Repository . id . in_ ( item_id_list ) , ( Repository . status == RepositoryStatus . active ) ) ) #NEWLINE# if ( len ( repo_list ) > 1 ) : #NEWLINE# #INDENT# logging . warning ( 'Multiple repositories found matching phabricator.callsign=%s' , callsign ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not repo_list ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# return repo_list [ 0 ]