开发者

Mercurial: where to put the "style file" so it can (easily) be used on all my projects

开发者 https://www.devze.com 2023-02-12 13:57 出处:网络
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\"

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


You can also stick it in Mercurial's template directory (C:\program files\mercurial\templates or c:\program files\tortoisehg\templates if using tortoisehg, or /usr/share/mercurial/templates on Ubuntu) to make it available system-wide.

0

精彩评论

暂无评论...
验证码 换一张
取 消