Mercurial > hg
diff mercurial/dirstatemap.py @ 47905:c0d6a59a7704
dirstate-item: add dedicated "legacy" constructor for `addfile` case
This way the internal details of how a DirstateItem is encoded is encapsulated
within the DirstateItem. This will finally give use some latitude to change the
data we store in a DirstateItem.
The addfile logic will likely be rewritten eventually and these dedicated
constructor can be removed at that time.
In the mean-time this should help with hiding internal details of DirstateItem
and to migrate it to new internal storage and logic.
Differential Revision: https://phab.mercurial-scm.org/D11330
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 16 Jul 2021 18:12:27 +0200 |
parents | 822c67420c77 |
children | 50ded8854f8d |
line wrap: on
line diff
--- a/mercurial/dirstatemap.py Fri Jul 16 17:32:40 2021 +0200 +++ b/mercurial/dirstatemap.py Fri Jul 16 18:12:27 2021 +0200 @@ -188,42 +188,28 @@ assert not merged assert not possibly_dirty assert not from_p2 - state = b'a' - size = NONNORMAL - mtime = AMBIGUOUS_TIME + new_entry = DirstateItem.new_added() elif merged: assert not possibly_dirty assert not from_p2 - state = b'm' - size = FROM_P2 - mtime = AMBIGUOUS_TIME + new_entry = DirstateItem.new_merged() elif from_p2: assert not possibly_dirty - state = b'n' - size = FROM_P2 - mtime = AMBIGUOUS_TIME + new_entry = DirstateItem.new_from_p2() elif possibly_dirty: - state = b'n' - size = NONNORMAL - mtime = AMBIGUOUS_TIME + new_entry = DirstateItem.new_possibly_dirty() else: - assert size != FROM_P2 - assert size != NONNORMAL assert size is not None assert mtime is not None - - state = b'n' size = size & rangemask mtime = mtime & rangemask - assert state is not None - assert size is not None - assert mtime is not None + new_entry = DirstateItem.new_normal(mode, size, mtime) old_entry = self.get(f) self._dirs_incr(f, old_entry) - e = self._map[f] = DirstateItem.from_v1_data(state, mode, size, mtime) - if e.dm_nonnormal: + self._map[f] = new_entry + if new_entry.dm_nonnormal: self.nonnormalset.add(f) - if e.dm_otherparent: + if new_entry.dm_otherparent: self.otherparentset.add(f) def reset_state(