Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial repositories with many active developers?

Tags:

mercurial

I'm going through Bitbucket and I can't seem to find any Mercurial repositories that look like what I suspect our repository would look like, provided we switch to Mercurial.

As such, I'm wondering, is there a workflow that we're not considering here?

The thing I'm talking about is that I did a small automated test. We're 14 people that work on the same project, split into 4 scrum teams. To simulate 14 (I picked 10, round number) people working in parallel on the code, using Mercurial DVCS, pushing to the same central master repository, I wrote a script.

  1. I created a new "master" repository, and then cloned it for 10 virtual people
  2. I then ran a 1000 iteration loop, picking a random clone, and doing one of the following:
    • 10% of the time, do a pull from master, merge, commit merge, and push
    • 90% of the time, do a local change and commit

Note that I ensured that there would never be merge conflicts by simply making each virtual person work on his own file.

This would simulate people working locally by doing 1+ commits before pulling, merging, and pushing (to avoid 2+ heads in the master repo). It might be that this workflow is wrong.

This is a sample of what the repository now looks like (screenshot + link to repo):

sample screenshot from TortoiseHg

The repository can be found here: http://hg.vkarlsen.no/hgweb.cgi/parallel_test/graph. Unfortunately this repository is no longer available and I no longer have a copy of the code due to an unfortunate backup incident, but this was just an example for people to visit, it should not be important any more

This looks awfully messy, and as I said, I can't seem to find any repositories that have similar history. By "messy", I mean that it looks like older history of the project will almost always have 10 parallel branches. Close to the top, it tapers off of course, but it will expand as people that are currently working in their local repository pushes to the master.

So I have two questions:

  1. Can anyone show me a repository that has similar history? Since I can't seem to find any, I'm starting to wonder about what kind of conclusions I can draw from that...
  2. Is there something wrong with our workflow (that is, the workflow I've laid out here)? Should we rebase/squash/transplant, delegate push responsibility to one person, other things, instead of the way it was done here?
like image 571
Lasse V. Karlsen Avatar asked Oct 08 '10 08:10

Lasse V. Karlsen


2 Answers

Impressive preparation!

  1. It always looks messy if you go back a bit and look at all old commits at the same time. It always tapers of, even looking at a small bit old history. See http://hg.intevation.org/mercurial/crew/graph/12402?revcount=120 for instance. This is not the most recent commit, but shows all history up to that commit.

  2. Rebase helps quite a lot, especially if persons are working on separate areas. (I usually check the incoming commits to see if there are potential file or functionality conflicts, and if not, I do rebase.)

Rebase is not fool-proof though, so merge is the preferred "safe" action, but it leaves more "garbage" in the history. A trade-off.

Rebase is sort-of like the bog standard SVN update. The existing stuff is made baseline and your changes go on top, cross your fingers it still works. It's useful, but there are times when you feel safer having yours, theirs and the merge as separate commits in the history.

There is also commit-squashing as an option (histedit extension maybe), which squashes all in-between commits to one. This is useful when you're about to push and want to transferring many partials commits in your own repo as a single commit to the main.

like image 126
Macke Avatar answered Oct 23 '22 20:10

Macke


I have 12 developers working in the same Mercurial repository at work, and our history looks nothing like that. There are occasional merge commits, but most merges are from merging actual branches, i.e there might be a merge in our main development branch bringing in changes from a bugfix release made on the production/release branch.

This is very easy to achieve, developers hack and commit to their local repository and when they have something stable enough to share with the rest of the team they push.

If nothing has been committed since they started committing the push goes through without problems.

If someone else has committed a change, Mercurial complains that the push will create remote heads. The developer then does a hg pull --rebase and retries the push. The push goes through and everyone is happy.

If you are using continuous integration with developers regularly pushing to a shared repository, this is the way to go. Knowing whether you have pushed changes or not is easy and you avoid lots of useless merge commits cluttering up your history.

like image 35
Joakim Hårsman Avatar answered Oct 23 '22 18:10

Joakim Hårsman