Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mercurial/mercurial-devel
1 result
Show changes
Commits on Source (55)
Showing
with 634 additions and 70 deletions
......@@ -236,3 +236,4 @@
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
......@@ -249,3 +249,7 @@
dbdee8ac3e3fcdda1fa55b90c0a235125b7f8e6f 6.2.3
a3356ab610fc50000cf0ba55c424a4d96da11db7 6.3rc0
04f1dba53c961dfdb875c8469adc96fa999cfbed 6.3.0
04f1dba53c961dfdb875c8469adc96fa999cfbed 6.3
04f1dba53c961dfdb875c8469adc96fa999cfbed 6.3.0
0000000000000000000000000000000000000000 6.3.0
c890d8b8bc59b18e5febf60caada629df5356ee2 6.3.1
......@@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --generate-hashes --output-file=contrib/packaging/requirements-windows-py3.txt contrib/packaging/requirements-windows.txt.in
# pip-compile --generate-hashes --no-reuse-hashes --output-file=contrib/packaging/requirements-windows-py3.txt contrib/packaging/requirements-windows.txt.in
#
atomicwrites==1.4.0 \
--hash=sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197 \
......@@ -110,7 +110,8 @@
--hash=sha256:f9552ac246bceab1c5cdd1ec3cfe9446fe76b9853eaf59d3244df03eb27fd3fe
# via -r contrib/packaging/requirements-windows.txt.in
fuzzywuzzy==0.18.0 \
--hash=sha256:45016e92264780e58972dca1b3d939ac864b78437422beecebb3095f8efd00e8
--hash=sha256:45016e92264780e58972dca1b3d939ac864b78437422beecebb3095f8efd00e8 \
--hash=sha256:928244b28db720d1e0ee7587acf660ea49d7e4c632569cad4f1cd7e68a5f0993
# via -r contrib/packaging/requirements-windows.txt.in
idna==3.2 \
--hash=sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a \
......@@ -222,7 +223,8 @@
--hash=sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890
# via pytest-vcr
pytest-vcr==1.0.2 \
--hash=sha256:23ee51b75abbcc43d926272773aae4f39f93aceb75ed56852d0bf618f92e1896
--hash=sha256:23ee51b75abbcc43d926272773aae4f39f93aceb75ed56852d0bf618f92e1896 \
--hash=sha256:2f316e0539399bea0296e8b8401145c62b6f85e9066af7e57b6151481b0d6d9c
# via -r contrib/packaging/requirements-windows.txt.in
pywin32-ctypes==0.2.0 \
--hash=sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942 \
......
# Declare Windows-specific requirements for generating
# the compiled (frozen) set of requirements in
# ./requirements-windows-py3.txt.
# If run on Windows, it may be necessary to run dos2unix
# on the output file to replace any CRLF newlines with LF.
docutils
dulwich
......
......@@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --generate-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in
# pip-compile --generate-hashes --no-reuse-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in
#
docutils==0.16 \
--hash=sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af \
......@@ -18,5 +18,7 @@
--hash=sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235 \
--hash=sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5 \
--hash=sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42 \
--hash=sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f \
--hash=sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39 \
--hash=sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff \
--hash=sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b \
......@@ -21,5 +23,7 @@
--hash=sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff \
--hash=sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b \
--hash=sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014 \
--hash=sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f \
--hash=sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1 \
--hash=sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e \
--hash=sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183 \
......@@ -28,6 +32,8 @@
--hash=sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1 \
--hash=sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15 \
--hash=sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1 \
--hash=sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85 \
--hash=sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1 \
--hash=sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e \
--hash=sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b \
--hash=sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905 \
......@@ -31,5 +37,7 @@
--hash=sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e \
--hash=sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b \
--hash=sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905 \
--hash=sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850 \
--hash=sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0 \
--hash=sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735 \
--hash=sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d \
......@@ -34,5 +42,6 @@
--hash=sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735 \
--hash=sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d \
--hash=sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb \
--hash=sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e \
--hash=sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d \
--hash=sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c \
......@@ -36,6 +45,8 @@
--hash=sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e \
--hash=sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d \
--hash=sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c \
--hash=sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1 \
--hash=sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2 \
--hash=sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21 \
--hash=sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2 \
--hash=sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5 \
......@@ -39,4 +50,5 @@
--hash=sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21 \
--hash=sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2 \
--hash=sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5 \
--hash=sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7 \
--hash=sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b \
......@@ -42,2 +54,3 @@
--hash=sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b \
--hash=sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8 \
--hash=sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6 \
......@@ -43,2 +56,3 @@
--hash=sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6 \
--hash=sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193 \
--hash=sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f \
......@@ -44,3 +58,4 @@
--hash=sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f \
--hash=sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b \
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \
--hash=sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2 \
......@@ -45,3 +60,6 @@
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \
--hash=sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2 \
--hash=sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5 \
--hash=sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c \
--hash=sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032 \
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \
......@@ -47,3 +65,4 @@
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be \
--hash=sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621
# via jinja2
# Declare requirements for generating the compiled (frozen)
# set of requirements in ./requirements.txt.
docutils
jinja2
......@@ -299,6 +299,7 @@
deltaprevious=False,
deltamode=None,
sidedata_helpers=None,
debug_info=None,
):
# we don't use any of these parameters here
del nodesorder, revisiondata, assumehaveparentrevisions, deltaprevious
......
......@@ -589,6 +589,7 @@
assumehaveparentrevisions=False,
deltamode=repository.CG_DELTAMODE_STD,
sidedata_helpers=None,
debug_info=None,
):
if nodesorder not in (b'nodes', b'storage', b'linear', None):
raise error.ProgrammingError(
......
......@@ -5,7 +5,7 @@
version: int
def bdiff(a: bytes, b: bytes): bytes
def bdiff(a: bytes, b: bytes) -> bytes: ...
def blocks(a: bytes, b: bytes) -> List[Tuple[int, int, int, int]]: ...
def fixws(s: bytes, allws: bool) -> bytes: ...
def splitnewlines(text: bytes) -> List[bytes]: ...
......
......@@ -2,6 +2,7 @@
AnyStr,
IO,
List,
Optional,
Sequence,
)
......@@ -15,7 +16,7 @@
st_mtime: int
st_ctime: int
def listdir(path: bytes, st: bool, skip: bool) -> List[stat]: ...
def listdir(path: bytes, st: bool, skip: Optional[bool]) -> List[stat]: ...
def posixfile(name: AnyStr, mode: bytes, buffering: int) -> IO: ...
def statfiles(names: Sequence[bytes]) -> List[stat]: ...
def setprocname(name: bytes) -> None: ...
......
......@@ -8,6 +8,11 @@
import struct
from typing import (
List,
Tuple,
)
from ..pure.bdiff import *
from . import _bdiff # pytype: disable=import-error
......@@ -15,7 +20,7 @@
lib = _bdiff.lib
def blocks(sa, sb):
def blocks(sa: bytes, sb: bytes) -> List[Tuple[int, int, int, int]]:
a = ffi.new(b"struct bdiff_line**")
b = ffi.new(b"struct bdiff_line**")
ac = ffi.new(b"char[]", str(sa))
......@@ -29,7 +34,7 @@
count = lib.bdiff_diff(a[0], an, b[0], bn, l)
if count < 0:
raise MemoryError
rl = [None] * count
rl = [(0, 0, 0, 0)] * count
h = l.next
i = 0
while h:
......@@ -43,7 +48,7 @@
return rl
def bdiff(sa, sb):
def bdiff(sa: bytes, sb: bytes) -> bytes:
a = ffi.new(b"struct bdiff_line**")
b = ffi.new(b"struct bdiff_line**")
ac = ffi.new(b"char[]", str(sa))
......
......@@ -6,6 +6,8 @@
# GNU General Public License version 2 or any later version.
from typing import List
from ..pure.mpatch import *
from ..pure.mpatch import mpatchError # silence pyflakes
from . import _mpatch # pytype: disable=import-error
......@@ -26,7 +28,7 @@
return container[0]
def patches(text, bins):
def patches(text: bytes, bins: List[bytes]) -> bytes:
lgt = len(bins)
all = []
if not lgt:
......
......@@ -57,7 +57,7 @@
ofs = cur.name_info.attr_dataoffset
str_lgt = cur.name_info.attr_length
base_ofs = ffi.offsetof(b'val_attrs_t', b'name_info')
name = str(
name = bytes(
ffi.buffer(
ffi.cast(b"char*", cur) + base_ofs + ofs, str_lgt - 1
)
......
This diff is collapsed.
......@@ -2114,7 +2114,9 @@
if repo[b'.'].closesbranch():
# Not ideal, but let us do an extra status early to prevent early
# bail out.
matcher = scmutil.match(repo[None], pats, opts)
matcher = scmutil.match(
repo[None], pats, pycompat.byteskwargs(opts)
)
s = repo.status(match=matcher)
if s.modified or s.added or s.removed:
bheads = repo.branchheads(branch, closed=True)
......
......@@ -588,6 +588,18 @@
b'revlog.debug-delta',
default=False,
)
# display extra information about the bundling process
coreconfigitem(
b'debug',
b'bundling-stats',
default=False,
)
# display extra information about the unbundling process
coreconfigitem(
b'debug',
b'unbundling-stats',
default=False,
)
coreconfigitem(
b'defaults',
b'.*',
......@@ -1774,6 +1786,13 @@
)
coreconfigitem(
b'merge-tools',
br'.*\.regappend$',
default=b"",
generic=True,
priority=-1,
)
coreconfigitem(
b'merge-tools',
br'.*\.symlink$',
default=False,
generic=True,
......
......@@ -612,8 +612,6 @@
if append:
docket = self.docket
data_filename = docket.data_filename()
if tr:
tr.add(data_filename, docket.data_size)
with self._opener(data_filename, b'r+b') as fp:
fp.seek(docket.data_size)
assert fp.tell() == docket.data_size
......
......@@ -111,6 +111,7 @@
assumehaveparentrevisions=False,
deltamode=repository.CG_DELTAMODE_STD,
sidedata_helpers=None,
debug_info=None,
):
return self._revlog.emitrevisions(
nodes,
......@@ -119,6 +120,7 @@
assumehaveparentrevisions=assumehaveparentrevisions,
deltamode=deltamode,
sidedata_helpers=sidedata_helpers,
debug_info=debug_info,
)
def addrevision(
......@@ -151,6 +153,7 @@
addrevisioncb=None,
duplicaterevisioncb=None,
maybemissingparents=False,
debug_info=None,
):
if maybemissingparents:
raise error.Abort(
......@@ -171,6 +174,7 @@
transaction,
addrevisioncb=addrevisioncb,
duplicaterevisioncb=duplicaterevisioncb,
debug_info=debug_info,
)
def getstrippoint(self, minlink):
......
......@@ -158,7 +158,7 @@
continue
p = util.lookupreg(k, _toolstr(ui, tool, b"regname"))
if p:
p = procutil.findexe(p + _toolstr(ui, tool, b"regappend", b""))
p = procutil.findexe(p + _toolstr(ui, tool, b"regappend"))
if p:
return p
exe = _toolstr(ui, tool, b"executable", tool)
......
......@@ -10,6 +10,18 @@
import re
import textwrap
from typing import (
Callable,
Dict,
Iterable,
List,
Optional,
Set,
Tuple,
Union,
cast,
)
from .i18n import (
_,
gettext,
......@@ -40,7 +52,16 @@
stringutil,
)
_exclkeywords = {
_DocLoader = Callable[[uimod.ui], bytes]
# Old extensions may not register with a category
_HelpEntry = Union["_HelpEntryNoCategory", "_HelpEntryWithCategory"]
_HelpEntryNoCategory = Tuple[List[bytes], bytes, _DocLoader]
_HelpEntryWithCategory = Tuple[List[bytes], bytes, _DocLoader, bytes]
_SelectFn = Callable[[object], bool]
_SynonymTable = Dict[bytes, List[bytes]]
_TopicHook = Callable[[uimod.ui, bytes, bytes], bytes]
_exclkeywords: Set[bytes] = {
b"(ADVANCED)",
b"(DEPRECATED)",
b"(EXPERIMENTAL)",
......@@ -56,7 +77,7 @@
# Extensions with custom categories should insert them into this list
# after/before the appropriate item, rather than replacing the list or
# assuming absolute positions.
CATEGORY_ORDER = [
CATEGORY_ORDER: List[bytes] = [
registrar.command.CATEGORY_REPO_CREATION,
registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
registrar.command.CATEGORY_COMMITTING,
......@@ -74,7 +95,7 @@
# Human-readable category names. These are translated.
# Extensions with custom categories should add their names here.
CATEGORY_NAMES = {
CATEGORY_NAMES: Dict[bytes, bytes] = {
registrar.command.CATEGORY_REPO_CREATION: b'Repository creation',
registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT: b'Remote repository management',
registrar.command.CATEGORY_COMMITTING: b'Change creation',
......@@ -102,7 +123,7 @@
# Extensions with custom categories should insert them into this list
# after/before the appropriate item, rather than replacing the list or
# assuming absolute positions.
TOPIC_CATEGORY_ORDER = [
TOPIC_CATEGORY_ORDER: List[bytes] = [
TOPIC_CATEGORY_IDS,
TOPIC_CATEGORY_OUTPUT,
TOPIC_CATEGORY_CONFIG,
......@@ -112,7 +133,7 @@
]
# Human-readable topic category names. These are translated.
TOPIC_CATEGORY_NAMES = {
TOPIC_CATEGORY_NAMES: Dict[bytes, bytes] = {
TOPIC_CATEGORY_IDS: b'Mercurial identifiers',
TOPIC_CATEGORY_OUTPUT: b'Mercurial output',
TOPIC_CATEGORY_CONFIG: b'Mercurial configuration',
......@@ -122,7 +143,12 @@
}
def listexts(header, exts, indent=1, showdeprecated=False):
def listexts(
header: bytes,
exts: Dict[bytes, bytes],
indent: int = 1,
showdeprecated: bool = False,
) -> List[bytes]:
'''return a text listing of the given extensions'''
rst = []
if exts:
......@@ -135,7 +161,7 @@
return rst
def extshelp(ui):
def extshelp(ui: uimod.ui) -> bytes:
rst = loaddoc(b'extensions')(ui).splitlines(True)
rst.extend(
listexts(
......@@ -153,7 +179,7 @@
return doc
def parsedefaultmarker(text):
def parsedefaultmarker(text: bytes) -> Optional[Tuple[bytes, List[bytes]]]:
"""given a text 'abc (DEFAULT: def.ghi)',
returns (b'abc', (b'def', b'ghi')). Otherwise return None"""
if text[-1:] == b')':
......@@ -164,7 +190,7 @@
return text[:pos], item.split(b'.', 2)
def optrst(header, options, verbose, ui):
def optrst(header: bytes, options, verbose: bool, ui: uimod.ui) -> bytes:
data = []
multioccur = False
for option in options:
......@@ -220,9 +246,11 @@
return b''.join(rst)
def indicateomitted(rst, omitted, notomitted=None):
def indicateomitted(
rst: List[bytes], omitted: bytes, notomitted: Optional[bytes] = None
) -> None:
rst.append(b'\n\n.. container:: omitted\n\n %s\n\n' % omitted)
if notomitted:
rst.append(b'\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
......@@ -224,9 +252,9 @@
rst.append(b'\n\n.. container:: omitted\n\n %s\n\n' % omitted)
if notomitted:
rst.append(b'\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
def filtercmd(ui, cmd, func, kw, doc):
def filtercmd(ui: uimod.ui, cmd: bytes, func, kw: bytes, doc: bytes) -> bool:
if not ui.debugflag and cmd.startswith(b"debug") and kw != b"debug":
# Debug command, and user is not looking for those.
return True
......@@ -249,7 +277,7 @@
return False
def filtertopic(ui, topic):
def filtertopic(ui: uimod.ui, topic: bytes) -> bool:
return ui.configbool(b'help', b'hidden-topic.%s' % topic, False)
......@@ -253,7 +281,9 @@
return ui.configbool(b'help', b'hidden-topic.%s' % topic, False)
def topicmatch(ui, commands, kw):
def topicmatch(
ui: uimod.ui, commands, kw: bytes
) -> Dict[bytes, List[Tuple[bytes, bytes]]]:
"""Return help topics matching kw.
Returns {'section': [(name, summary), ...], ...} where section is
......@@ -326,6 +356,6 @@
return results
def loaddoc(topic, subdir=None):
def loaddoc(topic: bytes, subdir: Optional[bytes] = None) -> _DocLoader:
"""Return a delayed loader for help/topic.txt."""
......@@ -330,6 +360,6 @@
"""Return a delayed loader for help/topic.txt."""
def loader(ui):
def loader(ui: uimod.ui) -> bytes:
package = b'mercurial.helptext'
if subdir:
package += b'.' + subdir
......@@ -342,7 +372,7 @@
return loader
internalstable = sorted(
internalstable: List[_HelpEntryNoCategory] = sorted(
[
(
[b'bid-merge'],
......@@ -407,7 +437,7 @@
)
def internalshelp(ui):
def internalshelp(ui: uimod.ui) -> bytes:
"""Generate the index for the "internals" topic."""
lines = [
b'To access a subtopic, use "hg help internals.{subtopic-name}"\n',
......@@ -419,7 +449,7 @@
return b''.join(lines)
helptable = sorted(
helptable: List[_HelpEntryWithCategory] = sorted(
[
(
[b'bundlespec'],
......@@ -581,9 +611,9 @@
)
# Maps topics with sub-topics to a list of their sub-topics.
subtopics = {
subtopics: Dict[bytes, List[_HelpEntryNoCategory]] = {
b'internals': internalstable,
}
# Map topics to lists of callable taking the current topic help and
# returning the updated version
......@@ -585,8 +615,8 @@
b'internals': internalstable,
}
# Map topics to lists of callable taking the current topic help and
# returning the updated version
helphooks = {}
helphooks: Dict[bytes, List[_TopicHook]] = {}
......@@ -591,6 +621,6 @@
def addtopichook(topic, rewriter):
def addtopichook(topic: bytes, rewriter: _TopicHook) -> None:
helphooks.setdefault(topic, []).append(rewriter)
......@@ -594,7 +624,14 @@
helphooks.setdefault(topic, []).append(rewriter)
def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
def makeitemsdoc(
ui: uimod.ui,
topic: bytes,
doc: bytes,
marker: bytes,
items: Dict[bytes, bytes],
dedent: bool = False,
) -> bytes:
"""Extract docstring from the items key to function mapping, build a
single documentation block and use it to overwrite the marker in doc.
"""
......@@ -622,8 +659,10 @@
return doc.replace(marker, entries)
def addtopicsymbols(topic, marker, symbols, dedent=False):
def add(ui, topic, doc):
def addtopicsymbols(
topic: bytes, marker: bytes, symbols, dedent: bool = False
) -> None:
def add(ui: uimod.ui, topic: bytes, doc: bytes):
return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
addtopichook(topic, add)
......@@ -647,7 +686,7 @@
)
def inserttweakrc(ui, topic, doc):
def inserttweakrc(ui: uimod.ui, topic: bytes, doc: bytes) -> bytes:
marker = b'.. tweakdefaultsmarker'
repl = uimod.tweakrc
......@@ -658,7 +697,9 @@
return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
def _getcategorizedhelpcmds(ui, cmdtable, name, select=None):
def _getcategorizedhelpcmds(
ui: uimod.ui, cmdtable, name: bytes, select: Optional[_SelectFn] = None
) -> Tuple[Dict[bytes, List[bytes]], Dict[bytes, bytes], _SynonymTable]:
# Category -> list of commands
cats = {}
# Command -> short description
......@@ -687,10 +728,12 @@
return cats, h, syns
def _getcategorizedhelptopics(ui, topictable):
def _getcategorizedhelptopics(
ui: uimod.ui, topictable: List[_HelpEntry]
) -> Tuple[Dict[bytes, List[Tuple[bytes, bytes]]], Dict[bytes, List[bytes]]]:
# Group commands by category.
topiccats = {}
syns = {}
for topic in topictable:
names, header, doc = topic[0:3]
if len(topic) > 3 and topic[3]:
......@@ -691,8 +734,8 @@
# Group commands by category.
topiccats = {}
syns = {}
for topic in topictable:
names, header, doc = topic[0:3]
if len(topic) > 3 and topic[3]:
category = topic[3]
category: bytes = cast(bytes, topic[3]) # help pytype
else:
......@@ -698,5 +741,5 @@
else:
category = TOPIC_CATEGORY_NONE
category: bytes = TOPIC_CATEGORY_NONE
topicname = names[0]
syns[topicname] = list(names)
......@@ -709,5 +752,5 @@
def help_(
ui,
ui: uimod.ui,
commands,
......@@ -713,7 +756,7 @@
commands,
name,
unknowncmd=False,
full=True,
subtopic=None,
fullname=None,
name: bytes,
unknowncmd: bool = False,
full: bool = True,
subtopic: Optional[bytes] = None,
fullname: Optional[bytes] = None,
**opts
......@@ -719,5 +762,5 @@
**opts
):
) -> bytes:
"""
Generate the help for 'name' as unformatted restructured text. If
'name' is None, describe the commands available.
......@@ -725,7 +768,7 @@
opts = pycompat.byteskwargs(opts)
def helpcmd(name, subtopic=None):
def helpcmd(name: bytes, subtopic: Optional[bytes]) -> List[bytes]:
try:
aliases, entry = cmdutil.findcmd(
name, commands.table, strict=unknowncmd
......@@ -826,7 +869,7 @@
return rst
def helplist(select=None, **opts):
def helplist(select: Optional[_SelectFn] = None, **opts) -> List[bytes]:
cats, h, syns = _getcategorizedhelpcmds(
ui, commands.table, name, select
)
......@@ -846,7 +889,7 @@
else:
rst.append(_(b'list of commands:\n'))
def appendcmds(cmds):
def appendcmds(cmds: Iterable[bytes]) -> None:
cmds = sorted(cmds)
for c in cmds:
display_cmd = c
......@@ -955,7 +998,7 @@
)
return rst
def helptopic(name, subtopic=None):
def helptopic(name: bytes, subtopic: Optional[bytes] = None) -> List[bytes]:
# Look for sub-topic entry first.
header, doc = None, None
if subtopic and name in subtopics:
......@@ -998,7 +1041,7 @@
pass
return rst
def helpext(name, subtopic=None):
def helpext(name: bytes, subtopic: Optional[bytes] = None) -> List[bytes]:
try:
mod = extensions.find(name)
doc = gettext(pycompat.getdoc(mod)) or _(b'no help text available')
......@@ -1040,7 +1083,9 @@
)
return rst
def helpextcmd(name, subtopic=None):
def helpextcmd(
name: bytes, subtopic: Optional[bytes] = None
) -> List[bytes]:
cmd, ext, doc = extensions.disabledcmd(
ui, name, ui.configbool(b'ui', b'strict')
)
......@@ -1127,8 +1172,14 @@
def formattedhelp(
ui, commands, fullname, keep=None, unknowncmd=False, full=True, **opts
):
ui: uimod.ui,
commands,
fullname: Optional[bytes],
keep: Optional[Iterable[bytes]] = None,
unknowncmd: bool = False,
full: bool = True,
**opts
) -> bytes:
"""get help for a given topic (as a dotted name) as rendered rst
Either returns the rendered help text or raises an exception.
......