# HG changeset patch # User Matt Harbison # Date 2024-08-16 21:58:17 # Node ID 0b2c978f595fb3984488eb3c5b442acc6b3a1653 # Parent 95cdc01f313d3580afe569166262415af5931637 largefiles: sync up `largefilesdirstate` methods with `dirstate` base class As it currently stands, pytype infers the `dirstate` class (and anything else decorated with `@interfaceutil.implementer`) as `Any`. When that is worked around, it suddenly noticed that most of these methods don't exist in the `dirstate` class anymore. Since they only called into the missing methods and there's no test failures, we can assume these are never called, and they can be dropped. In addition, PyCharm flagged `set_tracked()` and `_ignore()` as not overriding a superclass method with the same arguments. The missing default parameter for the former was the obvious issue. I'm guessing that the latter was named wrong because while there is `_ignore()` in the base class, it takes no arguments and returns a matcher. The `_ignorefiles()` superclass method also takes no args, and returns a list of bytes. The `_ignorefileandline()` superclass method DOES take a file, but returns a tuple. Therefore, the closest match is `_dirignore()`, which takes a file AND returns a bool. No idea why this needs to be overridden though. diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -162,36 +162,18 @@ class largefilesdirstate(dirstate.dirsta _large_file_dirstate = True _tr_key_suffix = b'-large-files' - def __getitem__(self, key): - return super(largefilesdirstate, self).__getitem__(unixpath(key)) + # XXX: why are there overrides to fix the path, if the path should already + # be in unix form for the superclass? - def set_tracked(self, f): - return super(largefilesdirstate, self).set_tracked(unixpath(f)) + def set_tracked(self, f, reset_copy=False): + return super(largefilesdirstate, self).set_tracked( + unixpath(f), reset_copy=reset_copy + ) def set_untracked(self, f): return super(largefilesdirstate, self).set_untracked(unixpath(f)) - def normal(self, f, parentfiledata=None): - # not sure if we should pass the `parentfiledata` down or throw it - # away. So throwing it away to stay on the safe side. - return super(largefilesdirstate, self).normal(unixpath(f)) - - def remove(self, f): - return super(largefilesdirstate, self).remove(unixpath(f)) - - def add(self, f): - return super(largefilesdirstate, self).add(unixpath(f)) - - def drop(self, f): - return super(largefilesdirstate, self).drop(unixpath(f)) - - def forget(self, f): - return super(largefilesdirstate, self).forget(unixpath(f)) - - def normallookup(self, f): - return super(largefilesdirstate, self).normallookup(unixpath(f)) - - def _ignore(self, f): + def _dirignore(self, f): return False def write(self, tr):