Mercurial > hg
comparison mercurial/commands.py @ 47763:76dccbbe73fd stable
typing: convert an annotation to an assertion in commands.py
Pytype was happy with the annotation at one point, but 2021.04.15 now complains.
Differential Revision: https://phab.mercurial-scm.org/D11206
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 21 Jul 2021 15:34:35 -0400 |
parents | f89d3050dcd5 |
children | 7d908ee19b5b |
comparison
equal
deleted
inserted
replaced
47762:f48a688a7044 | 47763:76dccbbe73fd |
---|---|
73 dateutil, | 73 dateutil, |
74 stringutil, | 74 stringutil, |
75 urlutil, | 75 urlutil, |
76 ) | 76 ) |
77 | 77 |
78 if pycompat.TYPE_CHECKING: | |
79 from typing import ( | |
80 List, | |
81 ) | |
82 | |
83 | |
84 table = {} | 78 table = {} |
85 table.update(debugcommandsmod.command._table) | 79 table.update(debugcommandsmod.command._table) |
86 | 80 |
87 command = registrar.command(table) | 81 command = registrar.command(table) |
88 INTENT_READONLY = registrar.INTENT_READONLY | 82 INTENT_READONLY = registrar.INTENT_READONLY |
3339 _(b'note: graft of %d:%s created no changes to commit\n') | 3333 _(b'note: graft of %d:%s created no changes to commit\n') |
3340 % (ctx.rev(), ctx) | 3334 % (ctx.rev(), ctx) |
3341 ) | 3335 ) |
3342 # checking that newnodes exist because old state files won't have it | 3336 # checking that newnodes exist because old state files won't have it |
3343 elif statedata.get(b'newnodes') is not None: | 3337 elif statedata.get(b'newnodes') is not None: |
3344 nn = statedata[b'newnodes'] # type: List[bytes] | 3338 nn = statedata[b'newnodes'] |
3339 assert isinstance(nn, list) # list of bytes | |
3345 nn.append(node) | 3340 nn.append(node) |
3346 | 3341 |
3347 # remove state when we complete successfully | 3342 # remove state when we complete successfully |
3348 if not opts.get('dry_run'): | 3343 if not opts.get('dry_run'): |
3349 graftstate.delete() | 3344 graftstate.delete() |