diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -248,6 +248,17 @@ def _merge(repo, mynode, orig, fcd, fco, return True, r return False, 0 +@internaltool('union', True, + _("merging %s incomplete! " + "(edit conflicts, then use 'hg resolve --mark')\n")) +def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): + """ + Uses the internal non-interactive simple merge algorithm for merging + files. It will use both left and right sides for conflict regions. + No markers are inserted.""" + return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, + files, labels, 'union') + @internaltool('merge', True, _("merging %s incomplete! " "(edit conflicts, then use 'hg resolve --mark')\n")) diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1202,6 +1202,11 @@ Test dynamic list of merge tools only sh ":tagmerge" Uses the internal tag merge algorithm (experimental). + ":union" + Uses the internal non-interactive simple merge algorithm for merging + files. It will use both left and right sides for conflict regions. No + markers are inserted. + Internal tools are always available and do not require a GUI but will by default not handle symlinks or binary files. diff --git a/tests/test-merge-internal-tools-pattern.t b/tests/test-merge-internal-tools-pattern.t --- a/tests/test-merge-internal-tools-pattern.t +++ b/tests/test-merge-internal-tools-pattern.t @@ -1,5 +1,6 @@ -Make sure that the internal merge tools (internal:fail, internal:local, and -internal:other) are used when matched by a merge-pattern in hgrc +Make sure that the internal merge tools (internal:fail, internal:local, +internal:union and internal:other) are used when matched by a +merge-pattern in hgrc Make sure HGMERGE doesn't interfere with the test: @@ -110,3 +111,31 @@ Merge using default tool: $ hg stat M f +Merge using internal:union tool: + + $ hg update -C 2 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ echo "line 4a" >>f + $ hg ci -Am "Adding fourth line (commit 4)" + $ hg update 2 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ echo "line 4b" >>f + $ hg ci -Am "Adding fourth line v2 (commit 5)" + created new head + + $ echo "[merge-patterns]" > .hg/hgrc + $ echo "* = internal:union" >> .hg/hgrc + + $ hg merge 3 + merging f + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ cat f + line 1 + line 2 + third line + line 4b + line 4a