[PATCH 2 of 5 RFC] windows: teach dirstate and posixfile to understand long paths
Kostia Balytskyi
ikostia at fb.com
Sat Aug 12 04:22:57 EDT 2017
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1502522414 25200
# Sat Aug 12 00:20:14 2017 -0700
# Node ID a1c8f310a66ada40697c824f4621bb54c757e9fa
# Parent 586870aa06799e2ef49a2be4c8feab1464ad54b1
windows: teach dirstate and posixfile to understand long paths
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -269,9 +269,7 @@ class dirstate(object):
return not util.fscasesensitive(self._join('.hg'))
def _join(self, f):
- # much faster than os.path.join()
- # it's safe because f is always a relative path
- return self._rootdir + f
+ return util.absjoin(self._rootdir, f)
def flagfunc(self, buildfallback):
if self._checklink and self._checkexec:
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -123,6 +123,9 @@ class mixedfilemodewrapper(object):
def posixfile(name, mode='r', buffering=-1):
'''Open a file with even more POSIX-like semantics'''
try:
+ if os.path.isabs(name) and not hasntprefix(name):
+ # we're out of luck if path is relative
+ name = converttontpath(name)
fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError
# The position when opening in append mode is implementation defined, so
More information about the Mercurial-devel
mailing list