comparison mercurial/dirstatemap.py @ 48128:a8ff00ad290b

dirstatemap: add a common `_insert_entry` method for dirstatemap This method is called to add a new DirstateItem to the map. Each variant have a different implementation (which is … the point). Differential Revision: https://phab.mercurial-scm.org/D11573
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Oct 2021 23:13:44 +0200
parents ced8cf9c4905
children a39192fc7c56
comparison
equal deleted inserted replaced
48127:ced8cf9c4905 48128:a8ff00ad290b
98 tracking in a different way. 98 tracking in a different way.
99 """ 99 """
100 100
101 def _refresh_entry(self, f, entry): 101 def _refresh_entry(self, f, entry):
102 """record updated state of an entry""" 102 """record updated state of an entry"""
103
104 def _insert_entry(self, f, entry):
105 """add a new dirstate entry (or replace an unrelated one)
106
107 The fact it is actually new is the responsability of the caller
108 """
103 109
104 ### method to manipulate the entries 110 ### method to manipulate the entries
105 111
106 def set_untracked(self, f): 112 def set_untracked(self, f):
107 """Mark a file as no longer tracked in the dirstate map""" 113 """Mark a file as no longer tracked in the dirstate map"""
400 ### code related to manipulation of entries and copy-sources 406 ### code related to manipulation of entries and copy-sources
401 407
402 def _refresh_entry(self, f, entry): 408 def _refresh_entry(self, f, entry):
403 if not entry.any_tracked: 409 if not entry.any_tracked:
404 self._map.pop(f, None) 410 self._map.pop(f, None)
411
412 def _insert_entry(self, f, entry):
413 self._map[f] = entry
405 414
406 def set_possibly_dirty(self, filename): 415 def set_possibly_dirty(self, filename):
407 """record that the current state of the file on disk is unknown""" 416 """record that the current state of the file on disk is unknown"""
408 self[filename].set_possibly_dirty() 417 self[filename].set_possibly_dirty()
409 418
782 if not entry.any_tracked: 791 if not entry.any_tracked:
783 self._map.drop_item_and_copy_source(f) 792 self._map.drop_item_and_copy_source(f)
784 else: 793 else:
785 self._map.addfile(f, entry) 794 self._map.addfile(f, entry)
786 795
796 def _insert_entry(self, f, entry):
797 self._map.addfile(f, entry)
798
787 def set_possibly_dirty(self, filename): 799 def set_possibly_dirty(self, filename):
788 """record that the current state of the file on disk is unknown""" 800 """record that the current state of the file on disk is unknown"""
789 entry = self[filename] 801 entry = self[filename]
790 entry.set_possibly_dirty() 802 entry.set_possibly_dirty()
791 self._map.set_dirstate_item(filename, entry) 803 self._map.set_dirstate_item(filename, entry)