Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 3784:1427949b8f80
imported patch folding
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 04 Dec 2006 17:10:29 -0600 |
parents | f96c158ea3a3 |
children | 92a3532a01d9 8a9a1a7e1698 |
comparison
equal
deleted
inserted
replaced
3783:4421cef5d3f0 | 3784:1427949b8f80 |
---|---|
631 except KeyError: | 631 except KeyError: |
632 return str(gid) | 632 return str(gid) |
633 except ImportError: | 633 except ImportError: |
634 return None | 634 return None |
635 | 635 |
636 # File system features | |
637 | |
638 def checkfolding(path): | |
639 """ | |
640 Check whether the given path is on a case-sensitive filesystem | |
641 | |
642 Requires a path (like /foo/.hg) ending with a foldable final | |
643 directory component. | |
644 """ | |
645 s1 = os.stat(path) | |
646 d, b = os.path.split(path) | |
647 p2 = os.path.join(d, b.upper()) | |
648 if path == p2: | |
649 p2 = os.path.join(d, b.lower()) | |
650 try: | |
651 s2 = os.stat(p2) | |
652 if s2 == s1: | |
653 return False | |
654 return True | |
655 except: | |
656 return True | |
657 | |
636 # Platform specific variants | 658 # Platform specific variants |
637 if os.name == 'nt': | 659 if os.name == 'nt': |
638 demandload(globals(), "msvcrt") | 660 demandload(globals(), "msvcrt") |
639 nulldev = 'NUL:' | 661 nulldev = 'NUL:' |
640 | 662 |