ó
    6°hï  ã                  óR  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	J
r
JrJrJrJrJ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 J!r!J"r"  SSK#J$r$  \RJ                  S\RL                  S	\RN                  S
0r(\RJ                  S\RL                  S\RN                  S0r)      SFS jr*SGS jr+SHSIS jjr,SJS jr-SKS jr. SL   SMS jjr/      SNS jr0SOS jr1SPS jr2 SQ   SRS jjr3SSS jr4STS jr5SJS jr6 " S S5      r7S r8Sr9Sr:Sr;SUS jr<S  r= " S! S"5      r>S# r?S$ r@SVS% jrAS& rBS' rCS( rD " S) S*\ RŠ                  5      rF " S+ S,\ RŽ                  5      rHSWS- jrISWS. jrJ    SXS/ jrK\R˜                  S0 5       rM " S1 S25      rNSYS3 jrO\\P   rQ\\P\\R   \Q4   rS " S4 S55      rT " S6 S75      rU " S8 S95      rV " S: S;5      rW " S< S=\W5      rX        SZS> jrY\WS4             S[S? jjrZS\S@ jr[SJSA jr\        S]SB jr]S^SC jr^SKSD jr_SJSE jr`g)_é    )ÚannotationsN)ÚCallableÚIterableÚIteratorÚOptionalÚSetÚTupleÚTypeé   )Ú_)Ú
repository)Ú	bookmarksÚbundle2Ú	cacheutilÚerrorÚ
narrowspecÚphasesÚpycompatÚrequirementsÚscmutilÚstoreÚtransactionÚutil)Únodemapé   é   i   i  @l        c                ód   • [        U 5      nU[        R                  -    UR                  U5        U$ )zùdetermine the final set of requirement for a new stream clone

this method combine the "default" requirements that a new repository would
use with the constaint we get from the stream clone content. We keep local
configuration choice when possible.
)ÚsetÚrequirementsmodÚSTREAM_IGNORABLE_REQUIREMENTSÚupdate)Údefault_requirementsÚstreamed_requirementsr   s      Ú7/usr/lib/python3/dist-packages/mercurial/streamclone.pyÚnew_stream_clone_requirementsr%   C   s2   € ô Ð+Ó,€LØ”?×@Ñ@Ò@Ø×ÑÐ-Ô.ØÐó    c                ó@   • U R                   [        R                  -
  nU$ )z•the set of requirement the new clone will have to support

This is used for advertising the stream options and to generate the actual
stream content.)r   r   r    )ÚrepoÚrequiredformatss     r$   r#   r#   S   s%   € ð 	×ÑœO×IÑIÑIð ð Ðr&   c                ó\  • U R                   nU R                  nU R                  nUc  UR                  S5      nU(       d  g[	        U5      (       a  gU R
                  (       a  gSnU R                  (       ab  [        R                  " USS9n[        UR                  S/ 5      5      n[        U R                  R                  S/ 5      5      n[        Xx-  5      nU(       a  U(       d  gU(       a  U(       d  g[        5       n	UR                  S5      (       a#  U	R                  [        R                  5        SU	4$ UR                  S5      n
U
(       d/  U R                   R                   R#                  [%        S5      5        g[        U
R'                  S	5      5      n
X¢R(                  -
  nU(       ax  U R                   R                   R#                  [%        S
5      SR+                  [-        U5      5      -  5        U R                   R                   R#                  [%        S5      5        gU
n	SU	4$ )a”  Whether it is possible to perform a streaming clone as part of pull.

``bundle2`` will cause the function to consider stream clone through
bundle2 and only through bundle2.

Returns a tuple of (supported, requirements). ``supported`` is True if
streaming clone is supported and False otherwise. ``requirements`` is
a set of repo requirements from the remote, or ``None`` if stream clone
isn't supported.
s   stream-preferred)FNFs   client)Úroles   streams
   streamreqss=   warning: stream clone requested but server has them disabled
ó   ,sG   warning: stream clone requested but client is missing requirements: %s
ó   , sQ   (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
T)r(   ÚremoteÚstreamclonerequestedÚcapableÚlenÚheadsÚcanusebundle2Ú
bundle2modÚgetrepocapsr   ÚgetÚremotebundle2capsÚboolÚaddr   ÚREVLOGV1_REQUIREMENTÚuiÚwarnr   ÚsplitÚ	supportedÚjoinÚsorted)Úpullopr   r(   r.   ÚstreamrequestedÚbundle2supportedÚ
local_capsÚlocal_supportedÚremote_supportedr   Ú
streamreqsÚmissingreqss               r$   ÚcanperformstreamclonerI   ^   sÝ  € ð �;‰;€DØ�]‰]€Fð ×1Ñ1€Oð Ñà Ÿ.™.Ð)<Ó=ˆÞØô ˆ4‡y�yØð ‡|‡|ØàÐØ××Ü×+Ò+¨D°yÑAˆ
Ü˜jŸn™n¨Y¸Ó;Ó<ˆÜ˜v×7Ñ7×;Ñ;¸IÀrÓJÓKÐÜ Ñ BÓCÐö ¦Øæ	Ö)Øô “5€LØ‡~�~�i× Ñ Ø×Ñœ×=Ñ=Ô>ðB �ÐÐð? —^‘^ MÓ2ˆ
æØ�K‰K�N‰N×ÑÜð"óôð ä˜×)Ñ)¨$Ó/Ó0ˆ
à §>¡>Ñ1ˆÞØ�K‰K�N‰N×ÑÜð*óð —*‘*œV KÓ0Ó1ñ	2ôð �K‰K�N‰N×ÑÜð/óôð Ø!ˆà�ÐÐr&   c                ó,  • SSK Jn  [        U 5      u  p#U(       d  gU R                  nU R                  nSnUR                  S5      (       a9  UR                  5        nUR                  S0 5      R                  5       nSSS5        UR                  R                  [        S5      5        UR                  5        nUR                  S0 5      R                  5       nSSS5        WR                  5       n	 [        U	5      n
U
S:X  a  [        R"                  " [        S5      5      eU
S	:X  a  [        R"                  " [        S
5      5      eU
S:w  a  [        R"                  " [        S5      5      eUR                  5       n	 [%        [        U	R'                  SS5      5      u  p¼UR+                  5          [-        XHX¼5        [/        UR0                  U5      Ul        UR3                  UR                  UR0                  UR4                  5      UR6                  l        [:        R<                  " U5        [>        R@                  " U5        U(       a  URB                  RE                  XF5        URG                  5         SSS5        g! , (       d  f       GN	= f! , (       d  f       GN¾= f! [         a!    [        R                   " [        S5      U	5      ef = f! [        [(        4 a!    [        R                   " [        S5      U	5      ef = f! , (       d  f       g= f)zÜPossibly perform a legacy stream clone operation.

Legacy stream clones are performed as part of pull but before all other
operations.

A legacy stream clone will not be performed if a bundle2 stream clone is
supported.
r   ©Ú	localrepoNs	   branchmaps   streaming all changes
s
   stream_outó'   unexpected response from remote server:s   operation forbidden by serveré   s$   locking the remote repository failedr   s%   the server sent an unknown error codeó    )$Ú rL   rI   r(   r.   r0   ÚcommandexecutorÚcallcommandÚresultr;   Ústatusr   ÚreadlineÚintÚ
ValueErrorr   ÚResponseErrorÚAbortÚmapr=   Ú	TypeErrorÚlockÚ	consumev1r%   r   ÚresolvestorevfsoptionsÚfeaturesÚsvfsÚoptionsr   Úwritereporequirementsr   Úpost_stream_cleanupÚ_branchcachesÚreplaceÚ
invalidate)rA   rL   r>   r   r(   r.   Ú
rbranchmapÚeÚfpÚlÚrespÚ	filecountÚ	bytecounts                r$   Úmaybeperformlegacystreamclonern   ¼   sk  € õ ä3°FÓ;Ñ€IæØà�;‰;€DØ�]‰]€Fð €JØ‡~�~�l×#Ñ#Ø×#Ñ#Ô%¨ØŸ™ |°RÓ8×?Ñ?ÓAˆJ÷ &ð 	‡G�G‡N�N”1Ð/Ó0Ô1à	×	Ñ	Ô	! QØ�]‰]˜=¨"Ó-×4Ñ4Ó6ˆ÷ 
"ð 	�‰‹€Að
Ü�1‹vˆð
 ˆqƒyÜ�kŠkœ!Ð<Ó=Ó>Ð>Ø	�‹Ü�kŠkœ!ÐCÓDÓEÐEØ	�‹Ü�kŠkœ!ÐDÓEÓFÐFà
�‰‹€Að
Ü"¤3¨¯©°°aÓ(8Ó9Ñˆ	ð 
�‰�Ü�$˜IÔ1Ü9Ø×ÑØó
ˆÔð &×<Ñ<Ø�G‰G�T×&Ñ&¨¯©ó
ˆ�	‰	Ôô 	×%Ò% dÔ+Ü×#Ò# DÔ)æØ×Ñ×&Ñ& tÔ8à�‰Ô÷ 
ˆ÷E &Ö%ú÷
 
"Ö	!ûô ó 
Ü×!Ò!ÜÐ8Ó9¸1ó
ð 	
ð
ûô œ	Ð"ó 
Ü×!Ò!ÜÐ8Ó9¸1ó
ð 	
ð
ú÷
 
�ús=   Á!I?Â9!JÃ3J# Å>"K Æ0CLÉ?
JÊ
J Ê#+KË1LÌ
Lc                óö   • [         R                  U R                  ;  a  gU R                  R	                  SSSS9(       d  g[
        R                  " U 5      nU(       a  U R                  R	                  SS5      $ g)z5Whether streaming clones are allowed from the server.Fs   servers   uncompressedT)Ú	untrusteds   uncompressedallowsecret)r   ÚREPO_FEATURE_STREAM_CLONEr_   r;   Ú
configboolr   Ú	hassecret)r(   Úsecrets     r$   Úallowservergenerationru     sc   € ä×+Ñ+°4·=±=Ó@Øà�7‰7×Ñ˜i¨ÀDÐÖIØô ×Ò˜dÓ#€FÞØ�w‰w×!Ñ! )Ð-GÓHÐHàr&   c                ó6   • U R                   R                  XUS9$ )N©ÚphaseÚobsolescence)r   Úwalk)r(   Úmatcherrx   ry   s       r$   Ú_walkstreamfilesr|     s   € ð �:‰:�?‰?˜7¸lˆ?ÐKÐKr&   c                óö   • [         R                  " 5       U-
  nUS::  a  Sn[        S5      nUU[         R                  " U5      U[         R                  " X4-  5      4-  nU R                  R                  U5        g)z@common utility to report time it took to apply the stream bundler   gü©ñÒMbP?s5   stream-cloned %d files / %s in %.1f seconds (%s/sec)
N)r   Útimerr   rm   r;   rT   )r(   Ú
start_timeÚ
file_countÚ
byte_countÚelapsedÚms         r$   Ú_report_transferredr„     sm   € ô �jŠj‹l˜ZÑ'€GØ�!ƒ|ØˆÜ	Ð
CÓD€AØØÜ�Š�zÓ"ØÜ�Š�zÑ+Ó,ð	
ñ €Að 	‡G�G‡N�N�1Õr&   c                óž  ^ ^^^• / mSnT R                  5          T R                  R                  S5        [        T 5        [	        T 5       Hi  nUR                  5        HR  nUR                  T R                  R                  5      nU(       d  M1  TR                  UR                  U45        X-  nMT     Mk     [        T 5        SSS5        [        T 5        T R                  R                  S[        T5      U4-  5        T R                  mT R                  R                  mSUUU U4S jjn[        T5      X" 5       4$ ! , (       d  f       N�= f)a›  Emit content for version 1 of a streaming clone.

This returns a 3-tuple of (file count, byte size, data iterator).

The data iterator consists of N entries for each file being transferred.
Each file entry starts as a line with the file name and integer size
delimited by a null byte.

The raw file data follows. Following the raw file data is the next file
entry, or EOF.

When used on the wire protocol, an additional line indicating protocol
success will be prepended to the stream. This function is not responsible
for adding it.

This function will obtain a repository lock to ensure a consistent view of
the store is captured. It therefore may raise LockError.
r   ó	   scanning
Ns   %d files, %d bytes to transfer
c               3  ó`  >#   • T H�  u  pT(       a  TR                   R                  SX4-  5        S[        R                  " U 5      U4-  v •  T" U SSS9 nUS::  a  UR	                  U5      v •  O[
        R                  " X!S9 S h  v•N   S S S 5        M‘     g  N! , (       d  f       M¥  = f7f)Ns   sending %s (%d bytes)
s   %s %d
s   rbF)Ú	auditpathi   ©Úlimit)r;   Údebugr   Ú	encodedirÚreadr   Úfilechunkiter)ÚnameÚsizeri   Ú	debugflagÚentriesr(   r`   s      €€€€r$   ÚemitrevlogdataÚ"generatev1.<locals>.emitrevlogdataY  s•   øé € Û!‰JˆDÞØ—‘—‘Ð8¸D¸<ÑGÔHà¤§¢°Ó!6¸Ð =Ñ=Ò=ñ �d˜E¨UÒ3°rØ˜5“=ØŸ'™' $›-Ó'ä#×1Ò1°"ÑA×AÐA÷	 4Ñ3ò "ñ B÷	 4Ö3üs0   ƒAB.Á2BÂBÂ	BÂB.ÂBÂ
B+	Â&B.©ÚreturnzIterator[bytes])r\   r;   r‹   Ú_test_sync_point_walk_1_2r|   ÚfilesÚ	file_sizer   ÚvfsÚappendÚunencoded_pathÚ_test_sync_point_walk_3Ú_test_sync_point_walk_4r1   r`   r‘   )	r(   Útotal_bytesÚentryÚfr™   r“   r‘   r’   r`   s	   `     @@@r$   Ú
generatev1r¢   0  s  û€ ð& €GØ€Kà	�‰�Ø�‰�‰�mÔ$Ü! $Ô'Ü% dÖ+ˆEØ—[‘[–]�ØŸK™K¨¯
©
¯©Ó7�	ß�9Ø—N‘N A×$4Ñ$4°iÐ#@ÔAØÑ,’Kó	 #ñ ,ô 	  Ô%÷ 
ô ˜DÔ!à‡G�G‡M�MØ+¬s°7«|¸[Ð.IÑIôð �9‰9€DØ—‘×!Ñ!€I÷Bò Bô ˆw‹<˜ nÓ&6Ð6Ð6÷C 
�ús   ™A2D>Â4D>Ä>
Ec              #  óÀ   #   • [        U 5      (       d  Sv •  g [        U 5      u  pnSv •  SX4-  v •  U Sh  v•N   g! [        R                   a    Sv •   gf = f N#7f)a«  Emit content for version 1 of streaming clone suitable for the wire.

This is the data output from ``generatev1()`` with 2 header lines. The
first line indicates overall success. The 2nd contains the file count and
byte size of payload.

The success line contains "0" for success, "1" for stream generation not
allowed, and "2" for error locking the repository (possibly indicating
a permissions error for the server process).
s   1
Ns   2
s   0
s   %d %d
)ru   r¢   r   Ú	LockError)r(   rl   rm   Úits       r$   Úgeneratev1wireprotor¦   j  sl   é € ô ! ×&Ñ&ØŠØðÜ#-¨dÓ#3Ñ ˆ	˜bð ‚LØ
˜	Ð-Ñ
-Ò-Ø‡M�Møô �?‰?ó ØŠÙðúñ ùs/   ‚A™> §A¸A¹A¾AÁAÁAÁAc                ó˜   ^ ^^• TS:w  a  [        S5      e[        T 5      nSR                  [        U5      5      mSUU U4S jjnX#" 5       4$ )a  Emit content for version 1 of a stream clone bundle.

The first 4 bytes of the output ("HGS1") denote this as stream clone
bundle version 1.

The next 2 bytes indicate the compression type. Only "UN" is currently
supported.

The next 16 bytes are two 64-bit big endian unsigned integers indicating
file count and byte count, respectively.

The next 2 bytes is a 16-bit big endian unsigned short declaring the length
of the requirements string, including a trailing  . The following N bytes
are the requirements string, which is ASCII containing a comma-delimited
list of repo requirements that are needed to support the data.

The remaining content is the output of ``generatev1()`` (which may be
compressed in the future).

Returns a tuple of (requirements, data generator).
ó   UNz.we do not support the compression argument yetr,   c               3  ó
  >#   • Sv •  Tv •  [        T5      u  pnTR                  R                  [        S5      X4-  5        [        R
                  " SX5      v •  [        R
                  " S[        T5      S-   5      v •  TS-   v •  TS:X  d   eTR                  R                  [        S5      U[        S	5      S
9nUR                  S5        U H  nUR                  [        U5      S9  Uv •  M!     UR                  5         g 7f)Ns   HGS1s   writing %d bytes for %d files
ó   >QQó   >Hr   ó    r¨   ó   bundleó   bytes©ÚtotalÚunitr   ©Ústep)r¢   r;   rT   r   ÚstructÚpackr1   Úmakeprogressr!   Ú	incrementÚcomplete)rl   rm   r¥   ÚprogressÚchunkÚcompressionr(   Úrequiress        €€€r$   ÚgenÚgeneratebundlev1.<locals>.gen£  sñ   øé € ØŠØÒä#-¨dÓ#3Ñ ˆ	˜bØ�‰�‰ÜÐ0Ó1°YÐ4JÑJô	
ô �kŠk˜& )Ó7Ò7Ü�kŠk˜%¤ X£°Ñ!2Ó3Ò3Ø˜ÑÒð ˜eÓ#Ð#Ð#à—7‘7×'Ñ'Üˆi‹L 	´°(³ð (ð 
ˆð 	�‰˜ÔãˆEØ×Ñ¤C¨£JÐÑ/ØŒKñ ð 	×ÑÕùs   ƒD Dr•   )rW   r#   r?   r@   )r(   r»   r   r½   r¼   s   ``  @r$   Úgeneratebundlev1r¿   …  sO   ú€ ð0 �eÓÜÐIÓJÐJä(¨Ó.€LØ�y‰yœ Ó-Ó.€H÷ñ ð6 ˜›ÐÐr&   c                ó  • U R                  5          U R                  R                  [        S5      U[        R
                  " U5      4-  5        U R                  R                  [        S5      U[        S5      S9nUR                  S5        [        R                  " 5       nSnU R                  S5         U R                  R                  U R                  US9   [        U5       GHe  n[        US5      (       a  UR                  5       nOW/ n	U	(       a	  U	S   S	:X  d4  U	R                  UR!                  S
5      5        U	(       d  M)  U	S   S	:X  d  M4  SR#                  U	5      n UR%                  SS
5      u  p«['        U5      nU R                  R0                  (       a4  U R                  R3                  SU
[        R
                  " U5      4-  5        [4        R6                  " U
5      nU R                  USSS9 nUS
-  n[        R8                  " XS9 H,  nUR;                  [=        U5      S9  UR?                  U5        M.     SSS5        GMh     SSS5        U RA                  SS9  SSS5        URC                  5         [E        XXc5        SSS5        g! [(        [*        4 a!    [,        R.                  " [        S5      U5      ef = f! , (       d  f       GMò  = f! , (       d  f       N‘= f! , (       d  f       N‹= f! , (       d  f       g= f)zùApply the contents from version 1 of a streaming clone file handle.

This takes the output from "stream_out" and applies it to the specified
repository.

Like "stream_out," the status line added by the wire protocol is not
handled by this function.
ó!   %d files to transfer, %s of data
ó   cloner®   r¯   r   )ÚexpectedcountrU   éÿÿÿÿó   
r   r&   r¬   rM   s   adding %s (%s)
ó   wT)Úbackgroundcloser‰   r²   N©Úclearfilecache)#r\   r;   rT   r   r   rm   r¶   r!   r~   r   r`   ÚbackgroundclosingÚrangeÚhasattrrU   r›   r�   r?   r=   rV   rW   r[   r   rX   r‘   r‹   r   Ú	decodedirrŽ   r·   r1   Úwriterf   r¸   r„   )r(   ri   rl   rm   r¹   ÚstartÚtotal_file_countÚirj   Úl_bufr�   r�   ÚpathÚofprº   s                  r$   r]   r]   Á  s|  € ð 
�‰�Ø�‰�‰ÜÐ3Ó4Øœ$Ÿ.š.¨Ó3Ð4ñ5ô	
ð —7‘7×'Ñ'Üˆh‹K˜y¬q°«{ð (ð 
ˆð 	�‰˜ÔÜ—
’
“ˆð  ÐØ×Ñ˜hÕ'Ø—‘×,Ñ,¨T¯W©WÀIÐ,ÒNÜ˜y×)�Aä˜r :×.Ñ.ØŸK™K›M™ð
 !#˜Þ#(¨U°2©Y¸%Ó-?Ø!ŸL™L¨¯©°«Ô4÷ $) 5¨U°2©Y¸%Õ-?àŸH™H U›O˜ðØ%&§W¡W¨U°AÓ%6™
˜Ü" 4›y˜ð
 —w‘w×(×(ØŸ™Ÿ™Ø/°4¼¿ºÈÓ9MÐ2NÑNôô !Ÿ?š?¨4Ó0�DØŸ™ 4¨¸t˜ÑDÈØ(¨AÑ-Ð(Ü%)×%7Ò%7¸Ô%G˜EØ$×.Ñ.´C¸³JÐ.Ñ?ØŸI™I eÖ,ñ &H÷ EÒDñ3 *÷ OðD �O‰O¨4ˆOÑ0÷G (ðJ 	×ÑÔÜ˜DÐ)9ÔE÷A 
ˆøôV '¬	Ð2ó Ü#×1Ò1ÜÐHÓIÈ1óð ðú÷ E×Dú÷5 OÕNú÷ (Õ'ú÷5 
�ús{   ‘B$K=Â5%K,ÃA+KÅ	KÅKÅ$JÆA6KÇ9A
KÉKÉK,É'$K=Ê1KËKË
KË	KË
K)Ë%K,Ë,
K:	Ë6K=Ë=
Lc                óü  • U R                  S5      nUS:w  a"  [        R                  " [        S5      U-  5      e[        R
                  " SU R                  S5      5      u  p#[        R
                  " SU R                  S5      5      S   nU R                  U5      nUR                  S5      (       d  [        R                  " [        S	5      5      e[        UR                  S5      R                  S
5      5      nX#U4$ )NrN   r¨   s<   only uncompressed stream clone bundles are supported; got %srª   é   r«   r   r¬   s@   malformed stream clone bundle: requirements not properly encodedr,   )
r�   r   rY   r   r´   ÚunpackÚendswithr   Úrstripr=   )ri   r»   rl   rm   Úrequireslenr¼   r   s          r$   Úreadbundle1headerrÛ     sá   € Ø—'‘'˜!“*€KØ�eÓÜ�kŠkÜð%óð ñ	ó
ð 	
ô "Ÿ=š=¨°·±¸³Ó=Ñ€IÜ—-’-  r§w¡w¨q£zÓ2°1Ñ5€KØ�w‰w�{Ó#€Hà×Ñ˜U×#Ñ#Ü�kŠkÜð5óó
ð 	
ô �x—‘ uÓ-×3Ñ3°DÓ9Ó:€Là Ð-Ð-r&   c                ó`  • [        U 5      (       a  [        R                  " [        S5      5      e[	        U5      u  p#nX@R
                  -
  nU(       a:  [        R                  " [        S5      SR                  [        U5      5      -  5      e[        XX#5        [        R                  " U 5        g)z®Apply the content from a stream clone bundle version 1.

We assume the 4 byte header has been read and validated and the file handle
is at the 2 byte compression identifier.
s2   cannot apply stream clone bundle on non-empty repoó4   unable to apply stream clone: unsupported format: %sr-   N)r1   r   rY   r   rÛ   r>   r?   r@   r]   r   rc   )r(   ri   rl   rm   r   rH   s         r$   Úapplybundlev1rÞ   )  s‘   € ô ˆ4‡y�yÜ�kŠkÜÐCÓDó
ð 	
ô *;¸2Ó)>Ñ&€I˜,Ø§¡Ñ/€KÞÜ�kŠkÜÐEÓFØ�j‰jœ Ó,Ó-ñ.ó
ð 	
ô
 ˆd˜	Ô-Ü×Ò Õ%r&   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)Ústreamcloneapplieri@  z³Class to manage applying streaming clone bundles.

We need to wrap ``applybundlev1()`` in a dedicated type to enable bundle
readers to perform bundle type-specific functionality.
c                ó   • Xl         g ©N©Ú_fh)ÚselfÚfhs     r$   Ú__init__Ústreamcloneapplier.__init__G  s   € Ø�r&   c                ó,   • [        XR                  5      $ râ   )rÞ   rä   )rå   r(   s     r$   ÚapplyÚstreamcloneapplier.applyJ  s   € Ü˜T§8¡8Ó,Ð,r&   rã   N©r–   ÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rç   rê   Ú__static_attributes__© r&   r$   rà   rà   @  s   † ñô÷-r&   rà   ó   só   cc                óV   • / nU R                  5       (       d  UR                  S5        U$ )z!list snapshot file from the stores
   phaseroots)Ú
publishingr›   )r(   Úfnamess     r$   Ú_walkstreamfullstorefilesrú   X  s%   € à€FØ�?‰?×ÑØ�‰�mÔ$Ø€Mr&   c                óZ   • U u  p4pVU[         :w  a  U $ X4XQ" X#   R                  U5      5      4$ )z actually copy the snapshot files)Ú	_filefullr?   )r    ÚcopyÚvfsmapÚsrcr�   ÚftypeÚdatas          r$   Ú_filterfullr  `  s8   € à"Ñ€CˆuØ”	ÓØˆØ�u˜d 6¡;×#3Ñ#3°DÓ#9Ó:Ð;Ð;r&   c                  ó®   • \ rS rSrSr\R                  (       a  SOSrSS jrS r	S r
SS jrSS	 jrSS
 jrSS jrSS jr\R"                  S 5       rSrg)ÚVolatileManagerih  aì  Manage temporary backups of volatile files during stream clone.

This class will keep open file handles for the volatile files, writing the
smaller ones on disk if the number of open file handles grow too much.

This should be used as a Python context, the file handles and copies will
be discarded when exiting the context.

The preservation can be done by calling the object on the real path
(encoded full path).

Valid filehandles for any file should be retrieved by calling `open(path)`.
rN   éd   c                ó<   • SU l         S U l        S U l        S U l        g ©Nr   )Ú_counterÚ_volatile_fpsÚ_copiesÚ_dst_dir©rå   s    r$   rç   ÚVolatileManager.__init__}  s   € ØˆŒØ!ˆÔØˆŒØˆ�r&   c                ó|   • U R                   S:X  a  U R                  b   e0 U l        U =R                   S-  sl         U $ ©Nr   r   )r  r	  r  s    r$   Ú	__enter__ÚVolatileManager.__enter__ƒ  s;   € Ø�=‰=˜AÓØ×%Ñ%Ñ-Ð-Ð-Ø!#ˆDÔØ�Š˜Ñ�Øˆr&   c                ó  • U =R                   S-  sl         U R                   S:X  aÚ  U R                  R                  5        H  u  p4UR                  5         M     SU l        U R                  bW  U R                  R                  5        H  n[
        R                  " U5        M     [
        R                  " U R                  5        SU l        SU l        U R                  b   eU R                  b   eU R                  b   egg)zdiscard all backupsr   r   N)	r  r	  ÚvaluesÚcloser
  r   Ú	tryunlinkÚtryrmdirr  )rå   ÚargsÚkwarsÚ_sizeri   Útmps         r$   Ú__exit__ÚVolatileManager.__exit__Š  sÊ   € à�Š˜Ñ�Ø�=‰=˜AÓØ!×/Ñ/×6Ñ6Ö8‘	�Ø—‘–
ñ 9à!%ˆDÔØ�|‰|Ñ'ØŸ<™<×.Ñ.Ö0�CÜ—N’N 3Ö'ñ 1ä—’˜dŸm™mÔ,ØˆDŒLØ ˆDŒMØ×%Ñ%Ñ-Ð-Ð-Ø—<‘<Ñ'Ð'Ð'Ø—=‘=Ñ(Ð(Ñ(ð r&   c                ó¤   • SU R                   :  d   eU R                  b   eU R                  b   e0 U l        [        R                  " SS9U l        g)zpprepare a temporary directory to save volatile files

This will be used as backup if we have too many files openr   Ns	   hg-clone-)Úprefix)r  r
  r  r   Úmkdtempr  s    r$   Ú_init_tmp_copiesÚ VolatileManager._init_tmp_copies›  sO   € ð �4—=‘=Ó Ð Ð Ø�|‰|Ñ#Ð#Ð#Ø�}‰}Ñ$Ð$Ð$ØˆŒÜ ×(Ò(°Ñ=ˆ�r&   c                ól  • U R                   c  U R                  5         U R                  S-  n[        U R                  R                  5       5      SU  HÍ  u  nu  p4[        R                  R                  U5      n[        R                  " XPR                  S9u  pgXpR                   U'   [        R                  " U5        [        US5       nUR                  S5        UR                  UR!                  5       5        SSS5        U R                  U	 UR                  5         MÏ     g! , (       d  f       N0= f)z4move some of the open files to tempory files on diskNrN   )r  ÚdirÚwbr   )r
  r   ÚMAX_OPENr@   r	  ÚitemsÚosrÓ   Úbasenamer   Úmkstempr  r  ÚopenÚseekrÎ   r�   )	rå   Úflush_countrÿ   r�   ri   r  ÚfdÚdstÚbcks	            r$   Ú_flush_some_on_diskÚ#VolatileManager._flush_some_on_disk¥  sã   € à�<‰<ÑØ×!Ñ!Ô#Ø—m‘m qÑ(ˆÜ% d×&8Ñ&8×&>Ñ&>Ó&@ÓAÀ,À;ÓO‰OˆC‘�$Ü—W‘W×%Ñ% cÓ*ˆFÜ×&Ò&¨f¿-¹-ÑH‰GˆBØ #�L‰L˜ÑÜ�HŠH�RŒLô �c˜4” CØ—‘˜”
Ø—	‘	˜"Ÿ'™'›)Ô$÷ !ð ×"Ñ" 3Ð'Ø�H‰HŽJò  P÷ !•ús   Ã
1D%Ä%
D3	c                óÄ   • S[        US5      4=u  p#U R                  U'   UR                  S[        R                  5        UR                  5       nXC4U R                  U'   U$ )z-preserve an open file handle for a given pathNÚrbr   )r*  r	  r+  r'  ÚSEEK_ENDÚtell)rå   rÿ   r   ri   r�   s        r$   Ú	_keep_oneÚVolatileManager._keep_one¸  sZ   € ð ,0´°c¸4³Ð*AÐA‰ˆ�×"Ñ" 3Ñ'Ø
�‰�”2—;‘;ÔØ�w‰w‹yˆØ#' *ˆ×Ñ˜3ÑØˆr&   c                ó¶   • SU R                   :  d   e[        U R                  5      U R                  S-
  :¼  a  U R	                  5         U R                  U5        g)z!preserve the volatile file at srcr   r   N)r  r1   r	  r%  r0  r6  )rå   rÿ   s     r$   Ú__call__ÚVolatileManager.__call__Á  sH   € à�4—=‘=Ó Ð Ð Üˆt×!Ñ!Ó" t§}¡}°qÑ'8Ó9Ø×$Ñ$Ô&Ø�‰�sÕr&   c                óB  • SU R                   :  d   e[        U R                  5      U R                  S-
  :¼  a  U R	                  5          U R                  U5      $ ! [         a9  nUR                  [        R                  [        R                  4;  a  e  SnAgSnAff = f)z‡record a volatile file and returns it size

return None if the file does not exists.

Used for cache file that are not lock protected.
r   r   N)
r  r1   r	  r%  r0  r6  ÚOSErrorÚerrnoÚENOENTÚEPERM)rå   rÿ   Úerrs      r$   Útry_keepÚVolatileManager.try_keepÈ  s�   € ð �4—=‘=Ó Ð Ð Üˆt×!Ñ!Ó" t§}¡}°qÑ'8Ó9Ø×$Ñ$Ô&ð	Ø—>‘> #Ó&Ð&øÜó 	Ø�y‰y¤§¡¬u¯{©{Ð ;Ó;ØÜûð	ús   Á
A Á
BÁ%/BÂBc              #  óJ  #   • SU R                   :  d   eU R                  R                  U5      nUb  Uu  p4UR                  S5        Uv •  g U R                  c  UnOU R                  R                  X5      n[        US5       nUv •  S S S 5        g ! , (       d  f       g = f7f)Nr   r3  )r  r	  r6   r+  r
  r*  )rå   rÿ   r    r  ri   Úactual_paths         r$   r*  ÚVolatileManager.openÙ  s‰   é € à�4—=‘=Ó Ð Ð Ø×"Ñ"×&Ñ& sÓ+ˆØÑØ‰IˆEØ�G‰G�AŒJØ‹Hà�|‰|Ñ#Ø!‘à"Ÿl™l×.Ñ.¨sÓ8�Ü�k 4Ô(¨BØ’÷ )×(Ö(üs   ‚BB#ÂBÂ		B#Â
B ÂB#)r
  r  r  r	  Nrì   )rÿ   Úbytesr–   rV   )rÿ   rF  r–   rí   )rÿ   rF  r–   zOptional[int])rî   rï   rð   rñ   rò   r   Ú	iswindowsr%  rç   r  r  r   r0  r6  r9  rA  Ú
contextlibÚcontextmanagerr*  ró   rô   r&   r$   r  r  h  sZ   † ñð$ ×&×&‰q¨C€Hôòò)ô">ôô&ôôð" ×Ññó ór&   r  c                óŠ   • [         U R                  [        U R                  0nU R                  UR                  5       ;  d   eU$ )z$make a (src -> vfs) map for the repo)Ú	_srcstorer`   Ú	_srccacheÚcachevfsrš   r  )r(   rþ   s     r$   Ú_makemaprN  ê  s<   € ô 	�4—9‘9Ü�4—=‘=ð€Fð �8‰8˜6Ÿ=™=›?Ó*Ð*Ð*à€Mr&   c              #  ó¬  #   • [        U 5      nU R                  UR                  5       ;   a  [        R                  " S5      eU VVs/ s H  u  p4X2U   U4PM     nnn[        U 5        [        U 5      nS=pg[        5        n[        R                  " 5          U HF  u  pšnUR                  X¨5        UR                  5        H  nUS-  nX{R                  U
5      -  nM     MH     SSS5        U R                  R                  [        S5      U[        S5      S9nUR!                  S5        U   Xg4v •  SnU HÐ  u  pênUR#                  U U
UUSS	9nU H±  u  nnnUv •  [        R$                  " [        U5      5      v •  [        R$                  " U5      v •  Uv •  SnU H4  nU[        U5      -  nU[        U5      -  nUR!                  U5        Uv •  M6     UU:w  d  MŒ  [        S
5      n[        R&                  " UUUU4-  5      e   MÒ     SSS5        SSS5        gs  snnf ! , (       d  f       GND= f! , (       d  f       N/= f! , (       d  f       g= f7f)zactually emit the stream bundleú9repo.vfs must not be added to vfsmap for security reasonsr   r   Nr­   r®   r¯   T)r(   rš   Ú	volatilesÚmax_changesetÚpreserve_file_counts=   clone could only read %d bytes from %s, but expected %d bytes)rN  rš   r  r   ÚProgrammingErrorr—   r1   r  r   ÚnogcÚpreserve_volatilesr˜   r™   r;   r¶   r   r!   Úget_streamsÚuvarintencoderY   )r(   r’   rþ   Úvfs_keyrh   Úmax_linkrevr€   ÚtotalfilesizerQ  Úkrš   r¡   r¹   Útotalbytecountrÿ   Úentry_streamsr�   Ústreamr�   rm   rº   Úmsgs                         r$   Ú_emit2ra  ÷  s+  é € ä�d‹^€Fð ‡x�x�6—=‘=“?Ó"Ü×$Ò$ØGó
ð 	
ñ
 BIÔIÂ±°'� ™¨!Ó,Á€GÑIÜ˜dÔ#ä�d“)€KØ!"Ð"€JÜ	Ô	˜iä�YŠY�[ã$‘	�˜Ø×$Ñ$ SÔ4ØŸ™ž�AØ !‘O�JØ!§[¡[°Ó%5Ñ5’Mó #ñ %÷ ð —7‘7×'Ñ'Üˆi‹L ´A°h³Kð (ð 
ˆð 	�‰˜ÔÚàÐ+Ò+ØˆNã&‘�˜!Ø !§¡ØØØ'Ø"-Ø(,ð !.ð !�ó +8Ñ&�D˜& $Ø’IÜ×,Ò,¬S°«YÓ7Ò7Ü×,Ò,¨TÓ2Ò2Ø’JØ !�IÛ!'˜Ø!¤S¨£ZÑ/˜	Ø&¬#¨e«*Ñ4˜Ø Ÿ™¨Ô7Ø#œñ	 "(ð
 ! DÕ(ô  ð1ó˜ô $Ÿkšk¨#°¸DÀ$Ð0GÑ*GÓHÐHó% +8ñ  '÷ ÷ 
Ð	ùó J÷ Ž[ú÷ �Xú÷ 
Õ	üsc   ‚AIÁHÁ&IÂ IÂAH Ã#AIÄ+B-H2Ç-H2È	IÈIÈ 
H/	È*IÈ2
I 	È<IÉ
IÉIc           
   #  óŠ  #   • [        U 5      nU R                  UR                  5       ;   a  [        R                  " S5      e[        U5      n[        U 5        / n[        5        nU H‰  u  pVX%   nSnUR                  (       aN  SnUR                  Xt5        UR                  5        H'  n	U	R                  (       a  U	R                  U5        SnM)     U(       d  Ms  UR                  XRU   U45        M‹     [        U5      n
[        U 5      nU R                  R!                  [#        S5      U
[#        S5      S9nUR%                  S5        Sv •  U   [&        R(                  " U
5      v •  U H¡  u  p×nUR+                  U UUUS	9n[&        R(                  " [        U5      5      v •  U HR  u  nnnUv •  [&        R(                  " [        U5      5      v •  [&        R(                  " U5      v •  Uv •  U Sh  v•N   MT     UR-                  5         M£     SSS5        SSS5        g N-! , (       d  f       N= f! , (       d  f       g= f7f)
z$actually emit the stream bundle (v3)rP  TFr­   s   entryr¯   r   N)r(   rš   rQ  rR  )rN  rš   r  r   rT  Úlistr—   r  Úmaybe_volatilerV  r˜   Úis_volatiler™   r›   r1   r;   r¶   r   r!   r   rX  rW  r·   )r(   r’   rþ   Úbase_entriesrQ  rY  rh   rš   Ú	any_filesr¡   Útotal_entry_countrZ  r¹   rÿ   r^  r�   r_  r�   s                     r$   Ú_emit3ri  :  s÷  é € ä�d‹^€Fð ‡x�x�6—=‘=“?Ó"Ü×$Ò$ØGó
ð 	
ô ˜“=€LÜ˜dÔ#Ø€GÜ	Ô	˜iã&‰JˆGØ‘/ˆCØˆIØ××Ø!�	Ø×$Ñ$ SÔ4ØŸ™ž�AØ—}—}àŸ™ CÔ(Ø $’Iñ	 #÷
 ˆyØ—‘ °©¸!Ð<Ö=ñ 'ô   ›LÐä˜$“iˆØ—7‘7×'Ñ'Üˆi‹LØ#Ü�8“ð (ð 
ˆð
 	�‰˜ÔàŠ
ÚÜ×$Ò$Ð%6Ó7Ò7ã&‘�˜!Ø !§¡ØØØ'Ø"-ð	 !.ð !�ô ×(Ò(¬¨]Ó);Ó<Ò<Û*7Ñ&�D˜& $Ø’IÜ×,Ò,¬S°«YÓ7Ò7Ü×,Ò,¨TÓ2Ò2Ø’JØ%×%Ò%ñ +8ð ×"Ñ"Ö$ñ  '÷ ÷7 
Ð	ñV &÷! �Xú÷7 
Õ	üsQ   ‚A"IÁ$A2H2ÃA4H2ÅB#H!Ç1HÇ2H!ÈH2È	IÈH!È!
H/	È+H2È2
I È<Ic                ó   • g)z·a function for synchronisation during tests

Triggered after gather entry, but before starting to process/preserve them
under lock.

(on v1 is triggered before the actual walk start)
Nrô   ©r(   s    r$   r—   r—   {  ó   � r&   c                ó   • g)z”a function for synchronisation during tests

Triggered right before releasing the lock, but after computing what need
needed to compute under lock.
Nrô   rk  s    r$   r�   r�   …  rl  r&   c                ó   • g)zWa function for synchronisation during tests

Triggered right after releasing the lock.
Nrô   rk  s    r$   rž   rž   �  rl  r&   c                  óJ   ^ • \ rS rSrSrSU 4S jjrSS jrSU 4S jjrSrU =r	$ )	Ú
CacheEntryi•  zþRepresent an entry for Cache files

It has special logic to preserve cache file early and accept optional
presence.


(Yes... this is not really a StoreEntry, but close enough. We could have a
BaseEntry base class, bbut the store one would be identical)
c                ó"   >• [         TU ]  USS9  g )NT)re  )Úsuperrç   )rå   Ú
entry_pathÚ	__class__s     €r$   rç   ÚCacheEntry.__init__   s   ø€ Ü‰ÑØàð 	ò 	
r&   c                ó  • UR                  UR                  U R                  5      5      U l        U R                  c  / U l        g U R
                  (       d   e[        U R                  U R                  U R
                  S9/U l        g )N)rœ   r™   re  )rA  r?   Ú_entry_pathÚ
_file_sizeÚ_filesÚ_is_volatileÚ	CacheFile)rå   rš   rQ  s      r$   rV  ÚCacheEntry.preserve_volatiles§  sm   € Ø#×,Ñ,¨S¯X©X°d×6FÑ6FÓ-GÓHˆŒØ�?‰?Ñ"ØˆD�Kà×$×$Ð$Ð$äØ#'×#3Ñ#3Ø"Ÿo™oØ $× 1Ñ 1ñðˆD�Kr&   c                ó‚   >• U R                   c$  [        U R                  U R                  S9/U l         [        TU ]  5       $ )N)rœ   re  )ry  r{  rw  rz  rr  r˜   )rå   rt  s    €r$   r˜   ÚCacheEntry.filesµ  s>   ø€ Ø�;‰;ÑäØ#'×#3Ñ#3Ø $× 1Ñ 1ñðˆDŒKô ‰w‰}‹Ðr&   )rx  ry  rì   )r–   zlist[store.StoreFile])
rî   rï   rð   rñ   rò   rç   rV  r˜   ró   Ú__classcell__©rt  s   @r$   rp  rp  •  s   ø† ñ÷
ô÷õ r&   rp  c                  ó$   • \ rS rSr% SrS\S'   Srg)r{  iÀ  Tr8   Úoptionalrô   N)rî   rï   rð   rñ   r‚  Ú__annotations__ró   rô   r&   r$   r{  r{  À  s   ‡ ð €HˆdÖr&   r{  c              #  ó  #   • U R                  U R                  5      c   eSnU(       d  U(       a!  [        R                  " U R                  X5      nU R                  5       (       + n[        R                  " 5          [        U UUUS9nU H  n[        U4v •  M     [        R                  " U 5       H6  nU R                  R                  U5      (       d  M%  [        [        US94v •  M8     SSS5        g! , (       d  f       g= f7f)z—emit a seris of files information useful to clone a repo

return (vfs-key, entry) iterator

Where `entry` is StoreEntry. (used even for cache entries)
Nrw   )rs  )Ú_currentlockÚ_lockrefr   ÚmatchÚrootrø   r   rU  r|   rK  r   ÚcachetocopyrM  ÚexistsrL  rp  )	r(   ÚincludesÚexcludesÚincludeobsmarkersr{   rx   r’   r    r�   s	            r$   Ú_entries_walkrŽ  Æ  sÎ   é € ð ×Ñ˜TŸ]™]Ó+Ñ7Ð7Ð7à€GÞ–8Ü×"Ò" 4§9¡9¨hÓAˆà—‘Ó!Ô!€Eô 
�Š�Ü"ØØØØ*ñ	
ˆó ˆEÜ˜eÐ$Ô$ñ ô ×)Ò)¨$Ö/ˆDØ�}‰}×#Ñ# D×)Ó)ä ¤*¸Ñ"=Ð>Ô>ñ 0÷ 
�Žüs%   ‚A:DÁ<AC5ÃC5Ã,	DÃ5
DÃ?Dc                ó  • U R                  5          U R                  R                  S5        [        U UUUS9n[	        X5      n[        U5      nUu  px[        U 5        SSS5        [        U 5        WWW4$ ! , (       d  f       N= f)a­  Emit content for version 2 of a streaming clone.

the data stream consists the following entries:
1) A char representing the file destination (eg: store or cache)
2) A varint containing the length of the filename
3) A varint containing the length of file data
4) N bytes containing the filename (the internal, store-agnostic form)
5) N bytes containing the file data

Returns a 3-tuple of (file count, file size, data iterator).
r†   ©r‹  rŒ  r�  N)r\   r;   r‹   rŽ  ra  Únextr�   rž   )	r(   r‹  rŒ  r�  r’   ÚchunksÚfirstr€   Útotal_file_sizes	            r$   Ú
generatev2r•  æ  s|   € ð 
�‰�Ø�‰�‰�mÔ$äØØØØ/ñ	
ˆô ˜Ó&ˆÜ�V“ˆØ&+Ñ#ˆ
Ü Ô%÷ 
ô ˜DÔ!à�¨Ð.Ð.÷ 
�ús   ‘AA6Á6
Bc           	     ó|  • U R                  5          [        R                  " 5          U R                  R	                  S5        [        U UUUS9n[        U [        U5      5      n[        U5      nUb   e[        U 5        SSS5        SSS5        [        U 5        W$ ! , (       d  f       N#= f! , (       d  f       N,= f)a�  Emit content for version 3 of a streaming clone.

the data stream consists the following:
1) A varint E containing the number of entries (can be 0), then E entries follow
2) For each entry:
2.1) The number of files in this entry (can be 0, but typically 1 or 2)
2.2) For each file:
2.2.1) A char representing the file destination (eg: store or cache)
2.2.2) A varint N containing the length of the filename
2.2.3) A varint M containing the length of file data
2.2.4) N bytes containing the filename (the internal, store-agnostic form)
2.2.5) M bytes containing the file data

Returns the data iterator.

XXX This format is experimental and subject to change. Here is a
XXX non-exhaustive list of things this format could do or change:

- making it easier to write files in parallel
- holding the lock for a shorter time
- improving progress information
- ways to adjust the number of expected entries/files ?
r†   r�  N)r\   r   rU  r;   r‹   rŽ  ri  rc  r‘  r�   rž   )r(   r‹  rŒ  r�  r’   r’  r“  s          r$   Ú
generatev3r—    s‹   € ð< 
�‰�”d—i’i•kØ�‰�‰�mÔ$äØØØØ/ñ	
ˆô ˜œd 7›mÓ,ˆÜ�V“ˆØ‰}Ðˆ}Ü Ô%÷ "�ô ˜DÔ!à€M÷ "•kú��ús#   ‘B-§ABÁ?B-Â
B*	Â&B-Â-
B;c               '  ó¼   #   • U S   nU SS  nU   U(       a  [        U6    S v •  S S S 5        OS v •  S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f7fr  )Únested)ÚctxsÚthisÚrests      r$   r™  r™  5  sI   é € à�‰7€DØ��ˆ8€DÚ	ÞÜ˜’Û÷ �ó ÷ 
ˆç•ú÷ 
�üs/   ‚A�AŸ:¤A±	Aº
A	ÁAÁ
AÁAc                  ó   • \ rS rSrSrS rSrg)ÚV2ReportiA  z8a small class to track the data we saw within the streamc                ó   • SU l         g r  ©r�   r  s    r$   rç   ÚV2Report.__init__D  s	   € Øˆ�r&   r   N)rî   rï   rð   rñ   rò   rç   ró   rô   r&   r$   rž  rž  A  s
   † ÙBõr&   rž  c                ó  ^ • T R                  5          T R                  R                  [        S5      U[        R
                  " U5      4-  5        T R                  R                  [        S5      U[        S5      S9n[        R                  " 5       n[        5       n[        T 5      nT R                  UR                  5       ;   a  [        R                  " S5      e[        R                  " T R                  S5      n[        R                  " T R                  S5      n	T R                  R!                  SS	5      n
T R                  R#                  SS
5      nUS::  a	  [$        U   nT R                  R'                  SS5      nUS:  a  SnOUS:X  a	  [(        U	   nT R+                  S5         U 4S jUR                  5        5       n[-        U6    / nSnSnSn U
(       d	  [.        nUnOu[0        n[3        US9nUb  UR4                  n[        R6                  " U5      n[8        R:                  " UR<                  U4S9nUR?                  U5        URA                  5         [C        T UUUUUUUS9nU
(       d  [E        U5        Oi[G        U5      n[I        U5       H>  n[8        R:                  " [D        U4S9nUR?                  U5        URA                  5         M@     URK                  5          Ub  URO                  [Q        U5      5        U H  nURS                  5         M      SSS5        T RU                  SS9  SSS5        URW                  5         URY                  S5      nU(       a   e[[        T XRUR\                  5        SSS5        g!   Ub  URM                  5         e = f! Ub  URO                  [Q        U5      5        U H  nURS                  5         M     f = f! , (       d  f       NÃ= f! , (       d  f       N½= f! , (       d  f       g= f)z†Apply the contents from a version 2 streaming clone.

Data is read from an object that only needs to provide a ``read(size)``
method.
rÁ   rÂ   r®   r¯   rP  s   cpus   memorys   workers!   parallel-stream-bundle-processings,   parallel-stream-bundle-processing.num-writerr   s/   parallel-stream-bundle-processing.memory-targetNc              3  óX   >#   • U  H  oR                  TR                  5      v •  M!     g 7frâ   ©rÊ   r;   ©Ú.0rš   r(   s     €r$   Ú	<genexpr>Úconsumev2.<locals>.<genexpr>z  ó!   øé € ÐNºo°s×)Ñ)¨$¯'©'×2Ð2ºoùó   ƒ'*)Úmemory_target)Útargetr  )Úfile_chunkerÚ	mark_usedTrÈ   r   )/r\   r;   rT   r   r   rm   r¶   r~   rž  rN  rš   r  r   rT  r   Úget_resource_profilerr   Ú	configintÚDEFAULT_NUM_WRITERÚconfigbytesÚDEFAULT_MEMORY_TARGETr   r™  Ú_FileChunkerÚ_ThreadSafeFileChunkerÚ
_DataQueuer®  ÚchunkbufferÚ	threadingÚThreadÚ	fill_fromr›   rÏ   Ú_v2_parse_filesÚ_write_filesÚ_FileInfoQueuerË   ÚfillÚabortr  r1   r?   rf   r¸   r�   r„   r�   )r(   ri   rl   Úfilesizer¹   rÏ   Úreportrþ   Úcpu_profileÚmem_profileÚthreadedÚ
num_writerr«  rš  ÚworkersÚ
info_queueÚ
data_queuer®  ÚfcÚraw_dataÚwr˜   Ú__Úremainss   `                       r$   Ú	consumev2rÎ  H  s‰  ø€ ð 
�‰�Ø�‰�‰ÜÐ3Ó4Øœ$Ÿ.š.¨Ó2Ð3ñ4ô	
ð —7‘7×'Ñ'Üˆh‹KØÜ�8“ð (ð 
ˆô
 —
’
“ˆÜ“ˆä˜$“ˆð �8‰8�v—}‘}“Ó&Ü×(Ò(ØKóð ô ×2Ò2°4·7±7¸FÓCˆÜ×2Ò2°4·7±7¸IÓFˆØ—7‘7×%Ñ%ØÐ;ó
ˆð —W‘W×&Ñ&ØØ;ó
ˆ
ð ˜‹?Ü+¨KÑ8ˆJØŸ™×+Ñ+ØØ>ó
ˆð ˜1ÓØ ‰MØ˜aÓÜ1°+Ñ>ˆMØ×Ñ˜hÕ'ÜN¸f¿m¹m¼oÓNˆDÜ˜’Ø�Ø!�
Ø!�
Ø �	ð3!Þ#Ü)˜Ø#%™ä3˜Ü%/¸mÑ%L˜
Ø(Ñ4Ø(2×(<Ñ(<˜IÜ#'×#3Ò#3°JÓ#?˜ä%×,Ò,Ø#-×#7Ñ#7Ø"$ ñ˜ð  Ÿ™ qÔ)ØŸ™œ	Ü+ØØ ØØ!Ø ØØ%'Ø"+ñ	�Eö $Ü$ UÕ+ä%3°EÓ%:˜
ä"'¨
Ö"3˜BÜ )× 0Ò 0Ü'3Ø&0 ]ñ!˜Að $ŸN™N¨1Ô-ØŸG™GžIñ #4ð #Ÿ™Õ)ð "Ñ-ð #×(Ñ(¬¨W«Ô6Û$˜ØŸ™žò %÷o ðx �O‰O¨4ˆOÑ0÷} (ð@ 	×ÑÔð —'‘'˜!“*ˆÞÐˆ{Ü˜D %°F×4EÑ4EÔF÷a 
ˆøðtØ!Ñ-Ø"×(Ñ(Ô*Øûð "Ñ-ð #×(Ñ(¬¨W«Ô6Û$˜ØŸ™žò %ú÷o •ú÷ (Õ'ú÷W 
�úsu   ’FO=Æ)#O,Ç	OÇB'NÉ=N É>A(NË&N Ë'6OÌO,Ì5A	O=ÎN	ÎN Î 8O	ÏOÏ
O)Ï%O,Ï,
O:	Ï6O=Ï=
Pc                  ó*   • \ rS rSrSrS rS rS rSrg)Ú_QueueiË  zDa reimplementation of queue.Queue which doesn't use thread.Conditionc                ó    • [         R                  " 5       U l        [        R                  " 5       U l        [        R                  " 5       U l        g râ   )ÚcollectionsÚdequeÚ_queuer¸  ÚLockÚ_lockÚ_waitr  s    r$   rç   Ú_Queue.__init__Î  s0   € Ü!×'Ò'Ó)ˆŒô —^’^Ó%ˆŒ
Ü—^’^Ó%ˆ�
r&   c                óø   • U R                      U R                  R                  U5        U R                  R	                  5       (       a  U R                  R                  5         S S S 5        g ! , (       d  f       g = frâ   )rÖ  rÔ  r›   r×  ÚlockedÚrelease)rå   Úitems     r$   ÚputÚ
_Queue.putÜ  sH   € Ø�Z‹ZØ�K‰K×Ñ˜tÔ$à�z‰z× Ñ ×"Ñ"Ø—
‘
×"Ñ"Ô$÷	 �ZŽZús   �AA+Á+
A9c                ó^  • U R                      [        U R                  5      S:X  aÔ  U R                  R	                  SS9  U R                   R                  5         U R                  R	                  5         U R                   R	                  5         U R                  R                  5       (       a3  [        U R                  5      S:”  a  U R                  R                  5         [        U R                  5      S:X  a  MÔ  U R                  R                  5       sS S S 5        $ ! , (       d  f       g = f)Nr   F©Úblockingr   )rÖ  r1   rÔ  r×  ÚacquirerÛ  rÚ  Úpopleftr  s    r$   r6   Ú
_Queue.getã  sÅ   € Ø�Z‹ZÜ�d—k‘kÓ" aÓ'à—
‘
×"Ñ"¨EÐ"Ñ2ð —
‘
×"Ñ"Ô$à—
‘
×"Ñ"Ô$à—
‘
×"Ñ"Ô$ð
 —:‘:×$Ñ$×&Ñ&¬3¨t¯{©{Ó+;¸aÓ+?Ø—J‘J×&Ñ&Ô(ô �d—k‘kÓ" aÕ'ð  —;‘;×&Ñ&Ó(÷# �Z�Zús   �C,DÃ;DÄ
D,)rÖ  rÔ  r×  N)	rî   rï   rð   rñ   rò   rç   rÝ  r6   ró   rô   r&   r$   rÐ  rÐ  Ë  s   † ÙNò&ò%õ)r&   rÐ  c                  ó@   • \ rS rSrSrSS jrS rS rS rS r	S	 r
S
rg)r¶  iø  zöA queue passing data from the bundle stream to other thread

It has a "memory_target" optional parameter to avoid buffering too much
information. The implementation is not exact and the memory target might be
exceed for a time in some situation.
Nc                ó&  • [        5       U l        SU l        Xl        U R                  b&  U R                  S::  a  [        R
                  " S5      e[        R                  " 5       U l        [        R                  " 5       U l	        SU l
        SU l        g )NFr   zmemory target should be > 0)rÐ  Ú_qÚ_abortÚ_memory_targetr   rT  r¸  rÕ  rÖ  r×  Ú_current_readÚ_current_used)rå   r«  s     r$   rç   Ú_DataQueue.__init__   sq   € Ü“(ˆŒØˆŒØ+ÔØ×ÑÑ*¨t×/BÑ/BÀaÓ/GÜ×(Ò(Ð)FÓGÐGô —^’^Ó%ˆŒ
Ü—^’^Ó%ˆŒ
àˆÔàˆÕr&   c                ój   • U R                   c  gU R                  U R                  -
  U R                   :  $ )zfTrue if more data can be read without further exceeding memory target

Must be called under the lock.
T)ré  rê  rë  r  s    r$   Ú_has_free_spaceÚ_DataQueue._has_free_space  s7   € ð
 ×ÑÑ&ð Ø×"Ñ" T×%7Ñ%7Ñ7¸4×;NÑ;NÑNÐNr&   c                ó2  • U R                   by  U R                     XR                  :”  a  Xl        U R                  R	                  5       (       a/  U R                  5       (       a  U R                  R                  5         SSS5        gg! , (       d  f       g= f)z{Notify we have used the buffer up to "offset"

This is meant to be used from another thread than the one filler the queue.
N)ré  rÖ  rë  r×  rÚ  rî  rÛ  )rå   Úoffsets     r$   r®  Ú_DataQueue.mark_used!  sl   € ð
 ×ÑÑ*Ø—“Ø×.Ñ.Ó.Ø)/Ô&à—:‘:×$Ñ$×&Ñ&¨4×+?Ñ+?×+AÑ+AØ—J‘J×&Ñ&Ô(÷ �ð +ß•ús   šA$BÂ
Bc                ó  • U R                   n U GH6  nU =R                  [        U5      -  sl        UR                  U5        U R                  (       a    OõU R
                  c  MU  U R                     U R                  5       (       d·  U R                  R                  SS9  U R                  R                  5         U R                  R                  5         U R                  R                  5         U R                  R                  5       (       a  U R                  R                  5         U R                  5       (       d  M·  SSS5        GM9     UR                  S5        g! , (       d  f       GM]  = f! UR                  S5        f = f)zffill the data queue from a bundle2 part object

This is meant to be called by the data reading thread
NFrà  )rç  rê  r1   rÝ  rè  ré  rÖ  rî  r×  râ  rÛ  rÚ  )rå   r  ÚqrÜ  s       r$   rº  Ú_DataQueue.fill_from.  s  € ð
 �G‰Gˆð	Ü�Ø×"Ò"¤c¨$£iÑ/Õ"Ø—‘�d”Ø—;—;ÙØ×&Ñ&Ó2ØŸ›Ø"&×"6Ñ"6×"8Ñ"8ð !ŸJ™J×.Ñ.¸Ð.Ñ>Ø ŸJ™J×.Ñ.Ô0à ŸJ™J×.Ñ.Ô0à ŸJ™J×.Ñ.Ô0ð  $Ÿz™z×0Ñ0×2Ñ2Ø $§
¡
× 2Ñ 2Ô 4ð #'×"6Ñ"6×"8Ó"8÷ $šñ ð* �E‰E�$�K÷ $Ÿûð �E‰E�$�Kús+   ŽAE0 Á%E0 Á1CEÄ>E0 Å
E-	Å'	E0 Å0Fc              #  ó¢   #   • U R                   nUR                  5       =nb,  Uv •  U R                  (       a  gUR                  5       =nb  M+  gg7f)zWIterate over the bundle chunkgs

This is meant to be called by the data parsing thread.N)rç  r6   rè  ©rå   rô  rÑ   s      r$   Ú__iter__Ú_DataQueue.__iter__L  sA   é € ð �G‰GˆØ—E‘E“Gˆ|ˆqÑ(ØŠGØ�{�{Øð —E‘E“Gˆ|ˆqÕ(ùs   ‚A	AÁAc                ó"  • SU l         U R                  R                  S5        U R                  bO  U R                     U R
                  R                  5       (       a  U R
                  R                  5         SSS5        gg! , (       d  f       g= f)zjstop the data-reading thread and interrupt the comsuming iteration

This is meant to be called on errors.
TN)rè  rç  rÝ  ré  rÖ  r×  rÚ  rÛ  r  s    r$   r¿  Ú_DataQueue.abortV  sc   € ð
 ˆŒØ�‰�‰�DÔØ×ÑÑ*Ø—“à—:‘:×$Ñ$×&Ñ&Ø—J‘J×&Ñ&Ô(÷ �ð +ß•ús   ¼:B Â 
B)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¶  ø  s&   † ñôò,	Oò)òò<õ)r&   r¶  c                  ó4   • \ rS rSrSrS	S jrS rS rS rSr	g)
r½  id  zDA thread-safe queue to passer parsed file information to the writersc                ó.   • Xl         [        5       U l        g râ   )Ú_inforÐ  rç  )rå   Úinfos     r$   rç   Ú_FileInfoQueue.__init__g  s   € ØŒ
Ü“(ˆ�r&   c                ód   • U R                   nU R                   H  nUR                  U5        M     g)z€iterate over the parsed information to file the queue

This is meant to be call from the thread parsing the stream information.
N)rç  rþ  rÝ  r÷  s      r$   r¾  Ú_FileInfoQueue.fillk  s&   € ð
 �G‰GˆØ—”ˆAØ�E‰E�!ŽHò r&   c                ó^   • [        U5       H  nU R                  R                  S5        M      g)z¡signal all the workers that we no longer have any file info coming

Called from the thread parsing the stream information (and/or the main
thread if different).
N)rË   rç  rÝ  )rå   Únumber_workerrÌ  s      r$   r  Ú_FileInfoQueue.closet  s#   € ô ˜Ö&ˆBØ�G‰G�K‰K˜Öò 'r&   c              #  ó~   #   • U R                   nUR                  5       =nb  Uv •  UR                  5       =nb  M  gg7f)zZiterate over the available file info

This is meant to be called from the writer threads.
N)rç  r6   r÷  s      r$   rø  Ú_FileInfoQueue.__iter__}  s7   é € ð
 �G‰GˆØ—E‘E“Gˆ|ˆqÑ(ØŠGð —E‘E“Gˆ|ˆqÕ(ùs   ‚7=»=)rþ  rç  N©rÿ  zIterable[FileInfoT])
rî   rï   rð   rñ   rò   rç   r¾  r  rø  ró   rô   r&   r$   r½  r½  d  s   † ÙNôòòõr&   r½  c                  óN   • \ rS rSrSr S         S	S jjrS
S jrSS jrSrg)r´  i‡  zŽyield the chunk that constitute a file

This class exists as the counterpart of the threaded version and
would not be very useful on its own.
Nc                óN   • X@l         X0l        [        R                  " XS9U l        g )Nr‰   )rÁ  r¹   r   rŽ   Ú_chunks)rå   ri   Údata_lenr¹   rÁ  r®  s         r$   rç   Ú_FileChunker.__init__Ž  s    € ð ŒØ ŒÜ×)Ò)¨"Ñ=ˆ�r&   c                ó   • g)z#Do nothing in non-threading contextNrô   r  s    r$   r¾  Ú_FileChunker.fillš  rl  r&   c              #  óÎ   #   • U R                    HQ  nU R                  =R                  [        U5      -  sl        U R                  R                  [        U5      S9  Uv •  MS     g 7f)Nr²   )r  rÁ  r�   r1   r¹   r·   )rå   rº   s     r$   rø  Ú_FileChunker.__iter__�  sJ   é € Ø—\”\ˆEØ�K‰K×"Ò"¤c¨%£jÑ0Õ"Ø�M‰M×#Ñ#¬¨U«Ð#Ñ4ØŒKò "ùs   ‚A#A%)r  r¹   rÁ  râ   ©
ri   úbundle2mod.unbundlepartr  rV   r¹   úscmutil.progressrÁ  rž  r®  úOptional[Callable[[int], None]]rì   ©r–   ÚFileChunksT)	rî   rï   rð   rñ   rò   rç   r¾  rø  ró   rô   r&   r$   r´  r´  ‡  sK   † ñð 6:ð
>à#ð
>ð ð
>ð #ð	
>ð
 ð
>ð 3õ
>ô2÷r&   r´  c                  ób   ^ • \ rS rSrSr S         SU 4S jjjrS	U 4S jjrS
S jrSrU =r	$ )rµ  i¤  z�yield the chunk that constitute a file

Make sure you  call the "fill" function in the main thread to read the
right data at the right time.
c                ó\   >• [         TU ]  XX45        Xl        [        5       U l        XPl        g râ   )rr  rç   Ú_fprÐ  rÔ  Ú
_mark_used)rå   ri   r  r¹   rÁ  r®  rt  s         €r$   rç   Ú_ThreadSafeFileChunker.__init__«  s'   ø€ ô 	‰Ñ˜ xÔ8ØŒÜ“hˆŒØ#�r&   c                ó  >•  [         TU ]  5        H9  nU R                  R                  5       nU R                  R                  X45        M;     U R                  R                  S5        g! U R                  R                  S5        f = f)zœfill the file chunker queue with data read from the stream

This is meant to be called from the thread parsing information (and
consuming the stream data).
N)rr  rø  r  r5  rÔ  rÝ  )rå   rº   rñ  rt  s      €r$   r¾  Ú_ThreadSafeFileChunker.fill¸  s^   ø€ ð	"Ü™Ñ)Ö+�ØŸ™Ÿ™›�Ø—‘—‘  Ö0ñ ,ð �K‰K�O‰O˜DÕ!øˆD�K‰K�O‰O˜DÕ!ús   ƒAA* Á*Bc              #  óÒ   #   • U R                   R                  5       =nbF  Uu  p#U R                  b  U R                  U5        Uv •  U R                   R                  5       =nb  ME  gg7f)zUIterate over all the file chunk

This is meant to be called from the writer threads.
N)rÔ  r6   r  )rå   rÿ  rº   rñ  s       r$   rø  Ú_ThreadSafeFileChunker.__iter__Å  sW   é € ð
 —{‘{—‘Ó(Ð(ˆtÑ5Ø ‰MˆEØ�‰Ñ*Ø—‘ Ô'ØŠKð	 —{‘{—‘Ó(Ð(ˆtÕ5ùs   ‚A!A'Á%A')r  r  rÔ  râ   r  rì   r  )
rî   rï   rð   rñ   rò   rç   r¾  rø  ró   r  r€  s   @r$   rµ  rµ  ¤  sV   ø† ñð 6:ð$à#ð$ð ð$ð #ð	$ð
 ð$ð 3÷$ð $÷"÷	ò 	r&   rµ  c              #  ó*   #   • Ub  U" U5        U v •  g7f)zused for single chunk file,Nrô   )rº   r®  rñ  s      r$   Ú_trivial_filer"  Ñ  s   é € ð ÑÙ�&ÔØ
ƒKùs   ‚c           	   #  óT  #   • [        5       nUR                  S5        [        U5       GHy  n	[        R                  " US5      n
[        R
                  " U5      n[        R
                  " U5      n[        R                  " X5      nU R                  R                  (       a4  U R                  R                  SX­[        R                  " U5      4-  5        X*   nUR                  XØ5      u  nnU[        R                  ::  aw  UR                  U5      nUR                  5       nU=R                  [        U5      -  sl        UR!                  [        U5      S9  [#        UUU5      nUU[%        U5      4v •  GMO  U" UUUUUS9nUU[%        U5      4v •  UR'                  5         GM|     g7f)zsdo the "stream-parsing" part of stream v2

The parsed information are yield result for consumption by the "writer"
r   r   ó   adding [%s] %s (%s)
r²   )r®  N)r   r!   rË   r   ÚreadexactlyÚuvarintdecodestreamr;   r‘   r‹   rm   Úprepare_streamed_fileÚDEFAULT_FILE_CHUNKr�   r5  r�   r1   r·   r"  Úiterr¾  )r(   ri   Úvfs_mapr€   r¹   rÁ  r­  r®  Ú
known_dirsrÑ   rÿ   ÚnamelenÚdatalenr�   rš   rÓ   ÚmodeÚcrñ  r’  s                       r$   r»  r»  Ü  s`  é € ô “€JØ‡O�O�AÔÜ�:×ˆÜ×Ò˜r 1Ó%ˆÜ×*Ò*¨2Ó.ˆÜ×*Ò*¨2Ó.ˆä×Ò Ó,ˆà�7‰7××Ø�G‰G�M‰MØ(¨C´t·~²~ÀgÓ7NÐ+OÑOôð ‰lˆØ×.Ñ.¨tÓ@‰
ˆˆdØ”d×-Ñ-Ó-Ø—‘˜Ó ˆAØ—W‘W“YˆFØ×Ò¤ Q£Ñ'ÕØ×Ñ¤C¨£FÐÑ+Ü" 1 i°Ó8ˆFØ˜œt F›|Ð,Õ,á!ØØØØØ#ñˆFð ˜œt F›|Ð,Ò,à�K‰K�Mò= ùs   ‚F&F(c                ó$  • [         R                  [         R                  -  n[        R                  (       a  U[         R
                  -  nU  H¦  u  p#nUc  [         R                  " X!5      nO[         R                  " X!US9n U HT  n[         R                  " XV5      nU[        U5      :  d  M*  [         R                  " XVUS 5      nU[        U5      :  a  M*  MV     [         R                  " U5        M¨     g! [         R                  " U5        f = f)zwrite files from parsed dataN)r.  )
r'  ÚO_WRONLYÚO_CREATr   rG  ÚO_BINARYr*  rÎ   r1   r  )rÿ  Úio_flagsrÓ   r.  r  r-  rº   Úwrittens           r$   r¼  r¼    sÄ   € ä�{‰{œRŸZ™ZÑ'€HÜ××Ø”B—K‘KÑˆÛ Ñˆ�DØ‰<Ü—’˜Ó(‰Bä—’˜¨dÑ3ˆBð	Û�ÜŸ(š( 2Ó-�à¤ E£
Õ*Ü Ÿhšh r°°¨?Ó;�Gð ¤ E£
×*ñ ô �HŠH�RŽLò !øô �HŠH�R�Lús   Â(C7Â.(C7ÃC7Ã7Dc                óL  ^ • T R                  5          [        R                  " 5       n[        R                  " U5      nT R                  R                  [        S5      U-  5        T R                  R                  [        S5      U[        S5      S9nUR                  S5        Sn[        T 5      nT R                  UR                  5       ;   a  [        R                  " S5      eSnT R                  S5         U 4S jUR                  5        5       n[        U6    [!        U5       GHp  n	[        R                  " U5      n
U
S:X  a9  T R                  R"                  (       a  T R                  R%                  SU	-  5        Xz-  n[!        U
5       Hõ  n	[        R&                  " US	5      nXk   n[        R                  " U5      n[        R                  " U5      n[        R&                  " X5      nT R                  R"                  (       a8  S
nUX¿[        R(                  " U5      4-  nT R                  R%                  U5        X^-  nU" US5       n[        R*                  " XS9 H  nUR-                  U5        M     SSS5        M÷     UR/                  S	S9  GMs     SSS5        T R1                  SS9  SSS5        UR3                  5         [5        T X'U5        SSS5        g! , (       d  f       GMb  = f! , (       d  f       N^= f! , (       d  f       NX= f! , (       d  f       g= f)z†Apply the contents from a version 3 streaming clone.

Data is read from an object that only needs to provide a ``read(size)``
method.
s   %d entries to transfer
rÂ   s   entriesr¯   r   rP  c              3  óX   >#   • U  H  oR                  TR                  5      v •  M!     g 7frâ   r¤  r¥  s     €r$   r§  Úconsumev3.<locals>.<genexpr>A  r©  rª  s   entry with no files [%d]
r   r$  rÆ   r‰   Nr²   TrÈ   )r\   r   r~   r&  r;   rT   r   r¶   r!   rN  rš   r  r   rT  r   r™  rË   r‘   r‹   r%  rm   rŽ   rÎ   r·   rf   r¸   r„   )r(   ri   rÏ   Ú
entrycountr¹   Úbytes_transferredrþ   rÐ   rš  rÑ   rl   rÿ   rš   r,  r-  r�   r`  rÔ   rº   s   `                  r$   Ú	consumev3r;  !  sv  ø€ ð 
�‰�Ü—
’
“ˆä×-Ò-¨bÓ1ˆ
Ø�‰�‰”qÐ4Ó5¸ÑDÔEà—7‘7×'Ñ'Üˆh‹KØÜ�:“ð (ð 
ˆð
 	�‰˜ÔØÐä˜$“ˆð �8‰8�v—}‘}“Ó&Ü×(Ò(ØKóð ð ÐØ×Ñ˜hÕ'ÜN¸f¿m¹m¼oÓNˆDÜ˜’Ü˜z×*�AÜ $× 8Ò 8¸Ó <�IØ  A“~ØŸ7™7×,×,Ø ŸG™GŸM™MÐ*GÈ1Ñ*MÔNØ$Ñ1Ð$Ü" 9Ö-˜Ü"×.Ò.¨r°1Ó5˜Ø$™k˜Ü"&×":Ò":¸2Ó">˜Ü"&×":Ò":¸2Ó">˜ä#×/Ò/°Ó<˜àŸ7™7×,×,Ø":˜CØ C¬t¯~ª~¸gÓ/FÐ#GÑG˜CØ ŸG™GŸM™M¨#Ô.Ø)Ñ4Ð)á   tœ_°Ü)-×);Ò);¸BÔ)N Ø #§	¡	¨%Ö 0ñ *O÷ -™_ñ .ð" ×&Ñ&¨AÐ&Ô.ñ/ +÷ ð8 �O‰O¨4ˆOÑ0÷= (ð@ 	×ÑÔÜ˜D %Ð;LÔM÷u 
ˆ÷` -Ÿ_ú÷+ •ú÷ (Õ'ú÷3 
�úsU   ’C%LÃ7#LÄD4K3É-K É; K3ÊLÊ2%LË 
K0Ë*	K3Ë3
LË=LÌ
L	ÌLÌ
L#c                óf  • SSK Jn  U Vs/ s H  ofU R                  ;  d  M  UPM     nnU(       a:  [        R                  " [        S5      SR                  [        U5      5      -  5      e[        R                  " 5          [        XX#5        S S S 5        [        U R                  U5      U l        UR                  U R                  U R                  U R                  5      U R                   l        [$        R&                  " U 5        [(        R*                  " U 5        g s  snf ! , (       d  f       N›= f©Nr   rK   rÝ   r-   )rP   rL   r>   r   rY   r   r?   r@   r   rU  rÎ  r%   r   r^   r;   r_   r`   ra   r   rb   r   rc   )r(   ri   rl   rÀ  r   rL   ÚrrH   s           r$   Úapplybundlev2r?  d  sæ   € õ á*ÓFšl˜°t·~±~Ñ.E—1™l€KÐFÞÜ�kŠkÜÐEÓFØ�j‰jœ Ó,Ó-ñ.ó
ð 	
ô
 
�Š�Ü�$˜IÔ0÷ 
ô 6Ø×ÑØó€DÔð "×8Ñ8Ø�‰�×"Ñ" D§M¡Mó€D‡I�IÔô ×!Ò! $Ô'Ü×Ò Õ%ùò% G÷ 
�ús   ‹D¢DÂ D"Ä"
D0c                ó  • SSK Jn  U Vs/ s H  oDU R                  ;  d  M  UPM     nnU(       a>  [        S5      nUSR	                  [        U5      5      -  n[        R                  " U5      e[        X5        [        U R                  U5      U l
        UR                  U R                  U R                  U R                  5      U R                  l        [         R"                  " U 5        [$        R&                  " U 5        g s  snf r=  )rP   rL   r>   r   r?   r@   r   rY   r;  r%   r   r^   r;   r_   r`   ra   r   rb   r   rc   )r(   ri   r   rL   r>  rH   r`  s          r$   Úapplybundlev3rA  ~  sÊ   € Ýá*ÓFšl˜°t·~±~Ñ.E—1™l€KÐFÞÜÐGÓHˆØˆu�z‰zœ& Ó-Ó.Ñ.ˆÜ�kŠk˜#ÓÐäˆdÔä5Ø×ÑØó€DÔð "×8Ñ8Ø�‰�×"Ñ" D§M¡Mó€D‡I�IÔô ×!Ò! $Ô'Ü×Ò Õ%ùò! Gs
   ‹D¢Dc           	     óì  ^^• S/mUU4S jnU HÆ  u  pVnX   nX   n	UR                  U5      n
U	R                  U5      n[        R                  R                  U5      n[        R                  R	                  U5      (       d  [
        R                  " U5        U	R                  U5         [
        R                  " U
UTS   USS9  TR                  5         MÈ     TS   $ ! [         a    U(       d  e  N-f = f)NTc                 ó0   >• ST S'   [        S5      Tl        g )NFr   s   copying)r   Útopic)Úhardlinkr¹   s   €€r$   Ú	copy_usedÚ_copy_files.<locals>.copy_used—  s   ø€ Øˆ�‰Ü˜:›ˆ�r&   r   F)rE  Úno_hardlink_cbÚcheck_fs_hardlink)r?   r'  rÓ   ÚdirnamerŠ  r   ÚmakedirsÚregister_fileÚcopyfileÚFileNotFoundErrorr·   )Úsrc_vfs_mapÚdst_vfs_mapr’   r¹   rF  r\  rÓ   r‚  Úsrc_vfsÚdst_vfsÚsrc_pathÚdst_pathrJ  rE  s      `         @r$   Ú_copy_filesrU  ”  så   ù€ Øˆv€Hö'ó %Ñˆ�Ø‘.ˆØ‘.ˆØ—<‘< Ó%ˆØ—<‘< Ó%ˆô —'‘'—/‘/ (Ó+ˆÜ�w‰w�~‰~˜g×&Ñ&Ü�MŠM˜'Ô"Ø×Ñ˜dÔ#ð
	Ü�MŠMØØØ! !™Ø(Ø"'òð 	×ÑÖñ/ %ð0 �A‰;Ðøô	 !ó 	ÞØñ ð	ús   Â*CÃC3Ã2C3c                óº  • U R                    Vs1 s H  nU[        R                  ;  d  M  UiM     nnUR                    Vs1 s H  nU[        R                  ;  d  M  UiM     nnX4:X  d   eUR                  5          U R                  5          [        R
                  " U 5      nUR                  S5      nSn[        R                  R                  U5      (       a  Sn[        U SSSS9n[        U5      n[        U 5      n	[        U5      n
[        S U 5       5      U-   nU R                  R                  [!        S5      U[!        S	5      S
9nU VVVs/ s H5  u  pÞUR#                  5         H  nXßR$                  UR&                  4PM     M7     nnnn[)        XšUU5      nU(       a>  [        R
                  " U5      nUR                  S5      n[*        R,                  " UU5        SSS5        WR/                  5         W(       a  SnOSnU R                  R1                  UW-  5        UR3                  S5       nUR4                  R7                  U5        SSS5        [2        R8                  " UR                  R:                  UR<                  5        SSS5        gs  snf s  snf s  snnnf ! , (       d  f       NÌ= f! , (       d  f       Nn= f! , (       d  f       g= f)zUcopy all content from one local repository to another

This is useful for local clones	   bookmarksr   r   NTr�  c              3  óZ   #   • U  H!  n[        US    R                  5       5      v •  M#     g7f)r   N)r1   r˜   )r¦  rh   s     r$   r§  Úlocal_copy.<locals>.<genexpr>Ú  s"   é € ÐAº°Aœc ! A¡$§*¡*£,×/Ð/ºùs   ‚)+s   linkings   files)rD  r°   r±   s   linked %d files
s   copied %d files
s
   localclone)r   r   ÚWORKING_DIR_REQUIREMENTSr\   r   Úbookmarksvfsr?   r'  rÓ   rŠ  rŽ  rc  rN  Úsumr;   r¶   r   r˜   rœ   r‚  rU  r   rM  r¸   r‹   r   r   rÎ   Úcleanup_undo_filesr<   r*  )Úsrc_repoÚ	dest_repor>  Úsrc_store_requirementsÚdest_store_requirementsÚsrc_book_vfsÚsrcbookmarksÚbm_countr’   rO  Údest_vfs_mapÚtotal_filesr¹   rY  rh   r¡   r˜   rE  Údst_book_vfsÚdstbookmarksr`  Útrs                         r$   Ú
local_copyri  ¶  sƒ  € ð ×&Ò&óâ&ˆAØ”O×<Ñ<Ñ<÷ 	
Ù&ð ð ð ×'Ò'óâ'ˆAØ”O×<Ñ<Ñ<÷ 	
Ù'ð ð ð
 "Ó<Ð<Ð<à	�‰Õ	Ø�]‰]�_ô %×1Ò1°(Ó;ˆLØ'×,Ñ,¨\Ó:ˆLØˆHÜ�w‰w�~‰~˜l×+Ñ+Ø�ä#ØØØØ"&ñ	ˆGô ˜7“mˆGÜ" 8Ó,ˆKÜ# IÓ.ˆLÜÑA¹ÓAÓAÀHÑLˆKØ—{‘{×/Ñ/Ü˜
“mØ!Ü�x“[ð 0ð ˆHñ #*õâ")‘J�GØŸ™Ÿ�Að ×*Ñ*¨A¯J©JÓ7á"ñ 8Ù")ð ò ô
 # ;¸eÀXÓNˆHö Ü(×5Ò5°iÓ@�Ø+×0Ñ0°Ó>�Ü—’˜l¨LÔ9÷W ðX 	×ÑÔÞØ&‰Cà&ˆCØ�‰×Ñ˜# Ñ+Ô,à×"Ñ" =Ô1°RØ�O‰O×!Ñ! "Ô%÷ 2ô 	×&Ò& y§|¡|×'8Ñ'8¸)×:KÑ:KÔL÷q 
Ð	ùòùò
ùôP÷A �_ú÷f 2Õ1ú÷i 
Õ	úsg   �J«JÁJÁJÁ<KÂCJ*Å<J#ÆAJ*Ç$AKÈ7J;É=KÊ#J*Ê*
J8	Ê4KÊ;
K		ËKË
K)r"   úIterable[bytes]r#   rj  r–   ú
Set[bytes])r–   rk  )F)r   r8   rì   )r–   r8   )NFF)rx   r8   ry   r8   )r   Úfloatr€   rV   r�   rV   )r–   z tuple[int, int, Iterator[bytes]]r•   )r¨   )r»   rF  r–   z"tuple[Set[bytes], Iterator[bytes]])rl   rV   rm   rV   r–   rí   )r–   ztuple[int, int, Set[bytes]])r–   zlist[bytes])r–   úIterator[bytes | None])r�  r8   )r�  r8   r–   rm  )rl   rV   rÀ  rV   r–   rí   )rº   rF  r®  r  rñ  rV   r–   r  )ri   r  r€   rV   r¹   r  rÁ  rž  r­  zType[_FileChunker]r®  r  r–   zIterator[FileInfoT]r  )rl   rV   rÀ  rV   r   rj  r–   rí   )r   rj  r–   rí   )aÚ
__future__r   rÒ  rH  r=  r'  r´   r¸  Útypingr   r   r   r   r   r	   r
   Úi18nr   Ú
interfacesr   rP   r   r   r4   r   r   r   r   r   r   r   r   r   r   r   Úrevlogutilsr   ÚRESOURCE_LOWÚRESOURCE_MEDIUMÚRESOURCE_HIGHr±  r³  r%   r#   rI   rn   ru   r|   r„   r¢   r¦   r¿   r]   rÛ   rÞ   rà   Ú_fileappendrü   rK  rL  rú   r  r  rN  ra  ri  r—   r�   rž   ÚSimpleStoreEntryrp  Ú	StoreFiler{  rŽ  r•  r—  rI  r™  rž  rÎ  rF  r  rV   Ú	FileInfoTrÐ  r¶  r½  r´  rµ  r"  r»  r¼  r;  r?  rA  rU  ri  rô   r&   r$   Ú<module>rz     s8  ðõ #ã Û Û Û 	Û Û ÷÷ ñ õ Ý "÷÷ ÷ ó õð ×Ñ˜!Ø×Ñ˜QØ×Ñ˜1ðÐ ð ×Ñ˜,Ø×Ñ˜[Ø×Ñ˜9ðÐ ðØ)ðà*ðð ôô ö[ô|HôVð& CHðLØ#ðLØ;?õLðØðØ),ðØ:=ôô"77ôtð8  %ð9Øð9à'õ9ôxIFôX.ô8&÷.-ñ -ð €Ø€	ð €	Ø€	ôò<÷ñ òD
ò@IôF>%òBòòô(�×'Ñ'ô (ôV�—‘ô ô?ô@/ð>-Ø15ð-àô-ð` ×Ññó ð÷ñ ôvGðt �u‰o€àØ	ØˆS�MØðñ€	÷*)ñ *)÷Zi)ñ i)÷X ñ  ÷Fñ ô:*˜\ô *ðZØðà.ðð ðð ô	ð$ (4Ø15ð.àð.ð ð	.ð
 ð.ð ð.ð %ð.ð /ð.ð õ.ôbô(@NðF&Øð&Ø(+ð&Ø;Jð&à	ô&ô4&ô,õDHMr&   