##// END OF EJS Templates
dirstate: group return logic and clarify each function in flagfunc...
Raphaël Gomès -
r49103:0d6a099b default
parent child Browse files
Show More
@@ -242,9 +242,11 b' class dirstate(object):'
242 242 return self._rootdir + f
243 243
244 244 def flagfunc(self, buildfallback):
245 if self._checklink and self._checkexec:
245 if not (self._checklink and self._checkexec):
246 fallback = buildfallback()
246 247
247 def f(x):
248 def check_both(x):
249 """This platform supports symlinks and exec permissions"""
248 250 try:
249 251 st = os.lstat(self._join(x))
250 252 if util.statislink(st):
@@ -255,12 +257,8 b' class dirstate(object):'
255 257 pass
256 258 return b''
257 259
258 return f
259
260 fallback = buildfallback()
261 if self._checklink:
262
263 def f(x):
260 def check_link(x):
261 """This platform only supports symlinks"""
264 262 if os.path.islink(self._join(x)):
265 263 return b'l'
266 264 entry = self.get_entry(x)
@@ -271,10 +269,8 b' class dirstate(object):'
271 269 return b'x'
272 270 return b''
273 271
274 return f
275 if self._checkexec:
276
277 def f(x):
272 def check_exec(x):
273 """This platform only supports exec permissions"""
278 274 if b'l' in fallback(x):
279 275 return b'l'
280 276 entry = self.get_entry(x)
@@ -285,10 +281,10 b' class dirstate(object):'
285 281 return b'x'
286 282 return b''
287 283
288 return f
289 else:
290
291 def f(x):
284 def check_fallback(x):
285 """This platform supports neither symlinks nor exec permissions, so
286 check the fallback in the dirstate if it exists, otherwise figure it
287 out the more expensive way from the parents."""
292 288 entry = self.get_entry(x)
293 289 if entry.has_fallback_symlink:
294 290 if entry.fallback_symlink:
@@ -300,7 +296,14 b' class dirstate(object):'
300 296 return b''
301 297 return fallback(x)
302 298
303 return f
299 if self._checklink and self._checkexec:
300 return check_both
301 elif self._checklink:
302 return check_link
303 elif self._checkexec:
304 return check_exec
305 else:
306 return check_fallback
304 307
305 308 @propertycache
306 309 def _cwd(self):
General Comments 0
You need to be logged in to leave comments. Login now