changeset 6533:65f1b97484be

Merge with -stable
author Matt Mackall <mpm@selenic.com>
date Sun, 13 Apr 2008 11:31:45 -0500
parents 833be17000b6 (current diff) 2b181fb3a70a (diff)
children 962eb403165b
files mercurial/filemerge.py
diffstat 3 files changed, 101 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Fri Apr 11 15:14:00 2008 +0200
+++ b/mercurial/filemerge.py	Sun Apr 13 11:31:45 2008 -0500
@@ -16,6 +16,8 @@
     return ui.configbool("merge-tools", tool + "." + part, default)
 
 def _findtool(ui, tool):
+    if tool in ("internal:fail", "internal:local", "internal:other"):
+        return tool
     k = _toolstr(ui, tool, "regkey")
     if k:
         p = util.lookup_reg(k, _toolstr(ui, tool, "regname"))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-internal-tools-pattern	Sun Apr 13 11:31:45 2008 -0500
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# make sure that the internal merge tools (internal:fail, internal:local, and
+# internal:other) are used when matched by a merge-pattern in hgrc
+
+unset HGMERGE # make sure HGMERGE doesn't interfere with the test
+
+hg init
+
+echo "# initial file contents"
+echo "line 1" > f
+echo "line 2" >> f
+echo "line 3" >> f
+hg commit -Am "revision 0" -d "1000000 0"
+cat f
+echo "# branch 1: editing line 1"
+sed 's/line 1/first line/' f > f.new
+mv f.new f
+hg commit -Am "edited first line" -d "1000000 0"
+
+echo "# branch 2: editing line 3"
+hg update 0
+sed 's/line 3/third line/' f > f.new
+mv f.new f
+hg commit -Am "edited third line" -d "1000000 0"
+
+echo "# merge using internal:fail tool"
+echo "[merge-patterns]" > .hg/hgrc
+echo "* = internal:fail" >> .hg/hgrc
+hg merge
+cat f
+hg stat
+
+echo "# merge using internal:local tool"
+hg update -C 2
+sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
+mv .hg/hgrc.new .hg/hgrc
+hg merge
+cat f
+hg stat
+
+echo "# merge using internal:other tool"
+hg update -C 2
+sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
+mv .hg/hgrc.new .hg/hgrc
+hg merge
+cat f
+hg stat
+
+echo "# merge using default tool"
+hg update -C 2
+rm .hg/hgrc
+hg merge
+cat f
+hg stat
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-internal-tools-pattern.out	Sun Apr 13 11:31:45 2008 -0500
@@ -0,0 +1,43 @@
+# initial file contents
+adding f
+line 1
+line 2
+line 3
+# branch 1: editing line 1
+# branch 2: editing line 3
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+created new head
+# merge using internal:fail tool
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+There are unresolved merges, you can redo the full merge using:
+  hg update -C 2
+  hg merge 1
+line 1
+line 2
+third line
+M f
+# merge using internal:local tool
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+line 1
+line 2
+third line
+M f
+# merge using internal:other tool
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+first line
+line 2
+line 3
+M f
+# merge using default tool
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+merging f
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+first line
+line 2
+third line
+M f