Show More
@@ -62,7 +62,7 b' def debugremotefilelog(ui, path, **opts)' | |||||
62 | queue.append(p2) |
|
62 | queue.append(p2) | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | def buildtemprevlog(repo, file): |
|
65 | def buildtemprevlog(repo, file) -> filelog.FileLog: | |
66 | # get filename key |
|
66 | # get filename key | |
67 | filekey = hex(hashutil.sha1(file).digest()) |
|
67 | filekey = hex(hashutil.sha1(file).digest()) | |
68 | filedir = os.path.join(repo.path, b'store/data', filekey) |
|
68 | filedir = os.path.join(repo.path, b'store/data', filekey) |
@@ -8,6 +8,10 b'' | |||||
8 |
|
8 | |||
9 | import collections |
|
9 | import collections | |
10 |
|
10 | |||
|
11 | from typing import ( | |||
|
12 | Iterator, | |||
|
13 | ) | |||
|
14 | ||||
11 | from mercurial.node import bin |
|
15 | from mercurial.node import bin | |
12 | from mercurial.i18n import _ |
|
16 | from mercurial.i18n import _ | |
13 | from mercurial import ( |
|
17 | from mercurial import ( | |
@@ -296,7 +300,7 b' class remotefilelog:' | |||||
296 | deltamode=None, |
|
300 | deltamode=None, | |
297 | sidedata_helpers=None, |
|
301 | sidedata_helpers=None, | |
298 | debug_info=None, |
|
302 | debug_info=None, | |
299 | ): |
|
303 | ) -> Iterator[revlog.RevLogRevisionDelta]: | |
300 | # we don't use any of these parameters here |
|
304 | # we don't use any of these parameters here | |
301 | del nodesorder, revisiondata, assumehaveparentrevisions, deltaprevious |
|
305 | del nodesorder, revisiondata, assumehaveparentrevisions, deltaprevious | |
302 | del deltamode |
|
306 | del deltamode |
@@ -8,6 +8,11 b'' | |||||
8 |
|
8 | |||
9 | import typing |
|
9 | import typing | |
10 |
|
10 | |||
|
11 | from typing import ( | |||
|
12 | Iterable, | |||
|
13 | Iterator, | |||
|
14 | ) | |||
|
15 | ||||
11 | from .i18n import _ |
|
16 | from .i18n import _ | |
12 | from .node import nullrev |
|
17 | from .node import nullrev | |
13 | from . import ( |
|
18 | from . import ( | |
@@ -26,6 +31,10 b' from .revlogutils import (' | |||||
26 |
|
31 | |||
27 |
|
32 | |||
28 | class FileLog: |
|
33 | class FileLog: | |
|
34 | _revlog: revlog.revlog | |||
|
35 | nullid: bytes | |||
|
36 | _fix_issue6528: bool | |||
|
37 | ||||
29 | def __init__(self, opener, path, try_split=False): |
|
38 | def __init__(self, opener, path, try_split=False): | |
30 | self._revlog = revlog.revlog( |
|
39 | self._revlog = revlog.revlog( | |
31 | opener, |
|
40 | opener, | |
@@ -43,7 +52,7 b' class FileLog:' | |||||
43 | opts = opener.options |
|
52 | opts = opener.options | |
44 | self._fix_issue6528 = opts.get(b'issue6528.fix-incoming', True) |
|
53 | self._fix_issue6528 = opts.get(b'issue6528.fix-incoming', True) | |
45 |
|
54 | |||
46 | def get_revlog(self): |
|
55 | def get_revlog(self) -> revlog.revlog: | |
47 | """return an actual revlog instance if any |
|
56 | """return an actual revlog instance if any | |
48 |
|
57 | |||
49 | This exist because a lot of code leverage the fact the underlying |
|
58 | This exist because a lot of code leverage the fact the underlying | |
@@ -52,10 +61,10 b' class FileLog:' | |||||
52 | """ |
|
61 | """ | |
53 | return self._revlog |
|
62 | return self._revlog | |
54 |
|
63 | |||
55 | def __len__(self): |
|
64 | def __len__(self) -> int: | |
56 | return len(self._revlog) |
|
65 | return len(self._revlog) | |
57 |
|
66 | |||
58 | def __iter__(self): |
|
67 | def __iter__(self) -> Iterator[int]: | |
59 | return self._revlog.__iter__() |
|
68 | return self._revlog.__iter__() | |
60 |
|
69 | |||
61 | def hasnode(self, node): |
|
70 | def hasnode(self, node): | |
@@ -234,7 +243,7 b' class FileLog:' | |||||
234 | """ |
|
243 | """ | |
235 | return not storageutil.filedataequivalent(self, node, text) |
|
244 | return not storageutil.filedataequivalent(self, node, text) | |
236 |
|
245 | |||
237 | def verifyintegrity(self, state): |
|
246 | def verifyintegrity(self, state) -> Iterable[revlog.RevLogProblem]: | |
238 | return self._revlog.verifyintegrity(state) |
|
247 | return self._revlog.verifyintegrity(state) | |
239 |
|
248 | |||
240 | def storageinfo( |
|
249 | def storageinfo( |
@@ -850,6 +850,12 b' def _splittopdir(f: bytes) -> Tuple[byte' | |||||
850 |
|
850 | |||
851 |
|
851 | |||
852 | class TreeManifest: |
|
852 | class TreeManifest: | |
|
853 | _dir: bytes | |||
|
854 | _dirs: Dict[bytes, 'TreeManifest'] | |||
|
855 | _dirty: bool | |||
|
856 | _files: Dict[bytes, bytes] | |||
|
857 | _flags: Dict[bytes, bytes] | |||
|
858 | ||||
853 | def __init__(self, nodeconstants, dir: bytes = b'', text: bytes = b''): |
|
859 | def __init__(self, nodeconstants, dir: bytes = b'', text: bytes = b''): | |
854 | self._dir = dir |
|
860 | self._dir = dir | |
855 | self.nodeconstants = nodeconstants |
|
861 | self.nodeconstants = nodeconstants | |
@@ -858,13 +864,13 b' class TreeManifest:' | |||||
858 | self._loadfunc = _noop |
|
864 | self._loadfunc = _noop | |
859 | self._copyfunc = _noop |
|
865 | self._copyfunc = _noop | |
860 | self._dirty = False |
|
866 | self._dirty = False | |
861 |
self._dirs |
|
867 | self._dirs = {} | |
862 | self._lazydirs: Dict[ |
|
868 | self._lazydirs: Dict[ | |
863 | bytes, |
|
869 | bytes, | |
864 | Tuple[bytes, Callable[[bytes, bytes], 'TreeManifest'], bool], |
|
870 | Tuple[bytes, Callable[[bytes, bytes], 'TreeManifest'], bool], | |
865 | ] = {} |
|
871 | ] = {} | |
866 | # Using _lazymanifest here is a little slower than plain old dicts |
|
872 | # Using _lazymanifest here is a little slower than plain old dicts | |
867 |
self._files |
|
873 | self._files = {} | |
868 | self._flags = {} |
|
874 | self._flags = {} | |
869 | if text: |
|
875 | if text: | |
870 |
|
876 | |||
@@ -2172,6 +2178,8 b' if typing.TYPE_CHECKING:' | |||||
2172 |
|
2178 | |||
2173 |
|
2179 | |||
2174 | class MemManifestCtx: |
|
2180 | class MemManifestCtx: | |
|
2181 | _manifestdict: ManifestDict | |||
|
2182 | ||||
2175 | def __init__(self, manifestlog): |
|
2183 | def __init__(self, manifestlog): | |
2176 | self._manifestlog = manifestlog |
|
2184 | self._manifestlog = manifestlog | |
2177 | self._manifestdict = manifestdict(manifestlog.nodeconstants.nodelen) |
|
2185 | self._manifestdict = manifestdict(manifestlog.nodeconstants.nodelen) | |
@@ -2213,6 +2221,8 b' class ManifestCtx:' | |||||
2213 | contents, its parent revs, and its linkrev. |
|
2221 | contents, its parent revs, and its linkrev. | |
2214 | """ |
|
2222 | """ | |
2215 |
|
2223 | |||
|
2224 | _data: Optional[ManifestDict] | |||
|
2225 | ||||
2216 | def __init__(self, manifestlog, node): |
|
2226 | def __init__(self, manifestlog, node): | |
2217 | self._manifestlog = manifestlog |
|
2227 | self._manifestlog = manifestlog | |
2218 | self._data = None |
|
2228 | self._data = None | |
@@ -2375,6 +2385,8 b' if typing.TYPE_CHECKING:' | |||||
2375 |
|
2385 | |||
2376 |
|
2386 | |||
2377 | class MemTreeManifestCtx: |
|
2387 | class MemTreeManifestCtx: | |
|
2388 | _treemanifest: TreeManifest | |||
|
2389 | ||||
2378 | def __init__(self, manifestlog, dir=b''): |
|
2390 | def __init__(self, manifestlog, dir=b''): | |
2379 | self._manifestlog = manifestlog |
|
2391 | self._manifestlog = manifestlog | |
2380 | self._dir = dir |
|
2392 | self._dir = dir | |
@@ -2417,6 +2429,8 b' if typing.TYPE_CHECKING:' | |||||
2417 |
|
2429 | |||
2418 |
|
2430 | |||
2419 | class TreeManifestCtx: |
|
2431 | class TreeManifestCtx: | |
|
2432 | _data: Optional[TreeManifest] | |||
|
2433 | ||||
2420 | def __init__(self, manifestlog, dir, node): |
|
2434 | def __init__(self, manifestlog, dir, node): | |
2421 | self._manifestlog = manifestlog |
|
2435 | self._manifestlog = manifestlog | |
2422 | self._dir = dir |
|
2436 | self._dir = dir | |
@@ -2699,6 +2713,9 b' class excludeddir(treemanifest):' | |||||
2699 | whose contents are unknown. |
|
2713 | whose contents are unknown. | |
2700 | """ |
|
2714 | """ | |
2701 |
|
2715 | |||
|
2716 | _files: Dict[bytes, bytes] | |||
|
2717 | _flags: Dict[bytes, bytes] | |||
|
2718 | ||||
2702 | def __init__(self, nodeconstants, dir, node): |
|
2719 | def __init__(self, nodeconstants, dir, node): | |
2703 | super(excludeddir, self).__init__(nodeconstants, dir) |
|
2720 | super(excludeddir, self).__init__(nodeconstants, dir) | |
2704 | self._node = node |
|
2721 | self._node = node |
@@ -25,6 +25,8 b' import weakref' | |||||
25 | import zlib |
|
25 | import zlib | |
26 |
|
26 | |||
27 | from typing import ( |
|
27 | from typing import ( | |
|
28 | Iterable, | |||
|
29 | Iterator, | |||
28 | Optional, |
|
30 | Optional, | |
29 | Tuple, |
|
31 | Tuple, | |
30 | ) |
|
32 | ) | |
@@ -1826,7 +1828,7 b' class revlog:' | |||||
1826 | def __len__(self): |
|
1828 | def __len__(self): | |
1827 | return len(self.index) |
|
1829 | return len(self.index) | |
1828 |
|
1830 | |||
1829 | def __iter__(self): |
|
1831 | def __iter__(self) -> Iterator[int]: | |
1830 | return iter(range(len(self))) |
|
1832 | return iter(range(len(self))) | |
1831 |
|
1833 | |||
1832 | def revs(self, start=0, stop=None): |
|
1834 | def revs(self, start=0, stop=None): | |
@@ -3902,7 +3904,7 b' class revlog:' | |||||
3902 | else: |
|
3904 | else: | |
3903 | rewrite.v2_censor(self, tr, censor_nodes, tombstone) |
|
3905 | rewrite.v2_censor(self, tr, censor_nodes, tombstone) | |
3904 |
|
3906 | |||
3905 | def verifyintegrity(self, state): |
|
3907 | def verifyintegrity(self, state) -> Iterable[RevLogProblem]: | |
3906 | """Verifies the integrity of the revlog. |
|
3908 | """Verifies the integrity of the revlog. | |
3907 |
|
3909 | |||
3908 | Yields ``revlogproblem`` instances describing problems that are |
|
3910 | Yields ``revlogproblem`` instances describing problems that are |
@@ -160,6 +160,8 b' class statichttprepository(' | |||||
160 | ): |
|
160 | ): | |
161 | supported = localrepo.localrepository._basesupported |
|
161 | supported = localrepo.localrepository._basesupported | |
162 |
|
162 | |||
|
163 | manifestlog: manifest.ManifestLog | |||
|
164 | ||||
163 | def __init__(self, ui, path): |
|
165 | def __init__(self, ui, path): | |
164 | self._url = path |
|
166 | self._url = path | |
165 | self.ui = ui |
|
167 | self.ui = ui |
@@ -817,7 +817,7 b' class basicstore:' | |||||
817 | concurrencychecker=concurrencychecker, |
|
817 | concurrencychecker=concurrencychecker, | |
818 | ) |
|
818 | ) | |
819 |
|
819 | |||
820 | def manifestlog(self, repo, storenarrowmatch): |
|
820 | def manifestlog(self, repo, storenarrowmatch) -> manifest.ManifestLog: | |
821 | rootstore = manifest.manifestrevlog(repo.nodeconstants, self.vfs) |
|
821 | rootstore = manifest.manifestrevlog(repo.nodeconstants, self.vfs) | |
822 | return manifest.manifestlog(self.vfs, repo, rootstore, storenarrowmatch) |
|
822 | return manifest.manifestlog(self.vfs, repo, rootstore, storenarrowmatch) | |
823 |
|
823 |
@@ -204,6 +204,9 b' class unionchangelog(unionrevlog, change' | |||||
204 |
|
204 | |||
205 |
|
205 | |||
206 | class unionmanifest(unionrevlog, manifest.manifestrevlog): |
|
206 | class unionmanifest(unionrevlog, manifest.manifestrevlog): | |
|
207 | repotiprev: int | |||
|
208 | revlog2: manifest.ManifestRevlog | |||
|
209 | ||||
207 | def __init__(self, nodeconstants, opener, opener2, linkmapper): |
|
210 | def __init__(self, nodeconstants, opener, opener2, linkmapper): | |
208 | # XXX manifestrevlog is not actually a revlog , so mixing it with |
|
211 | # XXX manifestrevlog is not actually a revlog , so mixing it with | |
209 | # bundlerevlog is not a good idea. |
|
212 | # bundlerevlog is not a good idea. | |
@@ -215,6 +218,10 b' class unionmanifest(unionrevlog, manifes' | |||||
215 |
|
218 | |||
216 |
|
219 | |||
217 | class unionfilelog(filelog.filelog): |
|
220 | class unionfilelog(filelog.filelog): | |
|
221 | _revlog: unionrevlog | |||
|
222 | repotiprev: int | |||
|
223 | revlog2: revlog.revlog | |||
|
224 | ||||
218 | def __init__(self, opener, path, opener2, linkmapper, repo): |
|
225 | def __init__(self, opener, path, opener2, linkmapper, repo): | |
219 | filelog.filelog.__init__(self, opener, path) |
|
226 | filelog.filelog.__init__(self, opener, path) | |
220 | filelog2 = filelog.filelog(opener2, path) |
|
227 | filelog2 = filelog.filelog(opener2, path) |
General Comments 0
You need to be logged in to leave comments.
Login now