Patchwork D7382: logcmdutil: add a type annotation

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2019, 3:52 a.m.
Message ID <differential-rev-PHID-DREV-6clrtzddthaafnlpymlo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43175/
State Superseded
Headers show

Comments

phabricator - Nov. 14, 2019, 3:52 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This wasn't actually required in the end, as there was a real bug
  found by pytype, but the annotation helped me figure that out. We can
  drop this patch if that's the preference.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7382

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -42,6 +42,16 @@ 
 )
 
 
+if not globals():
+    from typing import (
+        Any,
+        Tuple,
+    )
+
+    for t in (Any, Tuple):
+        assert t
+
+
 def getlimit(opts):
     """get the log limit according to option -l/--limit"""
     limit = opts.get(b'limit')
@@ -840,6 +850,7 @@ 
 
 
 def getrevs(repo, pats, opts):
+    # type: (Any, Any, Any) -> Tuple[smartset.BaseSet, changesetdiffer]
     """Return (revs, differ) where revs is a smartset
 
     differ is a changesetdiffer with pre-configured file matcher.