D6669: py: error out if a "skip" character was given with non-dict to util.dirs()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jul 22 15:04:06 EDT 2019


Closed by commit rHGb5092c23ca35: py: error out if a "skip" character was given with non-dict to util.dirs() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6669?vs=15995&id=15999

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

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3173,10 +3173,13 @@
     def __init__(self, map, skip=None):
         self._dirs = {}
         addpath = self.addpath
-        if safehasattr(map, 'iteritems') and skip is not None:
+        if isinstance(map, dict) and skip is not None:
             for f, s in map.iteritems():
                 if s[0] != skip:
                     addpath(f)
+        elif skip is not None:
+            raise error.ProgrammingError("skip character is only supported "
+                                         "with a dict source")
         else:
             for f in map:
                 addpath(f)



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


More information about the Mercurial-devel mailing list