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
--- 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)