(hook, j, config)
return u' '.join(line)
Create a formatted line summarizing the commits in `j`.
Create a formatted line summarizing the commits in `j`.
Create a formatted line summarizing the commits in j .
def _make_summary_line(hook, j, config):
    """
    Create a formatted line summarizing the commits in `j`.
    """
    original = j['original']
    show_branch = config.get('show_branch', True)

    # Buffer for the line summary.
    line = []

    # Project name
    line.append(u'{RESET}[{BLUE}{name}{RESET}]'.format(
        name=original['repository']['name'],
        **HookService.colors
    ))

    if j['pusher']:
        line.append(u'{ORANGE}{pusher}{RESET} pushed'.format(
            pusher=j['pusher'],
            **HookService.colors
        ))

    # Commit count
    line.append(u'{GREEN}{count}{RESET} {commits}'.format(
        count=len(original['commits']),
        commits='commit' if len(original['commits']) == 1 else 'commits',
        **HookService.colors
    ))

    if show_branch and j['branch']:
        line.append(u'to {GREEN}{branch}{RESET}'.format(
            branch=j['branch'],
            **HookService.colors
        ))

    # File movement summary.
    line.append(u'[+{added}/-{removed}/\u00B1{modified}]'.format(
        added=len(j['files']['added']),
        removed=len(j['files']['removed']),
        modified=len(j['files']['modified'])
    ))

    # TODO: We can apparently build URLs to show comparisons
    #       using /compare/<lc>..<lr>, which is completely
    #       undocumented. For now build a link to the last
    #       commit in the set.
    link = u'{0}{1}commits/'.format(
        original['canon_url'],
        original['repository']['absolute_url'],
        original['commits'][-1]['node']
    )
    line.append(u'{PINK}{0}{RESET}'.format(
        BitbucketHook.shorten(link),
        **HookService.colors
    ))

    return u' '.join(line)
def _make_summary_line ( hook , j , config ) : original = j [ 'original' ] show_branch = config . get ( 'show_branch' , True ) # Buffer for the line summary. line = [ ] # Project name line . append ( u'{RESET}[{BLUE}{name}{RESET}]' . format ( name = original [ 'repository' ] [ 'name' ] , * * HookService . colors ) ) if j [ 'pusher' ] : line . append ( u'{ORANGE}{pusher}{RESET} pushed' . format ( pusher = j [ 'pusher' ] , * * HookService . colors ) ) # Commit count line . append ( u'{GREEN}{count}{RESET} {commits}' . format ( count = len ( original [ 'commits' ] ) , commits = 'commit' if len ( original [ 'commits' ] ) == 1 else 'commits' , * * HookService . colors ) ) if show_branch and j [ 'branch' ] : line . append ( u'to {GREEN}{branch}{RESET}' . format ( branch = j [ 'branch' ] , * * HookService . colors ) ) # File movement summary. line . append ( u'[+{added}/-{removed}/\u00B1{modified}]' . format ( added = len ( j [ 'files' ] [ 'added' ] ) , removed = len ( j [ 'files' ] [ 'removed' ] ) , modified = len ( j [ 'files' ] [ 'modified' ] ) ) ) # TODO: We can apparently build URLs to show comparisons #       using /compare/<lc>..<lr>, which is completely #       undocumented. For now build a link to the last #       commit in the set. link = u'{0}{1}commits/' . format ( original [ 'canon_url' ] , original [ 'repository' ] [ 'absolute_url' ] , original [ 'commits' ] [ - 1 ] [ 'node' ] ) line . append ( u'{PINK}{0}{RESET}' . format ( BitbucketHook . shorten ( link ) , * * HookService . colors ) ) return u' ' . join ( line )