Show More
@@ -8,6 +8,9 b'' | |||||
8 |
|
8 | |||
9 | import os |
|
9 | import os | |
10 | import re |
|
10 | import re | |
|
11 | from typing import ( | |||
|
12 | Tuple, | |||
|
13 | ) | |||
11 |
|
14 | |||
12 | from mercurial.i18n import _ |
|
15 | from mercurial.i18n import _ | |
13 | from mercurial.pycompat import open |
|
16 | from mercurial.pycompat import open | |
@@ -121,7 +124,7 b' class monotone_source(common.converter_s' | |||||
121 |
|
124 | |||
122 | return self.mtnstdioreadcommandoutput(command) |
|
125 | return self.mtnstdioreadcommandoutput(command) | |
123 |
|
126 | |||
124 | def mtnstdioreadpacket(self): |
|
127 | def mtnstdioreadpacket(self) -> Tuple[bytes, bytes, int, bytes]: | |
125 | read = None |
|
128 | read = None | |
126 | commandnbr = b'' |
|
129 | commandnbr = b'' | |
127 | while read != b':': |
|
130 | while read != b':': | |
@@ -167,7 +170,7 b' class monotone_source(common.converter_s' | |||||
167 |
|
170 | |||
168 | return (commandnbr, stream, length, read) |
|
171 | return (commandnbr, stream, length, read) | |
169 |
|
172 | |||
170 | def mtnstdioreadcommandoutput(self, command): |
|
173 | def mtnstdioreadcommandoutput(self, command) -> bytes: | |
171 | retval = [] |
|
174 | retval = [] | |
172 | while True: |
|
175 | while True: | |
173 | commandnbr, stream, length, output = self.mtnstdioreadpacket() |
|
176 | commandnbr, stream, length, output = self.mtnstdioreadpacket() |
@@ -34,7 +34,7 b' from . import (' | |||||
34 | ) |
|
34 | ) | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | def debugremotefilelog(ui, path, **opts): |
|
37 | def debugremotefilelog(ui, path, **opts) -> None: | |
38 | decompress = opts.get('decompress') |
|
38 | decompress = opts.get('decompress') | |
39 |
|
39 | |||
40 | size, firstnode, mapping = parsefileblob(path, decompress) |
|
40 | size, firstnode, mapping = parsefileblob(path, decompress) |
@@ -8,6 +8,9 b'' | |||||
8 |
|
8 | |||
9 | import heapq |
|
9 | import heapq | |
10 | import typing |
|
10 | import typing | |
|
11 | from typing import ( | |||
|
12 | List, | |||
|
13 | ) | |||
11 |
|
14 | |||
12 | from .thirdparty import attr |
|
15 | from .thirdparty import attr | |
13 |
|
16 | |||
@@ -754,7 +757,7 b' def _annotatepair(parents, childfctx, ch' | |||||
754 | return child |
|
757 | return child | |
755 |
|
758 | |||
756 |
|
759 | |||
757 | def annotate(base, parents, skiprevs=None, diffopts=None): |
|
760 | def annotate(base, parents, skiprevs=None, diffopts=None) -> List[annotateline]: | |
758 | """Core algorithm for filectx.annotate() |
|
761 | """Core algorithm for filectx.annotate() | |
759 |
|
762 | |||
760 | `parents(fctx)` is a function returning a list of parent filectxs. |
|
763 | `parents(fctx)` is a function returning a list of parent filectxs. |
@@ -85,7 +85,7 b' class request:' | |||||
85 | # store the parsed and canonical command |
|
85 | # store the parsed and canonical command | |
86 | self.canonical_command = None |
|
86 | self.canonical_command = None | |
87 |
|
87 | |||
88 | def _runexithandlers(self): |
|
88 | def _runexithandlers(self) -> None: | |
89 | exc = None |
|
89 | exc = None | |
90 | handlers = self.ui._exithandlers |
|
90 | handlers = self.ui._exithandlers | |
91 | try: |
|
91 | try: | |
@@ -239,7 +239,7 b' def dispatch(req):' | |||||
239 | return status |
|
239 | return status | |
240 |
|
240 | |||
241 |
|
241 | |||
242 | def _rundispatch(req): |
|
242 | def _rundispatch(req) -> int: | |
243 | with tracing.log('dispatch._rundispatch'): |
|
243 | with tracing.log('dispatch._rundispatch'): | |
244 | if req.ferr: |
|
244 | if req.ferr: | |
245 | ferr = req.ferr |
|
245 | ferr = req.ferr |
@@ -110,7 +110,7 b' def _delayedinterrupt():' | |||||
110 | raiseinterrupt(assertedsigs[0]) |
|
110 | raiseinterrupt(assertedsigs[0]) | |
111 |
|
111 | |||
112 |
|
112 | |||
113 | def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs): |
|
113 | def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs) -> "lock": | |
114 | """return an acquired lock or raise an a LockHeld exception |
|
114 | """return an acquired lock or raise an a LockHeld exception | |
115 |
|
115 | |||
116 | This function is responsible to issue warnings and or debug messages about |
|
116 | This function is responsible to issue warnings and or debug messages about | |
@@ -256,7 +256,7 b' class lock:' | |||||
256 | # wrapper around procutil.getpid() to make testing easier |
|
256 | # wrapper around procutil.getpid() to make testing easier | |
257 | return procutil.getpid() |
|
257 | return procutil.getpid() | |
258 |
|
258 | |||
259 | def lock(self): |
|
259 | def lock(self) -> int: | |
260 | timeout = self.timeout |
|
260 | timeout = self.timeout | |
261 | while True: |
|
261 | while True: | |
262 | try: |
|
262 | try: | |
@@ -272,7 +272,7 b' class lock:' | |||||
272 | errno.ETIMEDOUT, inst.filename, self.desc, inst.locker |
|
272 | errno.ETIMEDOUT, inst.filename, self.desc, inst.locker | |
273 | ) |
|
273 | ) | |
274 |
|
274 | |||
275 | def _trylock(self): |
|
275 | def _trylock(self) -> None: | |
276 | if self.held: |
|
276 | if self.held: | |
277 | self.held += 1 |
|
277 | self.held += 1 | |
278 | return |
|
278 | return |
@@ -575,6 +575,10 b' class changesettemplater(changesetprinte' | |||||
575 | functions that use changesest_templater. |
|
575 | functions that use changesest_templater. | |
576 | """ |
|
576 | """ | |
577 |
|
577 | |||
|
578 | _tresources: formatter.templateresources | |||
|
579 | lastheader: Optional[bytes] | |||
|
580 | t: templater.templater | |||
|
581 | ||||
578 | # Arguments before "buffered" used to be positional. Consider not |
|
582 | # Arguments before "buffered" used to be positional. Consider not | |
579 | # adding/removing arguments before "buffered" to not break callers. |
|
583 | # adding/removing arguments before "buffered" to not break callers. | |
580 | def __init__( |
|
584 | def __init__( | |
@@ -665,7 +669,7 b' class changesettemplater(changesetprinte' | |||||
665 | self.footer = self.t.render(self._parts[b'footer'], props) |
|
669 | self.footer = self.t.render(self._parts[b'footer'], props) | |
666 |
|
670 | |||
667 |
|
671 | |||
668 | def templatespec(tmpl, mapfile): |
|
672 | def templatespec(tmpl, mapfile) -> formatter.templatespec: | |
669 | assert not (tmpl and mapfile) |
|
673 | assert not (tmpl and mapfile) | |
670 | if mapfile: |
|
674 | if mapfile: | |
671 | return formatter.mapfile_templatespec(b'changeset', mapfile) |
|
675 | return formatter.mapfile_templatespec(b'changeset', mapfile) | |
@@ -673,7 +677,7 b' def templatespec(tmpl, mapfile):' | |||||
673 | return formatter.literal_templatespec(tmpl) |
|
677 | return formatter.literal_templatespec(tmpl) | |
674 |
|
678 | |||
675 |
|
679 | |||
676 | def _lookuptemplate(ui, tmpl, style): |
|
680 | def _lookuptemplate(ui, tmpl, style) -> formatter.templatespec: | |
677 | """Find the template matching the given template spec or style |
|
681 | """Find the template matching the given template spec or style | |
678 |
|
682 | |||
679 | See formatter.lookuptemplate() for details. |
|
683 | See formatter.lookuptemplate() for details. |
@@ -947,7 +947,7 b' filteredmsgtable = {' | |||||
947 | } |
|
947 | } | |
948 |
|
948 | |||
949 |
|
949 | |||
950 | def _getfilteredreason(repo, changeid, ctx): |
|
950 | def _getfilteredreason(repo, changeid, ctx) -> bytes: | |
951 | """return a human-friendly string on why a obsolete changeset is hidden""" |
|
951 | """return a human-friendly string on why a obsolete changeset is hidden""" | |
952 | successors = successorssets(repo, ctx.node()) |
|
952 | successors = successorssets(repo, ctx.node()) | |
953 | fate = _getobsfate(successors) |
|
953 | fate = _getobsfate(successors) | |
@@ -974,6 +974,8 b' def _getfilteredreason(repo, changeid, c' | |||||
974 |
|
974 | |||
975 | args = (changeid, firstsuccessors, remainingnumber) |
|
975 | args = (changeid, firstsuccessors, remainingnumber) | |
976 | return filteredmsgtable[b'superseded_split_several'] % args |
|
976 | return filteredmsgtable[b'superseded_split_several'] % args | |
|
977 | else: | |||
|
978 | raise error.ProgrammingError("unhandled fate: %r" % fate) | |||
977 |
|
979 | |||
978 |
|
980 | |||
979 | def divergentsets(repo, ctx): |
|
981 | def divergentsets(repo, ctx): |
@@ -113,6 +113,10 b' import sys' | |||||
113 | import threading |
|
113 | import threading | |
114 | import time |
|
114 | import time | |
115 |
|
115 | |||
|
116 | from typing import ( | |||
|
117 | List, | |||
|
118 | ) | |||
|
119 | ||||
116 | from .pycompat import open |
|
120 | from .pycompat import open | |
117 | from . import ( |
|
121 | from . import ( | |
118 | encoding, |
|
122 | encoding, | |
@@ -155,6 +159,8 b' def clock():' | |||||
155 |
|
159 | |||
156 |
|
160 | |||
157 | class ProfileState: |
|
161 | class ProfileState: | |
|
162 | samples: List["Sample"] | |||
|
163 | ||||
158 | def __init__(self, frequency=None): |
|
164 | def __init__(self, frequency=None): | |
159 | self.reset(frequency) |
|
165 | self.reset(frequency) | |
160 | self.track = b'cpu' |
|
166 | self.track = b'cpu' |
@@ -482,7 +482,7 b' def showlatesttag(context, mapping):' | |||||
482 | return showlatesttags(context, mapping, None) |
|
482 | return showlatesttags(context, mapping, None) | |
483 |
|
483 | |||
484 |
|
484 | |||
485 | def showlatesttags(context, mapping, pattern): |
|
485 | def showlatesttags(context, mapping, pattern) -> _hybrid: | |
486 | """helper method for the latesttag keyword and function""" |
|
486 | """helper method for the latesttag keyword and function""" | |
487 | latesttags = getlatesttags(context, mapping, pattern) |
|
487 | latesttags = getlatesttags(context, mapping, pattern) | |
488 |
|
488 |
General Comments 0
You need to be logged in to leave comments.
Login now