
    6h                    ^    S SK Jr  S SKrS SKJrJrJrJrJrJ	r	  SSK
JrJr   " S S\5      rg)    )annotationsN)CallableListOptionalProtocolSetUnion   )HgPathTUserMsgTc                     \ rS rSr% Sr\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r	\R                  SS j5       r
SrS\S	'   \\R                  SS
 j5       5       r\R                  SS j5       r\\R                  SS j5       5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       r\R                  SS j5       rSrg)IMatcher   zQA protocol class that defines the common interface for all file matching
classes.c                    g N selfs    >/usr/lib/python3/dist-packages/mercurial/interfaces/matcher.pywas_tampered_with_nonrec!IMatcher.was_tampered_with_nonrec           c                    g r   r   r   s    r   was_tampered_withIMatcher.was_tampered_with!   r   r   c                    g r   r   )r   fns     r   __call__IMatcher.__call__%   r   r   c                    g r   r   )r   fmsgs      r   badIMatcher.bad+   r   r   Nz#Optional[Callable[[HgPathT], None]]traversedirc                    g r   r   r   s    r   _filesIMatcher._files3        	r   c                    g r   r   r   s    r   filesIMatcher.files8   r   r   c                    g r   r   r   s    r   _filesetIMatcher._fileset<   r*   r   c                    g)z!Returns True if f is in .files().Nr   r   r"   s     r   exactIMatcher.exactA       r   c                    g r   r   r2   s     r   matchfnIMatcher.matchfnE   r   r   c                    g)ax  Decides whether a directory should be visited based on whether it
has potential matches in it or one of its subdirectories. This is
based on the match's primary, included, and excluded patterns.

Returns the string 'all' if the given directory and all subdirectories
should be visited. Otherwise returns True or False indicating whether
the given directory should be visited.
Nr   r   dirs     r   visitdirIMatcher.visitdirI   r5   r   c                    g)aM  Decides whether a directory should be visited based on whether it
has potential matches in it or one of its subdirectories, and
potentially lists which subdirectories of that directory should be
visited. This is based on the match's primary, included, and excluded
patterns.

This function is very similar to 'visitdir', and the following mapping
can be applied:

     visitdir | visitchildrenlist
    ----------+-------------------
     False    | set()
     'all'    | 'all'
     True     | 'this' OR non-empty set of subdirs -or files- to visit

Example:
  Assume matchers ['path:foo/bar', 'rootfilesin:qux'], we would return
  the following values (assuming the implementation of visitchildrenset
  is capable of recognizing this; some implementations are not).

  '' -> {'foo', 'qux'}
  'baz' -> set()
  'foo' -> {'bar'}
  # Ideally this would be 'all', but since the prefix nature of matchers
  # is applied to the entire matcher, we have to downgrade this to
  # 'this' due to the non-prefix 'rootfilesin'-kind matcher being mixed
  # in.
  'foo/bar' -> 'this'
  'qux' -> 'this'

Important:
  Most matchers do not know if they're representing files or
  directories. They see ['path:dir/f'] and don't know whether 'f' is a
  file or a directory, so visitchildrenset('dir') for most matchers will
  return {'f'}, but if the matcher knows it's a file (like exactmatcher
  does), it may return 'this'. Do not rely on the return being a set
  indicating that there are no files in this dir to investigate (or
  equivalently that if there are files to investigate in 'dir' that it
  will always return 'this').
Nr   r:   s     r   visitchildrensetIMatcher.visitchildrensetT   r5   r   c                    g)z[Matcher will match everything and .files() will be empty --
optimization might be possible.Nr   r   s    r   alwaysIMatcher.always   r5   r   c                    g)z[Matcher will match exactly the list of files in .files() --
optimization might be possible.Nr   r   s    r   isexactIMatcher.isexact   r5   r   c                    g)zWMatcher will match the paths in .files() recursively --
optimization might be possible.Nr   r   s    r   prefixIMatcher.prefix   r5   r   c                    g)zXNone of .always(), .isexact(), and .prefix() is true --
optimizations will be difficult.Nr   r   s    r   anypatsIMatcher.anypats   r5   r   r   )returnbool)r   r   rM   rN   )r"   r   r#   zOptional[UserMsgT]rM   None)rM   zList[HgPathT])rM   zSet[HgPathT])r"   r   rM   rN   )r;   r   rM   zUnion[bool, bytes])r;   r   rM   zUnion[Set[HgPathT], bytes])__name__
__module____qualname____firstlineno____doc__abcabstractmethodr   r   r   r$   r&   __annotations__propertyr(   r,   r/   r3   r7   r<   r?   rB   rE   rH   rK   __static_attributes__r   r   r   r   r      s    	  	  	 
 	 
 8<K4;   	     	0 0 	  	  	( (T 	+ + 	+ + 	+ + 	, ,r   r   )
__future__r   rU   typingr   r   r   r   r   r	   
_basetypesr   r   r   r   r   r   <module>r]      s*    # 
 x,x x,r   