diff mercurial/scmutil.py @ 27610:b8405d739149

merge with stable
author Matt Mackall <mpm@selenic.com>
date Sat, 02 Jan 2016 02:13:56 +0100
parents dde3da2246f1 6a6e78f84cc6
children 07fc2f2134ba
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Dec 31 13:45:48 2015 -0500
+++ b/mercurial/scmutil.py	Sat Jan 02 02:13:56 2016 +0100
@@ -329,6 +329,17 @@
     def islink(self, path=None):
         return os.path.islink(self.join(path))
 
+    def isfileorlink(self, path=None):
+        '''return whether path is a regular file or a symlink
+
+        Unlike isfile, this doesn't follow symlinks.'''
+        try:
+            st = self.lstat(path)
+        except OSError:
+            return False
+        mode = st.st_mode
+        return stat.S_ISREG(mode) or stat.S_ISLNK(mode)
+
     def reljoin(self, *paths):
         """join various elements of a path together (as os.path.join would do)