diff mercurial/posix.py @ 10218:750b7a4f01f6 stable

Add support for relinking on Windows. Test and minor code change by Patrick M?zard <pmezard@gmail.com>
author Siddharth Agarwal <sid.bugzilla@gmail.com>
date Fri, 08 Jan 2010 18:48:39 +0530
parents 8b8920209317
children 2f7a38f336f4 25e572394f5c
line wrap: on
line diff
--- a/mercurial/posix.py	Fri Jan 08 22:30:07 2010 +0100
+++ b/mercurial/posix.py	Fri Jan 08 18:48:39 2010 +0530
@@ -105,6 +105,18 @@
 def localpath(path):
     return path
 
+def samefile(fpath1, fpath2):
+    """Returns whether path1 and path2 refer to the same file. This is only
+    guaranteed to work for files, not directories."""
+    return os.path.samefile(fpath1, fpath2)
+
+def samedevice(fpath1, fpath2):
+    """Returns whether fpath1 and fpath2 are on the same device. This is only
+    guaranteed to work for files, not directories."""
+    st1 = os.lstat(fpath1)
+    st2 = os.lstat(fpath2)
+    return st1.st_dev == st2.st_dev
+
 if sys.platform == 'darwin':
     def realpath(path):
         '''