# HG changeset patch # User Yuya Nishihara # Date 2019-11-19 14:53:12 # Node ID f892089b19a05964bb8044be5a42bc4f4482504f # Parent 47b8ca03c5183d6a2753b3d8c08557820edfe8c0 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] 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.