interfaces: mark a few dirstate methods abstract
I'm not sure what's going on here, but when enabling pytype checking on this
package, it spits out the following errors:
File "/mnt/c/Users/Matt/hg/mercurial/interfaces/dirstate.py", line 136, in changing_parents:
bad return type [bad-return-type]
Expected: Iterator
Actually returned: None
Attributes of protocol Iterator are not implemented on None: __next__
File "/mnt/c/Users/Matt/hg/mercurial/interfaces/dirstate.py", line 145, in changing_files:
bad return type [bad-return-type]
Expected: Iterator
Actually returned: None
Attributes of protocol Iterator are not implemented on None: __next__
I guess technically that's true, because these methods only have a doc comment,
and don't explicitly return something or unconditionally raise an error. The
strange thing is that both before and after this change, the *.pyi file that is
generated is unchanged, and contains:
def changing_files(self, repo) -> contextlib._GeneratorContextManager: ...
def changing_parents(self, repo) -> contextlib._GeneratorContextManager: ...
I'm not sure if the `@abstractmethod` should be the most inner or most outer
decoration. We'll roll the dice with being the innermost, because that's how
`@abstractproperty` says it should be used in conjunction with `@property`.
We should probably make all of the methods without an actual body abstract, like
was done for some `mercurial.wireprototypes` classes in fd200f5bcaea. But let's
hold off for now and do that enmass later.
tests: replace ersatz Traceback filtering with test utility
I wasn't aware of this utility until recently, but it seems to be used a lot in
tests that expect tracebacks.
tests: fix `filtertraceback.py` to handle contiguous "File" lines
It looks like it assumed each `" File"` line would be followed by the code at
the referenced line, but that's not true of a few things in `test-hook.t`. That
and the fact that there are an odd number of them in that test caused the
`self.loader.exec_module(module)` line below to leak through in non-chg tests,
when the filter is applied in `test-hook.t`:
Traceback (most recent call last):
File "C:\Users\Matt\hg\mercurial\hook.py", line 62, in pythonhook
obj = __import__(pycompat.sysstr(modname))
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "C:\Users\Matt\hg\hgdemandimport\demandimportpy3.py", line 52, in exec_module
self.loader.exec_module(module)
File "$TESTTMP\b\syntaxerror.py", line 1
(foo
config: return component from `repo_components`
We used to returns just paths. However using the same return types as
`rccomponents` will be quite useful later in this series.
repo-config: move rc component of repository inside `rcutil`
This gather logic about where to find config file in the same location.
This also reduce the amount of logic we do in dispatch.py which is a win in
itself.
repo-config: adjust "root" path for parsing shared config
That "root" argument is used to resolve relative path in the config. For a
repository config it is expected to be the root of the working copy (the
directory that contains the `.hg` directory). Before this patch, the config was
loaded using the `.hg/` directory of the share source, this is not the right
directory and would break in all cases.
Instead we use the working copy directory of the share. This is not always
good, if some relative path we pointing inside the source's `.hg`. However that
is better than something plain wrong. Also this is the right answer for all
path that refer to the actual working copy.
Fixing this ambiguity is left as an exercises to a future developer. At least we no longer use a plain invalid value.