def build_format_args(cfg, repo_info, next_custom=None):
    in_next = repo_info['count'] > 0
    has_next_custom = next_custom is not None and len(next_custom) > 0

    vmaj = repo_info['maj']
    vmin = repo_info['min']
    vpatch = repo_info['patch']
    vrev = repo_info['rev']
    vcount = repo_info['count']
    vpr = repo_info['pr']
    vbuildid = repo_info['build-id']
    has_pr = vpr is not None
    has_rev = vrev is not None

    # pre-release metadata in a tag has precedence over user-specified
    # NEXT strings
    if in_next and has_next_custom and not has_pr:
        u = parse_user_next_stable(next_custom)
        if not u:
            term.err("Invalid custom NEXT version numbers detected!")
            sys.exit(1)
        vmaj = u['maj']
        vmin = u['min']
        vpatch = u['patch']
        vrev = u['revision']
        has_rev = vrev is not None

    meta_pr = vpr if has_pr else \
        cfg['default_meta_pr_in_next'] if in_next and has_next_custom else \
        cfg['default_meta_pr_in_next_no_next'] if in_next else ''

    args = {
        'maj': vmaj,
        'min': vmin,
        'patch': vpatch,
        'rev': vrev if has_rev else '',
        'rev_prefix': '.' if has_rev else '',
        'meta_pr': meta_pr,
        'meta_pr_prefix': cfg['meta_pr_prefix'] if len(meta_pr) > 0 else '',
        'commit_count': vcount if vcount > 0 else '',
        'commit_count_prefix': cfg['commit_count_prefix'] if vcount > 0 else '',
        'build_id': vbuildid,
        'build_id_full': repo_info['full-build-id']
    }

    return args
Builds the formatting arguments by processing the specified repository
dataset/ETHPy150Open manuelbua/gitver/gitver/commands.py/build_format_args