
    6hУ                    X   S r SSKJr  SSKrSSKrSSKrSSKJr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JrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(  SSK)J*r*JrJ+r+J,r,J-r-J.r.J/r0J1r1J2r2J3r3J4r4J5r5  \Rl                    0 r7\!Rl                  " \75      r60 r8\!Rr                  " \85      r9\9" S	S
SS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	S\Rt                  S/S9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	SSS9  \9" S	S SS9  \9" S	S!SS9  \9" S	S"SS9  \9" S	S#S$S9  \9" S	S%S&S9  \9" S	S'S(S9  \9" S	S)S*S9  \9" S	S+S,S9  \9" S	S-\Rt                  5        \9" S	S.SS9  \9" S	S/SS9  \9" S	S0SS9  \9" S	S1SS9  \9" S	S2SS9  \9" S3S4S5S5S69  \9" S7S8SS9  \9" S7S9S:S9  \9" S;S<SS9  S=r;\9" S	S>\;S9  \9" S	S?S@S94  \9" S	SA/ SBQS9  \9" S	SCSDS9  \9" S	SESFS9  \9" S	SGSHS9  \9" S	SIS@S94  \9" S	SJSH/S9  \9" S	SKSDS9  \9" S	SLSMS9  \9" S	SNSHS9  SOr<\Rz                  r>\>R~                  R                  \*R                  5        \4R                  rBSP rCSQ rDSR rESS rFST rGSU rHSV rISW rJSX rKSY rLSSZ jrMS[ rNS\ rOSS] jrPSS^ jrQS_ rRSS` jrSSqTSa rUSSb jrVSc rW\6" Sd/ \
" Se5      S5Sf9Sg 5       rXSh rYSi rZSj r[Sk r\Sl r]Sm r^Sn r_So r`\6" SpSqSrS\
" Ss5      4/\
" St5      S5Sf9Su 5       ra\6" SvSqSrS\
" Sw5      4/\
" Sx5      S5Sf9Sy 5       rb\6" SzSS{S\
" S|5      4SS}S\
" S~5      S4/\
" S5      S5Sf9S 5       rc\6" S/ \
" S5      S5Sf9S 5       rd\6" S/ \
" S5      5      S 5       re\6" S/ \
" S5      5      S 5       rf\6" S/ \
" S5      5      S 5       rgS rh\6" SSS/ \
" S5      \
" S5      4SS3S\
" S5      4SSS\
" S5      4/\R                  -   \
" S5      \6R                  S9S 5       rk\6" S3SSS\
" S5      S4SSS\
" S5      S4SSS\
" S5      S4/\
" S5      5      S 5       rlg)a  remotefilelog causes Mercurial to lazilly fetch file contents (EXPERIMENTAL)

This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATIBILITY
GUARANTEES. This means that repositories created with this extension may
only be usable with the exact version of this extension/Mercurial that was
used. The extension attempts to enforce this in order to prevent repository
corruption.

remotefilelog works by fetching file contents lazily and storing them
in a cache on the client rather than in revlogs. This allows enormous
histories to be transferred only partially, making them easier to
operate on.

Configs:

    ``packs.maxchainlen`` specifies the maximum delta chain length in pack files

    ``packs.maxpacksize`` specifies the maximum pack file size

    ``packs.maxpackfilecount`` specifies the maximum number of packs in the
      shared cache (trees only for now)

    ``remotefilelog.backgroundprefetch`` runs prefetch in background when True

    ``remotefilelog.bgprefetchrevs`` specifies revisions to fetch on commit and
      update, and on other commands that use them. Different from pullprefetch.

    ``remotefilelog.gcrepack`` does garbage collection during repack when True

    ``remotefilelog.nodettl`` specifies maximum TTL of a node in seconds before
      it is garbage collected

    ``remotefilelog.repackonhggc`` runs repack on hg gc when True

    ``remotefilelog.prefetchdays`` specifies the maximum age of a commit in
      days after which it is no longer prefetched.

    ``remotefilelog.prefetchdelay`` specifies delay between background
      prefetches in seconds after operations that change the working copy parent

    ``remotefilelog.data.gencountlimit`` constraints the minimum number of data
      pack files required to be considered part of a generation. In particular,
      minimum number of packs files > gencountlimit.

    ``remotefilelog.data.generations`` list for specifying the lower bound of
      each generation of the data pack files. For example, list ['100MB','1MB']
      or ['1MB', '100MB'] will lead to three generations: [0, 1MB), [
      1MB, 100MB) and [100MB, infinity).

    ``remotefilelog.data.maxrepackpacks`` the maximum number of pack files to
      include in an incremental data repack.

    ``remotefilelog.data.repackmaxpacksize`` the maximum size of a pack file for
      it to be considered for an incremental data repack.

    ``remotefilelog.data.repacksizelimit`` the maximum total size of pack files
      to include in an incremental data repack.

    ``remotefilelog.history.gencountlimit`` constraints the minimum number of
      history pack files required to be considered part of a generation. In
      particular, minimum number of packs files > gencountlimit.

    ``remotefilelog.history.generations`` list for specifying the lower bound of
      each generation of the history pack files. For example, list [
      '100MB', '1MB'] or ['1MB', '100MB'] will lead to three generations: [
      0, 1MB), [1MB, 100MB) and [100MB, infinity).

    ``remotefilelog.history.maxrepackpacks`` the maximum number of pack files to
      include in an incremental history repack.

    ``remotefilelog.history.repackmaxpacksize`` the maximum size of a pack file
      for it to be considered for an incremental history repack.

    ``remotefilelog.history.repacksizelimit`` the maximum total size of pack
      files to include in an incremental history repack.

    ``remotefilelog.backgroundrepack`` automatically consolidate packs in the
      background

    ``remotefilelog.cachepath`` path to cache

    ``remotefilelog.cachegroup`` if set, make cache directory sgid to this
      group

    ``remotefilelog.cacheprocess`` binary to invoke for fetching file data

    ``remotefilelog.debug`` turn on remotefilelog-specific debug output

    ``remotefilelog.excludepattern`` pattern of files to exclude from pulls

    ``remotefilelog.includepattern`` pattern of files to include in pulls

    ``remotefilelog.fetchwarning``: message to print when too many
      single-file fetches occur

    ``remotefilelog.getfilesstep`` number of files to request in a single RPC

    ``remotefilelog.getfilestype`` if set to 'threaded' use threads to fetch
      files, otherwise use optimistic fetching

    ``remotefilelog.pullprefetch`` revset for selecting files that should be
      eagerly downloaded rather than lazily

    ``remotefilelog.reponame`` name of the repo. If set, used to partition
      data from other repos in a shared store.

    ``remotefilelog.server`` if true, enable server-side functionality

    ``remotefilelog.servercachepath`` path for caching blobs on the server

    ``remotefilelog.serverexpiration`` number of days to keep cached server
      blobs

    ``remotefilelog.validatecache`` if set, check cache entries for corruption
      before returning blobs

    ``remotefilelog.validatecachelog`` if set, check cache entries for
      corruption before returning metadata

    )annotationsN)hexwdirrev)_)changegroup	changelogcommandsconfigitemscontextcopiesdebugcommandsdispatcherrorexchange
extensionshg	localrepomatchmerge
mergestatepatchpycompat	registrarrepairrepoviewrevsetscmutilsmartsetstreamcloneutil   )	constantsr   fileserverclientremotefilectxremotefilelogremotefilelogserverrepackshallowbundleshallowreposhallowstoreshallowutilshallowverifier   remotefilelogs   debugF)defaults   reponame    s	   cachepaths
   cachegroups   cacheprocesss   cacheprocess.includepaths
   cachelimits   1000 GBs   fallbackpath)r-   s   fallbackrepo)r.   aliass   validatecachelogs   validatecaches   on   servers   servercachepaths   serverexpiration      backgroundrepack   bgprefetchrevs   pullprefetch   backgroundprefetch   prefetchdelayx      prefetchdays   s   strip.includefilesalls   getfilesstepi'  s   getfilestypes
   optimistics	   batchsizes   fetchwarnings   includepatterns   excludepattern   gcrepack   repackonhggc   repacks   chainorphansbysizeT)r.   experimentals   packss   maxpacksizes   maxchainleni  s   devels   remotefilelog.bg-waiti ' s   nodettls   data.gencountlimit   s   data.generations)s   1GB   100MBs   1MBs   data.maxrepackpacks2   s   data.repackmaxpacksizes   4GBs   data.repacksizelimitrA   s   history.gencountlimits   history.generationss   history.maxrepackpackss   history.repackmaxpacksizes   400MBs   history.repacksizelimits   ships-with-hg-corec                   [         R                  R                  [        R                  5        [
        R                  " [        R                  S[        5      nUS   R                  SSS[        S5      45        [
        R                  " [        R                  S[        R                  5        [
        R                  " [        R                  S[        R                  5        [
        R                  " [        R                  S	[        5        [
        R                  " [        R                  S
[        5        S n[
        R                  " [        R                  SU5        S"S jn[
        R                   " SU5        [
        R                  " [        R                  S["        5        [$        R&                  [(        l        [
        R,                  " [(        S[$        R.                  5        [
        R,                  " [(        S[$        R0                  5        [
        R,                  " [2        S[4        5        [
        R,                  " [6        S[8        5        [
        R,                  " [:        S[<        5        [
        R,                  " [:        S[>        5        [
        R,                  " [@        RB                  S[D        5        [
        R,                  " [F        S[H        5        [
        R,                  " [J        S[L        5        [
        R,                  " [N        S[P        5        [
        R,                  " [R        S[T        5        [
        R,                  " [@        RV                  S[X        5        [
        R,                  " [@        RB                  S[Z        5        [
        R,                  " [\        S[^        5        [
        R,                  " [         S[`        5        [F        Rb                  Re                  S[f        5        [
        R,                  " [F        S[h        5        [
        R,                  " [j        S [l        5        [j        Rn                  [j        Rp                  S!'   g)#zMWraps user facing Mercurial commands to swap them out with shallow
versions.
s   cloner!   r/   s   shallowNs5   create a shallow clone which uses remote file historys
   debugindexs   debugindexdots   logs   pullc                    [        U5      (       a5  UR                  S5      (       a  [        R                  " [	        S5      5      eU " X/UQ70 UD6$ )Nr;   s(   --all is not supported in a shallow repo)	isenabledgetr   Abortr   )origuirepoargsoptss        >/usr/lib/python3/dist-packages/hgext/remotefilelog/__init__.py	_manifestuisetup.<locals>._manifest&  sA    T??txx++a KLMMB,t,t,,r/   s   manifestc                    S n [         R                  " S5      nU(       a+  UR                  [        R                  5        U[
        l        g g ! [         a     N?f = f)N   lfs)r   findKeyErrorwrapfilelogr%   r#   _lfsmod)loadedlfsmods     rM   
_lfsloadeduisetup.<locals>._lfsloaded/  sU    	__V,F }::;'-$   		s   A 
AArQ   s	   debugdata_addchangegroupfilesmakechangegroup	makestorepullapplyupdates_checkunknownfiles_checklookup_findrenames_computeforwardmissing
runcommand_collectbrokencsetsfilectxtrydiffverifyr-   getrenamedfnfilelogs   filelogF)9r   wirepeersetupfuncsappendr#   	peersetupr   wrapcommandr	   tablecloneshallowr   r   
debugindexdebugindexdotlogr]   afterloadeddebugdatashallowr(   shallowcg1packerr   cgpackerwrapfunctionaddchangegroupfilesr[   r   storewrapperr   exchangepullr   r^   checkunknownfilesr   
workingctxchecklookupr   findrenamesr   computeforwardmissingr   rc   r   rd   	changectxre   workingfilectxr   rf   _verifyfileprefetchhooksadd_fileprefetchhookrh   r   filelogrevsetri   symbols)rI   entryrN   rX   s       rM   uisetupr     s      !1!;!;<""8>>8\JE	!HOOFG		
 }'?'? (-*E*E 8>>6378>>7D9- 8>>;	B. 6:. 8>><9IJ(99K+]-N-N &(E(E I{LAHfl;E><@E#79JKG..LG^[A(*? HlJ?F$9;NOG--y'BG..	>JE9g6B'2!!"24EF G^\BFI}=!'FNN:r/   c                `  ^	^
 UR                  S5      (       aj  / m	U	4S jn[        R                  " [        SU5        S m
U
4S jn[        R                  " [        SU5        S
S jn[        R                  " [        SU5         U " X/UQ70 UD6  UR                  S5      (       a7  T	 H0  n[        US	5      (       d  M  UR                  R                  5         M2     g g ! UR                  S5      (       a7  T	 H0  n[        US	5      (       d  M  UR                  R                  5         M2     f f = f)Nshallowc                v  > [        U5      (       Gd  TR                  UR                  5       5        [        UR                  UR                  5       5        [        U[        R                  5      (       aB  UR                  R                  S   UR                  5       R                  4UR                  l        UR                  R                  [        R                  5        UR                  5          [        R                  " U5        S S S 5        [!        X/UQ70 UD6$ U " U/UQ70 UD6$ ! , (       d  f       N)= fNr   )rE   rl   
unfilteredsetupclientrI   
isinstancer   	__class__	__bases__requirementsr   r"   SHALLOWREPO_REQUIREMENTlockr   writereporequirementsr{   )rH   selfrK   kwargsreposs       rM   pull_shallow"cloneshallow.<locals>.pull_shallowa  s    T??T__./DGGT__%67 dH$5$566003)330DNN, !!%%i&G&GHYY[ 11$7 ! $D@@@@D242622 ![s   0D**
D8r]   c                F   ^ ^ UU 4S jn[         R                  " TSU5        g )Nc                >  > TR                  5       n[        R                  U;   ar  0 nTR                  (       a  SR	                  TR                  5      US'   TR
                  (       a  SR	                  TR
                  5      US'   TR                  " S0 UD6$ U " 5       $ )N    includepatternexcludepattern)s   stream_out_shallow)capabilitiesr"   NETWORK_CAP_LEGACY_SSH_GETFILESr   joinr   _callstream)rH   capsrL   remoterJ   s      rM   stream_out_shallowAcloneshallow.<locals>.setup_streamout.<locals>.stream_out_shallow  s    **,<<DD**16D<O<O1P-.**16D<O<O1P-.!--LtLL6Mr/   
stream_out)r   rx   )rJ   r   r   s   `` rM   setup_streamout%cloneshallow.<locals>.setup_streamout~  s    
" ##FL:LMr/   c                N   > T" UR                   UR                  5        U " U5      $ N)rJ   r   )rH   opr   s     rM   stream_wrap!cloneshallow.<locals>.stream_wrap  s    BGGRYY/8Or/   maybeperformlegacystreamclonec                    SUR                   R                  S/ 5      ;   a  / UR                   S'   U(       a  gU " XS9u  p4Ub  UR                  [        R                  5        X44$ )Ns   v2s   stream)FN)bundle2)remotebundle2capsrF   r   r"   r   )rH   pullopr   	supportedr   s        rM   canperformstreamclone+cloneshallow.<locals>.canperformstreamclone  se     0044YCC68((3"&*6&C#I'  !B!BC**r/   r   fileservicerj   )rF   r   rx   r   r   hasattrr   close)rH   rI   rJ   rK   rL   r   r   r   rr   r   s            @@rM   rp   rp   ]  s    xx		32 	&,?	N"	 	8+	
	+ 	02G	
*R%%%88I1m,,MM'')  488I1m,,MM'')  s   C +D- D-c                    [         R                   R                  n S [         R                   l        U " U0 UD6U[         R                   l        $ ! U[         R                   l        f = f)Nc                    g)Nr!    )xs    rM   <lambda>"debugdatashallow.<locals>.<lambda>  s    r/   )r%   __len__)rH   rK   kwdsoldlens       rM   ru   ru     sP    ((00F5.9##+T"T".4##+f##+s   A A&c                X   UR                  5       (       d  g U R                  SS[        5        U R                  SS[        5        U R                  SS5      n[	        U5      nU(       a  U(       a  [        S5      eU(       a  [        X5        U(       a  [        R                  " X5        g g )Ns   hookss   update.prefetchs   commit.prefetchr-   r1   s+   Cannot be both a server and shallow client.)	local	setconfigwcpprefetch
configboolrE   RuntimeErrorr   r&   setupserver)rI   rJ   isserverenabledisshallowclients       rM   	reposetupr     s    ::<< LL-{;LL-{;mm$4i@OoO?IJJB''1 r/   c                    [        U[        R                  5      (       d  g [        R                  " U 5        [        U 5        [        R                  " U5        [        R                  " UR                  5      Ul
        g r   )r   r   localrepositoryr&   onetimesetuponetimeclientsetupr)   wraprepor*   	wrapstorestore)rI   rJ   s     rM   r   r     sT    dI5566 $$R(r''

3DJr/   c                l    U " XU5      n[         R                  U;   a  [        R                  " U5      nU$ r   )r"   r   r*   r   )rH   r   pathvfstypess        rM   rz   rz     s1    \)A((L8""1%Hr/   c                "   [        U5      (       au  UR                  5       n/ n	UR                  [        R                  /5       H$  u  pnU	R                  U
[        X   5      45        M&     UR                  R                  U	5        U " XX4XV40 UD6$ r   )	rE   manifest
getactionsmergestatemod
ACTION_GETrl   r   r   prefetch)rH   rJ   mresultwctxmctx	overwritewantfiledatarL   r   filesfrK   msgs                rM   r^   r^     s     ==?#..0H0H/IJLASLL!S-./ K 	!!%(t9KdKKr/   c           	     j   [        U5      (       Ga  / nUR                  UR                  5       5      n	UR                  5        H  u  n
u  pnU	(       a  U	" U
5      (       d  M  U[        R
                  [        R                  [        R                  4;   a-  UR                  U
[        UR                  U
5      5      45        M  U[        R                  :X  d  M  US   nUR                  U[        UR                  U5      5      45        M     UR                  R                  U5        U " XX4U/UQ70 UD6$ r   )rE   maybesparsematchrevfilemapr   ACTION_CREATEDACTION_DELETED_CHANGEDACTION_CREATED_MERGErl   r   filenodeACTION_LOCAL_DIR_RENAME_GETr   r   )rH   rJ   r   r   forcer   rK   r   r   sparsematchr   m
actionargsr   f2s                  rM   r|   r|     s    ++DHHJ7'.'8#A#s;q>>,,4422 
 aT]]1%5!678m???]b#dmmB&7"89: (9 	!!%(DB4B6BBr/   c           
     "   UR                   n[        U5      (       ak  / nUR                   H>  nU H5  nXv;   d  M
  UR                  U[	        UR                  U5      5      45        M7     M@     UR                  R                  U5        U " XU5      $ r   )_reporE   _parentsrl   r   r   r   r   )rH   r   r   mtime_boundaryrJ   prefetchfilesparentr   s           rM   r~   r~   	  sz    ::DmmF;!((!S1C-D)EF  $
 	!!-0^,,r/   c                    [        U5      (       a^  / nUS   R                  5       nU H(  n	X;   d  M
  UR                  U	[        X   5      45        M*     UR                  R                  U5        U " XX4/UQ70 UD6$ )N   .)rE   r   rl   r   r   r   )
rH   rJ   matcheraddedremovedrK   r   r   pmfr   s
             rM   r   r     su    4j!!#AxaSV-.  	!!%(u????r/   c                   U " XUS9nUR                   n[        U5      (       a  UR                  5       n/ nUR                  UR	                  5       5      nU(       aS  [        5       n	U HA  n
U" U
5      (       d  M  UR                  U
[        Xj   5      45        U	R                  U
5        MC     U	nUR                  R                  U5        U$ )N)r   )r   rE   r   r   r   setrl   r   r   r   r   )rH   abr   missingrJ   mbr   r   sparsemissingr   s              rM   r   r   $  s    1u%G77DZZ\++AEEG4EMq>>LL!SZ1!%%a(  $G 	!!%(Nr/   c                    S nU(       a  [        U5      (       a  UR                  n U " X/UQ70 UD6U(       a  UR                  5         $ $ ! U(       a  UR                  5         f f = fr   )rE   r   r   )rH   luirJ   rK   r   r   s         rM   rc   rc   :  s_    K 	$&& C/// ; s   A A%c                    [        U5      (       a)  U Vs/ s H  oAR                  U5      (       a  M  UPM     nnU " XU5      $ s  snf r   )rE   shallowmatch)rH   rJ   r   striprevr   s        rM   rd   rd   I  s<    !>Eq):):1)=E>X&& ?s
   AAc                    Uc  UR                  U5      n[        UR                  5      (       a@  UR                  R                  U5      (       a   [        R                  " UR                  X#XS9$ U " XX4S9$ )N)fileidr   ri   )r  ri   )r   rE   r   r  r$   )rH   r   r   r  ri   s        rM   re   re   P  se    ~t$!8!8!>!>**JJt
 	
 6;;r/   c                    [        UR                  5      (       a@  UR                  R                  U5      (       a   [        R                  " UR                  X!US9$ U " XUS9$ )N)r}   ri   )ri   )rE   r   r  r$   remoteworkingfilectx)rH   r   r   ri   s       rM   r   r   Z  sR    !8!8!>!>11JJw
 	
 G,,r/   c
                   [        U5      (       a  / nUR                  5       nXV-   U-    H  nX;   a9  U	" X5      R                  5       nU(       a  UR                  U[	        U5      45        X;  d  MH  U	" X5      R                  5       nU(       d  Mg  UR                  U[	        U5      45        M     UR
                  R                  U5        U " UUUUUUUUU	/	U
Q70 UD6$ r   )rE   r   r   rl   r   r   r   )rH   rJ   revsctx1ctx2modifiedr  r  copy
getfilectxrK   r   r   mf1fnamefnodes                   rM   rf   rf   c  s     mmo%/E|"5/88:OOUCJ$78#"5/88:5OOUCJ$78 0 	!!(+ 
  r/   c                    UR                  5       n [        R                  " U5      R                  5       UR                  5         $ ! UR                  5         f = fr   )r   r,   rg   release)rH   rJ   levelr   s       rM   r   r     s<    99;D..t4;;=s   #A Ac                   ^ [         (       a  g Sq / m  SU4S jjn[        R                  " [        R                  SU5        U4S jn[        R                  " [        R                  SU5        g )NTc                   > [        U[        5      (       a  TR                  UUUUUUUUU	U
4
5        U$ U " UUUUUUUUU	U
S9
$ )N)
_metatuple)r   intrl   )rH   r   rawtexttransactionlinkp1p2nodeflags
cachedeltar#  pendingfilecommitss              rM   addrawrevision*onetimeclientsetup.<locals>.addrawrevision  su     dC  %% K% r/   r.  c                  > [        U5      nU " U/UQ70 UD6n[        U5      nXF:w  aV  T HO  nUu
  ppppnnUR                  U5      nUU:X  a  UR                  XUXXUU5	        M;  [        R                  " S5      e   O9[        T Vs1 s H  nUS   iM
     sn5      S:  a  [        R                  " S5      eTS S 2	 U$ s  snf )Ns4   pending multiple integer revisions are not supported   r!   )lenr*  r.  r   ProgrammingError)rH   r   rK   r   r   r*  newlenoldargsrs   rttrr'  r(  r)  nflcr   linknoder   r-  s                       rM   changelogadd(onetimeclientsetup.<locals>.changelogadd  s    TD*4*6*T-9@621!Q99T?t#&&rx1M00O  . "45"4QAaD"456:,,K  q! 6s   B?r   NN)clientonetimer   rx   r%   r   )rI   r.  r<  r-  s      @rM   r   r     sc    }M  )V ##%5~2 I//Er/   c                   ^^ [        T5      (       a  [        R                  " T5      (       a	  U " TU5      $ 0 mUU4S jnU$ )Nc                  > UTR                  U 0 5      ;   a  TU    U   $  TU   R                  U 5      nUR                  5        HK  nUR                  5       U :X  d  M  UR	                  5       nU=(       a    US   TU    UR                  5       '   MM     UR	                  5       nU=(       a    US   $ ! [        R                   a     gf = f)zlooks up all renames for a file (up to endrev) the first
time the file is given. It indexes on the changerev and only
parses the manifest if linkrev != changerev.
Returns rename info for fn at changerev rev.r   N)
setdefaultre   	ancestorsr   renamedr   r   LookupError)fnr   fctxancestorrD  rcacherJ   s        rM   
getrenamed getrenamedfn.<locals>.getrenamed  s    
 &##B++":c?"
	9$$R(D NN,==?b(&..0G181GWQZF2Jx||~. -
 llnG)wqz)   		s   9B2 AB2 2C	C	)rE   r   usechangesetcentricalgo)rH   rJ   endrevrJ  rI  s    `  @rM   rh   rh     s;    T??f<<TBBD&!!F( r/   c                H  ^ [        U5      (       d	  U " XU5      $ [        R                  " U[        S5      5      n[        R
                  " UR                  UR                  5       U/SUS   S9m[        5       n[        R                  " U5      (       d\  U HU  nX   nUR                  5       nTR                  5        H*  n	X;   d  M
  UR                  UR                  5       5          MS     MW     OU4S jUS    5       n
U
 Hl  n	US   R                  U	5      nUR                  UR                  5       5        UR                  5        H"  nUR                  UR                  5       5        M$     Mn     [         R"                  " U Vs/ s H  ofU;   d  M
  UPM     sn5      $ s  snf )a  ``filelog(pattern)``
Changesets connected to the specified filelog.

For performance reasons, ``filelog()`` does not show every changeset
that affects the requested file(s). See :hg:`help log` for details. For
a slower, more accurate result, use ``file()``.
s   filelog requires a patterns   relpathN)r.   ctxc              3  F   >#    U  H  nT" U5      (       d  M  Uv   M     g 7fr   r   ).0r   r   s     rM   	<genexpr> filelogrevset.<locals>.<genexpr>/  s     /Jq!A$Js   !	!)rE   r   	getstringr   matchmodr   rootgetcwdr  patkindr   r   r   re   linkrevrC  r   baseset)rH   rJ   subsetr   patr   r   rO  cfilesr   r   rG  actxr   s                @rM   r   r     sJ    T??D!$$ 

1a =>
?C		4;;=3%d	A 	AC  A'CYY[FWWY;EE#'')$   0DJ/A:%%a(DEE$,,.!(dlln% )  91q&Q9::9s   	FFs   gcs   hg gc [REPO...])norepoc                   [        5       n[        R                  " U SS9nU(       a  UR                  U5        / nU R                  R                  S5      nU(       a  UR                  U5        UR                  U5        / nU Hf  n [        R                  " U 0 U5      n	UR                  U	5        [        R                  " U	R                  SS9n
U
(       a  UR                  U
5        Mf  Mh     U H  n[        X5        M     U H#  n	[        R                  " X	R                   5        M%     g! [        R                   a     M  f = f)z4garbage collect the client and server filelog cachesT)
allowemptys   PWDN)r  r+   getcachepathr   environrF   rl   extendr   peerrI   r   	RepoErrorgcclientr&   gcserverr   )rI   rK   rL   
cachepathssystemcache	repopathspwdr   repopathrJ   	repocache	cachepaths               rM   gcrp  9  s    J **2$?K{# I
**..
 C
TE	772r8,DLL#00TJIy)    	   $$R4   		s   A D**EEc                v  ^ [         R                  R                  US5      n[         R                  R                  U5      (       d  U R	                  [        S5      U-  5        g [        US5       nUR                  5        Vs1 s H  oDS S iM	     nnS S S 5        / n[        5       nS nSn	Sn
U R                  [        S5      S[        W5      S9nU GHc  nUR                  U
5        U
S	-  n
 [        R                  " [         R                  R                  U5      5      n [$        R&                  " U 0 U5      nUR(                  nUR/                  U5        [1        U5      (       d  M  [3        US5      (       d  U R	                  [        S5      U-  5        M  UR4                  R7                  SS5      nUR4                  R7                  SS5      nU(       a#  U(       a   [8        R:                  " U5        Sn	GM(  UR@                  mU(       d  URB                  nU4S jn[8        RD                  " UUUS9nGMf     URG                  5         [         RH                  " S5      n [        US5       nURK                  U Vs/ s H  nSU-  PM
     sn5        S S S 5        [         RH                  " U5        Ub  URM                  U5        g U	(       d  U R	                  [        S5      5        g g s  snf ! , (       d  f       GNb= f! [         a?  nU R	                  [        S
5      X4-  5        [         R"                  " 5          S nAGMr  S nAff = f! [*        R,                   a     GM  f = f! [<        [8        R>                  4 a     GNf = fs  snf ! , (       d  f       GN= f! [         RH                  " U5        f = f)Ns   reposs   no known cache at %s
rbFr   s   analyzing repositories)unittotalr!   s   warning: malformed path: %r:%s
names.   repo %s is a misconfigured remotefilelog repo
r-   r=   r<   Tc                F   > [         R                  " TU [        U5      5      $ r   )r#   getcachekeyr   )r  r  reponames     rM   keyfngcclient.<locals>.keyfn  s    #//%ULLr/   )rz  lastkeepkeysr@   wb   %s
s$   warning: no valid repos in repofile
)'osr   r   existswarnr   open	readlinesr  makeprogressr2  updater    
expandpathnormpath	TypeError	traceback	print_excr   re  r   r   rf  rl   rE   r   rI   r   	repackmodincrementalrepackOSErrorRepackAlreadyRunningrv  sharedstorekeepsetcompleteumask
writelinesrp  )rI   ro  	repospath	reposfiler   r   
validreposkeepkeyssharedcachefilesrepackedcountprogressr   ere  rJ   repackonhggcgcrepackrz  oldumaskry  s                       @rM   rg  rg  _  s   Y1I77>>)$$
+,y89	i	)!*!4!4!67!6A3B!67 
 JuHKME	
#$83u:  H 
	??277#3#3D#9:D
	772r4(D::D 	$
 tV$$GGDEL 
 ww))*:OL77%%&6DH++D1 $ 99**K	M $$TXNi l  xxH)T"i  !DA7Q;!DE # 	 x 
:;< a 8 
	&  	GGA9:dYFG!	  		6 Y;;<  * "E #" 	s   0K.K)K.-3L !$MM(!N  -N=N	
NN  )K..
K= 
M	
3MM	M%$M%(NN	N
NN   N8c                Z   [        U5      (       d  U " X/UQ70 UD6$ UR                  S5      nUR                  S5      nU(       a  U(       a  U(       a  SUS'   U(       d  U(       d  [        R                  " US   U[        R
                  " U5      5      nUR                  5       (       + nU(       aN  UR                  5        H:  n	[        R                  R                  UR                  U	5      5      (       a  M8  Sn  O   U(       a  UR                  [        S5      5        U " X/UQ70 UD6$ )Nfollowr   Tr  r   FsE   warning: file log can be slow on large repos - use -f to speed it up
)rE   rF   r   r   r   byteskwargsanypatsr   r  r   isfilewjoinr  r   )
rH   rI   rJ   patsrL   r  r  r   r  files
             rM   rs   rs     s    T??B,t,t,,XXhF88E?D "DO dMM$t*dH4H4H4NOE(F!KKMD77>>$**T*:;;!& *
 5 (4(4((r/   c                B    U R                  SS5      nUS:  a  SX4-  nU$ )zUpdate revset so that only changesets no older than 'prefetchdays' days
are included. The default value is set to 14 days. If 'prefetchdays' is set
to zero or negative value then date restriction is not applied.
r-   r9   r   s   (%s) & date(-%s))	configint)rI   r   dayss      rM   revdatelimitr    s-    
 <<(/:Dax$~5Mr/   c                n   U R                   R                  SS5      nU R                  R                  S5      nSn[	        US5         [
        R                  R                  U5      n[        R                  " 5       U-
  U:  a  [
        R                  " US5        SnSSS5        U$ ! , (       d  f       U$ = f)zCheck that enough time has passed since the last background prefetch.
This only relates to prefetches after operations that change the working
copy parent. Default delay between background prefetches is 2 minutes.
r-   r7   s   lastprefetchFr  NT)
rI   r  vfsr   r  r  r   getmtimetimeutime)rJ   timeoutr  readymodtimes        rM   readytofetchr    s    
 gg 02BCGHHMM/*EE	eS	''""5)IIK'!W,HHUD!E 
 L 
	 Ls   AB%%
B4c                  ^^^ [        T5      nU R                  SS5      m[        T5      nU(       a  T(       a  U(       d  gTR                  R	                  SS5      m[        U T5      mUUU4S jnTR                  U5        g)zPrefetches in background revisions specified by bgprefetchrevs revset.
Does background repack if backgroundrepack flag is set in config.
r-   r4   Nr3   c                z   > [        TS5      (       a  TR                  (       a  g STl        TR                  TTS9  g )NranprefetchTr'   )r   r  backgroundprefetch)unused_successbgprefetchrevsbgrepackrJ   s    rM   anonwcpprefetch.<locals>.anon  s6    4''D,<,<x@r/   )rE   configr  rI   r   r  
_afterlock)rI   rJ   r   r   isreadyr  r  r  s    `    @@rM   r   r     sl     oGYY/1BCN4 G7ww!!"24GHH!"n5NA 	OODr/   c                *   U " X/UQ70 UD6n[        U5      (       a  UR                  SS5      nUR                  R                  SS5      nUR                  R                  SS5      nU(       a  UR	                  [        S5      5        [        R                  " X&/5      n	US   R                  5       n
U(       a  UR                  XgS9  U$ UR                  XS9  U(       a  [        R                  " US	S
9  U$ U(       a  [        R                  " US	S
9  U$ )Nr-   r5   r3   r6   s   prefetching file contents
r   r  )baseTincremental)rE   r  rI   r   statusr   r   revranger   r  r   r  backgroundrepack)rH   rI   rJ   r  rL   resultprefetchrevsetr  
bgprefetchr  r  s              rM   r]   r]     s    "*T*T*F#3_E77%%&68KLWW''(8:OP
IIa678##D*:;D:>>#D'''H M d...tF M &&t>Mr/   c                     SS jn[        US5      (       a  Xl        O)[        US5      (       a  [        R                  " USU5        U " X/UQ70 UD6$ )Nc                z    U(       d
  [        5       nUR                  [        R                  5        U " U4X#US.UD6$ )N)headscommon
bundlecaps)r  r   r"   BUNDLE2_CAPABLITY)rH   sourcer  r  r  r   s         rM   localgetbundle$exchangepull.<locals>.localgetbundle0  sB     Jy223
:
IO
 	
r/   r   	getbundle)NNN)r   
_localrepor   rx   )rH   rJ   r   rK   r   r  s         rM   r{   r{   -  sU     ;?
 v}%% 		%	%^D.t.v..r/   c           	        [        U 5      (       a  / nU H  u  p4U[        :X  d  Uc  M  X   nUR                  5       nU R                  UR	                  5       5      nUR                  U5       H>  nU(       a  U" U5      (       d  M  X;   d  M   UR                  U[        Xh   5      45        M@     M     U R                  R                  U5        g g r   )
rE   r   r   r   r   walkrl   r   r   r   )	rJ   
revmatchesallfilesr   r   rO  mfr   r   s	            rM   r   r   B  s    $JCg~)CB//	:K#{4'8'8djOOT3rx=$9: ( % 	!!(+ r/   s   debugremotefilelog   ds
   decompresss   decompress the filelog firsts   hg debugremotefilelog <path>c                0    [         R                  " X40 UD6$ r   )r   debugremotefilelogrI   r   rL   s      rM   r  r  Q  s     ++B===r/   s   verifyremotefilelogs   decompress the filelogs firsts#   hg verifyremotefilelogs <directory>c                0    [         R                  " X40 UD6$ r   )r   verifyremotefilelogr  s      rM   r  r  ]  s     ,,R>>>r/   s   debugdatapacks   longs   print the long hashess   nodes   dump the contents of nodes   NODEs   hg debugdatapack <paths>c                6    [         R                  " U /UQ70 UD6$ r   )r   debugdatapack)rI   pathsrL   s      rM   r  r  i  s     &&r:E:T::r/   s   debughistorypacks   hg debughistorypack <path>c                .    [         R                  " X5      $ r   )r   debughistorypackr  s      rM   r  r  v  s    ))"33r/   s   debugkeepsets   hg debugkeepsetc                @   ^ U4S jn[         R                  " TU5        g )Nc                Z   > [         R                  " TR                  U [        U5      5      $ r   )r#   rx  rv  r   )r  r  rJ   s     rM   rz  debugkeepset.<locals>.keyfn~  s     ++DIIuc%jIIr/   )r  r  )rI   rJ   rL   rz  s    `  rM   debugkeepsetr  {  s    J dE"
r/   s   debugwaitonrepacks   hg debugwaitonrepackc                .    [         R                  " U5      $ r   )r   debugwaitonrepackrI   rJ   rL   s      rM   r  r    s    **400r/   s   debugwaitonprefetchs   hg debugwaitonprefetchc                .    [         R                  " U5      $ r   )r   debugwaitonprefetchr  s      rM   r  r    s    ,,T22r/   c                p   UR                  S5      (       d  SS/nU R                  SSS 5      nU(       a  UR                  " SU-  5        U R                  SSS 5      nU(       a  UR                  " SU-  5        SR                  U5      n[	        X5      nU/US'   UR                  S	5      (       d  S US	'   U$ )
N   revr   s   draft()r-   r5   s   (%s)r4      +   base)rF   r  rl   r   r  )rI   rL   r   r  r  s        rM   resolveprefetchoptsr    s    88F
##3_dKMM'N23#35FMMM'N236" b)xV88GWKr/   s   prefetch   rr  s    prefetch the specified revisionss   REVs   run repack after prefetch   br  s'   rev that is assumed to already be locals   hg prefetch [OPTIONS] [FILE...])helpcategoryc                   [         R                  " U5      n[        U5      (       d  [        R                  " [        S5      5      e[        X5      n[        R                  " XR                  S5      5      nUR                  XCR                  S5      X#5        UR                  S5      (       a  [        R                  " USS9  gg)a\  prefetch file revisions from the server

Prefetchs file revisions for the specified revs and stores them in the
local remotefilelog cache.  If no rev is specified, the default rev is
used which is the union of dot, draft, pullprefetch and bgprefetchrev.
File names or patterns can be used to limit which files are downloaded.

Return 0 on success.
s   repo is not shallowr  r  r>   Tr  N)r   r  rE   r   rG   r   r  r   r  rF   r   r  r  )rI   rJ   r  rL   r  s        rM   r   r     s    * %DT??kk!2344r(DD((6"23DMM$)46 xx	""4T: r/   s
   backgrounds   run in a background processs   incrementals   do an incremental repack	   packsonlys&   only repack packs (skip loose objects)s   hg repack [OPTIONS]c                   UR                  S5      (       a6  [        R                  " UUR                  S5      UR                  SS5      S9  g SUR                  S5      0n UR                  S5      (       a  [        R                  " XS9  g [        R                  " XS9  g ! [        R
                   a(  nUR                  R                  SU-  5         S nAg S nAff = f)	N
backgroundr  	packsonlyF)r  r  r  )optionsr~  )rF   r  r  r  
fullrepackr  rI   r  )rI   rJ   r  rL   r  exs         rM   repack_r     s      xx""/hh{E2	

 	TXXk23G#88M""''>  7)) # 	Wr\""#s   !*B! B! !C5CCr   r>  )m__doc__
__future__r   r  r  r  mercurial.noder   r   mercurial.i18nr   	mercurialr   r   r	   r
   r   r   r   hgdebugcommandsr   r   r   r   r   r   r   rU  r   r   r   r   r   r   r   r   r   r   r   r   r     r"   r#   r$   r%   r&   r'   r  r(   r)   r*   r+   r,   commandcmdtableconfigtable
configitemdynamicdefault_defaultlimit
testedwithr   	repoclass_basesupportedr   r   rE   r   rp   ru   r   r   rz   r^   r|   r~   r   r   rc   rd   re   r   rf   r   r?  r   rh   r   rp  rg  rs   r  r  r   r]   r{   r   r  r  r  r  r  r  r  r  walkoptsCATEGORY_MAINTENANCEr   r   r   r/   rM   <module>r     s^  wr # 	         8       


H
%!!+.
 
Xu 5 
[# 6 
\4 8 
]D 9 
_d ; 
8$ G 
]J ? 
&&.
/	 0$ ? 
-u = 
Y 5 
/ > 
0" = 
0% @ 
. = 
_d ; 
2E B 
-s ; 
_b 9 
2E B 
_e < 
_m D 
\;+E+E F 
_c : 
. = 
. = 
[% 8 
_e < 
9+T M 
8^Q / 
8^T 2 
8-u = " 
Z ? 
2A > ? 
)3M 3R @ 
6 G 
4h G 
5q A B 
3hZ H 
6 C 
98 L 
7 J #
%%	 	    Y>> ?!!	N0bQ*h52*
4
LC,
-	@, '<-*^ TFn:%;P 	A()$7"5 8"5JY=x )F&02/*, 		}dA&E$FG %&>> 		}dA&F$GH ,-?? 		gtQ789	gsA:;WE !";; 		b!$A"B4P4 Q4 	"a 234 5 		r1%<#=>1 ?1 		Q'@%AB3 C3. 		vr1@A1V9M	i"> ?@	wQIJK
  ()--
;
;. 		mT1%C#DdK	ndA&A$BDI78	

 ##r/   