Show More
@@ -1,12 +1,19 | |||
|
1 | 1 | from __future__ import annotations |
|
2 | 2 | |
|
3 | 3 | import contextlib |
|
4 | import typing | |
|
4 | 5 | |
|
5 | 6 | from typing import ( |
|
7 | Callable, | |
|
6 | 8 | Protocol, |
|
7 | 9 | ) |
|
8 | 10 | |
|
9 | from . import util as interfaceutil | |
|
11 | if typing.TYPE_CHECKING: | |
|
12 | # Almost all mercurial modules are only imported in the type checking phase | |
|
13 | # to avoid circular imports | |
|
14 | from .. import ( | |
|
15 | match as matchmod, | |
|
16 | ) | |
|
10 | 17 | |
|
11 | 18 | |
|
12 | 19 | class idirstate(Protocol): |
@@ -31,16 +38,22 class idirstate(Protocol): | |||
|
31 | 38 | |
|
32 | 39 | # TODO: all these private methods and attributes should be made |
|
33 | 40 | # public or removed from the interface. |
|
34 | _ignore = interfaceutil.Attribute("""Matcher for ignored files.""") | |
|
35 | is_changing_any = interfaceutil.Attribute( | |
|
41 | ||
|
42 | # TODO: decorate with `@rootcache(b'.hgignore')` like dirstate class? | |
|
43 | _ignore: matchmod.basematcher | |
|
44 | """Matcher for ignored files.""" | |
|
45 | ||
|
46 | @property | |
|
47 | def is_changing_any(self) -> bool: | |
|
36 | 48 | """True if any changes in progress.""" |
|
37 | ) | |
|
38 | is_changing_parents = interfaceutil.Attribute( | |
|
49 | ||
|
50 | @property | |
|
51 | def is_changing_parents(self) -> bool: | |
|
39 | 52 | """True if parents changes in progress.""" |
|
40 | ) | |
|
41 | is_changing_files = interfaceutil.Attribute( | |
|
53 | ||
|
54 | @property | |
|
55 | def is_changing_files(self) -> bool: | |
|
42 | 56 | """True if file tracking changes in progress.""" |
|
43 | ) | |
|
44 | 57 | |
|
45 | 58 | def _ignorefiles(self): |
|
46 | 59 | """Return a list of files containing patterns to ignore.""" |
@@ -48,8 +61,19 class idirstate(Protocol): | |||
|
48 | 61 | def _ignorefileandline(self, f): |
|
49 | 62 | """Given a file `f`, return the ignore file and line that ignores it.""" |
|
50 | 63 | |
|
51 | _checklink = interfaceutil.Attribute("""Callable for checking symlinks.""") | |
|
52 | _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""") | |
|
64 | # TODO: decorate with `@util.propertycache` like dirstate class? | |
|
65 | # (can't because circular import) | |
|
66 | # TODO: The doc looks wrong- the core class has this as a @property, not a | |
|
67 | # callable. | |
|
68 | _checklink: Callable | |
|
69 | """Callable for checking symlinks.""" | |
|
70 | ||
|
71 | # TODO: decorate with `@util.propertycache` like dirstate class? | |
|
72 | # (can't because circular import) | |
|
73 | # TODO: The doc looks wrong- the core class has this as a @property, not a | |
|
74 | # callable. | |
|
75 | _checkexec: Callable | |
|
76 | """Callable for checking exec bits.""" | |
|
53 | 77 | |
|
54 | 78 | @contextlib.contextmanager |
|
55 | 79 | def changing_parents(self, repo): |
General Comments 0
You need to be logged in to leave comments.
Login now