mercurial/util.py
changeset 3996 c190df14338c
parent 3995 a4e79f86d304
child 3997 3f0ba82c103f
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -707,6 +707,12 @@ def checkexec(path):
     os.unlink(fn)
     return r
 
+def execfunc(path, fallback):
+    '''return an is_exec() function with default to fallback'''
+    if checkexec(path):
+        return lambda x: is_exec(os.path.join(path, x), False)
+    return fallback
+
 # Platform specific variants
 if os.name == 'nt':
     import msvcrt