##// END OF EJS Templates
performance: normalize self._root, avoid calling os.path.join() in dirstate...
Benoit Boissinot -
r6972:63d1d3e4 default
parent child Browse files
Show More
@@ -28,6 +28,7 class dirstate(object):
28 28 def __init__(self, opener, ui, root):
29 29 self._opener = opener
30 30 self._root = root
31 self._rootdir = os.path.join(root, '')
31 32 self._dirty = False
32 33 self._dirtypl = False
33 34 self._ui = ui
@@ -99,13 +100,14 class dirstate(object):
99 100 raise AttributeError, name
100 101
101 102 def _join(self, f):
102 return os.path.join(self._root, f)
103 # much faster than os.path.join()
104 return self._rootdir + f
103 105
104 106 def flagfunc(self, fallback):
105 107 if self._checklink:
106 108 if self._checkexec:
107 109 def f(x):
108 p = os.path.join(self._root, x)
110 p = self._join(x)
109 111 if os.path.islink(p):
110 112 return 'l'
111 113 if util.is_exec(p):
@@ -113,7 +115,7 class dirstate(object):
113 115 return ''
114 116 return f
115 117 def f(x):
116 if os.path.islink(os.path.join(self._root, x)):
118 if os.path.islink(self._join(x)):
117 119 return 'l'
118 120 if 'x' in fallback(x):
119 121 return 'x'
@@ -123,7 +125,7 class dirstate(object):
123 125 def f(x):
124 126 if 'l' in fallback(x):
125 127 return 'l'
126 if util.is_exec(os.path.join(self._root, x)):
128 if util.is_exec(self._join(x)):
127 129 return 'x'
128 130 return ''
129 131 return f
General Comments 0
You need to be logged in to leave comments. Login now