Mercurial: where to put the & ldquo; style file & rdquo; so that it can (easily) be used on all my projects

advertisements

Just learning about mercurial's --style and --template options that can be used on hg log and hg tip and I find them to be extremely helpful, but I can't figure out where to put my "style files"

I have a "style file" which will allow me to do a hg tip --style ./my-style — and it works great. Except that I don't want this style file to be a file under my project. And I want to be able to use it on all my projects. I don't want it to be the default style (so it isn't an option to update .hgrc's style field).

Where should I put this file? Do I just need to put in in my home directory and refer to it like hg tip --style ~/my-style?

Not sure if you need to know, but although I use Windows at times, I mostly use Linux.


It doesn't really matter where you put it. I usually organize my hg-related files in a single directory in my home directory which I call ~/.hgstuff. I have an hgignore and some other common settings files in there.

You can also use the [alias] section to define aliases which will automatically apply your style file. Eg:

[alias]
stip = tip --style ~/.hgstuff/my-style

Then you just need to run hg stip to get your stylized version.

If you want to use the style for every command, you can set it in the [ui] section:

[ui]
style = ~/.hgstuff/my-style