Mercurial > hg
comparison mercurial/dirstatemap.py @ 48045:32ef647821b2
dirstate: Skip no-op conversion in Rust DirstateMap::set_v1
Now that the `DirstateItem` python class is implemented in Rust containing
a `DirstateEntry` value, use that value directly instead of reconstructing
it from v1 data.
Also rename from `set_v1` since dirstate-v1 data is not used anymore.
Differential Revision: https://phab.mercurial-scm.org/D11487
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 18:21:58 +0200 |
parents | d5528ac9b4f2 |
children | 76f1c76186a1 |
comparison
equal
deleted
inserted
replaced
48044:d5528ac9b4f2 | 48045:32ef647821b2 |
---|---|
662 if entry is None: | 662 if entry is None: |
663 self.addfile(filename, added=True) | 663 self.addfile(filename, added=True) |
664 new = True | 664 new = True |
665 elif not entry.tracked: | 665 elif not entry.tracked: |
666 entry.set_tracked() | 666 entry.set_tracked() |
667 self._rustmap.set_v1(filename, entry) | 667 self._rustmap.set_dirstate_item(filename, entry) |
668 new = True | 668 new = True |
669 else: | 669 else: |
670 # XXX This is probably overkill for more case, but we need this to | 670 # XXX This is probably overkill for more case, but we need this to |
671 # fully replace the `normallookup` call with `set_tracked` one. | 671 # fully replace the `normallookup` call with `set_tracked` one. |
672 # Consider smoothing this in the future. | 672 # Consider smoothing this in the future. |
947 | 947 |
948 def set_possibly_dirty(self, filename): | 948 def set_possibly_dirty(self, filename): |
949 """record that the current state of the file on disk is unknown""" | 949 """record that the current state of the file on disk is unknown""" |
950 entry = self[filename] | 950 entry = self[filename] |
951 entry.set_possibly_dirty() | 951 entry.set_possibly_dirty() |
952 self._rustmap.set_v1(filename, entry) | 952 self._rustmap.set_dirstate_item(filename, entry) |
953 | 953 |
954 def set_clean(self, filename, mode, size, mtime): | 954 def set_clean(self, filename, mode, size, mtime): |
955 """mark a file as back to a clean state""" | 955 """mark a file as back to a clean state""" |
956 entry = self[filename] | 956 entry = self[filename] |
957 mtime = mtime & rangemask | 957 mtime = mtime & rangemask |
958 size = size & rangemask | 958 size = size & rangemask |
959 entry.set_clean(mode, size, mtime) | 959 entry.set_clean(mode, size, mtime) |
960 self._rustmap.set_v1(filename, entry) | 960 self._rustmap.set_dirstate_item(filename, entry) |
961 self._rustmap.copymap().pop(filename, None) | 961 self._rustmap.copymap().pop(filename, None) |
962 | 962 |
963 def __setitem__(self, key, value): | 963 def __setitem__(self, key, value): |
964 assert isinstance(value, DirstateItem) | 964 assert isinstance(value, DirstateItem) |
965 self._rustmap.set_v1(key, value) | 965 self._rustmap.set_dirstate_item(key, value) |