问题
Given repository A and repository B (created off a clone of changeset A2):
A1 - A2 - A3 - A4 - A5
\
B3 - B4
Say we wanted to merge these two repositories together. Is there any difference if we merged repo B into repo A versus merging repo A into repo B?
The only diff I can think of is the merge tool local/base arguments would be reversed depending on which option you chose. Are there any other differences to be aware of?
回答1:
Generally merges are symmetric, with a few exceptions:
- If the merged heads are from different named branches, the order is important. The merge revision will be on the first parent's branch.
- Starting with Mercurial 1.8.4 the same applies to bookmarks, i.e. only the bookmark
of the first parent will move forward to the merge revision. - The order of the merge revision's parents in log and diff views is different, but that doest not have any noteworthy practical implications (from my experience).
回答2:
The order of the parents for the merge will be different, but that will only affect which diff you see first when you're looking at the merge changeset. Otherwise, there isn't really any difference if you update to B4 and merge to A5 or vice versa.
回答3:
I'm no mercurial expert, but after reading this question&resolution I get the feeling that the merge direction can make a huge difference: Backing Out a backwards merge on Mercurial
来源:https://stackoverflow.com/questions/5594731/mercurial-differences-merging-repository-a-b-vs-b-a