def get_force_push_body(payload: WildValue, change: WildValue) -> str: return get_force_push_commits_event_message( get_actor_info(payload), change["links"]["html"]["href"].tame(check_string), change["new"]["name"].tame(check_string), change["new"]["target"]["hash"].tame(check_string), )
def build_message_from_gitlog( user_profile: UserProfile, name: str, ref: str, commits: List[Dict[str, str]], before: str, after: str, url: str, pusher: str, forced: Optional[str] = None, created: Optional[str] = None, deleted: Optional[bool] = False) -> Tuple[str, str]: short_ref = re.sub(r'^refs/heads/', '', ref) subject = SUBJECT_WITH_BRANCH_TEMPLATE.format(repo=name, branch=short_ref) if re.match(r'^0+$', after): content = get_remove_branch_event_message(pusher, short_ref) # 'created' and 'forced' are github flags; the second check is for beanstalk elif (forced and not created) or (forced is None and len(commits) == 0): content = get_force_push_commits_event_message(pusher, url, short_ref, after[:7]) else: commits = _transform_commits_list_to_common_format(commits) try: content = get_push_commits_event_message(pusher, url, short_ref, commits, deleted=deleted) except TypeError: # nocoverage This error condition seems to # be caused by a change in GitHub's APIs. Since we've # deprecated this webhook, just suppress them with a 40x error. raise JsonableError("Malformed commit data") return subject, content
def get_force_push_body(payload: Dict[str, Any], change: Dict[str, Any]) -> Text: return get_force_push_commits_event_message( get_user_username(payload), change['links']['html']['href'], change['new']['name'], change['new']['target']['hash'] )
def build_message_from_gitlog(user_profile, name, ref, commits, before, after, url, pusher, forced=None, created=None, deleted=False): # type: (UserProfile, Text, Text, List[Dict[str, str]], Text, Text, Text, Text, Optional[Text], Optional[Text], Optional[bool]) -> Tuple[Text, Text] short_ref = re.sub(r'^refs/heads/', '', ref) subject = SUBJECT_WITH_BRANCH_TEMPLATE.format(repo=name, branch=short_ref) if re.match(r'^0+$', after): content = get_remove_branch_event_message(pusher, short_ref) # 'created' and 'forced' are github flags; the second check is for beanstalk elif (forced and not created) or (forced is None and len(commits) == 0): content = get_force_push_commits_event_message(pusher, url, short_ref, after[:7]) else: commits = _transform_commits_list_to_common_format(commits) content = get_push_commits_event_message(pusher, url, short_ref, commits, deleted=deleted) return subject, content
def get_force_push_body(payload: Dict[str, Any], change: Dict[str, Any]) -> str: return get_force_push_commits_event_message( get_actor_info(payload), change["links"]["html"]["href"], change["new"]["name"], change["new"]["target"]["hash"], )
def get_force_push_body(payload: Dict[str, Any], change: Dict[str, Any]) -> str: return get_force_push_commits_event_message( get_actor_info(payload), change['links']['html']['href'], change['new']['name'], change['new']['target']['hash'], )
def build_message_from_gitlog(user_profile, name, ref, commits, before, after, url, pusher, forced=None, created=None): # type: (UserProfile, text_type, text_type, List[Dict[str, str]], text_type, text_type, text_type, text_type, Optional[text_type], Optional[text_type]) -> Tuple[text_type, text_type] short_ref = re.sub(r"^refs/heads/", "", ref) subject = SUBJECT_WITH_BRANCH_TEMPLATE.format(repo=name, branch=short_ref) if re.match(r"^0+$", after): content = get_remove_branch_event_message(pusher, short_ref) # 'created' and 'forced' are github flags; the second check is for beanstalk elif (forced and not created) or (forced is None and len(commits) == 0): content = get_force_push_commits_event_message(pusher, url, short_ref, after[:7]) else: commits = _transform_commits_list_to_common_format(commits) content = get_push_commits_event_message(pusher, url, short_ref, commits) return subject, content
def build_message_from_gitlog(user_profile: UserProfile, name: Text, ref: Text, commits: List[Dict[str, str]], before: Text, after: Text, url: Text, pusher: Text, forced: Optional[Text]=None, created: Optional[Text]=None, deleted: Optional[bool]=False ) -> Tuple[Text, Text]: short_ref = re.sub(r'^refs/heads/', '', ref) subject = SUBJECT_WITH_BRANCH_TEMPLATE.format(repo=name, branch=short_ref) if re.match(r'^0+$', after): content = get_remove_branch_event_message(pusher, short_ref) # 'created' and 'forced' are github flags; the second check is for beanstalk elif (forced and not created) or (forced is None and len(commits) == 0): content = get_force_push_commits_event_message(pusher, url, short_ref, after[:7]) else: commits = _transform_commits_list_to_common_format(commits) content = get_push_commits_event_message(pusher, url, short_ref, commits, deleted=deleted) return subject, content
def build_message_from_gitlog(user_profile: UserProfile, name: str, ref: str, commits: List[Dict[str, str]], before: str, after: str, url: str, pusher: str, forced: Optional[str]=None, created: Optional[str]=None, deleted: Optional[bool]=False ) -> Tuple[str, str]: short_ref = re.sub(r'^refs/heads/', '', ref) subject = TOPIC_WITH_BRANCH_TEMPLATE.format(repo=name, branch=short_ref) if re.match(r'^0+$', after): content = get_remove_branch_event_message(pusher, short_ref) # 'created' and 'forced' are github flags; the second check is for beanstalk elif (forced and not created) or (forced is None and len(commits) == 0): content = get_force_push_commits_event_message(pusher, url, short_ref, after[:7]) else: commits = _transform_commits_list_to_common_format(commits) try: content = get_push_commits_event_message(pusher, url, short_ref, commits, deleted=deleted) except TypeError: # nocoverage This error condition seems to # be caused by a change in GitHub's APIs. Since we've # deprecated this webhook, just suppress them with a 40x error. raise JsonableError( "Malformed commit data") return subject, content