We are using mercurial/tortoisehg with a central repository hosted on kiln.
We have narrowed down what we are doing to the simplest possible scenario. The scenario starts with Bob and Joe having cloned the kiln repository, so they both start with identical sets.
- Bob changes file a.txt, commits and pushes it to kiln.
- Joe changes file b.txt and commits.
- Joe tries to push to kiln, but gets these errors: remote has heads on branch 'default' that are not known locally: 503dc02bd36c abort: push creates new remote head dba053a5be68!
- This is obviously due to Bob's changes that need to be pulled from kiln first. So, Joe pulls the changes from kiln and succeeds
- Joe tries to push to kiln, but gets these errors: abort: push creates new remote head dba053a5be68!
- Joe merges his commits with local and it succeeds
- Joe now tries to push to kiln and succeeds
In this scenario, it seems like Mercurial should detect that both users updated different files and not force a merge, which is essentially Joe pulling Bob's changes and having to recommit and push the changes of both users.
Thanks everyone. To clarify my question: We are curious whether we have missed something or this is just how it works. In this scenario, even though there is no conflict during merge, hg still forces me to have to pull, merge, recommit and re-push my colleague's changes that he has already committed and pushed to the central repository.
That's how Mercurial works.
If Joe did not have changes, there would be no need for a merge or merge commit and he could just use
hg update tip
orhg pull
. However, since Joe had changes when making the pull request, even though they were not in the same file, a merge is required.This information can be found in Mercurial's guide: https://www.mercurial-scm.org/guide