def bundle1allowed(repo, action):
    """Whether a bundle1 operation is allowed from the server.

    Priority is:

    1. server.bundle1gd.<action> (if generaldelta active)
    2. server.bundle1.<action>
    3. server.bundle1gd (if generaldelta active)
    4. server.bundle1
    """
    ui = repo.ui
    gd = b'generaldelta' in repo.requirements
    if gd:
        v = ui.configbool(b'server', b'bundle1gd.%s' % action)
        if v is not None:
            return v
    v = ui.configbool(b'server', b'bundle1.%s' % action)
    if v is not None:
        return v
    if gd:
        v = ui.configbool(b'server', b'bundle1gd')
        if v is not None:
            return v
    return ui.configbool(b'server', b'bundle1')
