§
    	^µc8?  ã                   ó  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlZddlmZ ddl	m
Z
mZmZmZ d„ Zd„ Zd„ Z G d„ d	¦  «        Zej        sej        r
d
Zej        ZndZdZdd„Z	 	 	 dd„Zdd„Zd„ Zdd„Zej        reZneZeZd„ ZdS )é    Né   )Ú_)ÚencodingÚerrorÚpycompatÚscmutilc                  ó
  — 	 t          t          j        d¦  «        ¦  «        } | dk    r| S n# t          t          f$ r Y nw xY w	 t          t
          j        d         ¦  «        } | dk    r| S n# t          t          f$ r Y nw xY wdS )z-try to count the number of CPUs on the systemÚSC_NPROCESSORS_ONLNr   s   NUMBER_OF_PROCESSORSr   )ÚintÚosÚsysconfÚAttributeErrorÚ
ValueErrorr   ÚenvironÚKeyError)Úns    ú2/usr/lib/python3/dist-packages/mercurial/worker.pyÚ	countcpusr      s±   € ðÝ•”
Ð0Ñ1Ô1Ñ2Ô2ˆØˆqŠ5ˆ5ØˆHð øå�JÐ'ð ð ð ØˆðøøøðÝ•Ô Ð!8Ô9Ñ:Ô:ˆØˆqŠ5ˆ5ØˆHð øå•jÐ!ð ð ð Øˆðøøøð ˆ1s    ‚(, ¬A ¿A Á&A, Á,B Á?B c                 ó  — |                       dd¦  «        }|rH	 t          |¦  «        }|dk    r|S n/# t          $ r" t          j        t          d¦  «        ¦  «        ‚w xY wt          t          t          ¦   «         d¦  «        d¦  «        S )Nó   workers   numcpusr   s!   number of cpus must be an integeré   é    )	Úconfigr   r   r   ÚAbortr   ÚminÚmaxr   )ÚuiÚsr   s      r   Ú_numworkersr   0   s˜   € Ø
�	Š	�)˜ZÑ(Ô(€AØð Gð	GÝ�A‘”ˆAØ�AŠvˆvØ�ð øåð 	Gð 	Gð 	GÝ”+�aÐ DÑEÔEÑFÔFÐFð	Gøøøå�s•9‘;”; Ñ"Ô" BÑ'Ô'Ð's	   š2 ²,Ac                  óR   — t          j        ¦   «         t          j        ¦   «         k    S ©N)Ú	threadingÚcurrent_threadÚmain_thread© ó    r   Úismainthreadr'   <   s   € ÝÔ#Ñ%Ô%­Ô)>Ñ)@Ô)@Ò@Ð@r&   c                   ó,   — e Zd ZdZd„ Zd„ Zd„ Zdd„ZdS )	Ú_blockingreadera  Wrap unbuffered stream such that pickle.load() works with it.

    pickle.load() expects that calls to read() and readinto() read as many
    bytes as requested. On EOF, it is fine to read fewer bytes. In this case,
    pickle.load() raises an EOFError.
    c                 ó   — || _         d S r!   )Ú_wrapped)ÚselfÚwrappeds     r   Ú__init__z_blockingreader.__init__H   s   € ØˆŒˆˆr&   c                 ó4   — | j                              ¦   «         S r!   )r+   Úreadline©r,   s    r   r0   z_blockingreader.readlineK   s   € ØŒ}×%Ò%Ñ'Ô'Ð'r&   c                 ó  — d}t          |¦  «        }t          |¦  «        5 }||k     rJ||d …         5 }| j                             |¦  «        }d d d ¦  «         n# 1 swxY w Y   |sn||z  }||k     °Jd d d ¦  «         n# 1 swxY w Y   |S ©Nr   )ÚlenÚ
memoryviewr+   Úreadinto)r,   ÚbufÚposÚsizeÚviewÚsubviewÚrets          r   r6   z_blockingreader.readintoN   s  € ØˆÝ�3‰xŒxˆå˜‰_Œ_ð 	 Ø˜’*�*Ø˜#˜$˜$”Zð : 7Øœ-×0Ò0°Ñ9Ô9�Cð:ð :ð :ñ :ô :ð :ð :ð :ð :ð :ð :øøøð :ð :ð :ð :àð ØØ�s‘
�ð ˜’*�*ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð ˆ
s4   ¡A>²AÁA>ÁA	ÁA>Á A	Á!A>Á>BÂBéÿÿÿÿc                 ó°   — |dk     r| j                              ¦   «         S t          |¦  «        }|                      |¦  «        }||d …= t	          |¦  «        S r3   )r+   ÚreadallÚ	bytearrayr6   Úbytes)r,   r9   r7   Ún_reads       r   Úreadz_blockingreader.read]   sR   € Ø�!Š8ˆ8Ø”=×(Ò(Ñ*Ô*Ð*å˜‰oŒoˆØ—’˜sÑ#Ô#ˆØ���ˆLÝ�S‰zŒzÐr&   N)r=   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r.   r0   r6   rC   r%   r&   r   r)   r)   @   s_   € € € € € ðð ð ð  ð  ð(ð (ð (ðð ð ðð ð ð ð ð r&   r)   g{®Gáz„?gêŒ 9Y>)FFTc                 ór   — |s	t           rdS ||z  }t          | ¦  «        }|t          |z  ||z  z   z
  }|dk    S )zetry to determine whether the benefit of multiple processes can
    outweigh the cost of starting themFg333333Ã?)Ú_DISALLOW_THREAD_UNSAFEr   Ú_STARTUP_COST)r   Ú	costperopÚnopsÚ
threadsafeÚlinearÚworkersÚbenefits          r   Ú
worthwhilerQ   r   sQ   € ð ð Õ1ð Øˆuà˜Ñ€FÝ˜"‰oŒo€GØ�¨Ñ/°&¸7Ñ2BÑBÑC€GØ�dŠ?Ðr&   c                 óî   — |                       dd¦  «        }|rt          t          u rt          ¦   «         sd}|r5t	          | |t          |¦  «        |¬¦  «        rt          | |||||¬¦  «        S  |||fz   Ž S )a  run a function, possibly in parallel in multiple worker
    processes.

    returns a progress iterator

    costperarg - cost of a single task

    func - function to run. It is expected to return a progress iterator.

    staticargs - arguments to pass to every invocation of the function

    args - arguments to split into chunks, to pass to individual
    workers

    hasretval - when True, func and the current function return an progress
    iterator then a dict (encoded as an iterator that yield many (False, ..)
    then a (True, dict)). The dicts are joined in some arbitrary order, so
    overlapping keys are a bad idea.

    threadsafe - whether work items are thread safe and can be executed using
    a thread-based worker. Should be disabled for CPU heavy tasks that don't
    release the GIL.

    prefork - a parameterless Callable that is invoked prior to forking the
    process.  fork() is only used on non-Windows platforms, but is also not
    called on POSIX platforms if the work amount doesn't warrant a worker.
    r   s   enabledF)rM   )Úprefork)Ú
configboolÚ_platformworkerÚ_posixworkerr'   rQ   r4   )	r   Ú
costperargÚfuncÚ
staticargsÚargsÚ	hasretvalrM   rS   Úenableds	            r   Úworkerr]      sš   € ðJ �mŠm˜I zÑ2Ô2€GØð •?¥lÐ2Ð2½<¹>¼>Ð2ð ˆàð 
•:˜b *­c°$©i¬iÀJÐOÑOÔOð 
ÝØ��j $¨	¸7ð
ñ 
ô 
ð 	
ð ˆ4�˜t˜gÑ%Ð&Ð&r&   c           	   #   ón	  ‡‡‡‡‡‡‡‡‡‡‡‡‡K  — t          | ¦  «        }t          j        t          j        ¦  «        Št          j        t          j        t          j        ¦  «         t          ¦   «         dgcŠŠˆˆfd„Šdˆˆfd„	Šˆˆˆfd„}t          j        t          j        |¦  «        Š|                      ¦   «          t          j	        ¦   «         }g Ši }	|r
 |¦   «          t          |t          |t          |¦  «        ¦  «        ¦  «        D �]ùŠt          j        ¦   «         \  ŠŠ‰                     ‰‰f¦  «         d}
	 t          j        ¦   «         }|dk    r]t          j        t          j        ‰¦  «         t          j        t          j        ‰¦  «         ˆˆˆˆˆˆfd„}t!          j        | |¦  «        }
nd#  t          j	        ¦   «         |k    r‚ t%          j        ¦   «         d         }t)          |t*          ¦  «         }|                      |¬¦  «         Y nxY wt          j	        ¦   «         |k    rQ	 |                      ¦   «          n#  Y nxY wt          j        |
d	z  ¦  «         nŠ# t          j        |
d	z  ¦  «         w xY wnm# t          j	        ¦   «         |k    rQ	 |                      ¦   «          n#  Y nxY wt          j        |
d	z  ¦  «         w # t          j        |
d	z  ¦  «         w xY ww xY w‰                     |¦  «         �Œût3          j        ¦   «         Š‰D ]M\  ŠŠt          j        ‰¦  «         ‰                     t          j        ‰d
d¦  «        t2          j        ¦  «         ŒNˆˆˆˆˆfd„}	 t          ‰¦  «        }|dk    r¹‰                     ¦   «         D ]ž\  }}	 tA          j!        tE          |j#        ¦  «        ¦  «        }|r$|d         r|	 $                    |d         ¦  «         n|V — ŒW# tJ          $ r; ‰ &                    |j#        ¦  «         |j#                             ¦   «          |dz  }Y Œ›w xY w|dk    °¹n#   ‰¦   «           |¦   «          ‚ xY w |¦   «         }|rA|dk     r't          j'        t          j	        ¦   «         | ¦  «         tQ          j)        |¦  «        ‚|rd|	fV — d S d S )Nr   c                  ó°   •— t          j         t           j        ‰¦  «         ‰D ]2} 	 t          j        | t           j        ¦  «         Œ## t
          $ r Y Œ/w xY wd S r!   )ÚsignalÚSIGCHLDr   ÚkillÚSIGTERMÚProcessLookupError)ÚpÚoldchldhandlerÚpidss    €€r   Úkillworkersz!_posixworker.<locals>.killworkers·   sn   ø€ õ 	Œ•f”n nÑ5Ô5Ð5àð 	ð 	ˆAðÝ”˜�6œ>Ñ*Ô*Ð*Ð*øÝ%ð ð ð Ø�ðøøøð	ð 	s   ¦AÁ
AÁATc                 óD  •— ‰                      ¦   «         D ]‰}dx}}	 t          j        || rdnt          j        ¦  «        \  }}n%# t          $ r ‰                     |¦  «         Y nw xY w|sŒV‰                     |¦  «         t          |¦  «        }|r‰d         s|‰d<   ŒŠd S r3   )Úcopyr   ÚwaitpidÚWNOHANGÚChildProcessErrorÚdiscardÚ_exitstatus)ÚblockingÚpidre   Ústrg   Úproblems       €€r   Úwaitforworkersz$_posixworker.<locals>.waitforworkersÃ   sÏ   ø€ Ø—9’9‘;”;ð 	 ð 	 ˆCØˆJˆA�ð"Ýœ
 3¨hÐ)F¨¨½B¼JÑHÔH‘��2�2øÝ$ð "ð "ð "ð —’˜SÑ!Ô!Ð!Ð!Ð!ð"øøøð ð ð Ø�LŠL˜‰OŒOˆOÝ˜R‘”ˆBØð  ˜' !œ*ð  Ø�˜‘
øð	 ð 	 s   �&AÁA&Á%A&c                 óH   •—  ‰d¬¦  «         ‰d         r ‰¦   «          d S d S )NF)rp   r   r%   )ÚsignumÚframerh   rs   rt   s     €€€r   Úsigchldhandlerz$_posixworker.<locals>.sigchldhandlerÕ   s;   ø€ Øˆ Ð&Ñ&Ô&Ð&Ø�1Œ:ð 	ØˆK‰MŒMˆMˆMˆMð	ð 	r&   r=   c                  óf  •— ‰d d…         D ]-\  } }t          j        | ¦  «         t          j        |¦  «         Œ.t          j        ‰¦  «         t          j        ‰	d¦  «        5 } ‰‰‰fz   Ž D ]+}t          j        ||¦  «         |                     ¦   «          Œ,	 d d d ¦  «         n# 1 swxY w Y   dS )Nr=   Úwbr   )r   ÚcloseÚfdopenÚpickleÚdumpÚflush)
ÚrÚwÚwfÚresultrX   ÚpargsÚpipesÚrfdrY   Úwfds
       €€€€€€r   Ú
workerfuncz _posixworker.<locals>.workerfuncù   sõ   ø€ Ø % c r c¤
ð $ð $™˜˜1Ýœ ™œ˜Ýœ ™œ˜˜Ý”H˜S‘M”M�MÝœ 3¨Ñ-Ô-ð '°Ø&* d¨Z¸5¸(Ñ-BÐ&Dð 'ð '˜FÝ"œK¨°Ñ3Ô3Ð3ØŸHšH™JœJ˜J˜Jð'ð'ð 'ð 'ñ 'ô 'ð 'ð 'ð 'ð 'ð 'ð 'øøøð 'ð 'ð 'ð 'ð ˜1s   Á#6B&Â&B*Â-B*)Úforceéÿ   Úrbc                  óÌ   •— t          j         t           j        ‰¦  «          ‰¦   «          t          j         t           j        ‰ ¦  «         ‰                     ¦   «          ‰d         S r3   )r`   ÚSIGINTra   r{   )rf   Ú
oldhandlerrs   Úselectorrt   s   €€€€€r   Úcleanupz_posixworker.<locals>.cleanup  sS   ø€ ÝŒ•f”m ZÑ0Ô0Ð0ØˆÑÔÐÝŒ•f”n nÑ5Ô5Ð5Ø�ŠÑÔÐØ�qŒzÐr&   r   ©T)*r   r`   Ú	getsignalr�   ÚSIG_IGNÚsetra   r   r   ÚgetpidÚ	partitionr   r4   ÚpipeÚappendÚforkr   Ú	callcatchÚsysÚexc_infoÚ
issubclassÚKeyboardInterruptÚ	tracebackÚ_exitÚaddÚ	selectorsÚDefaultSelectorr{   Úregisterr|   Ú
EVENT_READÚselectr}   Úloadr)   ÚfileobjÚupdateÚEOFErrorÚ
unregisterrb   r   ÚWorkerError) r   rX   rY   rZ   r[   rS   rO   rx   Ú	parentpidÚretvalr<   rq   rˆ   Úexctyper‰   r�   Ú	openpipesÚkeyÚeventsÚresÚstatusrh   rf   rŽ   r„   rg   r…   rs   r†   r�   rt   r‡   s     ``                  @@@@@@@@@@@r   rV   rV   ±   s*  øøøøøøøøøøøøøè è € Ý˜"‰oŒo€GÝÔ!¥&¤-Ñ0Ô0€JÝ
„M•&”-¥¤Ñ0Ô0Ð0Ý‘E”E˜A˜3€M€Dˆ'ð
ð 
ð 
ð 
ð 
ð 
ð ð  ð  ð  ð  ð  ð  ð$ð ð ð ð ð ð õ
 ”]¥6¤>°>ÑBÔB€NØ‡H‚H�J„J€JÝ”	‘”€IØ€EØ€Fàð Øˆ‰	Œ	ˆ	å˜4¥ W­c°$©i¬iÑ!8Ô!8Ñ9Ô9ð 0ñ 0ˆõ ”7‘9”9‰ˆˆSØ�Š�c˜3�ZÑ Ô Ð ð ˆð	(Ý”'‘)”)ˆCØ�aŠxˆxÝ”�fœm¨ZÑ8Ô8Ð8Ý”�fœn¨nÑ=Ô=Ð=ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	õ Ô'¨¨JÑ7Ô7�øøð	&ÝŒy‰{Œ{˜iÒ'Ð'ØÝ”l‘n”n QÔ'ˆGÝ" 7Õ,=Ñ>Ô>Ð>ˆEØ�LŠL˜uˆLÑ%Ô%Ð%Ð%Ð%øøøåŒy‰{Œ{˜iÒ'Ð'ð(Ø—H’H‘J”J�J�JøðØ�Døøøå”H˜S 3™YÑ'Ô'Ð'Ð'ø•B”H˜S 3™YÑ'Ô'Ð'Ð'øøøð (ø�rŒy‰{Œ{˜iÒ'Ð'ð(Ø—H’H‘J”J�J�JøðØ�Døøøå”H˜S 3™YÑ'Ô'Ð'Ð'ø•B”H˜S 3™YÑ'Ô'Ð'Ð'øøøð (øøøð 	�Š�‰Œˆ‰ÝÔ(Ñ*Ô*€HØð Ið I‰ˆˆSÝ
Œ�‰Œˆð
 	×Ò�"œ) C¨¨qÑ1Ô1µ9Ô3GÑHÔHÐHÐHðð ð ð ð ð ð ð ð ðÝ˜‘J”Jˆ	Ø˜!ŠmˆmØ'ŸšÑ0Ô0ð #ð #‘��Vð#õ !œ+¥o°c´kÑ&BÔ&BÑCÔC�Cà ð " S¨¤Vð "ØŸš c¨!¤fÑ-Ô-Ð-Ð-à!˜	˜	˜	øøÝð #ð #ð #Ø×'Ò'¨¬Ñ4Ô4Ð4à”K×%Ò%Ñ'Ô'Ð'à ‘N�I�I�Ið#øøøð ˜!Šmˆmøøð$Øˆ‰ŒˆØˆ‰	Œ	ˆ	ØøøøØˆW‰YŒY€FØð (Ø�AŠ:ˆ:ÝŒG•B”I‘K”K & Ñ)Ô)Ð)ÝÔ Ñ'Ô'Ð'Øð Ø�FˆlÐÐÐÐÐðð sš   Å A6F7Æ6JÆ7AHÈJÈ3IÉI'ÉIÉ
I'É'J ÊK.ÊJ2Ê1KÊ2J6	Ê4KÊ9K.ËK*	Ë*K.Í5.Q Î$AO5Ï4Q Ï5AP:Ð7Q Ð9P:Ð:	Q ÑQc                 ó¨   — t          j        | ¦  «        rt          j        | ¦  «        S t          j        | ¦  «        rt          j        | ¦  «         S dS )zˆconvert a posix exit status into the same form returned by
    os.spawnv

    returns None if the process was stopped instead of exitingN)r   Ú	WIFEXITEDÚWEXITSTATUSÚWIFSIGNALEDÚWTERMSIG)Úcodes    r   Ú_posixexitstatusr»   E  sU   € õ
 
„|�DÑÔð $ÝŒ~˜dÑ#Ô#Ð#Ý	Œ˜Ñ	Ô	ð $Ý”˜TÑ"Ô"Ð#Ð#ð$ð $r&   c              #   óª  ‡ ‡K  —  G d„ dt           j        ¦  «        }g Šˆˆ fd„}t          ‰ ¦  «        }t          j                             ¦   «         }	t          j                             ¦   «         }
i }t          ||dz  ¦  «        D ]}|
                     |¦  «         Œt          |¦  «        D ]9} ||
|	||¦  «        }‰ 	                    |¦  «         | 
                    ¦   «          Œ:	 t          ‰¦  «        dk    rÈ|	                     ¦   «         sR|	                     ¦   «         }|r$|d         r|                     |d         ¦  «         n|V — |	                     ¦   «         ¯R‰d                              d¦  «         d„ ‰D ¦   «         }|D ]%}|j        �|j        ‚‰                     |¦  «         Œ&t          ‰¦  «        dk    °Èn # t$          t&          f$ r  |¦   «          ‚ w xY w|	                     ¦   «         sR|	                     ¦   «         }|r$|d         r|                     |d         ¦  «         n|V — |	                     ¦   «         ¯R|rd	|fV — d S d S )
Nc                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ú_windowsworker.<locals>.Workerc                 óœ   — t          j        j        | g|¢R i |¤Ž || _        || _        || _        || _        d| _        d| _        d | _	        d S )NFT)
r"   ÚThreadr.   Ú
_taskqueueÚ_resultqueueÚ_funcÚ_staticargsÚ_interruptedÚdaemonÚ	exception)r,   Ú	taskqueueÚresultqueuerX   rY   rZ   Úkwargss          r   r.   z'_windowsworker.<locals>.Worker.__init__R  s`   € õ ÔÔ% dÐ<¨TÐ<Ð<Ð<°VÐ<Ð<Ð<Ø'ˆDŒOØ +ˆDÔØˆDŒJØ)ˆDÔØ %ˆDÔØˆDŒKØ!ˆDŒNˆNˆNr&   c                 ó   — d| _         d S )NT)rÅ   r1   s    r   Ú	interruptz(_windowsworker.<locals>.Worker.interrupt^  s   € Ø $ˆDÔÐÐr&   c                 ó„  — 	 | j                              ¦   «         s‹	 | j                              ¦   «         } | j        | j        |fz   Ž D ]&}| j                             |¦  «         | j        r d S Œ'n# t          j	        j
        $ r Y d S w xY w| j                              ¦   «         ¯‰d S d S # t          $ r}|| _        ‚ d }~ww xY wr!   )rÁ   ÚemptyÚ
get_nowaitrÃ   rÄ   rÂ   ÚputrÅ   r   ÚqueueÚEmptyÚ	ExceptionrÇ   )r,   rZ   r³   Úes       r   Úrunz"_windowsworker.<locals>.Worker.runa  s  € ðØœ/×/Ò/Ñ1Ô1ð ð
Ø#œ×9Ò9Ñ;Ô;˜Ø#- 4¤:¨tÔ/?À4À'Ñ/IÐ#Jð 'ð '˜CØ Ô-×1Ò1°#Ñ6Ô6Ð6ð  $Ô0ð 'Ø &  ð'ð'øõ $œ>Ô/ð ð ð Ø˜˜ðøøøð œ/×/Ò/Ñ1Ô1ð ð ð ð ð øõ ð ð ð ð "#�”Øøøøøð	øøøsA   ‚B( œAA0 Á.A0 Á/B( Á0BÂB( ÂBÂB( Â(
B?Â2B:Â:B?N)rD   rE   rF   r.   rÌ   rÕ   r%   r&   r   ÚWorkerr¾   Q  sA   € € € € € ð
	"ð 
	"ð 
	"ð	%ð 	%ð 	%ð	ð 	ð 	ð 	ð 	r&   rÖ   c                  ó8  •— t          j         ¦   «         dz   } ‰D ]}|                     ¦   «          Œ‰D ]f}| t          j         ¦   «         z
  }|                     |¦  «         |                     ¦   «         r%‰                     t          d¦  «        ¦  «          d S Œgd S )Nr   s:   failed to kill worker threads while handling an exception
)ÚtimerÌ   ÚjoinÚis_aliveÚwarnr   )Ú
cleanupendÚtÚremainingtimeÚthreadsr   s      €€r   Útrykillworkersz&_windowsworker.<locals>.trykillworkersw  s³   ø€ å”Y‘[”[ 1‘_ˆ
Øð 	ð 	ˆAØ�KŠK‰MŒMˆMˆMØð 	ð 	ˆAØ&­¬©¬Ñ4ˆMØ�FŠF�=Ñ!Ô!Ð!Ø�zŠz‰|Œ|ð ð
 —’Ýð3ñô ñô ð ð ��ðð	ð 	r&   é   r   r   gš™™™™™©?c                 ó:   — g | ]}|                      ¦   «         °|‘ŒS r%   )rÚ   )Ú.0Ú_ts     r   ú
<listcomp>z"_windowsworker.<locals>.<listcomp>¡  s%   € ÐIÐIÐI b¸2¿;º;¹=¼=ÐI˜rÐIÐIÐIr&   T)r"   rÀ   r   r   rÑ   ÚQueuer–   rÐ   Úranger˜   Ústartr4   rÎ   Úgetr©   rÙ   rÇ   ÚremoverÓ   rž   )r   rX   rY   rZ   r[   rS   rÖ   rà   rO   rÉ   rÈ   r®   r„   Ú_irÝ   r³   Úfinishedthreadsrß   s   `                @r   Ú_windowsworkerrí   P  s×  øøè è € ð"ð "ð "ð "ð "•Ô!ñ "ô "ð "ðH €Gðð ð ð ð ð õ* ˜"‰oŒo€GÝ”.×&Ò&Ñ(Ô(€KÝ”×$Ò$Ñ&Ô&€IØ€Fõ ˜4 ¨2¡Ñ.Ô.ð ð ˆØ�Š�eÑÔÐÐÝ�G‰nŒnð ð ˆØˆF�9˜k¨4°Ñ<Ô<ˆØ�Š�qÑÔÐØ	�Š‰	Œ	ˆ	ˆ	ðÝ�'‰lŒl˜QÒÐØ!×'Ò'Ñ)Ô)ð Ø!—o’oÑ'Ô'�Øð   Q¤ð Ø—M’M # a¤&Ñ)Ô)Ð)Ð)à�I�I�Ið "×'Ò'Ñ)Ô)ð ð �AŒJ�OŠO˜DÑ!Ô!Ð!ØIÐI¨GÐIÑIÔIˆOØ$ð "ð "�Ø”;Ð*Øœ+Ð%Ø—’˜qÑ!Ô!Ð!Ð!õ �'‰lŒl˜QÒÐøøõ Õ(Ð)ð ð ð ØˆÑÔÐØðøøøð ×ÒÑ!Ô!ð Ø�oŠoÑÔˆØð 	˜˜Qœð 	Ø�MŠM˜#˜aœ&Ñ!Ô!Ð!Ð!àˆIˆIˆIð ×ÒÑ!Ô!ð ð ð Ø�FˆlÐÐÐÐÐðð s   Ã'CG ÇG c              #   óH   K  — t          |¦  «        D ]}| |d|…         V — ŒdS )aæ  partition a list into N slices of roughly equal size

    The current strategy takes every Nth element from the input. If
    we ever write workers that need to preserve grouping in input
    we should consider allowing callers to specify a partition strategy.

    olivia is not a fan of this partitioning strategy when files are involved.
    In his words:

        Single-threaded Mercurial makes a point of creating and visiting
        files in a fixed order (alphabetical). When creating files in order,
        a typical filesystem is likely to allocate them on nearby regions on
        disk. Thus, when revisiting in the same order, locality is maximized
        and various forms of OS and disk-level caching and read-ahead get a
        chance to work.

        This effect can be quite significant on spinning disks. I discovered it
        circa Mercurial v0.4 when revlogs were named by hashes of filenames.
        Tarring a repo and copying it to another disk effectively randomized
        the revlog ordering on disk by sorting the revlogs by hash and suddenly
        performance of my kernel checkout benchmark dropped by ~10x because the
        "working set" of sectors visited no longer fit in the drive's cache and
        the workload switched from streaming to random I/O.

        What we should really be doing is have workers read filenames from a
        ordered queue. This preserves locality and also keeps any worker from
        getting more than one file out of balance.
    N)rç   )ÚlstÚnslicesÚis      r   r–   r–   º  s@   è è € õ: �7‰^Œ^ð ð ˆØ�!�*�W�*ŒoÐÐÐÐðð r&   r‘   )FTNr!   )r   r}   r¢   r`   r›   r"   rØ   Úi18nr   Ú r   r   r   r   r   r   r'   r)   ÚisposixÚ	iswindowsrJ   rI   rQ   r]   rV   r»   rí   rU   ro   r–   r%   r&   r   ú<module>rö      sÔ  ðð 
€	€	€	Ø €€€Ø Ð Ð Ð Ø €€€Ø 
€
€
€
Ø Ð Ð Ð Ø €€€à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð,	(ð 	(ð 	(ðAð Að Að$ð $ð $ð $ð $ñ $ô $ð $ðN Ôð $�xÔ)ð $Ø€Mð 'Ô0ÐÐà€MØ#Ðð
ð 
ð 
ð 
ð& ØØð/'ð /'ð /'ð /'ðdQð Qð Qð Qðh$ð $ð $ð`ð `ð `ð `ðF Ôð #Ø$€O€Oà"€OØ"€Kðð ð ð ð r&   