Submitter | phabricator |
---|---|
Date | Nov. 14, 2019, 3:52 a.m. |
Message ID | <differential-rev-PHID-DREV-7w2wacovvwnjepih2ykn-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/43179/ |
State | Superseded |
Headers | show |
Comments
dlax added inline comments. INLINE COMMENTS > cmdutil.py:3970 > def readgraftstate(repo, graftstate): > + # type: (Any, statemod.cmdstate) -> Dict[bytes, Any] > """read the graft state file and return a dict of the data stored in it""" Wouldn't `-> Dict[bytes, List[bytes]]` be okay? (Not sure why "Any" you're referering to in commit message, though I understand `Dict[bytes, Any]` comes from `state.cmdstate.read()` return type in D7383 <https://phab.mercurial-scm.org/D7383>.) REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7381/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7381 To: durin42, #hg-reviewers Cc: dlax, mercurial-devel
durin42 added inline comments. durin42 marked an inline comment as done. INLINE COMMENTS > dlax wrote in cmdutil.py:3970 > Wouldn't `-> Dict[bytes, List[bytes]]` be okay? (Not sure why "Any" you're referering to in commit message, though I understand `Dict[bytes, Any]` comes from `state.cmdstate.read()` return type in D7383 <https://phab.mercurial-scm.org/D7383>.) I'm pretty sure that some of the dict values are booleans at the very least? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7381/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7381 To: durin42, #hg-reviewers, dlax Cc: dlax, mercurial-devel
Patch
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -61,6 +61,15 @@ stringutil, ) +if not globals(): + from typing import ( + Any, + Dict, + ) + + for t in (Any, Dict): + assert t + stringio = util.stringio # templates of common command options @@ -3958,6 +3967,7 @@ def readgraftstate(repo, graftstate): + # type: (Any, statemod.cmdstate) -> Dict[bytes, Any] """read the graft state file and return a dict of the data stored in it""" try: return graftstate.read()