comparison mercurial/dirstate.py @ 47988:d459c6b84961

dirstate: inline the last two `_drop` usage The function is small and having the associated code directly inline help use to cleanup the dirstate API. Differential Revision: https://phab.mercurial-scm.org/D11428
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Sep 2021 10:20:25 +0200
parents dd267f16042f
children 87b3010c08e0
comparison
equal deleted inserted replaced
47987:dd267f16042f 47988:d459c6b84961
558 # the underlying reference might have changed, we will have to 558 # the underlying reference might have changed, we will have to
559 # check it. 559 # check it.
560 possibly_dirty = True 560 possibly_dirty = True
561 elif not (p1_tracked or wc_tracked): 561 elif not (p1_tracked or wc_tracked):
562 # the file is no longer relevant to anyone 562 # the file is no longer relevant to anyone
563 self._drop(filename) 563 if self._map.dropfile(filename):
564 self._dirty = True
565 self._updatedfiles.add(filename)
564 elif (not p1_tracked) and wc_tracked: 566 elif (not p1_tracked) and wc_tracked:
565 if entry is not None and entry.added: 567 if entry is not None and entry.added:
566 return # avoid dropping copy information (maybe?) 568 return # avoid dropping copy information (maybe?)
567 elif p1_tracked and not wc_tracked: 569 elif p1_tracked and not wc_tracked:
568 pass 570 pass
740 elif entry.merged or entry.from_p2: 742 elif entry.merged or entry.from_p2:
741 return 743 return
742 self._addpath(f, possibly_dirty=True) 744 self._addpath(f, possibly_dirty=True)
743 self._map.copymap.pop(f, None) 745 self._map.copymap.pop(f, None)
744 746
745 def _drop(self, filename):
746 """internal function to drop a file from the dirstate"""
747 if self._map.dropfile(filename):
748 self._dirty = True
749 self._updatedfiles.add(filename)
750
751 def _discoverpath(self, path, normed, ignoremissing, exists, storemap): 747 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
752 if exists is None: 748 if exists is None:
753 exists = os.path.lexists(os.path.join(self._root, path)) 749 exists = os.path.lexists(os.path.join(self._root, path))
754 if not exists: 750 if not exists:
755 # Maybe a path component exists 751 # Maybe a path component exists
858 self._map.setparents(parent, self._nodeconstants.nullid) 854 self._map.setparents(parent, self._nodeconstants.nullid)
859 855
860 for f in to_lookup: 856 for f in to_lookup:
861 self._normallookup(f) 857 self._normallookup(f)
862 for f in to_drop: 858 for f in to_drop:
863 self._drop(f) 859 if self._map.dropfile(f):
860 self._updatedfiles.add(f)
864 861
865 self._dirty = True 862 self._dirty = True
866 863
867 def identity(self): 864 def identity(self):
868 """Return identity of dirstate itself to detect changing in storage 865 """Return identity of dirstate itself to detect changing in storage