How to prevent Mercurial commit / block certain files?

At the time of our development process, we send all * .resx files to the translator. A translator usually takes a week to send files back. During this time, no one can add, delete or update any resx file.

How can I configure mercurial to enforce this policy?

Our setup: each developer works with a local clone of our central repository.

Nice to have:

  • I will enable and disable the "policy" every few weeks. Therefore, ideally, I would like something that is easy to set up in one place and affect all developers.

  • I prefer to apply this policy at the local repository level, and then at the central repository level, because if we prevent push in the central repository, it will be more difficult for the developer to cancel the locally revisions.

thanks


UPDATE:

Additional information about the translation process:

Merging is not a problem here. The translator does not change the files that we sent him. We send him a bunch of neutral .resx languages ​​(form1.resx) and return a bunch of resx-specific languages ​​(form1.FR.resx).

Why not add a new resx? Adding resx occurs when we add a new user interface to our application. If we do this after sending the translation package, the translator will not know about the new user interface, and we will get a new interface without translation.

Why prevent resx update? If dev changes the label value from "open" to "close", he made a very important semantic change. If he does this after sending the translation package, we will not receive the correct translation.

+4
source share
2 answers

You cannot stop people from making changes to .resx files if you do not have control over their desktop computers (using the pretxncommit hook), and even then it will easily pretxncommit . It is much more normal to put the check on the central server at the time of push using pretxnchangegroup , but you are right that they will have to fix any changes and re-click, which is an extended use. In any case, you used AclExtension to enforce the actual constraint.

Here are two alternative ways to solve this problem that might be better for you:

  • Cloning your repository at the beginning of the translation process, let developers leave some time for .resx, apply the work of translators when they are complete, and then merge these changes back into the main development repository using the merge command, which always gives priority to incoming changes : X. Then use the simple hg log command to find all the changes to the .resx that have just been overwritten, and ask the developers to add them again. Cut them off at this time.

alternately

  • Make .resx Subrepository files of a larger external repository. Then disable write access to this resx repository for the forbidden period. Developers will be able to commit in the external repository, but not in the internal, but the clones will still get what they always did.

For what it's worth, everyone else handles this problem with a simple merge, the .resx text is (XML), and it just merges.

When working with DVCS, it is not always easy to accurately reflect your svn experience, but usually there is a better option.

+4
source

You can add * .resx to the hgignore file

0
source

Source: https://habr.com/ru/post/1343333/


All Articles