filemerge: move :merge-local/other symlink check to precheck
authorSiddharth Agarwal <sid0@fb.com>
Sun, 08 Nov 2015 23:42:44 -0800
changeset 26893 19c4b93cb7d6
parent 26892 4b966aaadc45
child 26894 41957e50e109
filemerge: move :merge-local/other symlink check to precheck In upcoming patches we're going to add more checks to the function currently named _symlinkcheck. This consolidates all those checks.
mercurial/filemerge.py
tests/test-merge-types.t
--- a/mercurial/filemerge.py	Sun Nov 08 23:47:20 2015 -0800
+++ b/mercurial/filemerge.py	Sun Nov 08 23:42:44 2015 -0800
@@ -308,16 +308,12 @@
     """
     assert localorother is not None
     tool, toolpath, binary, symlink = toolconf
-    if symlink:
-        repo.ui.warn(_('warning: :merge-%s cannot merge symlinks '
-                       'for %s\n') % (localorother, fcd.path()))
-        return False, 1
     a, b, c, back = files
     r = simplemerge.simplemerge(repo.ui, a, b, c, label=labels,
                                 localorother=localorother)
     return True, r
 
-@internaltool('merge-local', mergeonly)
+@internaltool('merge-local', mergeonly, precheck=_symlinkcheck)
 def _imergelocal(*args, **kwargs):
     """
     Like :merge, but resolve all conflicts non-interactively in favor
@@ -325,7 +321,7 @@
     success, status = _imergeauto(localorother='local', *args, **kwargs)
     return success, status
 
-@internaltool('merge-other', mergeonly)
+@internaltool('merge-other', mergeonly, precheck=_symlinkcheck)
 def _imergeother(*args, **kwargs):
     """
     Like :merge, but resolve all conflicts non-interactively in favor
--- a/tests/test-merge-types.t	Sun Nov 08 23:47:20 2015 -0800
+++ b/tests/test-merge-types.t	Sun Nov 08 23:42:44 2015 -0800
@@ -118,7 +118,7 @@
   picked tool ':merge-local' for a (binary False symlink True)
   merging a
   my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
-  warning: :merge-local cannot merge symlinks for a
+  warning: internal :merge-local cannot merge symlinks for a
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -140,7 +140,7 @@
   picked tool ':merge-other' for a (binary False symlink True)
   merging a
   my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
-  warning: :merge-other cannot merge symlinks for a
+  warning: internal :merge-other cannot merge symlinks for a
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]