Disable extensions from the Mercurial command line

When working with Mercurial, sometimes you need to access the same repository from multiple hg installations.

For example, currently I’m working on a project on OSX, and need to access the same repo from within a Vagrant environment. In this case, my .hgrc includes


The HistEdit extension is not available by default in the version of hg in Vagrant, so every (scripted) action that uses Mercurial spews something like:

$ hg branch
*** failed to import extension histedit: No module named histedit

One solution is to use a custom hgrc, but an easier solution if you can use it is to use the command line to disable the extension:

$ hg --config extensions.histedit=! branch

In this case, setting the extension path to ! disables it entirely.

4 thoughts on “Disable extensions from the Mercurial command line”

  1. This has absolutely nothing to do with the above post, but I wanted to let you know that Green Milk is an *sublimely* beautiful synth. That tone is neck and neck with a perfectly-detuned Moog Mini in full flight, but Green Milk sounds that beautiful right out of the box (so to speak), and I love how it sounds beautiful without “cheating” – the default 0/64/127 sound is just ethereal, and you can take it in all sorts of directions. And as a bonus, the built-in chording makes it easy for us lazy monosynth dipsticks who’ve never taken a piano lesson in our lives to get certain sounds that (for us) require a lot of thought and stepping-back from the creative process to chart stuff out.

    Nothing else of substance to note – but you really, absolutely knocked it out of the park. The music world is a poorer place without you.

    1. Wow, thanks ZP! That’s a lovely thing to say. I’ve been meaning to dust off the Green Milk source – there are a couple of semi-finished changes in there but it’s been 10 years so who knows if it’ll compile!

  2. Does not work for me (I’m using two hg-installations, because I get errors for some extensions depending on the hg-version):

    env LANG=C hg –conf extensions.hgext.blackbox=! shelve
    *** failed to import extension hgext.blackbox: No module named blackbox
    abort: option –config may not be abbreviated!

    Maybe the hg version is too old and does not know about both: blackbox and –config + disable-ext?

    1. Hey Mayra, might be a silly question but is that exactly the command you’re using?

      Make sure you use two dashes, and the word “config”

      env LANG=C hg –-config extensions.hgext.blackbox=! shelve

Leave a Reply

Your email address will not be published. Required fields are marked *