Do Large Mercurial Repositories Suffer from Push Race?

dvcsmercurial

Reading a few "Why a DVCS is better" answers to several question on Programmers.SE they all seem to say that in general, DVCS is better since you don't have a commit race in large projects, IE commit, out of date so update, commit, out of date again, commit, still out of date, etc.

DVCS limit this with the concept of the push. However in very large projects wouldn't there be a "push race", especially at the end of the day? I know in Git this is somewhat remedied by the constant branching for everything, but in Mercurial you don't branch, you create a new head.

Problem I see

  1. User attempts to push
  2. Out of date (mercurial won't let you push if your local repo is out of date), so you pull and merge your local changes
  3. User attempts to push again but while they were merging someone else pushed, so they are out of date again
  4. Pull and merge again
  5. Still out of date
  6. Repeat

Sound familiar?

Is this an actual problem with very large and popular mercurial repos? What about inside a company when everyone does their final push of the day?

Best Answer

As far as I'm aware most of the big open source projects using DVCS use "pull requests" instead of pushes, i.e. a user requests that the project pulls from their branch, and the prject can choose to undertake these pull requests in any order, if at all. This eliminates the needs for the "push race", as you've named it.

In other companies I can't vouch for process, but where I work this isn't an issue.

See, when you're working on a case you're working on a branch of the entire repo, so your push requests go to a remote version of the main trunk. When you want to integrate your (finished) change into the trunk you load up the trunk, pull, merge, push.

Occasionally (very occasionally) two people will try and do this at the same time (usual due to some miscommunication). In this case whoever "loses" will just have to re-pull, merge, push. Since there's no 5pm rush to commit to a central repository the problem you've outlined isn't really there.

That's the beauty of DVCS: branching is painless, so everyone can work on their own branch.

EDIT

Oh, I just noticed your "In mercurial you don't branch..." comment: Yes, you do. You don't have to, but since it's so easy to and the benefits of doing so outweigh not doing so do greatly, you do tend to just branch repos a lot.