Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Fri Oct 15 16:33:19 2021 +0200 +++ b/mercurial/pure/parsers.py Mon Oct 18 20:02:15 2021 +0200 @@ -96,6 +96,8 @@ _mode = attr.ib() _size = attr.ib() _mtime = attr.ib() + _fallback_exec = attr.ib() + _fallback_symlink = attr.ib() def __init__( self, @@ -110,6 +112,9 @@ self._p1_tracked = p1_tracked self._p2_info = p2_info + self._fallback_exec = None + self._fallback_symlink = None + self._mode = None self._size = None self._mtime = None @@ -282,6 +287,85 @@ return self.v1_state() @property + def has_fallback_exec(self): + """True if "fallback" information are available for the "exec" bit + + Fallback information can be stored in the dirstate to keep track of + filesystem attribute tracked by Mercurial when the underlying file + system or operating system does not support that property, (e.g. + Windows). + + Not all version of the dirstate on-disk storage support preserving this + information. + """ + return self._fallback_exec is not None + + @property + def fallback_exec(self): + """ "fallback" information for the executable bit + + True if the file should be considered executable when we cannot get + this information from the files system. False if it should be + considered non-executable. + + See has_fallback_exec for details.""" + return self._fallback_exec + + @fallback_exec.setter + def set_fallback_exec(self, value): + """control "fallback" executable bit + + Set to: + - True if the file should be considered executable, + - False if the file should be considered non-executable, + - None if we do not have valid fallback data. + + See has_fallback_exec for details.""" + if value is None: + self._fallback_exec = None + else: + self._fallback_exec = bool(value) + + @property + def has_fallback_symlink(self): + """True if "fallback" information are available for symlink status + + Fallback information can be stored in the dirstate to keep track of + filesystem attribute tracked by Mercurial when the underlying file + system or operating system does not support that property, (e.g. + Windows). + + Not all version of the dirstate on-disk storage support preserving this + information.""" + return self._fallback_symlink is not None + + @property + def fallback_symlink(self): + """ "fallback" information for symlink status + + True if the file should be considered executable when we cannot get + this information from the files system. False if it should be + considered non-executable. + + See has_fallback_exec for details.""" + return self._fallback_symlink + + @fallback_symlink.setter + def set_fallback_symlink(self, value): + """control "fallback" symlink status + + Set to: + - True if the file should be considered a symlink, + - False if the file should be considered not a symlink, + - None if we do not have valid fallback data. + + See has_fallback_symlink for details.""" + if value is None: + self._fallback_symlink = None + else: + self._fallback_symlink = bool(value) + + @property def tracked(self): """True is the file is tracked in the working copy""" return self._wc_tracked