Beispiel #1
0
def ensureenabled(ui):
    """make sure the extension is enabled when used as hook

    When eol is used through hooks, the extension is never formally loaded and
    enabled. This has some side effect, for example the config declaration is
    never loaded. This function ensure the extension is enabled when running
    hooks.
    """
    if "eol" in ui.uiconfig()._knownconfig:
        return
    ui.setconfig("extensions", "eol", "", source="internal")
    extensions.loadall(ui, ["eol"])
Beispiel #2
0
hgrc = open(os.environ["HGRCPATH"], "wb")
hgrc.write(b"[extensions]\n")

for ext in disabled:
    hgrc.write(ext + b"=\n")

hgrc.close()

u = uimod.ui.load()

# Some extensions may print useful warning messages when they are loaded without
# the necessary config options. Let's capture that output since it does not
# matter for this test.
u.pushbuffer(error=True)
extensions.loadall(u)
u.popbuffer()

globalshort = set()
globallong = set()
for option in commands.globalopts:
    option[0] and globalshort.add(option[0])
    option[1] and globallong.add(option[1])

for cmd, entry in commands.table.items():
    seenshort = globalshort.copy()
    seenlong = globallong.copy()
    for option in entry[1]:
        if (option[0]
                and option[0] in seenshort) or (option[1]
                                                and option[1] in seenlong):