Patchwork D7289: branchmap: always copy closednodes to a set

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 11 p.m.
Message ID <differential-rev-PHID-DREV-qojpn5wzfuyzim3adsgv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42839/
State New
Headers show

Comments

phabricator - Nov. 6, 2019, 11 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This avoids some typechecking problems in other places in this file. I
  suspect we could also avoid this by adding an explicit type annotation
  on the __init__ here, but this felt slightly less invasive.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 8, 2019, 4:43 p.m.
This revision now requires changes to proceed.
indygreg added a comment.
indygreg requested changes to this revision.


  Could you please add a comment or add an annotation? I really don't like having to recreate collection instances to satisfy a type checker. Am I wrong in thinking this shouldn't be necessary?

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -177,7 +177,7 @@ 
         if closednodes is None:
             self._closednodes = set()
         else:
-            self._closednodes = closednodes
+            self._closednodes = set(closednodes)
         self._entries = dict(entries)
         # whether closed nodes are verified or not
         self._closedverified = False