comparison mercurial/pure/parsers.py @ 48252:602c8e8411f5

dirstate: add a concept of "fallback" flags to dirstate item The concept is defined and "used" by the flag code, but it is neither persisted nor set anywhere yet. We currently focus on defining the semantic of the attribute. More to come in the next changesets Check the inline documentation for details. Differential Revision: https://phab.mercurial-scm.org/D11686
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 18 Oct 2021 20:02:15 +0200
parents dfc5a505ddc5
children 948570aa7630
comparison
equal deleted inserted replaced
48251:dfc5a505ddc5 48252:602c8e8411f5
94 _p1_tracked = attr.ib() 94 _p1_tracked = attr.ib()
95 _p2_info = attr.ib() 95 _p2_info = attr.ib()
96 _mode = attr.ib() 96 _mode = attr.ib()
97 _size = attr.ib() 97 _size = attr.ib()
98 _mtime = attr.ib() 98 _mtime = attr.ib()
99 _fallback_exec = attr.ib()
100 _fallback_symlink = attr.ib()
99 101
100 def __init__( 102 def __init__(
101 self, 103 self,
102 wc_tracked=False, 104 wc_tracked=False,
103 p1_tracked=False, 105 p1_tracked=False,
107 parentfiledata=None, 109 parentfiledata=None,
108 ): 110 ):
109 self._wc_tracked = wc_tracked 111 self._wc_tracked = wc_tracked
110 self._p1_tracked = p1_tracked 112 self._p1_tracked = p1_tracked
111 self._p2_info = p2_info 113 self._p2_info = p2_info
114
115 self._fallback_exec = None
116 self._fallback_symlink = None
112 117
113 self._mode = None 118 self._mode = None
114 self._size = None 119 self._size = None
115 self._mtime = None 120 self._mtime = None
116 if parentfiledata is None: 121 if parentfiledata is None:
280 if not self.any_tracked: 285 if not self.any_tracked:
281 return b'?' 286 return b'?'
282 return self.v1_state() 287 return self.v1_state()
283 288
284 @property 289 @property
290 def has_fallback_exec(self):
291 """True if "fallback" information are available for the "exec" bit
292
293 Fallback information can be stored in the dirstate to keep track of
294 filesystem attribute tracked by Mercurial when the underlying file
295 system or operating system does not support that property, (e.g.
296 Windows).
297
298 Not all version of the dirstate on-disk storage support preserving this
299 information.
300 """
301 return self._fallback_exec is not None
302
303 @property
304 def fallback_exec(self):
305 """ "fallback" information for the executable bit
306
307 True if the file should be considered executable when we cannot get
308 this information from the files system. False if it should be
309 considered non-executable.
310
311 See has_fallback_exec for details."""
312 return self._fallback_exec
313
314 @fallback_exec.setter
315 def set_fallback_exec(self, value):
316 """control "fallback" executable bit
317
318 Set to:
319 - True if the file should be considered executable,
320 - False if the file should be considered non-executable,
321 - None if we do not have valid fallback data.
322
323 See has_fallback_exec for details."""
324 if value is None:
325 self._fallback_exec = None
326 else:
327 self._fallback_exec = bool(value)
328
329 @property
330 def has_fallback_symlink(self):
331 """True if "fallback" information are available for symlink status
332
333 Fallback information can be stored in the dirstate to keep track of
334 filesystem attribute tracked by Mercurial when the underlying file
335 system or operating system does not support that property, (e.g.
336 Windows).
337
338 Not all version of the dirstate on-disk storage support preserving this
339 information."""
340 return self._fallback_symlink is not None
341
342 @property
343 def fallback_symlink(self):
344 """ "fallback" information for symlink status
345
346 True if the file should be considered executable when we cannot get
347 this information from the files system. False if it should be
348 considered non-executable.
349
350 See has_fallback_exec for details."""
351 return self._fallback_symlink
352
353 @fallback_symlink.setter
354 def set_fallback_symlink(self, value):
355 """control "fallback" symlink status
356
357 Set to:
358 - True if the file should be considered a symlink,
359 - False if the file should be considered not a symlink,
360 - None if we do not have valid fallback data.
361
362 See has_fallback_symlink for details."""
363 if value is None:
364 self._fallback_symlink = None
365 else:
366 self._fallback_symlink = bool(value)
367
368 @property
285 def tracked(self): 369 def tracked(self):
286 """True is the file is tracked in the working copy""" 370 """True is the file is tracked in the working copy"""
287 return self._wc_tracked 371 return self._wc_tracked
288 372
289 @property 373 @property