# Cross-platform Mercurial settings

I have project files in Dropbox, VC-ed with Mercurial. This way I can work on the same code in Windows at work and in Linux at home. The central repository is on our institute Samba file server, which I have mounted in Linux (as /mnt/server/) and in Windows (as a network drive Z:). Now, Mercurial stores the location of the central repo (for push/pull) in .hg/hgrc. And the path there is, of course, either the Linux or the Windows one. As a result, I should always edit the file or pull/push only in one OS.

Is there a better practice/way to go? I wouldn't like having two branches for two operating systems since I already have a few branches according to what I am working on.

-
Why do you need Dropbox and Mercurial? –  sblair Oct 19 '11 at 10:16
@sblair - i think he's using dropbox as a repo sync. service between home/work. –  ldigas Oct 19 '11 at 10:22
@sblair: Exactly. Plus to sync between OSes. At work, I have both Windows and Linux. I want to be able to work on the same files in both OSes. Dropbox does that. I don't want two different branches for two different OSes because branches should be created according to tasks, not according to where I access those tasks. –  texnic Oct 25 '11 at 7:39
you can have one VCS (mercurial) and one codebase on any amount of OSes and workplaces -just use external repo (private Bitbucket, f.e) and perform pull-push cycle with it –  Lazy Badger Oct 26 '11 at 0:44

If you only have one project with one path to the repository then you can move the [paths] section out of .hg/hgrc and put it instead in the per-user config file on each computer, \$HOME/.hgrc on Unix and %HOME%\.hgrc on Windows.

Another option is to put both Unix and Windows aliases into the [paths] section:

[paths]
win = z:\path\to\repo
unix = /mnt/server/path/to/repo


And then specify the alias when pushing/pulling:

hg push win
hg push unix

hg pull win
hg pull unix

-
The first option doesn't work for me: I have more than one project under version control. However the second one looks just like what I need. However to make it work I need to specify this alias in TortoiseHg. Do you think it's possible? I couldn't find the way. –  texnic Oct 25 '11 at 7:46
Aliases can be managed nicely from the Synchronize view (there's a button on the toolbar or just choose menu View-->Synchronize). (I'm using TortoiseHg 2.1.3). You use the same view to sync to/from a selected alias. –  Dave Hartnoll Oct 25 '11 at 16:38

Is there a better practice/way to go?

Yes.

Idea 1 Use ssh:// or http:// protocol instead of file://, where FQDNs of remote repo are the same

Idea 2 Just pull/push ftom/to work/home repo (and don't use Dropbox for repo syncs)

-
SSH and HTTP seems to be a good solution. I should check with our admin if our server provides this option. –  texnic Oct 25 '11 at 8:01