Mercurial > hg
comparison mercurial/filemerge.py @ 22028:3d0572ab3b4a
merge: add an internal:merge3 tool
This variant gives access to a feature already present in ``internal:merge``:
displaying merge base content.
In the basic merge (calling ``hg merge``) case, including more context to the
merge markers is an interesting addition.
But this extra information is the only viable option in case conflict from
grafting (, rebase, etc…).
When grafting ``source`` on ``destination``, the parent of ``source`` is
used as the ``base``. When all three changesets add content in the same
location, the marker for ``source`` will contains both ``base`` and ``source``
content. Without the content of base exposed, there is no way for the user
to discriminate content coming from ``base`` and content commit from ``source``.
Practical example (all addition are in the same place):
* ``destination`` adds ``Dest-Content``
* ``base`` adds ``Base-Content``
* ``source`` adds ``Src-Content``
Grafting ``source`` on ``destination`` will produce the following conflict:
<<<<<<< destination
Dest-Content
=======
Base-Content
Src-Content
>>>>>>> source
This that case there is no way to distinct ``base`` from ``source``. As a result
content from ``base`` are likely to slip in the resolution result.
However, adding the base make the situation very clear:
<<<<<<< destination
Dest-Content
||||||| base
Base-Content
======= base
Base-Content
Src-Content
>>>>>>> source
Once the base is added, the addition from the grafted changeset is made clear.
User can compare the content from ``base`` and ``source`` to make an enlightened
decision during merge resolution.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 05 Aug 2014 14:58:45 -0700 |
parents | b98e5c7afc70 |
children | b36c60cfe46f |
comparison
equal
deleted
inserted
replaced
22027:b98e5c7afc70 | 22028:3d0572ab3b4a |
---|---|
221 | 221 |
222 r = simplemerge.simplemerge(ui, a, b, c, label=labels) | 222 r = simplemerge.simplemerge(ui, a, b, c, label=labels) |
223 return True, r | 223 return True, r |
224 return False, 0 | 224 return False, 0 |
225 | 225 |
226 @internaltool('merge3', True, | |
227 _("merging %s incomplete! " | |
228 "(edit conflicts, then use 'hg resolve --mark')\n")) | |
229 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
230 """ | |
231 Uses the internal non-interactive simple merge algorithm for merging | |
232 files. It will fail if there are any conflicts and leave markers in | |
233 the partially merged file. Marker will have three sections, one from each | |
234 side of the merge and one for the base content.""" | |
235 if not labels: | |
236 labels = _defaultconflictlabels | |
237 if len(labels) < 3: | |
238 labels.append('base') | |
239 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels) | |
240 | |
226 @internaltool('tagmerge', True, | 241 @internaltool('tagmerge', True, |
227 _("automatic tag merging of %s failed! " | 242 _("automatic tag merging of %s failed! " |
228 "(use 'hg resolve --tool internal:merge' or another merge " | 243 "(use 'hg resolve --tool internal:merge' or another merge " |
229 "tool of your choice)\n")) | 244 "tool of your choice)\n")) |
230 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | 245 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |