Question

Mercurial's log command contains a parameter -u USER to filter the changesets such that only the changes by USER are displayed. I was wondering if there is a way to tell hg to take the username from my .hgrc.

I am aware that I can simply use an alias like the following in .hgrc:

[alias]
ulog = log -u MYUSERNAME

Unfortunately, if I want to share parts of my configuration with other people by using %include, thus they will not be able to use the alias in the intended way.

So, my question is: Is there a way to refer to other variables in a .hgrc file?

Was it helpful?

Solution

You cannot refer to other values in the .hgrc when defining a new value. However, for this particular case you're in luck: things like ~foo and $USER are expanded in aliases. This means that you can define your alias like this

[alias]
ulog = log -u $USER

This is not quite what you ask for, but if all your users are on Linux, it should work fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top