Encountering A Merge¶
A Merge is when two or more commits/revisions are brought together, here we have some following examples and how to fix them.
Example Problem 1¶
When each commit was carried out at the same time a merge may be required.
Stage1: User 1 carries out some file changes and starts to write a commit message.
Stage2: User 2 also carries out certain file changes and begins to write their commit message. User 1 has carried out a hg push, and the the repository has been updated.
Stage3: User 2 carries out a hg push, discovers a merge error because the repository has been updated whilst they were typing/submitting a commit.
Solving This Problem¶
Once Stage 2 has been reached the following actions must take place to solve the merging problem.
1. The user receives a error message during a hg push, first step is to carry out a hg pull -u,
C:\Documents and Settings\Owner\project>hg pull -u
This will updated your computer with the commit that was carried out by User 1 during your commit.
2. Now we shall carry out a hg heads, this will give us info on recent commits, this info should give us Two commits,
C:\Documents and Settings\Owner\project>hg heads r2 (Most Current Revision User 2) r1 (Previous Revision User 1)
One Commit will be the commit from User 1 and the other being from User 2.
3. Once we have Two heads we can carry out a hg merge, this will now merge both commits/revisions together,
C:\Documents and Settings\Owner\project>hg merge
4. Once the merge is complete then it will ask you to carry out a commit to info that you have merged,
C:\Documents and Settings\Owner\project>hg commit -m "Merged r1 and r2"
5. Finally you can now carry out a hg push,
C:\Documents and Settings\Owner\project>hg push
Checking a Merge¶
You may check if the merge was successful out by looking at the timeline graph for your Project.
This can be found by following a link formed like this,
http://mz.openttdcoop.org/hg/project/graph
Project = The name of your project.