Submitter | Yuya Nishihara |
---|---|
Date | Nov. 19, 2019, 3:20 p.m. |
Message ID | <835d415c5a17258e2cf1.1574176851@mimosa> |
Download | mbox | patch |
Permalink | /patch/43362/ |
State | Accepted |
Headers | show |
Comments
Yuya Nishihara a écrit : > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1574175192 -32400 > # Tue Nov 19 23:53:12 2019 +0900 > # Node ID 835d415c5a17258e2cf11e9fcd650441690dfbd4 > # Parent 75589cc751d7053a9852f7de88b35ec64909a46a > typing: fix return type of logcmdutil.getrevs() > > Fixes the following errors: > > Invalid type annotation "'Tuple[smartset.BaseSet, changesetdiffer]'" > [invalid-annotation] > No attribute 'BaseSet' on module 'mercurial.smartset' > getrevs: bad option in return type [bad-return-type] > Expected: Tuple[mercurial.smartset.abstractsmartset, changesetdiffer] > Actually returned: Tuple[mercurial.smartset.baseset, None] I don't get the second error (running "pytype mercurial/logcmdutil.py"), but this is indeed correct.
Patch
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -45,10 +45,11 @@ from .utils import ( if pycompat.TYPE_CHECKING: from typing import ( Any, + Optional, Tuple, ) - for t in (Any, Tuple): + for t in (Any, Optional, Tuple): assert t @@ -853,7 +854,7 @@ def _initialrevs(repo, opts): def getrevs(repo, pats, opts): - # type: (Any, Any, Any) -> Tuple[smartset.BaseSet, changesetdiffer] + # type: (Any, Any, Any) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]] """Return (revs, differ) where revs is a smartset differ is a changesetdiffer with pre-configured file matcher.