--- 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)