
    6h0                       S 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
  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  SSKJr  SSKJr  SS	KJrJr  S
SK J!r!J"r"J#r#  Sr$0 r%\RL                  " \%5      r&\&" SSSS9  \&" SSSS9  \&" SSSS9  \&" SS\'S9  \&" SSSS9  \&" SSSSS9  \&" SSSS9  SS/r(S r)S  r*S! r+\!R                  RY                  5       r-\R\                  " 5       =(       d    \R^                  " 5       r0\Rb                  " \-5      \Rb                  " \05      :g  r2S" r3S1S# jr4       S2S$ jr5 " S% S&5      r6S' r7S( r8S) r9S* r: " S+ S,5      r;S- r<    S3S. jr=S/ r>S0 r?g)4ab	  Faster status operations with the Watchman file monitor (EXPERIMENTAL)

Integrates the file-watching program Watchman with Mercurial to produce faster
status results.

On a particular Linux system, for a real-world repository with over 400,000
files hosted on ext4, vanilla `hg status` takes 1.3 seconds. On the same
system, with fsmonitor it takes about 0.3 seconds.

fsmonitor requires no configuration -- it will tell Watchman about your
repository as necessary. You'll need to install Watchman from
https://facebook.github.io/watchman/ and make sure it is in your PATH.

fsmonitor is incompatible with the largefiles and eol extensions, and
will disable itself if any of those are active.

The following configuration options exist:

::

    [fsmonitor]
    mode = {off, on, paranoid}

When `mode = off`, fsmonitor will disable itself (similar to not loading the
extension at all). When `mode = on`, fsmonitor will be enabled (the default).
When `mode = paranoid`, fsmonitor will query both Watchman and the filesystem,
and ensure that the results are consistent.

::

    [fsmonitor]
    timeout = (float)

A value, in seconds, that determines how long fsmonitor will wait for Watchman
to return results. Defaults to `2.0`.

::

    [fsmonitor]
    blacklistusers = (list of userids)

A list of usernames for which fsmonitor will disable itself altogether.

::

    [fsmonitor]
    walk_on_invalidate = (boolean)

Whether or not to walk the whole repo ourselves when our cached state has been
invalidated, for example when Watchman has been restarted or .hgignore rules
have been changed. Walking the repo in that case can result in competing for
I/O with Watchman. For large repos it is recommended to set this value to
false. You may wish to set this to true if you have a very fast filesystem
that can outpace the IPC overhead of getting the result data for the full repo
from Watchman. Defaults to false.

::

    [fsmonitor]
    warn_when_unused = (boolean)

Whether to print a warning during certain operations when fsmonitor would be
beneficial to performance but isn't enabled.

::

    [fsmonitor]
    warn_update_file_count = (integer)
    # or when mercurial is built with rust support
    warn_update_file_count_rust = (integer)

If ``warn_when_unused`` is set and fsmonitor isn't enabled, a warning will
be printed during working directory updates if this many files will be
created.
    )annotationsN)_)hex)contextencodingerror
extensions	localrepomergepathutilpycompat	registrarscmutilutil)parsers)match)hashutil
stringutil   )
pywatchmanstatewatchmanclients   ships-with-hg-core	   fsmonitor   modes   on)defaults   walk_on_invalidateFs   timeout   2s   blacklistusers   watchman_exe   watchman   verboseT)r   experimental   experimental   fsmonitor.transaction_notifys
   largefiless   eolc                   UR                  S[        S5      U R                  SS5      5        [        R                  " 5       n[
        R                  " X5      nS n UR                  S5      nUR                  S[        S5      [        R                  " US   5      5        UR                  US	[        S
5      U5        U(       a  S$ S$ ! [
        R                   a   n[        R                  " U5      n S nANWS nAff = f)Ns   fsmonitor-watchmans/   fsmonitor checking for watchman binary... (%s)
r   r   s   versions   fsmonitor-watchman-versions    watchman binary version %s
versions   fsmonitor-watchman-errors'    watchman binary missing or broken: %s
r   r   )writer   
configpathtempfilemkdtempr   clientcommandr   bytestrUnavailabler   forcebytestr	condwrite)uifmrootcerrves          :/usr/lib/python3/dist-packages/hgext/fsmonitor/__init__.pydebuginstallr7      s    HH	
=>
lO4
 Db'A
C)IIj!
)./Qy\*	
 LL#	
56	 1 %% )%%a()s   AC C;C66C;c                <   [        U[        R                  5      (       a  UR                  (       aY  U R	                  SS5      (       aB  S[
        R                  " U5      ;  a(  U R                  [
        R                  " U5      S-   5        UR                  (       a  UR                  " 5         U R	                  SS5      (       a2  U R                  SS[
        R                  " UR                  5      5        ggU R                  SS[
        R                  " U5      5        g)z5Exception handler for Watchman interaction exceptionsr   r   s   illegal_fstypes   
s   Watchman unavailable: %s
s   Watchman exception: %s
N)

isinstancer   r,   warn
configboolr   r-   
invalidatelogmsg)r/   r   exs      r6   _handleunavailablerA      s    "n001177r}}\:>>!)@)@)DD
//3e;<====z22FF-''/ 3 	'##B'	
    c                    [         R                  " 5       nUR                  [        R                  " U 5      5        [        R
                  " UR                  5       5      $ )zCalculate hash for ignore patterns and filenames

If this information changes between Mercurial invocations, we can't
rely on Watchman information anymore and have to re-scan the working
copy.

)r   sha1updater   bytereprsysbytes	hexdigest)ignorerD   s     r6   _hashignorerJ      s>     ==?DKK!!&)*T^^-..rB   c                N    U R                  [        5      n UR                  [        S5      nU$ ! [         a.  n[        R                  " [
        R                  " U5      SS9eSnAff = f! [         a/  n[        R                  " [
        R                  " U5      5      eSnAff = f)zFix path to match watchman and local filesystem encoding

watchman's paths encoding can differ from filesystem encoding. For example,
on Windows, it's always utf-8.
s   watchman encoding error)hintNstrict)
decode_watchmanencodingUnicodeDecodeErrorr   Abortr   r-   encode_fsencodingUnicodeEncodeError)pathdecodedr5   encodeds       r6   _watchmantofsencodingrX     s    
++/06..h7 N  
kk##A&-G
 	

  6kk*11!4556s+   0 A+ 
A()A##A(+
B$5*BB$c           
       ^ ^^^^^^6^7 UUU UUU4S jnU(       a  U" S5      $ T(       a  U" S5      $ TR                   R                  5       (       d  U" S5      $ TR                  nUR                  " 5       u  pnU	(       d  UR                  (       a  U" S5      $ Sn	/ nTR
                  nTR                  nT(       a3  [        U5      U
:w  a#  U	S:w  a  UR                  (       a  U" S5      $ / nSn	O [        R                  n[        R                  nTR                  m6TR                  5       nTR                  n[        US5      (       a  UR                  n[        R                  n[        R                  nUU-  nTR                  R!                  5        VVs1 s HB  u  nnUR"                  (       a)  [%        UR'                  5       S	   U-  U-  5      (       d  M@  UiMD     nnnTR                  R(                  n[*        R,                  n[*        R.                  n[*        R0                  n[*        R2                  nTR4                  n[        R6                  nS
nS
=nnTR9                  5       (       a  Sn[        R                  nOTR;                  5       (       a  SnU(       d   TR<                  (       a  TR>                  n S
nOSn TRA                  TT5      u  m7n!n"U=(       a    U!=(       d    U"(       + nU! V#s/ s H  n#U" U#S	   5      (       a  M  U#PM     n!n#U!(       d  U(       d  U(       a  T H  n$T7U$	 M     T7S	 T7$  TR                   RC                  URD                  S-   5        TR                   RG                  S/ SQU	SSSS// SQ//[I        URD                  S-  5      UR                  S.5      n%URJ                  " [L        RN                  " U%S   5      5        U%S   (       a.  UR                  (       a  URP                  " 5         U" S5      $ Sn/ nU (       a  T7 V's0 s H  n'U" U'5      U'_M     n(n'[L        RZ                  S:H  n)U%S    GH  n*U*S   n+[]        U+[^        5      (       d  U+Ra                  [b        5      n+[d        (       a  [g        U+5      n+U)(       a  U+Ri                  SS5      n+U (       a  U" U+5      n,U " U+SS5      n+U+W(U,'   U*S   n-U*S    n.U" U-5      n/S!U+;   d  U+Rk                  S"5      (       a
  U" S#5      s  $ U.(       d-  U+T7;  a%  U+U;   a  U(       d  T6" U+5      (       a  ST7U+'   M  M  M  M  U/U:X  a(  U+U;   a  U(       d  T6" U+5      (       a  ST7U+'   GM  GM  GM  U/U:X  d  U/U:X  aT  U+U;   a  U(       d  T6" U+5      (       a  U*T7U+'   GMH  GMK  U(       d  T6" U+5      (       a  U" U+5      (       d  U*T7U+'   GMt  GMw  GMz  U+U;   d  GM  U(       d  T6" U+5      (       d  GM  ST7U+'   GM     U (       a(  U Vs1 s H  nU" U5      W(;  d  M  U " USS5      iM     nnU Vs1 s H1  nUT7;  d  M  T6" U5      (       d  M  UU;   d  U" U5      (       a  M/  UiM3     n0nU(       dw  U(       a7  U0Rm                  U74S$ jU 5       5        U0Rm                  U74S% jU 5       5        OU0Rm                  U6U74S& jU 5       5        U0Rm                  U6U74S' jU 5       5        OU(       aE  U0Rm                  U74S( jUR!                  5        5       5        U0Rm                  U74S) jU 5       5        OFU0Rm                  U6U74S* jUR!                  5        5       5        U0Rm                  U6U74S+ jU 5       5        [n        Rp                  " TRr                  SS,9Rt                  n1U0 Vs/ s H  nU1" U5      (       d  M  UPM     n2nU2Rw                  5         U0Ry                  U25      n3U3 H  nST7U'   M
     [{        U25      n4[        R|                  " U2 Vs/ s H  nU" U5      PM     sn5       H"  n5[        U45      nU5(       d  UU;   d  M  U5T7U'   M$     T H  n$T7U$	 M     T7S	 T7$ s  snnf s  sn#f ! [R         aC  n&[U        TRV                  UU&5        TR                   RY                  5         U" S5      s Sn&A&$ Sn&A&ff = fs  sn'f s  snf s  snf s  snf s  snf )-zReplacement for dirstate.walk, hooking into Watchman.

Whenever full is False, ignored is False, and the Watchman client is
available, use Watchman combined with saved state to possibly return only a
subset of files.c                T   > TR                   R                  SU -  5        T" TTTTSS9$ )Ns'   fsmonitor: fallback to core status, %s
T)full)_uidebug)reasonignoredr   origselfsubreposunknowns    r6   bailoverridewalk.<locals>.bail*  s,    BVKLE8WgDAArB   s   full rewalk requesteds   listing ignored filess   client unavailables   no clocks   c:0:0s   ignore rules changed_mapr   FTN   .hg皙?s   query)r   s   mtimes   size   exists   names   nots   anyofs   dirname)rj   rg   s	   wholenamei  )s   fieldss   sinces
   expressions   sync_timeouts   empty_on_fresh_instances   clocks   is_fresh_instances   fresh instances   exception during run   \s   filesrj      /r   ri   s   /.hg/s   /.hgs   nested-repo-detectedc              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7fN .0fresultss     r6   	<genexpr>overridewalk.<locals>.<genexpr>  s     ELqW4DL   		c              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7frn   ro   rp   s     r6   rt   ru           @Gq/?Grv   c              3  T   >#    U  H  oT;  d  M
  T" U5      (       d  M  Uv   M     g 7frn   ro   rq   rr   matchfnrs   s     r6   rt   ru     s#      'aG+;
<   	((	(c              3  T   >#    U  H  oT;  d  M
  T" U5      (       d  M  Uv   M     g 7frn   ro   rz   s     r6   rt   ru           OGq/?GAJGr|   c              3  <   >#    U  H  u  pUT;  d  M  Uv   M     g 7frn   ro   )rq   rr   strs   s      r6   rt   ru     s     Iuq8Hs   	c              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7frn   ro   rp   s     r6   rt   ru   	  rx   rv   c              3  Z   >#    U  H   u  pUT;  d  M  T" U5      (       d  M  Uv   M"     g 7frn   ro   )rq   rr   r   r{   rs   s      r6   rt   ru     s'      +eaq/?GAJ|s   ++	+c              3  T   >#    U  H  oT;  d  M
  T" U5      (       d  M  Uv   M     g 7frn   ro   rz   s     r6   rt   ru     r~   r|   )cached)@_watchmanclient	available_fsmonitorstategetwalk_on_invalidate_ignore
_dirignorerJ   r   alwaysr{   rf   hasattrr   DIRSTATE_V2_HAS_MTIME"DIRSTATE_V2_MTIME_SECOND_AMBIGUOUSitemsmaybe_cleanboolv2_datacopymapstatS_IFMTS_IFDIRS_IFREGS_IFLNK_joinnormcaseisexactprefix
_checkcase_normalizefile_walkexplicit
settimeouttimeoutr*   intsetlastclockr   rG   r=   	ExceptionrA   r\   clearconnectionossepr:   bytesrR   rO   _fixencodingrX   replaceendswithrE   r   pathauditor_rootchecksort
differenceiter	statfilesnext)8r`   ra   r   rb   rc   r_   r[   rd   r   clock
ignorehash	notefilesrI   	dirignorematchalwaysdmap	has_mtimemtime_is_ambiguousmaskrr   r5   nonnormalsetr   getkinddirkindregkindlnkkindjoinr   fresh_instanceexact	skipstep3	normalizeworkdirsnotfounddsresultr@   kfoldmapswitch_slashesentryfnamenormedfmodefexistskindvisitaudit	auditpass	auditfailnfr   r{   rs   s8   ``````                                                @@r6   overridewalkr   #  s   B B ,--,--))++)**  E#(99; Ey##$$ 	\\FIv*,(1B''344IE KK	mmG,,.K99DtV yy--I CC))D
 IIOO%
%DAq}} Q$&)34 	
%  
 iiGkkGllGllGllG::D}}HNEI}}KK			T__ ''			 #'"4"4UH"EGT<84#7<8I3t!9QqT?AtD3UiA
 FO$ 	''(;<%%--K #V,7  "%U]]T%9!:,1,D,D
0 	8,,VH-=>?&'''  "-..!NI +237a8A;>73^^u,N !g %''LL!23E<)%0EMM%.Ee_FeT40E#GFOg	"u~uw 7 7/00 W$TM GENN!% %3 " %
 W_}+!% 2@}W_}'%..%*GEN #1!& :Gd]wu~~!GEN[ "b 
 
{') %Iat$ 	 
 AW 	
!( 	
12d&) 	
 
  LLELEELL@G@@LL '  LLOGOOLLI

IILL@G@@LL #zz|  LLOGOO  D9??E!.EqU1XEI.NN  +I
  
iBnny9y!d1gy9:HdGAJ ;
 AJ NO
R 4>  -488UB/,,.+,,-& 4|

4 / :ss   ?aa5aa<A5a b.9b3b3!
b8/b8>b8b8b=-b=c
b+(8b& b+&b+c	           
     P  ^ Un	Un
UnU4S jn[        U[        R                  5      (       a  UnOTU   n[        U[        R                  5      (       a  UnOTU   nUR                  5       S L nU=(       a    UTS   :H  nU=(       d    [        R
                  " 5       nU=(       a`    UR                  5       =(       aI    [        U[        R                  [        R                  45      (       + =(       a    S[        R                  ;  n TR                  R                  (       a  TR                  R                  S5        O2TR                  R                  TR                  R                  S-   5        TR                  R                  5       nU(       a  SnOUnU(       a  [)        U5      nTR+                  U5        U " X#XIU
UU5      nUu  nnnnpunU(       d  / nU
=(       d    UR,                  S LnTR                  R.                  S:X  Ga7  U(       Gd/  STR0                  l        TR&                  R4                  nSTR&                  l        TR&                  R6                  TR&                  R8                  nn[;        [<        R>                  S5       nU=TR&                  l        TR&                  l         U " UUUU	U
UU5      n STR0                  l        UTR&                  l        UUsTR&                  l        TR&                  l         S S S 5        TRA                  5          U" UUUUXuU/W 5        S S S 5        W u  nnnnpun[B        RD                  " UUUUXuU5      $ ! [          aS  nTR                  R#                  5         [%        TR&                  TR                  U5        U " UUUU	U
UU5      s S nA$ S nAff = f! STR0                  l        UTR&                  l        UUsTR&                  l        TR&                  l        f = f! , (       d  f       GN= f! , (       d  f       N= f)	Nc                T  >  S[         R                  ;   a   [         R                  S   n[        US5      nOSnTR                  R                  US5      n  [        [        X5      5       H^  u  nu  pV[        U5      [        U5      :w  d  M"  UR                  SU-  5        UR                  SU-  5        UR                  SU-  5        M`     UR                  5         g ! [         a*    TR
                  R                  [        S5      W-  5         g f = f! UR                  5         f = f)	Ns   FSMONITOR_LOG_FILEwbs   fsmonitorfail.logs   wbs   warning: unable to write to %s
s    sets at position %d are unequal
s   watchman returned: %r
s   stat returned: %r
)r   environopenvfsOSErrorr/   r;   r   	enumeratezipsetr%   close)l1l2fnrr   is1s2ra   s          r6   _cmpsets overridestatus.<locals>._cmpsets2  s    		$(8(88%%&;<TN)HHMM"e,
	(R58Br7c"g%GG@1DEGG6;<GG2R78	  6 GGI  	GGLL>?"DE	 GGIs)   3C C 2D A D 1DDD'   .s
   HG_PENDINGrh   Ts   paranoidr   F)#r:   r   	changectxrevmatchmodr   workingcommitctxmemctxr   r   r   r   r   r   r   getcurrentclockr   r   rA   r/   
poststatusaddpostdsstatustraversedirmodedirstate_fsmonitordisablequietfoutferrr   osdevnullwlockr   status)!r`   ra   node1node2r   r_   cleanrc   listsubreposlistignored	listcleanlistunknownr   ctx1ctx2workingparentworkingupdatestate
startclockr@   stateunknownpsrmodifiedaddedremoveddeletedr[   r   r   r   fprv2s!    `                               r6   overridestatusr  #  s    KIK* %**++E{%**++E{hhjD G2T
 2M&X__&E 	 	2LLN	24'":":GNN!KLL	2 !1!11	 
22   ++C0   ++D,@,@,H,H3,NO))99;
  "
#R e)\<	A BC>HeWgw 5))5D  K/*.' WW\\477<<d"**d#r*,,DGGL477<8  38/ %-14*dggl! $& ZZ\5'7GeL 
 FIB%'7U>>%'7U M  
,,.477D$8$8"=
 	
	
t 38/ %-14*dggl! $#& \sR   BM #P3N;APP
N8%AN3-N83N8;APP
P
P%c                       \ rS rSrS rS rSrg)r   i  c                :    [         R                  " U5      U l        g rn   )r   rG   _startclock)ra   r  s     r6   __init__poststatus.__init__  s    #,,Z8rB   c                   UR                  5       R                  R                  5       =(       d    U R                  n[	        UR                  5       R
                  R                  5      nUR                  UR                  -   UR                  -   UR                  -   UR                  -   nUR                  5       R                  R                  X4U5        g rn   )repor   getlastclockr  rJ   r   r   r  r  r  r  rc   r   )ra   wctxr  r   
hashignorer   s         r6   __call__poststatus.__call__  s    		++88:Nd>N>N !5!5!=!=>
OOllnn nn nn	 	 			##''9ErB   )r  N)__name__
__module____qualname____firstlineno__r  r#  __static_attributes__ro   rB   r6   r   r     s    9
FrB   r   c                \     " S SUR                   5      nX!l         UR                  U 5        g )Nc                  F   ^  \ rS rSrS rU 4S jrU 4S jrU 4S jrSrU =r	$ )'makedirstate.<locals>.fsmonitordirstatei  c                    SU l         UR                  U l        UR                  U l        [        R                  " U5      U l        g NF)r   r   r   weakrefproxy_repo)ra   r  s     r6   _fsmonitorinit6makedirstate.<locals>.fsmonitordirstate._fsmonitorinit  s6    %*D"#'#7#7D #'#7#7D  t,DJrB   c                h   > [         TU ]  nU R                  (       a  U" U0 UD6$ [        X0/UQ70 UD6$ rn   )superwalkr   r   ra   argskwargsr`   	__class__s       r6   r6  ,makedirstate.<locals>.fsmonitordirstate.walk  s:    7<D%%T,V,,<T<V<<rB   c                X   > U R                   R                  5         [        TU ]  " U0 UD6$ rn   )r   r=   r5  rebuildra   r8  r9  r:  s      r6   r=  /makedirstate.<locals>.fsmonitordirstate.rebuild  s)      ++-7?D3F33rB   c                X   > U R                   R                  5         [        TU ]  " U0 UD6$ rn   )r   r=   r5  r>  s      r6   r=   2makedirstate.<locals>.fsmonitordirstate.invalidate  s*      ++-7%t6v66rB   )r   r   r1  r   )
r%  r&  r'  r(  r2  r6  r=  r=   r)  __classcell__)r:  s   @r6   fsmonitordirstater,    s    	-	=	4	7 	7rB   rC  )r:  r2  )r  r   rC  s      r6   makedirstaterD    s*    7H.. 7, +D!rB   c                N    U " U5      n[        US5      (       a  [        X5        U$ )Nr   )r   rD  )r`   ra   dss      r6   wrapdirstaterG    s&    	dBt&''TIrB   c                   [         R                  " [        R                  S[        5        [
        R                  (       a   [         R                  " [        S[        5        [         R                  " [        S[        5        g )N   dirstatesymlink_update)r	   wrapfilecacher
   localrepositoryrG  r   isdarwinwrapfunctionr   wrapsymlinkr   
wrapupdate)r/   s    r6   extsetuprR    sL    !!; I{;E9j9rB   c                2    U " X5       [         R                  " [         R                  R                  U5      S5        $ ! [         a     $ f = f!  [         R                  " [         R                  R                  U5      S5        f ! [         a     f f = f= f)zuif we create a dangling symlink, also touch the parent dir
to encourage fsevents notifications to work more correctlyN)r   utimerU   dirnamer   )r`   source	link_names      r6   rP  rP    ss    F&	HHRWW__Y/6 			HHRWW__Y/6 		s>   A 4?
AAB4BB
BBBBc                  P    \ rS rSrSr    SS jrS rS rS rSS jr	SS	 jr
S
rg)state_updatei	  a  This context manager is responsible for dispatching the state-enter
and state-leave signals to the watchman service. The enter and leave
methods can be invoked manually (for scenarios where context manager
semantics are not possible). If parameters oldnode and newnode are None,
they will be populated based on current working copy in enter and
leave, respectively. Similarly, if the distance is none, it will be
calculated based on the oldnode and newnode in the leave method.Nc                    UR                  5       U l        X l        X0l        X@l        XPl        X`l        S U l        SU l        g r.  )	
unfilteredr  nameoldnodenewnodedistancepartial_lock
need_leave)ra   r  r\  r]  r^  r_  r`  s          r6   r  state_update.__init__  s9     OO%		 
rB   c                $    U R                  5         g rn   )enterra   s    r6   	__enter__state_update.__enter__$  s    

rB   c                   U R                   c"  U R                  S   R                  5       U l         U R                  R                  5       cZ  [	        U R                  S5      (       a   U R                  R                  5       U l        OU R                  R                  5       U l        U R                  S[        U R                   5      5      U l
        U $ )Nr   wlocknostateupdates   state-enter)r]  r  nodecurrentwlockr   rj  ra  r   _stater   rb  rf  s    r6   re  state_update.enter'  s    
 <<99T?//1DL99!!#+tyy"677!YY99;
!YY__.
++nc$,,6GHrB   c                8    U(       a  SOSnU R                  US9  g )NTF)abort)exit)ra   type_valuetbrp  s        r6   __exit__state_update.__exit__7  s    5			rB   c                4    U R                   (       a  U(       a  SOSnU R                  c"  U R                  S   R                  5       U l        U R                  c0  [        U R                  U R                  U R                  5      U l        U R                  S[        U R                  5      US9  SU l         U R                  (       a  U R                  R                  5         g g ! SU l         U R                  (       a  U R                  R                  5         f f = f)Ns   failed   okr   s   state-leave)r  F)rb  r^  r  rk  r_  calcdistancer]  rm  r   ra  release)ra   rp  r  s      r6   rq  state_update.exit;  s    	%&+<<'#'99T?#7#7#9DL==($0		4<<%DM NC,=fM#DOzz

""$  $DOzz

""$ s   B,C" "5Dc           	     x   [        U R                  S5      (       d  g U R                  R                  R                  UU R                  UU R
                  (       a  U R
                  OSUU R                  S.S.5        g! [         a1  nU R                  R                  R                  SSXA5         S nAgS nAff = f)	Nr   Fr   )s   revs   distances   statuss   partial)rj   s   metadataTr   s   Exception %s while running %s
)
r   r  r   r*   r\  r_  r`  r   r/   r>   )ra   cmd
commithashr  r5   s        r6   rm  state_update._stateK  s    tyy"344	II%%--!YY !+6:mmT]]#)$(LL	"   	IILL? 	s   AA> >
B9'B44B9)ra  r_  r\  rb  r^  r]  r`  r  )NNNF)F)rx  )r%  r&  r'  r(  __doc__r  rg  re  ru  rq  rm  r)  ro   rB   r6   rY  rY  	  s4    H  $ % rB   rY  c                    U R                   R                  X5      nX   R                  5       n[        X   R                  5       U-
  5      [        X   R                  5       U-
  5      -   nU$ rn   )	changelogancestorr   abs)r  r]  r^  ancancrevr_  s         r6   ry  ry  i  sc    
..
!
!'
3CY]]_F4=$$&/03f$4 H OrB   c	                .   Sn
SnUS   R                  5       nX   R                  5       nUb  UR                  5       (       a  Sn[        UR                  5       X5      n
[	        USUUU
US9   U " UUUUUUUU40 U	D6sS S S 5        $ ! , (       d  f       g = f)Nr   Tr   Fs	   hg.update)r\  r]  r^  r_  r`  )rk  r   ry  r[  rY  )r`   r  rk  branchmergeforcer  mergeancestorlabelsmatcherr9  r_  r`  r]  r^  s                 r6   rQ  rQ  v  s     HG4jooGjooG'..** 17D	
 

 


 
 
s   ,B
Bc                "   U R                   R                  5        Hq  n[        R                  R	                  [        R                  R                  U R                  US5      5      (       d  MR  SnU R                  R                  X!-  5          g   g)Nrg   s:   fsmonitor: sub-repository %r detected, fsmonitor disabled
TF)	wvfslistdirr   rU   isdirr   r1   r/   r]   )r  rr   r?   s      r6   repo_has_depth_one_nested_repor    s`    YY 77==diiF;<<PCGGMM#'"	 !
 rB   c                  ^  [         R                  " 5       n[         H'  nX2;   d  M
  T R                  [	        S5      U-  5          g    UR                  5       (       a  UR                  R                  S5      (       d   UR                  R                  S5      (       a  g [        U5      (       a  g [        R                  " U5      nUR                  S:X  a  g  [        R                  " UR                  UR                  5      nXAl        XQl        [&        R(                  " US5      u  pxU(       a  [+        X5         " U 4S jSUR,                  5      n	Xl        g g ! [         a  n[!        T XF5         S nAg S nAff = f)NsU   The fsmonitor extension is incompatible with the %s extension and has been disabled.
s   .hgsubstates   .hgsubs   offrI  c                  D   >^  \ rS rSrU 4S jrU 4S jrU U4S jrSrU =r$ ) reposetup.<locals>.fsmonitorrepoi  c                6   > [         TU ]  n[        X0/UQ70 UD6$ rn   )r5  r  r  r7  s       r6   r  'reposetup.<locals>.fsmonitorrepo.status  s!    w~%dB4B6BBrB   c                $   > [         TU ]  " U0 UD6$ rn   )r5  r   r>  s      r6   rj  3reposetup.<locals>.fsmonitorrepo.wlocknostateupdate  s    w}d5f55rB   c                  >^^ [         TU ]  " U0 UD6mTR                  SS5      (       d  T$ TR                  S:w  a  T$ TR                  mUU4S jn S Tl        [        U SS9Tl        TR
                  R                  5         UTl        T$ ! [         a(  nU R                  R                  SSU5         S nAT$ S nAff = f)	Nr!   r"   r   c                    > T(       a  T" 5         T R                   (       a"  T R                   R                  5         S T l         g g rn   )stateupdaterq  )lorigreleases   r6   staterelease<reposetup.<locals>.fsmonitorrepo.wlock.<locals>.staterelease  s.    "#}}**,(, %rB   s   hg.transaction)r\  r   s   Exception in state update %s
)r5  r   r<   held	releasefnr  rY  re  r   r/   r>   )	ra   r8  r9  r  r5   r  r  r:  r/   s	        @@r6   r   &reposetup.<locals>.fsmonitorrepo.wlock  s    GM4262}}#%D  H66Q;Hkk-	$(AM$0<M$NAMMM'')".AK  ! GGKK#%F  s   7B 
B>B99B>ro   )	r%  r&  r'  r(  r  rj  r   r)  rB  )r:  r/   s   @r6   fsmonitorrepor    s    C6 rB   r  )r	   enabled
_blacklistr;   r   localr  existsr  r   r   r   r)   r/   r1   r   rA   r   r   r
   isfilecachedrD  r:  )
r/   r  extsextfsmonitorstater)   r@   r   r   r  s
   `         r6   	reposetupr    s<   D;GG: 	   zz||
 99N++tyy/?/?	/J/J)$//T*&(	#**477DII>F
  .%$11$D (#	DNN #	J 'G "  	r>6	s   +E 
E9#E44E9)T)r   NNFFFF)NFNN)@r  
__future__r   codecsr   r   sysr'   r/  mercurial.i18nr   mercurial.noder   	mercurialr   r   r   r	   r
   r   r   r   r   r   r   mercurial.purer   r   r   mercurial.utilsr   r    r   r   r   
testedwithconfigtable
configitemlistr  r7   rA   rJ   get_local_encodingrO   getfilesystemencodinggetdefaultencodingrS   lookupr   rX   r   r  r   rD  rG  rR  rP  rY  ry  rQ  r  r  ro   rB   r6   <module>r     s  JL #  	  
        # '
  #
!!+.
 

 
 
 
 
 	 # V$
6
0
/ ''::< '')ES-C-C-E}}./6==3MM*}F 


XvF F""6:	\ \@& &
RQ'rB   