How to use the gita.utils.Color.green function in gita

To help you get started, we’ve selected a few gita examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nosarthur / gita / gita / utils.py View on Github external
def _get_branch_color() -> str:
    """
    Return terminal color string for a repo
    """
    diff_returncode = run_quiet_diff(['@{u}', '@{0}'])
    has_no_remote = diff_returncode == 128
    has_no_diff = diff_returncode == 0
    if has_no_remote:
        return Color.white
    elif has_no_diff:
        return Color.green
    else:
        common_commit = get_common_commit()
        outdated = run_quiet_diff(['@{u}', common_commit])
        if outdated:
            diverged = run_quiet_diff(['@{0}', common_commit])
            return Color.red if diverged else Color.yellow
        else:  # local is ahead of remote
            return Color.purple