diff mercurial/pathutil.py @ 47944:e02f9af7aed1

pathutil: replace the `skip` argument of `dirs` with a boolean It is ever only used for `r` file. So we make it a boolean this will give use more versatility later as we will stop storing the state explicitly. Differential Revision: https://phab.mercurial-scm.org/D11383
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 30 Aug 2021 18:45:54 +0200
parents a9f38b144096
children 35f1ecd84bd0
line wrap: on
line diff
--- a/mercurial/pathutil.py	Thu Sep 02 00:16:37 2021 +0200
+++ b/mercurial/pathutil.py	Mon Aug 30 18:45:54 2021 +0200
@@ -315,20 +315,19 @@
 class dirs(object):
     '''a multiset of directory names from a set of file paths'''
 
-    def __init__(self, map, skip=None):
+    def __init__(self, map, only_tracked=False):
         """
         a dict map indicates a dirstate while a list indicates a manifest
         """
         self._dirs = {}
         addpath = self.addpath
-        if isinstance(map, dict) and skip is not None:
+        if isinstance(map, dict) and only_tracked:
             for f, s in pycompat.iteritems(map):
-                if s.state != skip:
+                if s.state != b'r':
                     addpath(f)
-        elif skip is not None:
-            raise error.ProgrammingError(
-                b"skip character is only supported with a dict source"
-            )
+        elif only_tracked:
+            msg = b"`only_tracked` is only supported with a dict source"
+            raise error.ProgrammingError(msg)
         else:
             for f in map:
                 addpath(f)