Khawer Zeshan
Khawer Zeshan

Reputation: 9646

Why doesn't Mercurial check for the latest revision before commiting?

In SVN you cannot commit if your local revision is not up to date with the master repository. Mercurial doesn't check for this and allows you to commit. Then you have to do a merge.

If there are many programmers working then this could lead to a big problem. Is there is any way around this?

Upvotes: 2

Views: 96

Answers (1)

krtek
krtek

Reputation: 26607

Mercurial and SVN have two very different way of working.

SVN is centralized, everything you commit will be immediately accessible by all the others. It is why you must always commit on top of every other changes. So you can ascertain that what you've done still work with the modifications made by others.

With Mercurial, commits are local to your working directory. Only the push is distributed to other people. It's the reason why there's no check on each and every commit. (In this way, you can also work offline, ie without being connected to the repository).

It is only when you try to push your changes that Mercurial checks if there are new commits on the branch you're working one. If so, you can force the push (this will create a new head) or merge the other modifications, thus acknowledging the work of others.

Every DVCS (D is for distributed) I know off have the same way of dealing with commit / push, it's one of their many advantages. As long as the merge are done right, you won't have problems because of this.

If you really want to check for new changeset on each commit, I think it's possible to do it with some hooks, but I really don't see the reason why. Maybe someone will propose such a thing.

Upvotes: 6

Related Questions