Patchwork D7389: branchmap: annotate constructor type for branchcache

login
register
mail settings
Submitter phabricator
Date Nov. 15, 2019, 3:36 a.m.
Message ID <08fa5f8a3879c0242a9ae72e48774469@localhost.localdomain>
Download mbox | patch
Permalink /patch/43228/
State Not Applicable
Headers show

Comments

phabricator - Nov. 15, 2019, 3:36 a.m.
Closed by commit rHG9c1eccdd7ed8: branchmap: annotate constructor type for branchcache (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7389?vs=18078&id=18116

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7389/new/

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -27,6 +27,23 @@ 
     stringutil,
 )
 
+if not globals():
+    from typing import (
+        Any,
+        Callable,
+        Dict,
+        Iterable,
+        List,
+        Optional,
+        Set,
+        Tuple,
+        Union,
+    )
+
+    assert any(
+        (Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Union,)
+    )
+
 subsettable = repoviewutil.subsettable
 
 calcsize = struct.calcsize
@@ -165,6 +182,7 @@ 
         closednodes=None,
         hasnode=None,
     ):
+        # type: (Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes,  int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None
         """ hasnode is a function which can be used to verify whether changelog
         has a given node or not. If it's not provided, we assume that every node
         we have exists in changelog """
@@ -177,7 +195,7 @@ 
         if closednodes is None:
             self._closednodes = set()
         else:
-            self._closednodes = set(closednodes)
+            self._closednodes = closednodes
         self._entries = dict(entries)
         # whether closed nodes are verified or not
         self._closedverified = False