# HG changeset patch # User Erik Huelsmann # Date 2015-08-15 22:24:29 # Node ID e15966216aecda30c833978af680dde253e44fbd # Parent 09d6725cbc602e232aa34eb6fffb81639b951529 filemerge: split internal merge into api entry point and internal helper This is a step toward adding 'union merge' to the internal merge tool. 'union merge' is a merge strategy which adds both left and right hand side of a conflict region. Git implements this merge strategy which is very practical to have for merging to e.g. the Changelog file. diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -227,15 +227,12 @@ def _premerge(repo, toolconf, files, lab util.copyfile(back, a) # restore from backup and try again return 1 # continue merging -@internaltool('merge', True, - _("merging %s incomplete! " - "(edit conflicts, then use 'hg resolve --mark')\n")) -def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): +def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode): """ Uses the internal non-interactive simple merge algorithm for merging files. It will fail if there are any conflicts and leave markers in the partially merged file. Markers will have two sections, one for each side - of merge.""" + of merge, unless mode equals 'union' which suppresses the markers.""" tool, toolpath, binary, symlink = toolconf if symlink: repo.ui.warn(_('warning: internal :merge cannot merge symlinks ' @@ -247,10 +244,22 @@ def _imerge(repo, mynode, orig, fcd, fco ui = repo.ui - r = simplemerge.simplemerge(ui, a, b, c, label=labels) + r = simplemerge.simplemerge(ui, a, b, c, label=labels, mode=mode) return True, r return False, 0 +@internaltool('merge', True, + _("merging %s incomplete! " + "(edit conflicts, then use 'hg resolve --mark')\n")) +def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): + """ + Uses the internal non-interactive simple merge algorithm for merging + files. It will fail if there are any conflicts and leave markers in + the partially merged file. Markers will have two sections, one for each side + of merge.""" + return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, + files, labels, 'merge') + @internaltool('merge3', True, _("merging %s incomplete! " "(edit conflicts, then use 'hg resolve --mark')\n"))