Mercurial > hg
comparison mercurial/dirstatemap.py @ 47893:0b35bc0b8636
dirstatemap: temporarily use `from_v1_data` in `addfile`
We are about to change the `__init__` for `DirstateItem`. To make the
transition easier, we move existing caller to `DirstateItem.from_v1_data`.
Differential Revision: https://phab.mercurial-scm.org/D11318
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 16 Jul 2021 16:30:52 +0200 |
parents | 3853e6ee160d |
children | 226c7dbeea11 |
comparison
equal
deleted
inserted
replaced
47892:32aa80a8d162 | 47893:0b35bc0b8636 |
---|---|
218 assert state is not None | 218 assert state is not None |
219 assert size is not None | 219 assert size is not None |
220 assert mtime is not None | 220 assert mtime is not None |
221 old_entry = self.get(f) | 221 old_entry = self.get(f) |
222 self._dirs_incr(f, old_entry) | 222 self._dirs_incr(f, old_entry) |
223 e = self._map[f] = DirstateItem(state, mode, size, mtime) | 223 e = self._map[f] = DirstateItem.from_v1_data(state, mode, size, mtime) |
224 if e.dm_nonnormal: | 224 if e.dm_nonnormal: |
225 self.nonnormalset.add(f) | 225 self.nonnormalset.add(f) |
226 if e.dm_otherparent: | 226 if e.dm_otherparent: |
227 self.otherparentset.add(f) | 227 self.otherparentset.add(f) |
228 | 228 |
271 self.addfile(filename, added=True, possibly_dirty=possibly_dirty) | 271 self.addfile(filename, added=True, possibly_dirty=possibly_dirty) |
272 elif (p1_tracked or p2_tracked) and not wc_tracked: | 272 elif (p1_tracked or p2_tracked) and not wc_tracked: |
273 # XXX might be merged and removed ? | 273 # XXX might be merged and removed ? |
274 old_entry = self._map.get(filename) | 274 old_entry = self._map.get(filename) |
275 self._dirs_decr(filename, old_entry=old_entry, remove_variant=True) | 275 self._dirs_decr(filename, old_entry=old_entry, remove_variant=True) |
276 self._map[filename] = DirstateItem(b'r', 0, 0, 0) | 276 self._map[filename] = DirstateItem.from_v1_data(b'r', 0, 0, 0) |
277 self.nonnormalset.add(filename) | 277 self.nonnormalset.add(filename) |
278 elif clean_p2 and wc_tracked: | 278 elif clean_p2 and wc_tracked: |
279 if p1_tracked or self.get(filename) is not None: | 279 if p1_tracked or self.get(filename) is not None: |
280 # XXX the `self.get` call is catching some case in | 280 # XXX the `self.get` call is catching some case in |
281 # `test-merge-remove.t` where the file is tracked in p1, the | 281 # `test-merge-remove.t` where the file is tracked in p1, the |