Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

Mercurial: Collaborating on a Windows Network Using Shares

πŸ“… 2010-Aug-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ mercurial, repository ⬩ πŸ“š Archive

You might feel the need to publish Mercurial repositories in a central location and collaborate using that. This is really useful when:

Publishing a Mercurial repository in a central location enables different people or computers to push and pull from it. There are a few common ways to do this:

Β 
  1. Designate one computer as the central repository server. Let us call it A. It can be the workstation of the one of the team members, it does not really matter. Other computers, B and C, should be in the same Windows network as A.

  2. Create a directory on A, say D:\HgReps and move all your current repositories to it. New repositories in the future should also be created here.

  3. Share the directory on A, so it becomes \\A\HgReps. Give only the team members who use A, B and C access to read and write to this share. You could also give read access to other users who you wish only pull from A. These access permissions should be very easy to configure if you are in a well set up Windows domain.

  4. Point all the current working directories on A, B and C to push and pull from \\A\HgReps. To do this, open the .hg/hgrc file in each working directory and edit it so it points to A. For a project named Foobar, the .hg/hgrc file looks like:

[paths]
default = \\A\HgReps\Foobar

All this setup is ridiculously easy to do for a small team and everything just works without much configuration. Another nice side-effect is that you can backup the D:\HgReps on computer A easily and grab all the team’s commits.


Β© 2022 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 @codeyarns@hachyderm.io β€’ πŸ“§