# Path: gg/utils.py
# def error_out(msg, raise_abort=True):
#     click.echo(click.style(msg, fg="red"))
#     if raise_abort:
#         raise click.Abort
# 
# def info_out(msg):
#     click.echo(msg)
# 
# def success_out(msg):
#     click.echo(click.style(msg, fg="green"))
# 
# Path: gg/state.py
# def read(configfile):
#     with open(configfile, "r") as f:
#         return json.load(f)
# 
# Path: gg/main.py
# DEFAULT_CONFIGFILE = os.path.expanduser("~/.gg.json")
# class Config:
#     def __init__(self):
# def cli(config, configfile, verbose):


from gg.utils import error_out, info_out, success_out
from gg.state import read
from gg.main import cli, pass_config


@cli.command()
@pass_config
def merge(config):
    """Merge the current branch into $default_branch."""
    repo = config.repo

    state = read(config.configfile)
    default_branch = state.get("DEFAULT_BRANCH", "master")

    active_branch = repo.active_branch
    if active_branch.name == default_branch:
        error_out(f"You're already on the {default_branch} branch.")

    if repo.is_dirty():

# Path: gg/utils.py
# def error_out(msg, raise_abort=True):
#     click.echo(click.style(msg, fg="red"))
#     if raise_abort:
#         raise click.Abort
# 
# def info_out(msg):
#     click.echo(msg)
# 
# def success_out(msg):
#     click.echo(click.style(msg, fg="green"))
# 
# Path: gg/state.py
# def read(configfile):
#     with open(configfile, "r") as f:
#         return json.load(f)
# 
# Path: gg/main.py
# DEFAULT_CONFIGFILE = os.path.expanduser("~/.gg.json")
# class Config:
#     def __init__(self):
# def cli(config, configfile, verbose):


# Path: gg/builtins/merge/gg_merge.py
from gg.utils import error_out, info_out, success_out
from gg.state import read
from gg.main import cli, pass_config



@cli.command()
@pass_config
def merge(config):
    """Merge the current branch into $default_branch."""
    repo = config.repo

    state = read(config.configfile)
    default_branch = state.get("DEFAULT_BRANCH", "master")

    active_branch = repo.active_branch
    if active_branch.name == default_branch:
        error_out(f"You're already on the {default_branch} branch.")

    if repo.is_dirty():

        error_out(