##// END OF EJS Templates
hg: make _local() behave consistently on Python 3.8 (issue6287)...
Augie Fackler -
r45061:6a8738dc default
parent child Browse files
Show More
@@ -60,12 +60,19 b' def _local(path):'
60 path = util.expandpath(util.urllocalpath(path))
60 path = util.expandpath(util.urllocalpath(path))
61
61
62 try:
62 try:
63 isfile = os.path.isfile(path)
63 # we use os.stat() directly here instead of os.path.isfile()
64 # because the latter started returning `False` on invalid path
65 # exceptions starting in 3.8 and we care about handling
66 # invalid paths specially here.
67 st = os.stat(path)
68 isfile = stat.S_ISREG(st.st_mode)
64 # Python 2 raises TypeError, Python 3 ValueError.
69 # Python 2 raises TypeError, Python 3 ValueError.
65 except (TypeError, ValueError) as e:
70 except (TypeError, ValueError) as e:
66 raise error.Abort(
71 raise error.Abort(
67 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
72 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
68 )
73 )
74 except OSError:
75 isfile = False
69
76
70 return isfile and bundlerepo or localrepo
77 return isfile and bundlerepo or localrepo
71
78
General Comments 0
You need to be logged in to leave comments. Login now