
    6h/                       S r SSKJr  SSKJr  SSKJrJrJrJ	r	J
r
JrJrJrJrJr  Sr0 r\R&                  " \5      rS rS rS rS	 rS
 rS r\" SSS/ \" S5      \" S5      4SS/ \" S5      \" S5      4SS/ \" S5      \" S5      4SSS\" S5      4SS/ \" S5      \" S5      4SS/ \" S5      \" S5      4SS / \" S!5      \" S5      4SS"S\" S#5      4SS$S\" S%5      4SS&S\" S'5      4/
\R4                  -   \" S(5      S)S*9S+ 5       rg,)-aG	  allow sparse checkouts of the working directory (EXPERIMENTAL)

(This extension is not yet protected by backwards compatibility
guarantees. Any aspect may break in future releases until this
notice is removed.)

This extension allows the working directory to only consist of a
subset of files for the revision. This allows specific files or
directories to be explicitly included or excluded. Many repository
operations have performance proportional to the number of files in
the working directory. So only realizing a subset of files in the
working directory can improve performance.

Sparse Config Files
-------------------

The set of files that are part of a sparse checkout are defined by
a sparse config file. The file defines 3 things: includes (files to
include in the sparse checkout), excludes (files to exclude from the
sparse checkout), and profiles (links to other config files).

The file format is newline delimited. Empty lines and lines beginning
with ``#`` are ignored.

Lines beginning with ``%include `` denote another sparse config file
to include. e.g. ``%include tests.sparse``. The filename is relative
to the repository root.

The special lines ``[include]`` and ``[exclude]`` denote the section
for includes and excludes that follow, respectively. It is illegal to
have ``[include]`` after ``[exclude]``.

Non-special lines resemble file patterns to be added to either includes
or excludes. The syntax of these lines is documented by :hg:`help patterns`.
Patterns are interpreted as ``glob:`` by default and match against the
root of the repository.

Exclusion patterns take precedence over inclusion patterns. So even
if a file is explicitly included, an ``[exclude]`` entry can remove it.

For example, say you have a repository with 3 directories, ``frontend/``,
``backend/``, and ``tools/``. ``frontend/`` and ``backend/`` correspond
to different projects and it is uncommon for someone working on one
to need the files for the other. But ``tools/`` contains files shared
between both projects. Your sparse config files may resemble::

  # frontend.sparse
  frontend/**
  tools/**

  # backend.sparse
  backend/**
  tools/**

Say the backend grows in size. Or there's a directory with thousands
of files you wish to exclude. You can modify the profile to exclude
certain files::

  [include]
  backend/**
  tools/**

  [exclude]
  tools/tests/**
    )annotations)_)
cmdutilcommandserror
extensions
logcmdutilmergepycompat	registrarsparseutils   ships-with-hg-corec                \    S[         l        [        U 5        [        U 5        [	        U 5        g )NT)r   enabled_setupclone	_setuplog	_setupadd)uis    ./usr/lib/python3/dist-packages/hgext/sparse.pyextsetupr   d   s    FNObMbM    c                   U n[        U5      (       d   eU [        LaK  XR                  ;   a"  U R                  U   n[        XU" U5      5        OU R                  S   n U [        La  MK  U [        L a  [        [        S5      X14-  5      eg)zeReplace a filecache property with a new class. This allows changing the
cache invalidation condition.r   s   type '%s' has no property '%s'N)callableobject__dict__setattr	__bases__AttributeErrorr   )clspropnamereplacementorigclsorigs        r   replacefilecacher$   l   s     GK    
V
||#<<)DC;t#45mmA V
 f}/0G3FF
 	
 r   c                    [         R                  S   nUS   R                  S5        S n[        R                  " [
        SU5        g )Ns   log|history   )r      sparseNs1   limit to changesets affecting the sparse checkoutc                   ^^ U " TU5      nUR                   R                  S5      (       a.  [        R                  " T5      mUU4S jnUR	                  U5      nU$ )Nr'   c                T   > TU    n[        U4S jUR                  5        5       5      $ )Nc              3  F   >#    U  H  nT" U5      (       d  M  Uv   M     g 7f)N ).0fsparsematchs     r   	<genexpr>D_setuplog.<locals>._initialrevs.<locals>.ctxmatch.<locals>.<genexpr>   s     Dk[^11ks   !	!)anyfiles)revctxrepor.   s     r   ctxmatch1_setuplog.<locals>._initialrevs.<locals>.ctxmatch   s#    3iDciikDDDr   )optsgetr   matcherfilter)r#   r5   woptsrevsr6   r.   s    `   @r   _initialrevs_setuplog.<locals>._initialrevs   sK    D% ::>>)$$ ...KE ;;x(Dr   r>   )r   tableappendr   wrapfunctionr	   )r   entryr>   s      r   r   r   ~   s>    NN>*E	!HOO	

 JEr   c                (  ^^^	 UR                  S5      m	UR                  S5      mUR                  S5      mUR                  S5      nU(       d9  T	(       d  T(       d  T(       a$  UUU	4S jn[        R                  " [        SU5        U " X/UQ70 UD6$ )Nincludeexcludeenable_profilenarrowc           	        > [         R                  " UR                  5       R                  5       0 TTTSS9  U " U/UQ70 UD6$ )NT)rE   rF   enableprofileusereporootpaths)r   updateconfigr5   
unfiltered)r#   r4   argskwargsrJ   rF   rE   s       r   clonesparse$_clonesparsecmd.<locals>.clonesparse   sI    
%%'+!% -d-f--r   update)r9   r   rB   mergemod)
r#   r   r5   rN   r8   
narrow_patrP   rJ   rF   rE   s
          @@@r   _clonesparsecmdrU      su    hhy!Ghhy!GHH-.M(#J 7g		. 	(K@(4(4((r   c                   [         R                  S   nUS   R                  SS/ S45        US   R                  SS/ S45        US   R                  SS/ S	45        [        R                  " [         R                  S[
        5        g )
Ns   cloner&   r      enable-profiles   enable a sparse profile   includes   include sparse pattern   excludes   exclude sparse pattern)r   r@   rA   r   wrapcommandrU   )r   rC   s     r   r   r      su    NN8$E	!HOOS+R1KLM	!HOOS*b*CDE	!HOOS*b*CDE8>>8_Er   c                    [         R                  S   nUS   R                  S5        S n[        R                  " [         R                  SU5        g )Ns   addr&   )   sr'   Ns8   also include directories of added files in sparse configc                    UR                  S5      (       aZ  [        5       nU H,  n[        R                  " U5      u  pxUR	                  U5        M.     [
        R                  " X$[        U5      S9  U " X/UQ70 UD6$ )Nr   )rE   )r9   setr   splitaddr   rL   list)	r#   r   r5   patsr8   dirspatdirnamebasenames	            r   _add_setupadd.<locals>._add   si    88H5D$(JJsO!!  DJ?B,t,t,,r   )r   r@   rA   r   rZ   )r   rC   rg   s      r   r   r      sB    NN6"E	!HOO	
- 8>>648r   s   debugsparse   IrX   s$   include files in the sparse checkouts   PATTERN   XrY   s$   exclude files in the sparse checkout   d   deletes   delete an include/exclude rule   f   forceFs.   allow changing rules even with pending changesr   rW   s   enables the specified profiles   disable-profiles   disables the specified profiles   import-ruless   imports rules from a files   clear-ruless"   clears local include/exclude rules   refreshs,   updates the working after sparseness changes   resets   makes the repo full agains
   [--OPTION]T)	helpbasicc                L   [         R                  " U5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      n	UR                  S5      n
UR                  S	5      nUR                  S
5      n[        R                  " USSS	5      n[        U=(       d&    U=(       d    U
=(       d    U=(       d    U=(       d    U5      n[        U[        U5      /5      nUS:  a  [        R                  " [        S5      5      eSUl
        US:X  a  UR                  R                  S5      (       a  U R                  UR                  R                  S5      S-   5        [        R                   " U5      nU(       a=  U R                  [        S5      5        U R#                  SR%                  U5      S-   5        g[        R                  " [        S5      5      eU(       a  [        R&                  " UUUUUU
UUUS9	  U(       a  [        R(                  " XXS9  U	(       a  [        R*                  " XS9  U(       a  UR-                  5          [         R.                  " [0        [        R2                  " XR                  5       [        R4                  " U5      US95      n[        R6                  " U UUS   US   US   S9  SSS5        U?
gU?
g! , (       d  f       U?
g= f)a  make the current checkout sparse, or edit the existing checkout

The sparse command is used to make the current checkout sparse.
This means files that don't meet the sparse condition will not be
written to disk, or show up in any working copy operations. It does
not affect files in history in any way.

Passing no arguments prints the currently applied sparse rules.

--include and --exclude are used to add and remove files from the sparse
checkout. The effects of adding an include or exclude rule are applied
immediately. If applying the new rule would cause a file with pending
changes to be added or removed, the command will fail. Pass --force to
force a rule change even with pending changes (the changes on disk will
be preserved).

--delete removes an existing include/exclude rule. The effects are
immediate.

--refresh refreshes the files on disk based on the sparse rules. This is
only necessary if .hg/sparse was changed by hand.

--enable-profile and --disable-profile accept a path to a .hgsparse file.
This allows defining sparse checkouts and tracking them inside the
repository. This is useful for defining commonly used sparse checkouts for
many people to use. As the profile definition changes over time, the sparse
checkout will automatically be updated appropriately, depending on which
changeset is checked out. Changes to .hgsparse are not applied until they
have been committed.

--import-rules accepts a path to a file containing rules in the .hgsparse
format, allowing you to add --include, --exclude and --enable-profile rules
in bulk. Like the --include, --exclude and --enable-profile switches, the
changes are applied immediately.

--clear-rules removes all local include and exclude rules, while leaving
any enabled profiles in place.

Returns 0 if editing the sparse checkout succeeds.
rX   rY   rn   s   enable_profiles   disable_profiles   import_ruless   clear_rulesrl   ro   rp   r&   s   too many flags specifiedTr   r'      
s/   Temporarily Included Files (for merge/rebase):
Ns@   the debugsparse command is only supported on sparse repositories)rE   rF   resetdeleterJ   disableprofileforce)rw      )addeddroppedconflicting)r   byteskwargsr9   r   check_at_most_one_argboolsumr   Abortr   _has_sparsevfsexistsstatusreadr   readtemporaryincludesstatusnoi18njoinrL   importfromfiles
clearruleswlockmaplistlenrefreshwdirr:   printchanges)r   r5   r8   rE   rF   rw   rJ   rv   importrulesr   ru   refreshrt   actionrL   counttemporaryincludesfcountss                     r   debugsparser      s   R %Dhhz"Ghhz"GHHXEHH./MXX01N((?+K.)JXXi Fhhz"GHHXE**o~zF P7PfPPP.L tF|,-Eqykk!7899 Dz88??9%%IIdhhmmI.67 & < <T B 		IJ 

+< = EF++,  ')
	
 t;D$,ZZ\&&""++-)=UG aj
#AJ  	 \ 	s   A3L
L#N)__doc__
__future__r   mercurial.i18nr   	mercurialr   r   r   r   r	   r
   rS   r   r   r   r   
testedwithcmdtablecommandr   r$   r   rU   r   r   templateoptsr   r+   r   r   <module>r      s  @D #   " #



H
%
$F4)2F9. 	 56jM	
 56jM	
 /0jM	
 ?@		
 ./jM	
 /0jM	
 *+jM	
 
neQ'L%MN=>		
 
hq!=>?q9t u:v m}?@vA?@vr   