How to enable Mercurial extensions (such as mq)?
Asked Answered
E

4

20

I have installed Mercurial from the Ubuntu package repository. However I don't know how to enable extensions (q* commands). How should I do that? The help shows that

enabled extensions:
style  (no help text available)

I want to enable mq and hgk.

Exert answered 2/12, 2011 at 17:52 Comment(0)
B
19

Enable extensions in hgrc.

extensions

Mercurial has an extension mechanism for adding new features. To enable an extension, create an entry for it in this section.

If you know that the extension is already in Python's search path, you can give the name of the module, followed by =, with nothing after the =.

Otherwise, give a name that you choose, followed by =, followed by the path to the .py file (including the file name extension) that defines the extension.

...

Example for ~/.hgrc:

[extensions]
# (the mq extension will get loaded from Mercurial's path)
mq =
# (this extension will get loaded from the file specified)
myfeature = ~/.hgext/myfeature.py

http://www.selenic.com/mercurial/hgrc.5.html#extensions

Bilocular answered 2/12, 2011 at 17:55 Comment(0)
V
8

You can also enable an extension without editing the hgrc, if you want to do it one off. [Source]

hg --config extensions.histedit= --help
Velodrome answered 19/1, 2016 at 20:39 Comment(0)
J
3

The documentation of both extensions shows how to enable them : MQ, Hgk.

The usual way to enable an extension is to add a line to your .hgrc (or Mercurial.ini on some Windows system). It is explained in the hgrc documentation.

In your following case, add this to your configuration file :

[extensions]
mq =
hgk=

You can put it in your global configuration file or the repository one, depending if you want to have the extensions activated in every repository or just a specific one.

Janis answered 2/12, 2011 at 18:1 Comment(0)
F
3

The output of hg help extensions starts with

Using additional features

Mercurial has the ability to add new features through the use of extensions. Extensions may add new commands, add options to existing commands, change the default behavior of commands, or implement hooks.

Extensions are not loaded by default for a variety of reasons: they can increase startup overhead; they may be meant for advanced usage only; they may provide potentially dangerous abilities (such as letting you destroy or modify history); they might not be ready for prime time; or they may alter some usual behaviors of stock Mercurial. It is thus up to the user to activate extensions as needed.

To enable the "foo" extension, either shipped with Mercurial or in the Python search path, create an entry for it in your configuration file, like this:

[extensions]
foo =

You may also specify the full path to an extension:

[extensions]
myfeature = ~/.hgext/myfeature.py

So just add

[extensions]
mq =

to enable the MQ extension.

Fiji answered 5/12, 2011 at 8:58 Comment(1)
I am using Mac, how to add mq= in the terminal screen? How to save/ exit?Polash

© 2022 - 2024 — McMap. All rights reserved.