Mercurial > hg-stable
changeset 47741:9f19d9f2d191
dirstate: deprecate the `normallookup` method in all cases
All code have been migrated to the new APIs.
Differential Revision: https://phab.mercurial-scm.org/D11183
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 19 Jul 2021 00:26:02 +0200 |
parents | 28d5e05c139a |
children | f51aaa0f1485 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Jul 19 15:41:51 2021 +0200 +++ b/mercurial/dirstate.py Mon Jul 19 00:26:02 2021 +0200 @@ -403,7 +403,7 @@ source = self._map.copymap.get(f) if source: copies[f] = source - self.normallookup(f) + self._normallookup(f) # Also fix up otherparent markers elif s.from_p2: source = self._map.copymap.get(f) @@ -476,7 +476,7 @@ self._add(filename) return True elif not entry.tracked: - self.normallookup(filename) + self._normallookup(filename) return True # XXX This is probably overkill for more case, but we need this to # fully replace the `normallookup` call with `set_tracked` one. @@ -746,6 +746,24 @@ def normallookup(self, f): '''Mark a file normal, but possibly dirty.''' + if self.pendingparentchange(): + util.nouideprecwarn( + b"do not use `normallookup` inside of update/merge context." + b" Use `update_file` or `update_file_p1`", + b'6.0', + stacklevel=2, + ) + else: + util.nouideprecwarn( + b"do not use `normallookup` outside of update/merge context." + b" Use `set_possibly_dirty` or `set_tracked`", + b'6.0', + stacklevel=2, + ) + self._normallookup(f) + + def _normallookup(self, f): + '''Mark a file normal, but possibly dirty.''' if self.in_merge: # if there is a merge going on and the file was either # "merged" or coming from other parent (-2) before @@ -825,7 +843,7 @@ def merge(self, f): '''Mark a file merged.''' if not self.in_merge: - return self.normallookup(f) + return self._normallookup(f) return self.otherparent(f) def drop(self, f): @@ -956,7 +974,7 @@ self._map.setparents(parent, self._nodeconstants.nullid) for f in to_lookup: - self.normallookup(f) + self._normallookup(f) for f in to_drop: self._drop(f)