diff mercurial/util.py @ 4000:3297aa945cf2

symlinks: add a linkfunc
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Dec 2006 20:04:31 -0600
parents 0b740dcf0cf1
children d7b9ec589546
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -725,6 +725,12 @@ def checksymlink(path):
     except OSError:
         return False
 
+def linkfunc(path, fallback):
+    '''return an is_link() function with default to fallback'''
+    if checklink(path):
+        return lambda x: is_link(os.path.join(path, x))
+    return fallback
+
 # Platform specific variants
 if os.name == 'nt':
     import msvcrt