mercurial/posix.py
changeset 13375 f1fa8f481c7c
parent 13280 6052bbc7aabd
child 13400 14f3795a5ed7
--- a/mercurial/posix.py	Mon Feb 14 11:12:22 2011 +0100
+++ b/mercurial/posix.py	Mon Feb 14 11:12:26 2011 +0100
@@ -13,6 +13,7 @@
 nulldev = '/dev/null'
 normpath = os.path.normpath
 samestat = os.path.samestat
+os_link = os.link
 unlink = os.unlink
 rename = os.rename
 expandglobs = False
@@ -24,6 +25,10 @@
     '''return true if it is safe to hold open file handles to hardlinks'''
     return True
 
+def nlinks(name):
+    '''return number of hardlinks for the given file'''
+    return os.lstat(name).st_nlink
+
 def rcfiles(path):
     rcs = [os.path.join(path, 'hgrc')]
     rcdir = os.path.join(path, 'hgrc.d')