Question

I am not an advanced user of Mercurial and need some recommendations on the following problem that might be typical :

  • I am using Mercurial for code sharing and version control
  • Several users will be sharing/modifying doing pull/push from/to a central repo via ssh

up to here i got it working. What i would like now is to have a mean of controlling the push of the other users, like an "allow push" function if I accept the changes.

I have some ideas but i'd like to know what are the recommendations in this case.

(Maybe raw push/pull in a branch and another branch that i control alone... but does not look nice if several users can accept push of others)

(Maybe there is an easy solution and i am complicating for nothing)

I look for something easy to set even if not perfect AND would like not to use commercial third-party tools (e.g. review board)

I read stuff about hg-review but i'm not sure it can do what i'm looking for.

Any suggestion ?

Thanks a lot,

Adrien.

Was it helpful?

Solution 2

What i would like now is to have a mean of controlling the push of the other users, like an "allow push" function if I accept the changes.

How will you know whether to accept changes? The only practical way to review changes is after somehow getting them into your (personal) repository.

If your fellow contributors are trusted team members, you can instruct them to develop and push in branches; only you are allowed to merge their contributions to the default branch (or to whichever branch you delegate as "clean").

A more robust alternative would be to have two central repositories, one that allows pushes from everyone and a second one that only you can push to: Users push to repo1; you review and push to repo2 as appropriate; users pull from repo2. Mercurial makes this easy by allowing you to define separate paths default-push and default (which would then only be used for pulling).

A third way is to pull from the contributors instead of letting them push, as @Stephen suggests. This is how repositories hosted on bitbucket work, so you could consider hosting your project there if this model appeals to you.

OTHER TIPS

I think pulling from other users is a better work flow if you are going to manually approve the incoming code. This way you remain in control and you can validate the changeset messages using hg incoming.

You could also write a hook to prevent pushes. However, there would have to be some sort of programming logic to accept/reject the pushes and this may not be realistic. Take a look at http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html to get detailed information on hooks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top