def afterhgrcload(ui, wdirvfs, hgvfs, requirements):
    """Perform additional actions after .hg/hgrc is loaded.

    This function is called during repository loading immediately after
    the .hg/hgrc file is loaded and before per-repo extensions are loaded.

    The function can be used to validate configs, automatically add
    options (including extensions) based on requirements, etc.
    """
    autoextensions = {b'git': [b'git'], b'largefiles': [b'largefiles'],
        b'lfs': [b'lfs']}
    for requirement, names in sorted(autoextensions.items()):
        if requirement not in requirements:
            continue
        for name in names:
            if not ui.hasconfig(b'extensions', name):
                ui.setconfig(b'extensions', name, b'', source=b'autoload')
