--- a/mercurial/scmutil.py Sat Dec 26 15:18:16 2015 +0900
+++ b/mercurial/scmutil.py Mon Dec 28 22:51:37 2015 -0800
@@ -312,6 +312,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)