Mercurial > hg
comparison mercurial/pure/parsers.py @ 48222:7e78c72ee3ea
dirstate-v2: Initial Python serializer
This adds code seralizing a `map` and `copy_map` dicts into dirstate-v2
file formate. This is not used yet.
Differential Revision: https://phab.mercurial-scm.org/D11519
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 22 Jul 2021 17:31:37 +0200 |
parents | a32a96079e2d |
children | db5897321351 |
comparison
equal
deleted
inserted
replaced
48221:a32a96079e2d | 48222:7e78c72ee3ea |
---|---|
311 @property | 311 @property |
312 def removed(self): | 312 def removed(self): |
313 """True if the file has been removed""" | 313 """True if the file has been removed""" |
314 return not self._wc_tracked and (self._p1_tracked or self._p2_info) | 314 return not self._wc_tracked and (self._p1_tracked or self._p2_info) |
315 | 315 |
316 def v2_data(self): | |
317 """Returns (flags, mode, size, mtime) for v2 serialization""" | |
318 flags = 0 | |
319 if self._wc_tracked: | |
320 flags |= DIRSTATE_V2_WDIR_TRACKED | |
321 if self._p1_tracked: | |
322 flags |= DIRSTATE_V2_P1_TRACKED | |
323 if self._p2_info: | |
324 flags |= DIRSTATE_V2_P2_INFO | |
325 if self.mode is not None and self.size is not None: | |
326 flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE | |
327 if self.mode & stat.S_IXUSR: | |
328 flags |= DIRSTATE_V2_MODE_EXEC_PERM | |
329 if stat.S_ISLNK(self.mode): | |
330 flags |= DIRSTATE_V2_MODE_IS_SYMLINK | |
331 if self.mtime is not None: | |
332 flags |= DIRSTATE_V2_HAS_MTIME | |
333 return (flags, self.size or 0, self.mtime or 0) | |
334 | |
316 def v1_state(self): | 335 def v1_state(self): |
317 """return a "state" suitable for v1 serialization""" | 336 """return a "state" suitable for v1 serialization""" |
318 if not self.any_tracked: | 337 if not self.any_tracked: |
319 # the object has no state to record, this is -currently- | 338 # the object has no state to record, this is -currently- |
320 # unsupported | 339 # unsupported |