Merge on push?

Martin Geisler mg at daimi.au.dk
Sat Jun 7 17:18:24 CDT 2008


Roman Kennke <roman.kennke at aicas.com> writes:

> I think pushing to a central repository is a very important action,
> and I also think that it is unnecessarily complicated in Mercurial.
> The current situation is that when a developer tries to push, in
> almost all cases it aborts and he needs to pull && merge && commit
> and then push again (don't forget to update at some point too).

Is this not the same you have to do with something like Subversion? If
you somehow know in advance that you need to merge in SVN, then you
do:

  svn update; svn commit

With Mercurial this becomes

  hg fetch; hg push

On the other hand, if you know that no merging is necessary, then the
commands are simply

  svn commit

or

  hg push

So in both cases it seems that it is equally cumbersome to push
something to a remote repository.

I personally don't use the fetch extension -- I really like to take
the extra 'hg merge' step so that I can check what is going on.

And the automatic merge done by SVN now really scares me since it is
messing with my uncommitted data in the working copy! Having explicit
merge changesets is a cool and important feature of Mercurial.

> I know, hg fetch can make all this a little easier, but still, it is
> additional overhead at the side of the developer. The worst thing
> is, that it is possible that after the fetch sequence, the push can
> fail again, when another developer managed to push something in
> between. [...]

This also applies to Subversion where there can be contention and you
have to repeat the 'svn update; svn commit' commands until you finally
manage to commit.

Would the advantage of having a 'hg push --merge' command be that it
would take the write lock when pushing and keeping it when merging?
That would solve the problem of having to repeat merging because
someone committed in the mean time.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.



More information about the Mercurial mailing list