简体   繁体   中英

Enforcing hg settings on all users of a mercurial repository

Is there any way to centrally manage mercurial settings for all users of a repository? Are there additional [existing] tools, add-ons, extensions, etc for this?

My use case

We have a repository that includes a few Excel, Word etc files that constantly cause trouble with merging.

With [merge-patterns] entries a la **.doc = internal:fail I can specify the intended behaviour, but I have to set this up for each and every user.

I want this to propagate automatically to anyone who clones the repository.

Environment

We use Kiln 2.6 hosted on our own Windows Server and TortoiseHg 2.2 on our Windows clients.

As far as I know, this possibility doesn't exists in Mercurial and I'm not aware of any extension which let you clone the .hgrc along with the other files.

However, you can do some things to "ease" the process of setup for each user.

Provide a template hgrc in the repository

You can add a "template" .hgrc in the repository. When a user clone the repo, the only thing he as to do is move the template to the right place.

Change the system wide hgrc

If you have some kind of Configuration management system for your clients, you can set the system wide configuration file for each of your users. There's various way of doing it. From the documentation :

(Windows) <install-dir>\\Mercurial.ini or
(Windows) <install-dir>\\hgrc.d\\*.rc or
(Windows) HKEY_LOCAL_MACHINE\\SOFTWARE\\Mercurial

Per-installation/system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Registry keys contain PATH-like strings, every part of which must reference a Mercurial.ini file or be a directory where *.rc files will be read. Mercurial checks each of these locations in the specified order until one or more configuration files are detected. If the pywin32 extensions are not installed, Mercurial will only look for site-wide configuration in C:\\Mercurial\\Mercurial.ini .

But obviously this depends on the way your clients are set up, so you will have to find the solution yourself. For example you can:

  1. Set these files on the computer installation
  2. Provide an executable which configure this that every user must run
  3. Configure your in-house configuration management system to set up this on the next computer start
  4. Change the roaming user profile if they have one.

You can use the projrc extension to push a project configuration file to others. It requires that the clients enable the extension first and that they fully trusts the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM