changeset 4000:3297aa945cf2

symlinks: add a linkfunc
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Dec 2006 20:04:31 -0600
parents 0b740dcf0cf1
children dda03b2d9ef1
files mercurial/util.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/util.py	Fri Dec 29 20:04:31 2006 -0600
@@ -725,6 +725,12 @@
     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