With Mercurial: how to record various source code changes on a computer

I use Mercurial on two different computers changing the same repository. If I want to save the tabs, what changes have occurred on which machine, how should I write this?

I came up with using different usernames on two machines (the [ui] --> username variable in the hg configuration file), but is there a more suitable mechanism / variable for this?

+6
source share
2 answers

For several years, you can extend shell variables inside .hg/hgrc .

So I just do something like this in my .bash_profile :

export HGUSER = $ (host name)

Then inside .hg/hgrc :

username = $ {HGUSER}

The BIG ADVANTAGE of this method is that now you can put EXACTLY THE .hg/hgrc on ALL machines. The same goes for .bash_profile : it can be the same on all machines. This helps when you automate the configuration of the machine!

Note: the HGUSER environment HGUSER is an old way of telling Mercurial about your username, so technically setting HGUSER to .bash_profile should solve the problem yourself, but I think its use is deprecated / not recommended, and I recommend defining username in .hg/hgrc explicitly as shown above.

+2
source

It looks good; usernames must accurately identify the committer, here is the computer. An alternative would be to work on different branches on each computer and often merge with default. However, the latter is more error prone.

+6
source

All Articles