changeset 16256:c655e4acaa82

merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 13 Mar 2012 16:29:13 -0500
parents 17f179805297 (current diff) ca5cc2976574 (diff)
children 589aab2ca716
files mercurial/filemerge.py mercurial/merge.py
diffstat 3 files changed, 45 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Mon Mar 12 17:05:42 2012 -0500
+++ b/mercurial/filemerge.py	Tue Mar 13 16:29:13 2012 -0500
@@ -107,8 +107,11 @@
         if check(t, None, symlink, binary):
             toolpath = _findtool(ui, t)
             return (t, '"' + toolpath + '"')
-    # internal merge as last resort
-    return (not (symlink or binary) and "internal:merge" or None, None)
+
+    # internal merge or prompt as last resort
+    if symlink or binary:
+        return "internal:prompt", None
+    return "internal:merge", None
 
 def _eoltype(data):
     "Guess the EOL type of a file"
--- a/mercurial/merge.py	Mon Mar 12 17:05:42 2012 -0500
+++ b/mercurial/merge.py	Tue Mar 13 16:29:13 2012 -0500
@@ -170,9 +170,10 @@
         if m and m != a: # changed from a to m
             return m
         if n and n != a: # changed from a to n
-            if n == 'l' or a == 'l':
-                # can't automatically merge symlink flag change here, let
-                # filemerge take care of it
+            if (n == 'l' or a == 'l') and m1[f] != ma[f]:
+                # can't automatically merge symlink flag when there
+                # are file-level conflicts here, let filemerge take
+                # care of it
                 return m
             return n
         return '' # flag was cleared
--- a/tests/test-merge-types.t	Mon Mar 12 17:05:42 2012 -0500
+++ b/tests/test-merge-types.t	Tue Mar 13 16:29:13 2012 -0500
@@ -70,3 +70,39 @@
   > fi
   a has no flags (default for conflicts)
 
+Update to link without local change should get us a symlink (issue3316):
+
+ $ hg up -C 0
+ $ hg up
+ $ hg st
+
+Update to link with local change should cause a merge prompt (issue3200):
+
+  $ hg up -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo data > a
+  $ HGMERGE= hg up -y --debug
+    searching for copies back to rev 2
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
+   a: versions differ -> m
+  preserving a for resolve of a
+  updating: a 1/1 files (100.00%)
+  couldn't find merge tool hgmerge
+  picked tool 'internal:prompt' for a (binary False symlink True)
+   no tool found to merge a
+  keep (l)ocal or take (o)ther? l
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  $ hg diff --git
+  diff --git a/a b/a
+  old mode 120000
+  new mode 100644
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -symlink
+  \ No newline at end of file
+  +data
+
+