Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 24902:986a5c23b1c1 stable
util.checkcase: don't abort on broken symlinks
One case where that would happen is while trying to resolve a subrepo, if the
path to the subrepo was actually a broken symlink. This bug was exposed by an
hg-git test.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 03 May 2015 12:49:15 -0700 |
parents | 144883a8d0d4 |
children | 754df8e932d3 |
comparison
equal
deleted
inserted
replaced
24894:c48850339988 | 24902:986a5c23b1c1 |
---|---|
875 Return true if the given path is on a case-sensitive filesystem | 875 Return true if the given path is on a case-sensitive filesystem |
876 | 876 |
877 Requires a path (like /foo/.hg) ending with a foldable final | 877 Requires a path (like /foo/.hg) ending with a foldable final |
878 directory component. | 878 directory component. |
879 """ | 879 """ |
880 s1 = os.stat(path) | 880 s1 = os.lstat(path) |
881 d, b = os.path.split(path) | 881 d, b = os.path.split(path) |
882 b2 = b.upper() | 882 b2 = b.upper() |
883 if b == b2: | 883 if b == b2: |
884 b2 = b.lower() | 884 b2 = b.lower() |
885 if b == b2: | 885 if b == b2: |
886 return True # no evidence against case sensitivity | 886 return True # no evidence against case sensitivity |
887 p2 = os.path.join(d, b2) | 887 p2 = os.path.join(d, b2) |
888 try: | 888 try: |
889 s2 = os.stat(p2) | 889 s2 = os.lstat(p2) |
890 if s2 == s1: | 890 if s2 == s1: |
891 return False | 891 return False |
892 return True | 892 return True |
893 except OSError: | 893 except OSError: |
894 return True | 894 return True |