def get_review_request_id(commit_message, server_url, commit_id=None, repository=None):
 regex = (settings.HOSTINGSVCS_HOOK_REGEX % {u'server_url': server_url})
 pattern = re.compile(regex, settings.HOSTINGSVCS_HOOK_REGEX_FLAGS)
 match = pattern.search(commit_message)
 if match:
  try:
   review_request_id = int(match.group(u'id'))
  except ValueError:
   logging.error(u'The review request ID must be an integer.')
   review_request_id = None
 elif commit_id:
  assert repository
  try:
   review_request = ReviewRequest.objects.get(commit_id=six.text_type(commit_id), repository=repository)
   review_request_id = review_request.display_id
  except ReviewRequest.DoesNotExist:
   review_request_id = None
 return review_request_id

def get_review_request_id ( commit_message , server_url , commit_id = None , repository = None ) : regex = ( settings . HOSTINGSVCS_HOOK_REGEX % { u'server_url' : server_url } ) pattern = re . compile ( regex , settings . HOSTINGSVCS_HOOK_REGEX_FLAGS ) match = pattern . search ( commit_message ) if match : try : review_request_id = int ( match . group ( u'id' ) ) except ValueError : logging . error ( u'The review request ID must be an integer.' ) review_request_id = None elif commit_id : assert repository try : review_request = ReviewRequest . objects . get ( commit_id = six . text_type ( commit_id ) , repository = repository ) review_request_id = review_request . display_id except ReviewRequest . DoesNotExist : review_request_id = None return review_request_id
returns the review request id matching the pushed commit .