##// 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 b' class dirstate(object):'
28 def __init__(self, opener, ui, root):
28 def __init__(self, opener, ui, root):
29 self._opener = opener
29 self._opener = opener
30 self._root = root
30 self._root = root
31 self._rootdir = os.path.join(root, '')
31 self._dirty = False
32 self._dirty = False
32 self._dirtypl = False
33 self._dirtypl = False
33 self._ui = ui
34 self._ui = ui
@@ -99,13 +100,14 b' class dirstate(object):'
99 raise AttributeError, name
100 raise AttributeError, name
100
101
101 def _join(self, f):
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 def flagfunc(self, fallback):
106 def flagfunc(self, fallback):
105 if self._checklink:
107 if self._checklink:
106 if self._checkexec:
108 if self._checkexec:
107 def f(x):
109 def f(x):
108 p = os.path.join(self._root, x)
110 p = self._join(x)
109 if os.path.islink(p):
111 if os.path.islink(p):
110 return 'l'
112 return 'l'
111 if util.is_exec(p):
113 if util.is_exec(p):
@@ -113,7 +115,7 b' class dirstate(object):'
113 return ''
115 return ''
114 return f
116 return f
115 def f(x):
117 def f(x):
116 if os.path.islink(os.path.join(self._root, x)):
118 if os.path.islink(self._join(x)):
117 return 'l'
119 return 'l'
118 if 'x' in fallback(x):
120 if 'x' in fallback(x):
119 return 'x'
121 return 'x'
@@ -123,7 +125,7 b' class dirstate(object):'
123 def f(x):
125 def f(x):
124 if 'l' in fallback(x):
126 if 'l' in fallback(x):
125 return 'l'
127 return 'l'
126 if util.is_exec(os.path.join(self._root, x)):
128 if util.is_exec(self._join(x)):
127 return 'x'
129 return 'x'
128 return ''
130 return ''
129 return f
131 return f
General Comments 0
You need to be logged in to leave comments. Login now