Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pure/parsers.py @ 48244:f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Previously the same flag was used, with its meaning based on whether the node
otherwise identifies a file tracked anywhere.
In addition to being more explicit, this enables storing a directory mtime
if a given path used to be tracked in a parent commit (so the dirstate still
has data about it) but became a directory in the working copy.
(However this is not done yet as it would require a larger change,
replacing the `dirstate_map::NodeData` enum with struct fields.)
Differential Revision: https://phab.mercurial-scm.org/D11662
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 14 Oct 2021 16:39:16 +0200 |
parents | db5897321351 |
children | 1730b2fceaa1 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Thu Oct 14 16:06:31 2021 +0200 +++ b/mercurial/pure/parsers.py Thu Oct 14 16:39:16 2021 +0200 @@ -49,9 +49,10 @@ DIRSTATE_V2_P1_TRACKED = 1 << 1 DIRSTATE_V2_P2_INFO = 1 << 2 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3 -DIRSTATE_V2_HAS_MTIME = 1 << 4 -DIRSTATE_V2_MODE_EXEC_PERM = 1 << 5 -DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 6 +DIRSTATE_V2_HAS_FILE_MTIME = 1 << 4 +_DIRSTATE_V2_HAS_DIRCTORY_MTIME = 1 << 5 # Unused when Rust is not available +DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6 +DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7 @attr.s(slots=True, init=False) @@ -138,7 +139,7 @@ p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED), p2_info=bool(flags & DIRSTATE_V2_P2_INFO), has_meaningful_data=has_mode_size, - has_meaningful_mtime=bool(flags & DIRSTATE_V2_HAS_MTIME), + has_meaningful_mtime=bool(flags & DIRSTATE_V2_HAS_FILE_MTIME), parentfiledata=(mode, size, mtime), ) @@ -329,7 +330,7 @@ if stat.S_ISLNK(self.mode): flags |= DIRSTATE_V2_MODE_IS_SYMLINK if self._mtime is not None: - flags |= DIRSTATE_V2_HAS_MTIME + flags |= DIRSTATE_V2_HAS_FILE_MTIME return (flags, self._size or 0, self._mtime or 0) def v1_state(self):