equal
deleted
inserted
replaced
313 |
313 |
314 |
314 |
315 class dirs(object): |
315 class dirs(object): |
316 '''a multiset of directory names from a set of file paths''' |
316 '''a multiset of directory names from a set of file paths''' |
317 |
317 |
318 def __init__(self, map, skip=None): |
318 def __init__(self, map, only_tracked=False): |
319 """ |
319 """ |
320 a dict map indicates a dirstate while a list indicates a manifest |
320 a dict map indicates a dirstate while a list indicates a manifest |
321 """ |
321 """ |
322 self._dirs = {} |
322 self._dirs = {} |
323 addpath = self.addpath |
323 addpath = self.addpath |
324 if isinstance(map, dict) and skip is not None: |
324 if isinstance(map, dict) and only_tracked: |
325 for f, s in pycompat.iteritems(map): |
325 for f, s in pycompat.iteritems(map): |
326 if s.state != skip: |
326 if s.state != b'r': |
327 addpath(f) |
327 addpath(f) |
328 elif skip is not None: |
328 elif only_tracked: |
329 raise error.ProgrammingError( |
329 msg = b"`only_tracked` is only supported with a dict source" |
330 b"skip character is only supported with a dict source" |
330 raise error.ProgrammingError(msg) |
331 ) |
|
332 else: |
331 else: |
333 for f in map: |
332 for f in map: |
334 addpath(f) |
333 addpath(f) |
335 |
334 |
336 def addpath(self, path): |
335 def addpath(self, path): |