Mercurial > hg
comparison mercurial/util.py @ 2193:fb28ce04b349
add util.samestat function for windows.
windows does not have os.path.samestat, and stat().st_ino is always zero,
so util.samestat always returns false on windows.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Wed, 03 May 2006 22:47:08 -0700 |
parents | 6886bc0b77af |
children | 6d3cc2a982f3 |
comparison
equal
deleted
inserted
replaced
2178:00205fe76993 | 2193:fb28ce04b349 |
---|---|
229 while True: | 229 while True: |
230 try: | 230 try: |
231 name_st = os.stat(name) | 231 name_st = os.stat(name) |
232 except OSError: | 232 except OSError: |
233 break | 233 break |
234 if os.path.samestat(name_st, root_st): | 234 if samestat(name_st, root_st): |
235 rel.reverse() | 235 rel.reverse() |
236 name = os.path.join(*rel) | 236 name = os.path.join(*rel) |
237 audit_path(name) | 237 audit_path(name) |
238 return pconvert(name) | 238 return pconvert(name) |
239 dirname, basename = os.path.split(name) | 239 dirname, basename = os.path.split(name) |
559 return pconvert(os.path.normpath(path)) | 559 return pconvert(os.path.normpath(path)) |
560 | 560 |
561 makelock = _makelock_file | 561 makelock = _makelock_file |
562 readlock = _readlock_file | 562 readlock = _readlock_file |
563 | 563 |
564 def samestat(s1, s2): | |
565 return False | |
566 | |
564 def explain_exit(code): | 567 def explain_exit(code): |
565 return _("exited with status %d") % code, code | 568 return _("exited with status %d") % code, code |
566 | 569 |
567 try: | 570 try: |
568 # override functions with win32 versions if possible | 571 # override functions with win32 versions if possible |
625 | 628 |
626 def localpath(path): | 629 def localpath(path): |
627 return path | 630 return path |
628 | 631 |
629 normpath = os.path.normpath | 632 normpath = os.path.normpath |
633 samestat = os.path.samestat | |
630 | 634 |
631 def makelock(info, pathname): | 635 def makelock(info, pathname): |
632 try: | 636 try: |
633 os.symlink(info, pathname) | 637 os.symlink(info, pathname) |
634 except OSError, why: | 638 except OSError, why: |