changeset 18868:cafa447a7d3b

util: add functions to check symlink/exec bits These are not yet used.
author Bryan O'Sullivan <bryano@fb.com>
date Wed, 03 Apr 2013 11:35:27 -0700
parents c7e8b143e086
children e8b4b139a545
files mercurial/posix.py mercurial/util.py mercurial/windows.py
diffstat 3 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Wed Apr 03 13:03:50 2013 -0500
+++ b/mercurial/posix.py	Wed Apr 03 11:35:27 2013 -0700
@@ -557,3 +557,11 @@
         if self.realpath != self.path:
             okayifmissing(os.unlink, self.realpath)
             okayifmissing(os.rmdir, os.path.dirname(self.realpath))
+
+def statislink(st):
+    '''check whether a stat result is a symlink'''
+    return st and stat.S_ISLNK(st.st_mode)
+
+def statisexec(st):
+    '''check whether a stat result is an executable file'''
+    return st and (st.st_mode & 0100 != 0)
--- a/mercurial/util.py	Wed Apr 03 13:03:50 2013 -0500
+++ b/mercurial/util.py	Wed Apr 03 11:35:27 2013 -0700
@@ -65,6 +65,8 @@
 split = platform.split
 sshargs = platform.sshargs
 statfiles = getattr(osutil, 'statfiles', platform.statfiles)
+statisexec = platform.statisexec
+statislink = platform.statislink
 termwidth = platform.termwidth
 testpid = platform.testpid
 umask = platform.umask
--- a/mercurial/windows.py	Wed Apr 03 13:03:50 2013 -0500
+++ b/mercurial/windows.py	Wed Apr 03 11:35:27 2013 -0700
@@ -337,3 +337,11 @@
             pass
 
 expandglobs = True
+
+def statislink(st):
+    '''check whether a stat result is a symlink'''
+    return False
+
+def statisexec(st):
+    '''check whether a stat result is an executable file'''
+    return False