
    6hiK                   (   % 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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Jr  SSKJr  SSKJrJrJrJrJr  SSKJr  \	R:                  (       a  S SKrSSKJr J!r!J"r"J#r$J%r%J&r&J'r'J(r(J)r)J*r*J+r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3  SS	K4J5r6  SS
K7J8r8J9r9J:r:  \*Rv                  (       a  SSKJ<r=  OSSKJ>r=  \	R:                  (       a  SSKJ?r@  \)R                  " S5      rB\)R                  " SSS9rD\=R                  rE\R                  " SSS9 " S S\6R                  5      5       r5S rHS|S}S jjrIS~S jrJSS jrKSS jrLSS jrMSS jrN " S S5      rO S SS! jjrPS" rQS# rRSS$ jrS   S       SS% jjrTSS& jrUSS' jrVSS( jrWSS) jrXSS* jrYSS+ jrZSSS, jjr[SS- jr\SS. jr]SS/ jr^SS0 jr_SS1 jr`S2 raS|S3 jrb S     SS4 jjrcS5 rdS6 re  S     SS7 jjrf      SS8 jrgSS9 jrhSS; jri     S   SS< jjrj     S   SS= jjr#S> rkS|SS? jjrlSS@ jrmSSA jrnSSB jro " SC SD5      rp     S SSE jjrq  S     SSF jjrrSSSG jjrs  SSH jrt    SSI jruSSJ jrvS|SK jrwS|SL jrx  S       SSM jjryS|SSN jjrzSO r{SSP jr|SSSQ jjr}SR r~SSSS jjr " ST SU5      r " SV SW5      r " SX SY5      rSSZ jr " S[ S\5      rSS] jrSS^ jr " S_ S`5      r/ SaQrS:\Sb'   ScSd/rS:\Se'   SSf jr\2GR                  " 5       rSrS \Sg'    S     SSh jjrSSi jrSSSj jjrSSk jrSl rSSm jrSSn jrSSo jrSSp jrSSq jrSrrS\Ss'   StrS\Su'   SrS\Sv'   \\\Sw.rSx\Sy'   \rS\Sz'    S|     SS{ jjrg)    )annotationsN)CallableDictIterableIteratorListOptionalSetTuple   _)binhexnullrevshortwdirrev)attr)copiesencodingerrormatchobsoleteobsutilpathutilphasespolicypycompatrequirements
revsetlangsimilarsmartsettypeliburlutilvfs)status)hashutilprocutil
stringutil)
scmwindows)scmposixuiparsersrevlogT)pyo3F)slotsreprc                  $   \ rS rSrSr\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9r\R                  " \R                  " \5      \	\
   S9rSS jrS	S jrSrg)
r'   [   zStruct with a list of files per status.

The 'deleted', 'unknown' and 'ignored' properties are only
relevant to the working copy.
)defaulttypec              #     #    U R                   v   U R                  v   U R                  v   U R                  v   U R                  v   U R
                  v   U R                  v   g 7fN)modifiedaddedremoveddeletedunknownignoredcleanselfs    3/usr/lib/python3/dist-packages/mercurial/scmutil.py__iter__status.__iter__k   sK     mmjjlllllllljjs   A$A&c                ,    S[        S U  5       5      -  $ )NzX<status modified=%s, added=%s, removed=%s, deleted=%s, unknown=%s, ignored=%s, clean=%s>c              3  v   #    U  H/  n[         R                  " [        R                  " U5      5      v   M1     g 7fr9   )r   sysstrr*   pprint).0vs     rC   	<genexpr>"status.__repr__.<locals>.<genexpr>x   s'     FA(//*"3"3A"677s   79)tuplerA   s    rC   __repr__status.__repr__t   s!    1FFFG 	G     N)returnzIterator[List[bytes]])rS   str)__name__
__module____qualname____firstlineno____doc__r   ibFactorylistr   bytesr:   r;   r<   r=   r>   r?   r@   rD   rO   __static_attributes__rR   rQ   rC   r'   r'   [   s     wwt||D1UDHGGDLL.T%[AEggdll40tE{CGggdll40tE{CGggdll40tE{CGggdll40tE{CGGGDLL.T%[AEGrQ   r'   c              #    #    [         R                  UR                  U5      nUR                  [         R                  U R                  U 5      5        [	        5       nUR                   H'  nX@R                  ;  d  M  X$	 UR                  U5        M)     [        UR                  5       5       H  u  pEXER                  U5      4v   M     U H  nXAR                  X@5      4v   M     g7f)zfind subrepos in ctx1 or ctx2N)
dictfromkeyssubstateupdatesetaddsorteditemssubnullsub)ctx1ctx2subpathsmissingsubpathctxs         rC   itersubreposrp   {   s     
 }}T]]D1HOODMM$--67eG==--'!KK  !
 x~~/0www''' 1 ||G222 s   A6C'<A+C'c                X   / nU(       aY  U HS  nX   nUR                  5       [        R                  :  d  M+  UR                  5       (       a  MB  UR	                  U5        MU     U(       a'  U R                  [        S5      [        U5      -  5        gU R                  [        S5      5        g)zbReport no changes for push/pull, excluded is None or a list of
nodes excluded from the push/pull.
s0   no changes found (ignored %d secret changesets)
s   no changes found
N)phaser   secretextinctappendr'   r   len)r.   repoexcluded
secretlistnro   s         rC   nochangesfoundr{      s     JA'Cyy{fmm+CKKMM!!!$ 
 
		BC*o	

 			!)*+rQ   intc           	        SnSn  U" 5       $ !   U R                  5         e = f! [        R                   a  nSnUR                  [        R                  :X  a-  [        S5      [        R                  " UR                  5      -  nO[        S5      UR                  -  nU R                  [        S5      UR                  =(       d     [        R                  " UR                  5      U4-  5        UR                  (       d  U R                  [        S5      5         SnAGOSnAf[        R                   a{  nSnU R                  [        S5      UR                  =(       d     [        R                  " UR                  5      [        R                  " UR                   5      4-  5         SnAGOSnAf[        R"                   a  n[%        U[        R&                  5      (       a  S	nU R                  [        S
5      U-  5        UR(                  (       a'  U R                  [        S5      UR(                  -  5         SnAGO}SnAf[        R*                   Ga  nU R                  [        S5      UR,                  S   -  5        UR,                  S   n[%        U[.        5      (       a  [        R0                  " U5      nUc  U R                  S5         SnAGO[%        U[2        5      (       d  U R                  SU4-  5         SnAGOU(       d   U R                  [        S5      5         SnAGOU R                  S[        R                  " [        R4                  " U5      5      -  5         SnAGONSnAf[        R6                   a(  nU R                  [        S5      U-  5         SnAGOSnAf[        R8                   a    U R                  [        S5      5         GO[        R:                   a\  nUR<                  b  UR<                  nUR>                  b  UR>                  nU R                  URA                  5       5         SnAGOvSnAf[        RB                   a  nURD                  s SnA$ SnAf[F         a  nU R                  [        S
5      [        R                  " U5      -  5        [        R                  " U5      RI                  5       S   nUSRI                  5       ;   a   U R                  [        S5      5         SnAGOUSRI                  5       ;   a  U R                  [        S5      5         SnAGOSnAf[J        RL                  RN                   a>  nSnU R                  [        S
5      [        R                  " U5      -  5         SnAGO'SnAf[J        RL                  RP                   a  nSn URR                  R,                  S   nO"! [T        [V        4 a    URR                  n Of = f[%        U[.        5      (       a  [        RX                  " U5      nU R                  [        S5      [        R                  " U5      -  5         SnAGOeSnAf[Z         Ga  n[]        US5      (       a8  UR,                  (       a'  UR,                  S   [        R^                  :X  a   SnAGO[a        USS5      (       a  [a        USS5      b`  U R                  [        S5      [        R                  " UR                   5      [        R                  " UR                  5      4-  5         SnAOU R                  [        S
5      [        R                  " UR                   5      -  5         SnAONe SnAf[b         a    U R                  [        S5      5         O$[d         a  nS nURf                  n SnAOSnAff = fU Ri                  S!S"5      (       a  U$ U$ )#zcall func() with global exception handling

return func() if no exception happens. otherwise do some error handling
and return an exit code accordingly. does not handle all exceptions.
   s%   timed out waiting for lock held by %rs   lock held by %rs   abort: %s: %s
s   (lock might be very busy)
Ns   abort: could not lock %s: %s

   s
   abort: %s
s   (%s)
s	   abort: %sr   r      
s    %r
s    empty string
s   
%r
s   abort: file censored %s
s6   abort: working directory revision cannot be specified
s   mpatch bdiffs(   (did you forget to compile extensions?)
s   zlibs"   (is your Python install correct?)
d   s   abort: error: %s
argsstrerrorfilenames   abort: %s: '%s'
s   abort: out of memory
      uis   detailed-exit-code)5	tracebackr   LockHelderrno	ETIMEDOUTr   r   bytestrlockerdescr*   forcebytestrr   LockUnavailabler   
strtolocalr   	RepoError
isinstanceRepoLookupErrorhintResponseErrorr   rT   sysbytesr]   ellipsisCensoredNodeErrorWdirUnsupportedErrordetailed_exit_codecoarse_exit_codeformatWorkerErrorstatus_codeImportErrorsplitr%   urlerr	httperrorurlerrorreasonAttributeError
IndexError
unitolocalOSErrorhasattrEPIPEgetattrMemoryError
SystemExitcode
configbool)r.   funcr   r   instr   msgms           rC   	callcatchr      s    j%	6M	LLN >> 8::(?@  -F )*T[[8F
 !yyBJ33DMMBFKL	
 {{HHQ567   

/0		CZ44T]]C##DMM2	
 	
 ?? /dE1122!#
>"T)*99HHQy\DII-. M
<499Q</0iilc3##C(C;HHUOOC''HHX&''HHQ)*++HHY!1!1*2E2Ec2J!KKLL"" 9
/04788   P
MNO;;  "".!%!8!8  ,#44
   @
>"Z%<%<T%BBC##D)//1"5%%''HHQCDEE'--/!HHQ=>?;;   D 
>"Z%<%<T%BBCC;; 
M 	![[%%a(F
+ 	![[F	! fc""((0F
()J,C,CF,KKLL 4  TYY499Q<5;;3NT:t,,tZ.:*+ ++DMM:"//>  >*X-@-@-OOPP /
,-. % !99	% 
}}U122!!s	   !$ ^8C D^85A0F++^8A6H>>^8A8M-*M-!M-+<M--^8N''1^8^8.AQ^8Q-'^8-^8:BT:.T::!^83V!^85Y8WYW1.Y0W11AY^8$A].-A;].-;].-]..'^8	^8 ^33^8c                   US;   a"  [         R                  " [        S5      U-  5      eS H>  nX1;   d  M
  [         R                  " [        S5      [        R                  " U5      -  5      e    [        U5        SU;   a  [        e[         R                  " [        S5      5      e! [         a     Of = fUR                  5       U:w  a"  [         R                  " [        S5      U-  5      eg )N)   tip   .   nulls   the name '%s' is reserved)   :    r      s   %r cannot be used in a name   _s   cannot use an integer as a names)   leading or trailing whitespace in name %r)r   
InputErrorr   r   r   r|   
ValueErrorstrip)rw   lblkindcs       rC   checknewlabelr   #  s     %%q!=>DEE(8""01H4D4DQ4GG  )
	C3; q!CDEE 
yy{c:;cA
 	
 s   .6B$ $
B10B1c                    SU ;   d  SU ;   a6  [         R                  " [        S5      [        R                  " U 5      -  5      eg)zFCheck that the filename f is an acceptable filename for a tracked filer   r   s)   '\n' and '\r' disallowed in filenames: %rN)r   r   r   r   r   fs    rC   checkfilenamer   =  sC    zUaZ<=q!"
 	
  rQ   c                8   [        U5        [        U 5      u  p#U(       d  U(       at  [        R                  " U5      nU(       aV  SU[        R
                  " U5      4-  nU(       a  [        R                  " U5      eU R                  [        S5      U-  5        ggg)zECheck if filename f is portable and warn or abort depending on configs   %s: %s   warning: %s
N)
r   checkportabilityalertr%   checkwinfilenamer)   
shellquoter   r   warnr   )r.   r   abortr   r   s        rC   checkportabler   F  s}    !'+KE##A&sH$7$7$:;;C&&s++GGA&'#-.	  rQ   c                >   U R                  SS5      nUR                  5       n[        R                  " U5      n[        R
                  =(       d    US:H  nU=(       d    US:H  nUc6  U(       d/  U(       d(  US:X  d"  [        R                  " [        S5      U-  5      eXE4$ )z[check if the user's config requests nothing, a warning, or abort for
non-portable filenamesr   s   portablefilenamess   abort   warns   ignores,   ui.portablefilenames value is invalid ('%s'))	configlowerr*   	parseboolr   	iswindowsr   ConfigErrorr   )r.   vallvalbvalr   r   s         rC   r   r   S  s     ))E/
0C99;D$D2$("2E"47?D|TUdi.?=>D
 	
 ;rQ   c                  (    \ rS rSrSS jrSS jrSrg)casecollisionauditorib  c                    Xl         X l        SR                  U5      n[        [        R
                  " U5      R                  S5      5      U l        X0l        [        5       U l	        g )Nr   )
_ui_abortjoinrd   r   r   r   _loweredfiles	_dirstate	_newfiles)rB   r.   r   dirstateallfiless        rC   __init__casecollisionauditor.__init__c  sK    ::h' !9!?!?!FG! rQ   c                   XR                   ;   a  g [        R                  " U5      nX R                  ;   ak  XR                  ;  a\  [        S5      U-  nU R                  (       a  [        R                  " U5      eU R                  R                  [        S5      U-  5        U R                  R                  U5        U R                   R                  U5        g )Ns&   possible case-folding collision for %sr   )r   r   r   r   r   r   r   r   
StateErrorr   r   re   )rB   r   flr   s       rC   __call__casecollisionauditor.__call__n  s    ^^A###(?=>BC{{&&s++HHMM!,-34r"1rQ   )r   r   r   r   r   N)r.   uimod.uir   boolrS   Noner   r]   rS   r   )rU   rV   rW   rX   r   r   r^   rR   rQ   rC   r   r   b  s    	
rQ   r   r   c                   U R                   nU(       aR  [        R                  " U S5      nUR                  (       d  U(       d  gU[	        UR                  5      [	        U5      4nOUR                  (       d  gUn[        5       nUR                  R                  U5      nU(       dC  [        X5      u  pxU(       a  Xx-  n[        U5      nU(       a  [        U5      nXcR                  U'   U$ )a  build hash of filtered revisions in the current repoview.

Multiple caches perform up-to-date validation by checking that the
tiprev and tipnode stored in the cache file match the current repository.
However, this is not sufficient for validating repoviews because the set
of revisions in the view may change without the repository tiprev and
tipnode changing.

This function hashes all the revs filtered from the view (and, optionally,
all obsolete revs) up to maxrev and returns that SHA-1 digest.
   obsoleteN)	changelogr   getrevsfilteredrevshash	frozenset_filteredrevs_hashcacheget_filtered_and_obs_revsrf   
_hash_revs)	rw   maxrevneedobsoleteclobsrevskeyresultrevsobs_revss	            rC   #combined_filtered_and_obsolete_hashr  {  s     
B""45wtBOO,d7m<+''++C0F/=?Dd|%F.4&&s+MrQ   c                V   U R                   n[        R                  " U S5      nU[        UR                  5      [        U5      4nUR
                  R                  U5      nUcF  SnSn[        X5      u  pU(       a  [        U5      nU	(       a  [        U	5      nXg4nXRR
                  U'   U$ )a  build hashs of filtered and obsolete revisions in the current repoview.

Multiple caches perform up-to-date validation by checking that the
tiprev and tipnode stored in the cache file match the current repository.
However, this is not sufficient for validating repoviews because the set
of revisions in the view may change without the repository tiprev and
tipnode changing.

This function hashes all the revs filtered from the view up to maxrev and
returns that SHA-1 digest. The obsolete revisions hashed are only the
non-filtered one.
r   N)	r   r   r   r   r   r   r   r   r   )
rw   r   r   obs_setr  r  filtered_hashobs_hashfiltered_revsr  s
             rC   filtered_and_obsolete_hashr    s     
Bt[1G4($w-
8C''++C0F~"8"F&}5M!(+H**0""3'MrQ   c                @   U R                   n[        R                  " U S5      nUR                  nUR                  (       a  X2R                  -
  nU[	        U5      S-
  :  a2  U Vs1 s H  oUU::  d  M
  UiM     nnU Vs1 s H  oUU::  d  M
  UiM     nnXC4$ s  snf s  snf )z=return the set of filtered and non-filtered obsolete revisionr   r   )r   r   r   r   rv   )rw   max_revr   r  filtered_setrs         rC   r   r     s    	Bt[1G??L	OO+#b'A+#/@<a<<@%6gg1g6"" A6s   %	B2B>	BBc                    [         R                  " 5       nU  H  nUR                  SU-  5        M     UR                  5       $ )z-return a hash from a list of revision numberss   %d;)r(   sha1rc   digest)r  srevs      rC   r   r     s3    A	# 88:rQ   c              #  R  ^ ^#    U 4S jn[        [        R                  SS5      mU(       a
  Tb  U4S jnOSnUc  U(       a  / nW" UT 5        [        R                  " T SUS9 GH;  u  pgnUR	                  5         SU;   a  Uv   [        R                  R                  USS	5      n	[        R                  R                  [        R                  R                  U	S5      5      (       a  U	v   U(       a  UR                  S5        M  / USS& M  U(       d  M  / n
U H}  n[        R                  R                  Xk5      nW" X,5      (       d  M1  [        R                  R                  U5      (       a  [        USU5       Sh  vN   Ml  U
R                  U5        M     XSS& GM>     g N%7f)
z}yield every hg repository under path, always recursively.
The recurse flag will only control recursion into repo working dirsc                *   > U R                   T:X  a  U eg r9   )r   )errpaths    rC   
errhandlerwalkrepos.<locals>.errhandler  s    <<4I  rQ   samestatNc                   >^ [         R                  " U5      m[        UU4S jU  5       5      nU(       d  U R                  T5        U(       + $ )Nc              3  6   >#    U  H  nT" TU5      v   M     g 7fr9   rR   )rJ   
lstdirstatdirstatr  s     rC   rL   ,walkrepos.<locals>.adddir.<locals>.<genexpr>  s     O**55s   )osstatanyru   )dirlstdirnamer   r  r  s      @rC   adddirwalkrepos.<locals>.adddir  s8    ggg&GOOOEg&9rQ   FT)topdownonerrors   .hgs   patches)r   r!  r  walksortr   isdirremoveislink	walkreposru   )r  	followsym	seen_dirsrecurser  r&  rootdirsfilesqrootnewdirsdfnamer  s   `            @rC   r/  r/    sB     rww
D1HX)	 	y	y$WWT4LE		T>JGGLLvz:Eww}}RWW\\%899F#QYGT-)++ww~~e,,#,UD)#DDDq)  G+ M$ Es   DF'1F'4F'?F% &F'c                t    U R                  5       nUc$  U R                  5       R                  R                  $ U$ )z)Return binary node id for a given basectx)noderw   nodeconstantswdirid)ro   r;  s     rC   binnoder>    s/    88:D|xxz''...KrQ   c                8    U R                  5       nUc  [        $ U$ )zYReturn integer for a given basectx that can be used in comparison or
arithmetic operation)r  r   )ro   r  s     rC   intrevr@    s     '')C
{JrQ   c                t    U R                  5       n[        UR                  [        U 5      [	        U 5      5      $ )zvFormat changectx as '{rev}:{node|formatnode}', which is the default
template provided by logcmdutil.changesettemplater)rw   formatrevnoder.   r@  r>  )ro   rw   s     rC   formatchangeidrC    s*     88:D&+ws|<<rQ   c                V    U R                   (       a  [        nO[        nSX" U5      4-  $ )zAFormat given revision and node depending on the current verbositys   %d:%s)	debugflagr   r   )r.   r  r;  hexfuncs       rC   rB  rB  #  s'    	||sGDM***rQ   c                   UR                  S5      (       a  USS  n U R                  5       R                  R                  U5      nUc  g U R                  R                  U5        U$ ! [        R
                   a    U R                  R                  SS5      nU(       a  SS 0nU R                  R                  U5         U R                  U/SS9n/ nU HP  nU R                  R                  U5      n[        U5      R                  U5      (       d  M?  UR                  U5        MR     [        U5      S:X  a  US   sS S S 5        s $  S S S 5        e ! , (       d  f       e = fe f = f)	N   xr      experimental   revisions.disambiguatewithin)rI  rJ  Tuserr   )
startswith
unfilteredr   _partialmatchr   AmbiguousPrefixLookupErrorr.   r   configoverrideanyrevsr;  r   ru   rv   r  )rw   prefixr;  revsetconfigoverridesr  matchesr  s           rC   resolvehexnodeidprefixrW  ,  sN     **88@( |NNtK- ++ <
  CDO ''8||VH4|8C>>..s3D4y++F33t,   w<1$"1: 98 % 9 	 98 	%s1   )A' 'AE#=AE(E:
E#	E#
E		E#c                z     [        U5      nUS:w  a	  USS S:X  d  U[        U 5      :  a  gg! [         a     gf = f)z@Checks if the given prefix may be mistaken for a revision number   0r   r   FT)r|   rv   r   )rw   rS  is      rC   mayberevnumr[  L  sH    
K
 dNva{d2qCI~ s   )- 
::c                  ^ ^ [        US5      nSUU 4S jjnT R                  5       R                  nT R                  R	                  SS5      nU(       Ga  SnUb  UR                  S5      nUc  T R                  U/SS9nUb  XsS'   UR                  T5      U;   Ga  [        T5      nSn	Ub  UR                  S	5      n	[        U	S
S 5      n
U
" 5       (       a  Sn	U	(       dj  [        [        S5      (       aT  [        UR                  [        R                  5      (       a+  UR                  n[        R                  U[        U5      5      n	O;[        UR                  SS5      (       a  [         R#                  UR                  5      n	U	bI  U H  nU	R%                  U5        M     Ub  XS	'   [        U	R'                  T5      U5      nUSU nU" U5      $ [)        U[        U5      S-   5       H[  n/ nUSU nU H2  nT U   R                  5       nUUSU :X  d  M!  UR+                  U5        M4     [        U5      S:X  d  MS  U" U5      s  $     U" UR'                  TU5      5      $ ! [,        R.                   a    [,        R0                  " 5       ef = f)zFind the shortest unambiguous prefix that matches hexnode.

If "cache" is not None, it must be a dictionary that can be used for
caching between calls to this method.
r   c                  > TR                   R                  SS5      (       a  [        TU 5      (       a  SU -   $ U $ [        T5      n[	        [        U 5      [        U5      S-   5       H  nUSU n [        TU 5      (       a  M  U s  $    g)zDisambiguate against revnums.rI  s   revisions.prefixhexnoderH  r   N)r.   r   r[  r   rangerv   )rS  hexnodelengthr;  rw   s      rC   disambiguate-shortesthexnodeidprefix.<locals>.disambiguateg  s|    77o/IJJ4((f}$d)CKW)9:FWf%FtV,, ;rQ   rI  rJ  Ns   disambiguationrevsetTrK  s   disambiguationnodetreeis_invalidatedc                     gNFrR   rR   rQ   rC   <lambda>)shortesthexnodeidprefix.<locals>.<lambda>  s    rQ   nodetreeis_rustFrS  r]   )maxrN  r   r.   r   r   rR  r  r   r   r   r/   r   indexrh  rv   
rustrevlogNodeTreeinsertshortestr^  ru   r   LookupErrorr   )rw   r;  	minlengthcachera  r   rT  r  r_  rh  rc  rl  r  r`  rS  rV  r  otherhexnodes   ``                rC   shortesthexnodeidprefixru  [  s[    Iq!I  
		$	$BWW^^O-LMF9945D<<<t<4D 15-.66$<4$iGH  99%>?$X/?ON7J//JHHgmm5 5 HHE&//s4yAH9e44%..rxx8#AOOA& $7?34X..t4i@ &)#F++	3w<!+;< &)C#'9==?Lgv!66|4   w<1$'// =&BKKi899 &##%%&s   
I" "*Jc                P     [        X5        g! [        R                   a     gf = f)zChecks if a symbol exists in the repo.

See revsymbol() for details. Raises error.AmbiguousPrefixLookupError if the
symbol is an ambiguous nodeid prefix.
TF)	revsymbolr   r   )rw   symbols     rC   isrevsymbolry    s*    $   s    %%c                   [        U[        5      (       d&  SU[        U5      4-  n[        R                  " U5      e US;   a  X   $  [        U5      nSU-  U:w  a  [        e[        U R                  5      nUS:  a  X4-  nUS:  d  X4:  a  U[        :w  a  [        eX   $ ! [        R                   a    e [        [        [        4 a     Of = f[        U5      SU R                  R                  -  :X  a_   [        U5      nU R                  R!                  U5      nX   $ ! [        R"                   a    e [$        R&                  [(        4 a     Of = f U R*                  R-                  X5      nU R                  R!                  U5      nX   $ ! [.         a     Of = f[1        X5      nUb  U R                  R!                  U5      nX   $ [        R2                  " [5        S5      U-  5      e! [        R6                   a    U S   s $ [        R                  [        R"                  [        R8                  4 a    [;        X5      ef = f)zReturns a context given a single revision symbol (as string).

This is similar to revsingle(), but accepts only a single revision symbol,
i.e. things like ".", "tip", "1234", "deadbeef", "my-bookmark" work, but
not "max(public())".
sC   symbol (%s of type %s) was not a string, did you mean repo[symbol]?)r   r   r      %dr      Ns   unknown revision '%s')r   r]   r7   r   ProgrammingErrorr|   r   rv   r   r   FilteredIndexErrorOverflowErrorr   r<  nodelenr   r  FilteredLookupErrorbinasciir   rq  names
singlenodeKeyErrorrW  r   r   r   FilteredRepoLookupError_filterederror)rw   rx  r   r  lr;  r  s          rC   rw  rw    s0    fe$$ &V56 	 $$S))3+,,<	FAqyF"  DNN#A1u1u1<  7N'' 	M:6 		 v;!d0088886{nn((.y ,, NNK0 	::((6D..$$T*C9 		 &d3..$$T*C9##A&>$?&$HII   Dz  !!%% +
 T**+sr   	G. AB   )C	G. C)G. 6)D   .EG. EG. 9F 
FG. F/G. "G. .I	>Ic                   U R                   R                  S5      (       au  U R                  5       n[        X!5      nUR	                  5       (       a  [
        R                  " XU5      nO[        S5      U-  n[        S5      n[        R                  " XES9$ [        S5      nXAU R                   4-  n[        R                  " U5      $ )zbuild an exception to be raised about a filtered changeid

This is extracted in a function to help extensions (eg: evolve) to
experiment with various message variants.   visibles   hidden revision '%s's'   use --hidden to access hidden revisionsr   s+   filtered revision '%s' (not in '%s' subset))

filternamerM  rN  rw  r   r   _getfilteredreasonr   r   r  )rw   changeidunfilteredreporo   r   r   s         rC   r  r    s    
 !!*--*1 <<>>,,TSAC+,x7C;<,,S<<
:
;Cdoo&&C((--rQ   c                    U(       d
  US:w  a  X   $ [        X/US9nU(       d  [        R                  " [        S5      5      eXR	                  5          $ )Nr   )
localaliass   empty revision set)revranger   r   r   last)rw   revspecr6   r  r  s        rC   	revsingler    sI    w!|}yZ8Aq!6788>rQ   c                P    [         R                  " U 5      nU=(       a    US   S;   $ )Nr   )s   ranges   rangepres	   rangeposts   rangeall)r    parse)r  trees     rC   	_pairspecr    s/    G$D DG    rQ   c                  ^  U(       d
  T S   T S    4$ [        T U5      nU(       d  [        R                  " [        S5      5      eUR	                  5       nUR                  5       nX4:X  aH  [        U5      S:  a9  [        U 4S jU 5       5      (       d  [        R                  " [        S5      5      eX4:X  a,  [        U5      S:X  a  [        US   5      (       d
  T U   T S    4$ T U   T U   4$ )Nr   s   empty revision ranger|  c              3  >   >#    U  H  n[        TU/5      v   M     g 7fr9   )r  )rJ   r  rw   s     rC   rL   revpair.<locals>.<genexpr>4  s     6AHTA3''s   s#   empty revision on one side of ranger   r   )	r  r   r   r   firstr  rv   allr  )rw   r  r  r  seconds   `    rC   revpairr  %  s    Dz4:%%tAq!89::GGIEVVXF 	IN6666q!GHII 3t9>)DG2D2DE{DJ&&;V$$rQ   c                    / nU H@  n[        U[        5      (       a  [        R                  " SU5      nUR	                  U5        MB     U R                  USUS9$ )a  Execute 1 to many revsets and return the union.

This is the preferred mechanism for executing revsets using user-specified
config options, such as revset aliases.

The revsets specified by ``specs`` will be executed via a chained ``OR``
expression. If ``specs`` is empty, an empty result is returned.

``specs`` can contain integers, in which case they are assumed to be
revision numbers.

It is assumed the revsets are already formatted. If you have arguments
that need to be expanded in the revset, call ``revsetlang.formatspec()``
and pass the result as an element of ``specs``.

Specifying a single revset is allowed.

Returns a ``smartset.abstractsmartset`` which is a list-like interface over
integer revisions.
r{  T)rL  r  )r   r|   r    
formatspecru   rR  )rw   specsr  allspecsspecs        rC   r  r  ?  sU    * HdC  ((5D  <<t
<CCrQ   c              #  ,   #     U v   X:  a  U S-  n M  7f)Nr|  rR   )
windowsize	sizelimits     rC   increasingwindowsr  \  s$      !!OJ s   c                T   ^^^^ T(       d  / $ U R                   mUUUU4S jnU" 5       $ )aT  Iterate over files and the revs in a "windowed" way.

Callers most commonly need to iterate backwards over the history
in which they are interested. Doing so has awful (quadratic-looking)
performance, so we use iterators in a "windowed" way.

We walk a window of revisions in the desired order.  Within the
window, we first walk forwards to gather data, then in the desired
order (usually backwards) to display it.

This function returns an iterator yielding contexts. Before
yielding each context, the iterator will first call the prepare
function on each context in the window in forward order.c               3  D  >#    [        T
5      n Sn[        5        H  n/ n[        U5       H'  n[        U S 5      nUc  Sn  OUR	                  U5        M)     [        U5       H  nT" U5      nT	" UT" U5      5        M     U H  nT" U5      v   M     U(       d  M    g    g 7f)NFT)iterr  r^  nextru   rf   )itstopiterationr  nrevsrZ  r  ro   changemakefilematcherpreparer  s          rC   iteratewalkchangerevs.<locals>.iteratex  s     $Z+-JE:&2tn;$(MS! ' e}Sk_S12 % Sk!  } .s   BB B )__getitem__)rw   r  r  r  r  r  s    ``` @rC   walkchangerevsr  e  s,     	F ( 9rQ   c                    UR                  5       n[        U5      S:  a  U$ U R                  R                  (       a  US   U [           /$ US   R                  5       [        U5      S-
  :  a  / $ U$ )zReturn list of meaningful (or all if debug) parentrevs for rev.

For merges (two non-nullrev revisions) both parents are meaningful.
Otherwise the first parent revision is considered meaningful if it
is not the preceding revision.
r   r   )parentsrv   r.   rE  r   r  r@  )rw   ro   r  s      rC   meaningfulparentsr    se     kkmG
7|aww
DM**qz~~6#;?*	NrQ   c                  ^^ Ub  UnO`U R                   R                  SS5      nUS:X  a  UnO;[        R                  " U5      nUc"  [        R
                  " [        S5      U-  5      eU(       a)  U R                  5       mTS:w  a  U R                  mUU4S j$ U R                   R                  SS5      (       a  S $ [        R                  $ )	a  Return a function that produced paths for presenting to the user.

The returned function takes a repo-relative path and produces a path
that can be presented in the UI.

Depending on the value of ui.relative-paths, either a repo-relative or
cwd-relative path will be produced.

legacyrelativevalue is the value to use if ui.relative-paths=legacy

If forcerelativevalue is not None, then that value will be used regardless
of what ui.relative-paths is set to.
r   s   relative-pathss   legacys)   ui.relative-paths is not a boolean ('%s')rQ   c                   > T" U T5      $ r9   rR   )r   cwdpathtos    rC   rf  getuipathfn.<locals>.<lambda>  s    VAs^rQ   s   slashc                    U $ r9   rR   r   s    rC   rf  r    s    rQ   )r.   r   r*   r   r   r   r   getcwdr  r   r%   	localpath)rw   legacyrelativevalueforcerelativevaluerelativer   r  r  s        @@rC   getuipathfnr    s    $ %%'89Y*H!++F3H''BCfL  kkm#: [[F++ww%**~~rQ   c                   ^ ^ U U4S j$ )zBCreate a new uipathfn that treats the file as relative to subpath.c                >   > T" [         R                  " TU 5      5      $ r9   )	posixpathr   )r   rn   uipathfns    rC   rf   subdiruipathfn.<locals>.<lambda>  s    XinnWa89rQ   rR   )rn   r  s   ``rC   subdiruipathfnr    s     :9rQ   c                x    [        U =(       d)    UR                  S5      =(       d    UR                  S5      5      $ )zChecks if any patterns, including --include and --exclude were given.

Some commands (e.g. addremove) use this condition for deciding whether to
print absolute or relative paths.
   include   exclude)r   r   )patsoptss     rC   anypatsr    s+     D,D0DEErQ   List[bytes]c                R   [         R                  (       d  [        U 5      $ / nU  Ha  n[        R                  " US5      u  p4Uc1   [
        R
                  " U5      nU(       a  UR                  U5        MP  UR                  U5        Mc     U$ ! [        R                   a    U/n NJf = f)zeExpand bare globs when running on windows.
On posix we assume it already has already been done by sh.N)
r%   expandglobsr\   matchmod	_patsplitglobrer   extendru   )r  retkindpatr   patglobbeds         rC   
expandpatsr    s     Dz
C&&w5	< ))C. 

7#

7  J 88  % s   BB&%B&c           	     P  ^ ^ Uc  0 nU(       d  US:X  a  [        U=(       d    / 5      n[        T R                  5       SS9mU U4S jnUc  UnT R                  UUR	                  S5      UR	                  S5      UUR	                  S5      US9nUR                  5       (       a  / nXq4$ )	zReturn a matcher and the patterns that were used.
The matcher will warn about bad matches, unless an alternate badfn callback
is provided.   relpathTr  c                n   > TR                  5       R                  R                  ST" U 5      U4-  5        g )Ns   %s: %s
)rw   r.   r   )r   r   ro   r  s     rC   badmatchandpats.<locals>.bad  s)    
;(1+s);;<rQ   r  r     subrepos)listsubreposbadfn)r  r  rw   r   r   always)	ro   r  r  r  r6   r  r  r   r  s	   `       @rC   matchandpatsr    s     |w*,$*"%388:4@H= }		XXk* 	 	A 	xxzz7NrQ   c           	         [        XX#XES9S   $ )z2Return a matcher that will warn about bad matches.r  r   )r  )ro   r  r  r  r6   r  s         rC   r   r     s     4'GJJrQ   c                ,    [         R                  " 5       $ )z8Return a matcher that will efficiently match everything.)r  r  rw   s    rC   matchallr  "  s    ??rQ   c                *    [         R                  " XS9$ )zAReturn a matcher that will efficiently match exactly these files.r  )r  exact)rw   r5  r  s      rC   
matchfilesr  '  s    >>%--rQ   c                   [         R                  " U5      (       d0  [        R                  " U R                  U R                  5       U5      $ X   n[         R                  " U R                  U R                  5       U/US9nU Vs/ s H  oe" U5      (       d  M  UPM     nn[        U5      S:w  a  [        R                  " U5      eUS   $ s  snf )zOReturn a file name from `pat` pattern suitable for usage in followlines
logic.
)ro   r   r   )
r  patkindr   	canonpathr3  r  r   rv   r   
ParseError)rw   r  r  r   ro   r   r   r5  s           rC   parsefollowlinespatternr  ,  s     C  !!$))T[[]C@@iNN499dkkmcUD(Cq1Q4C(u:?""3''Qx )s   C
C
c                    U R                  SS5      nU(       d  g[        R                  " UR                  R                  U5      5      $ )z\return a vfs suitable to save 'orig' file

return None if no special directory is configuredr   s   origbackuppathN)r   r&   wvfsr   )r.   rw   origbackuppaths      rC   
getorigvfsr  ;  s7     YYu&78N77499>>.122rQ   c                4   [        X5      nUc  UR                  US-   5      $ UR                  U5      nUR                  U5      (       a  UR	                  U5      (       a  U R                  [        S5      UR                  U5      -  5        [        [        [        R                  " U5      5      5       HX  nUR                  U5      (       d  M  U R                  [        S5      UR                  U5      -  5        UR                  U5          O   UR                  U5        UR                  U5      (       aR  UR	                  U5      (       d<  U R                  [        S5      UR                  U5      -  5        UR                  USS9  UR                  U5      $ )a  customize where working copy backup files (.orig files) are created

Fetch user defined path from config file: [ui] origbackuppath = <path>
Fall back to default (filepath with .orig suffix) if not specified

filepath is repo-relative

Returns an absolute path
s   .origs   creating directory: %s
s   removing conflicting file: %s
s#   removing conflicting directory: %s
T)forcibly)r  wjoinr%  r,  r.  noter   r   reversedr\   r   finddirsisfileorlinkunlinkmakedirsrmtree)r.   rw   filepathorigvfsorigbackupdirr   s         rC   
backuppathr	  E  sC    "Gzz(X-..OOH-M==''7>>-+H+H
-.m1LLM $x00:;<A##A&&<=QOPq!	 = 	'}}Xw~~h'?'?
56h9OO	
 	x$/<<!!rQ   c                  (    \ rS rSrSrS rSS jrSrg)_containsnodeii  zEproxy __contains__(node) to container.__contains__ which accepts revsc                \    UR                   R                  U l        UR                  U l        g r9   )r   r  _torev__contains___revcontains)rB   rw   revcontainers      rC   r   _containsnode.__init__l  s!    nn(((55rQ   c                B    U R                  U R                  U5      5      $ r9   r  r  )rB   r;  s     rC   r  _containsnode.__contains__p  s      T!233rQ   r  NrS   r   )rU   rV   rW   rX   rY   r   r  r^   rR   rQ   rC   r  r  i  s    O64rQ   r  c           
       ^.^/^0^1 U(       d  Ub   eU(       d  U(       d  g[        US5      (       d  U Vs0 s H  o4S_M     nnO90 n	UR                  5        H!  u  p[        U
[        5      (       d  U
4n
XU
'   M#     U	nU R	                  5       m1Uc  0 nUR                  5        H  u  pU H  nX;   a  M
  [        U5      S:  a*  [        T1R                  SU5      5      R                  5       nOt[        U5      S:X  a`  / nU H  nUR                  U5        M     [        T1R                  SUU5      5      nU(       a  US   R                  5       nOU R                  nOUS   nXU'   M     M     UR                  5        VVs/ s H  nU  H  oPM     M     nnn0 n0 nU(       GaA  0 nUR                  5        H8  u  pU H-  nU H$  nUR                  U/ 5      R                  U5        M&     M/     M:     UR                  U14S jS	9  0 m.U.4S
 jm/U H  nT1U   n[!        U/4S jUR#                  5        5       5      nUc%  [!        U14S jUU    5       5      n[!        UU5      nO[!        UU5      nUT.U'   UUR%                  5       :  a#  UR                  U/ 5      R                  U5        M  UUR%                  5       :  d  M  UR                  U/ 5      R                  U5        M     U R'                  S5       nU R(                  n/ nUR                  5        H  u  pU R+                  U5      nU(       d  M  SSKJn   U R0                  R3                  S[4        R6                  " [4        R8                  U5      [;        U5      [;        U5      4-  5        U R=                  SUUU5      n![?        U U!5      n"U HC  n#UR                  U#U45        U RA                  U U"U#5       H  n$UR                  U$S45        M     ME     M     U(       a  URC                  U UU5        UR                  5        H  u  m/n%[D        RF                  " U UT/U%5        M!     UR                  5        H  u  m/n%[D        RH                  " U UT/U%5        M!     U R0                  RK                  SS5      n&[L        RN                  " U [L        RP                  5      (       a  T1RR                  RT                  m0U04S jn'/ n([W        UR                  5       U'S	9 HA  u  nn)[        U14S jU 5       5      [        U14S jU) 5       5      4n*U(R                  U*5        MC     U((       a  [L        RX                  " U U(X$S9  O[D        RZ                  " U 5      (       a  U&(       a  [        5       nUR]                  5        H  nUR_                  U5        M     U(       a9  SSKJ0n+  [c        UU RR                  RT                  S	9n,U+Re                  U UUU,U5        [D        RF                  " U U[D        Rf                  U5        O;SSKJ0n+  [        S U 5       5      n-U-(       a  U+Ri                  U R0                  U U-X'S9  SSS5        gs  snf s  snnf ! , (       d  f       g= f)a  do common cleanups when old nodes are replaced by new nodes

That includes writing obsmarkers or stripping nodes, and moving bookmarks.
(we might also want to move working directory parent in the future)

By default, bookmark moves are calculated automatically from 'replacements',
but 'moves' can be used to override that. Also, 'moves' may include
additional bookmark moves that should not have associated obsmarkers.

replacements is {oldnode: [newnode]} or a iterable of nodes if they do not
have replacements. operation is a string, like "rebase".

metadata is dictionary containing metadata to be stored in obsmarker if
obsolescence is enabled.
Nrg   rR   r   s   max(%ln)r   s   max((::%n) - %ln)c                *   > TU    R                  5       $ r9   )r  )rz   unfis    rC   rf  cleanupnodes.<locals>.<lambda>  s    tAw{{}rQ   )r  c                `   > TR                  U R                  5       U R                  5       5      $ r9   )r   r;  rr   )ro   	newphasess    rC   rr   cleanupnodes.<locals>.phase  s     ==SYY[99rQ   c              3  4   >#    U  H  nT" U5      v   M     g 7fr9   rR   )rJ   prr   s     rC   rL   cleanupnodes.<locals>.<genexpr>  s     >1eAhhs   c              3  J   >#    U  H  nTU   R                  5       v   M     g 7fr9   )rr   )rJ   oldnoder  s     rC   rL   r    s%      9LgDM''))9Ls    #s   cleanup)	bookmarkss"   moving bookmarks %r from %s to %s
s*   parents(roots(%ln & (::%n))) - parents(%n)rI  s   cleanup-as-archivedc                    > T" U S   S   5      $ )Nr   rR   )nstorevs    rC   rf  r    s    %1a/rQ   c              3  .   >#    U  H
  nTU   v   M     g 7fr9   rR   )rJ   rz   r  s     rC   rL   r    s     1bT!Wb   c              3  .   >#    U  H
  nTU   v   M     g 7fr9   rR   )rJ   r   r  s     rC   rL   r    s     8L!Qa!r'  )	operationmetadata)repairc              3  6   #    U  H  o  H  o"v   M     M     g 7fr9   rR   )rJ   r$  rz   s      rC   rL   r  $  s     @|R1R1|s   )backup)5r   rg   r   rN   rN  rv   r  rd   r;  r  r\   nullidvalues
setdefaultru   r+  rk  r  rr   transaction
_bookmarksnodebookmarks r"  r.   debugr   rapplymaybebytestrr   r  r  divergent2deleteapplychangesr   retractboundaryadvanceboundaryr   r   	isenabledcreatemarkersoptr   r  rf   createmarkerssupportarchivedkeysrc   r+  minbackupbundlearchiveddelayedstrip)2rw   replacementsr)  movesr*  fixphasetargetphaser-  rz   replsr  valueoldnodesnewnodesr!  newnodeallreplacedreprootsr$  allnewnodes	toretract	toadvance
precursorsro   parentphaseoldphasenewphasetrbmarksbmarkchanges	oldbmarksr"  
deleterevsdeletenodesnamebnodesmayusearchivedsortfuncrelsr  relr+  r;  tostripr  rr   r%  r  s2                                                 @@@@rC   cleanupnodesrf  t  s   2 {*** <))*67,Qb,7 &,,.JCc5))f#J /  ??D }"."4"4"6H##x=1$"488K#BCHHJG]a'"$K+#**3/  , !5wLE "'(--/"&++&qkG!(g) $ #7.  ,224A4b1b14KAII
"."4"4"6H#'G))'26==gF  ( $ #7
 	45		: #Gw-C>>>K" 9CG9L  x5{K8!)Ig#))+%$$Xr299'BCIIK'$$Xr299'B #  
		*	% %G**73I#GGMM6OOH$9$99ELL =	J (j9K!##T7O4"33D+tLA ''D	2 M "- !.6 b,7%OO-LE5""4UE: .%OO-LE5""4UE: . 9OPdH$=$=>> NN&&E1HD 2 2 4(CA1b1158L!8L3LMC  D &&$) ##D))n%K"'')""2& *$;DNN,>,>?##+{D) ""4V__kJ @|@@G##GGT7I $ Y 
&	%O 8N B@ 
&	%s   Y Y!6MY''
Y5c                N  ^^ Uc  0 nUmUR                  S5      n [        UR                  S5      =(       d    S5      nUS:  d  US:  a  [        R                  " [        S5      5      eUS-  nSnU S    n	[        U	R                  5       H  n
[        R                  " U
T5      nUR                  S5      (       d6  TR                  U
5      (       d   [        UR                  5       5      (       d  Mf  U	R                  U
5      nU R                  R                  X*5      n[!        X5      n UR#                  XX5      (       a  S	nM  M     / mSUU4S jjn[        R*                  " TU5      n[-        U U5      u  nnnnn[/        UU-   5      nUR1                  5       nUR3                  U5        [        U5       H  nU R&                  R4                  (       d  TR                  U5      (       a  M6  UU;   a  [        S5      U" U5      -  nSnO[        S5      U" U5      -  nSnU R&                  R)                  UUS9  M     [7        U TUU-   UU-   Xs5      nU(       d7  U(       d  U(       d  U(       d  U(       a  Ub  U" 5         [9        U UU-   UU5        T H  nUTR                  5       ;   d  M    g	   U$ ! [         a     [        R                  " [        S5      5      ef = f! [        R$                   a2    U R&                  R)                  [        S
5      U" U
5      -  5         GM  f = f)Ns   dry_runs
   similarityr   s   similarity must be a numberr   s$   similarity must be between 0 and 100      Y@r  r   s#   skipping missing subrepository: %s
c                r   > U TR                  5       ;   a  TR                  X5        TR                  U 5        g r9   )r5  r  ru   )r   r   r   rejecteds     rC   r  addremove.<locals>.badfnS  s'    	>EE!MrQ   
   adding %s
s   ui.addremove.added   removing %s
s   ui.addremove.removed)label)r   r]   r   r]   rS   r   )r   floatr   r   r   r   rf   rb   r  subdirmatcherr  r#  r5  rh   r  reljoinr  	addremoverq  r.   r'   badmatch_interestingfilesrd   copyrc   verbose_findrenames_markchanges)rw   matcherrS  r  r  open_trdry_run
similarityr  wctxrn   submatchrh   	subprefixsubuipathfnr  rs  r;   r>   r=   r<   	forgotten
unknownsettoprintabsr'   rn  renamesr   r   rj  s                                @@rC   rr  rr  +  s    |Ahhz"GB488M27a8
 A~c)q!HIJJ%J
C:D$--())'1588K  AGGG$4$4HNN<L8M8M((7#C		))&:I(;K==kHHC I ) H 
   E*H2Ch3/E7GWi Wy()JooGNN7g77??!''#,,j >*Xc]:-+,x}</GGNN6N/  a'G"3ZG 97IT7Y.A	>  J{  Bq!?@AAB$ $$ =>w'( s   #J1 )K1*KAL$#L$c                  ^ [        XU4S jS9n/ m[        X5      u  pEpgnU R                  R                  (       a}  [	        XX-   5      n	U	R                  5       n
U
R                  U5        [        U
5       H@  nX;   a  [        S5      U-  nO[        S5      U-  nU R                  R                  U5        MB     [        U SS9n[        XXE-   Xv-   X-5      n[        XU-   Xn5        T H  nXR                  5       ;   d  M    g   g)	zWAssert that files have somehow been operated upon. files are relative to
the repo root.c                &   > TR                  U 5      $ r9   )ru   )xyrj  s     rC   rf  marktouched.<locals>.<lambda>|  s    8??13ErQ   r  rl  rm  Tr  r   r   )r  rt  r.   rv  rd   ru  rc   rf   r   r'   r  rw  rx  r5  )rw   r5  r|  r   r;   r>   r=   r<   r  r  r  r  r'   r  r  r   rj  s                   @rC   marktouchedr  y  s     	4&EFAH2CD2L/EGiww,-
//#w'?C >*S0+,s2GGNN6" # 4T:H'"3ZG *G=	>  rQ   c                    / / / / / 4u  p#pEn[         R                  " U R                  SS9nU S   nU R                  n	U R	                  USS9nU	R                  U[        UR                  5      SSSS9n
U
R                  5        H  u  pU	R                  U5      nUR                  (       d)  UR                  U5      (       a  UR                  U5        MP  UR                  (       d  U(       d  UR                  U5        M{  UR                  (       a  U(       a  UR                  U5        M  UR                  (       a  U(       d  UR                  U5        M  UR                  (       d  M  UR                  U5        M     X#XEU4$ )zWalk dirstate with matcher, looking for files that addremove would care
about.

This is different from dirstate.status because it doesn't care about
whether files are modified or clean.T)cachedN)includeexactF)subreposr>   r?   full)r   pathauditorr3  r   narrowmatchr*  rf   rb   rg   	get_entryany_trackedcheckru   r<   r;   )rw   ry  r;   r>   r=   r<   r  
audit_pathro   r   walkresultsr  stentrys                 rC   rt  rt    s4    35b"b"2D/EGi%%dii=J
t*C}}HwT:G--%   K $$&""3'!!z'7'7'<'<NN3--NN3]]rS!]]2NN3[[[LL ' 7Y66rQ   c                `   0 nUS:  a  [         R                  " XX45       H  u  pxn	U R                  R                  (       d,  UR	                  U5      (       a  UR	                  U5      (       d9  U R                  R                  [        S5      U" U5      U" U5      U	S-  4-  5        XvU'   M     U$ )z.Find renames from removed files to added ones.r   s7   recording removal of %s as rename to %s (%d%% similar)
r   )r!   findrenamesr.   rv  r  r'   r   )
rw   ry  r;   r<   r|  r  r  oldnewscores
             rC   rw  rw    s     GA~&22 
OCe }}S))}}S)),  }hsmUS[A	B CL 
  NrQ   c                    U S   nU R                  5          UR                  U5        UR                  U5        UR                  5        H  u  pVUR	                  Xe5        M     SSS5        g! , (       d  f       g= f)ziMarks the files in unknown as added, the files in deleted as removed,
and the files in renames as copied.N)wlockforgetre   rg   ru  )rw   r>   r=   r  r}  r  r  s          rC   rx  rx    sV     :D	GHCIIc ( 
s   AA,,
A:c                   ^ ^^ [         R                  " T 5      (       a  U 4S jnU$ 0 mTc  [        T 5      mUUU 4S jnU$ )Nc                t   > TU   nUR                  5       nX;   a  X0   $ UR                  5       nX;   a  X@   $ g r9   )p1copiesp2copies)fnr  ro   r  r  rw   s        rC   
getrenamed getrenamedfn.<locals>.getrenamed  s?    s)C||~H~|#||~H~|#rQ   c                l  > U T;  al  0 TU '   TR                  U 5      nU HP  nUR                  U5      nUR                  UR                  U5      5      nU=(       a    US   TU    U'   UT:  d  MP    O   UTU    ;   a  TU    U   $  TU   U    R	                  5       $ ! [
        R                   a     gf = f)zlooks up all renames for a file (up to endrev) the first
time the file is given. It indexes on the changerev and only
parses the manifest if linkrev != changerev.
Returns rename info for fn at changerev rev.r   N)filelinkrevrenamedr;  
copysourcer   rq  )	r  r  r   rZ  lrr  endrevrcacherw   s	         rC   r  r    s    
 VF2J2BZZ]**RWWQZ0!(!7WQZr
2<  &*":c?"	9R=++--   		s   B B32B3)	copiesmodusechangesetcentricalgorv   )rw   r  r  r  s   `` @rC   getrenamedfnr    sA    ((..	 F~T0 rQ   c                j   ^ [         R                  " U 5      (       a  S nU$ [        X5      mU4S jnU$ )Nc                &   U R                  5       (       aV  U R                  5       R                  5       nUR                  U R                  5       5        [	        UR                  5       5      $ [	        U R                  5       R                  5       5      $ r9   )r  r  ru  rc   rf   rg   )ro   	allcopiess     rC   copiesfngetcopiesfn.<locals>.copiesfn  sa    ||~~LLN//1	  0ioo/00clln22455rQ   c                   > / nU R                  5        H4  nT" X R                  5       5      nU(       d  M"  UR                  X#45        M6     U$ r9   )r5  r  ru   )ro   r   r  renamer  s       rC   r  r  #  sB    Fiik#B	26MM2,/ " MrQ   )r  r  r  )rw   r  r  r  s      @rC   getcopiesfnr    s8    ((..	6( O "$/
	 OrQ   c                   UR                   R                  U5      =(       d    UnXG:X  ab  UR                   R                  U5      nUR                  (       d  UR                  (       d$  U(       d  UR                   R                  U5        gggUR                   R                  U5      R                  (       a  Xs:X  a  U R                  (       d=  U R                  [        S5      UR                  Xv5      UR                  XF5      4-  5        UR                   R                  U5      R                  (       d  U(       d  UR                  U/5        gggU(       d  UR                  Xt5        gg)zUpdate the dirstate to reflect the intent of copying src to dst. For
different reasons it might not end with dst being marked as copied from src.
sF   %s has not been committed yet, so no copy data will be stored for %s.
N)r   copiedr  r;   trackedset_trackedquietr   r   r  re   ru  )	r.   rw   r}  srcdstdryrunr  origsrcr  s	            rC   dirstatecopyr  .  s    mm""3'.3G
~'',KKu}}fMM%%c* 7=} ==""7+11gn889 {{70$++c2GH	I ==**3/77# AG7IIg# rQ   c           	     *   U S   nU R                   n[        UR                  5       5      nUR                  UR	                  5       U R
                  5        UR                  X2S9nUR                   H  nUR                  USS9  M     UR                   H  nUR                  USS9  M     UR                   H  nUR                  USS9  M     [        R                  " XU5      nUR                  U5        UR                  5        V	V
s0 s H  u  pXR                  X5      _M     nn	n
UR                  5        HB  u  pX;  d%  X;   d   UR!                  U	5      R                  (       d  Sn
UR#                  X5        MD     U R%                  5         gs  sn
n	f )zMove the dirstate to newctx and adjust it as necessary.

A matcher can be provided as an optimization. It is probably a bug to pass
a matcher that doesn't match all the differences between the parent of the
working copy and newctx.
r   )r   T)
p1_trackedFN)r   r`   r   
setparentsr;  r.  r'   r:   update_file_p1r;   r<   r  
pathcopiesrc   rg   r   r  ru  !_quick_access_changeid_invalidate)rw   newctxr   oldctxdsr   r  r   	oldcopiesr  r  s              rC   movedirstater  O  sT    $ZF	B"))+FMM&++--f*AZZ
!-  WW
!.  YY
!-  $$VU;IV;D??;LM;Lxsc==**;LFMLLNR\\#5F5L5LC
 # 	**, Ns   Fc                    [         R                  U ;   aW  [        5       [        5       p!U  H;  nU[         R                  ;   a  UR	                  U5        M*  UR	                  U5        M=     X4$ U S4$ )zfilters the requirements into two sets:

wcreq: requirements which should be written in .hg/requires
storereq: which should be written in .hg/store/requires

Returns (wcreq, storereq)
N)requirementsmodSHARESAFE_REQUIREMENTrd   WORKING_DIR_REQUIREMENTSre   )r   wcstorer  s       rC   filterrequirementsr  q  s`     ,,<E35EAO<<<q			!	 
 yrQ   c                <    [         R                  U R                  ;   $ )z;returns whether the repository is using treemanifest or not)r  TREEMANIFEST_REQUIREMENTr   r  s    rC   istreemanifestr    s    33t7H7HHHrQ   c                8   U(       a  Xl         [        U R                   5      u  p4Ub  [        U R                  U5        Ub  [        U R                  XBS9  gU R
                  R                  SS5      (       a$  U(       a  U R                  R                  S5        ggg)zwrites requirements for the repo

Requirements are written to .hg/requires and .hg/store/requires based
on whether share-safe mode is enabled and which requirements are wdir
requirements and which are store requirements
N)maywrite   formats   usestore   requires)r   r  writerequiresr&   svfsr.   r   	tryunlink)rw   r   maywritestorewcreqstorereqs        rC   writereporequirementsr    s}     (():):;OEdhh&diiB			I{	3	3II,  
4rQ   c                ~    U(       a  U R                   OU R                  n[        U" S5      R                  5       5      $ )zreads the require file present at root of this vfs
and return a set of requirements

If allowmissing is True, we suppress FileNotFoundError if raisedr  )tryreadreadrd   
splitlines)r&   allowmissingr  s      rC   readrequiresr    s.     '3;;CHHDtK ++-..rQ   c                   [        U S5      nU[        U5      :X  d^  U(       d  [        R                  " [	        S5      5      eU " SSSS9 n[        U5       H  nUR                  SU-  5        M     S S S 5        g g ! , (       d  f       g = f)NTs&   store requirements are not as expectedr     w)
atomictemp   %s
)r  rd   r   Abortr   rf   write)openerr   r  on_diskfpr  s         rC   r  r    sv    64(Gs<((++a IJKKK$72L)1% * 87 ) 87s   
'A;;
B	c                  `    \ rS rSr% SrS\S'   SS jrSS jrSS jrSS jr	\
SS	 j5       rS
rg)filecachesubentryi  NOptional[bool]
_cacheablec                    Xl         S U l        S U l        U(       a]  [        R	                  U R                   5      U l        U R                  (       a   U R                  R                  5       U l        g S U l        g g r9   )r  	cachestatr  r  r"  	cacheable)rB   r  r"  s      rC   r   filecachesubentry.__init__  sW    	.33DII>DN~~"&..":":"< #' rQ   c                x    U R                  5       (       a%  [        R                  U R                  5      U l        g g r9   )r  r  r"  r  r  rA   s    rC   refreshfilecachesubentry.refresh  s*    >>.33DII>DN rQ   c                6    U R                   b  U R                   $ gNT)r  rA   s    rC   r  filecachesubentry.cacheable  s    ??&??" rQ   c                   U R                  5       (       d  g[        R                  U R                  5      nU(       a4  U R                  c'  UR                  5       U l        U R                  (       d  gU R
                  U:w  a  Xl        gg)NTF)r  r  r"  r  r  r  )rB   newstats     rC   changedfilecachesubentry.changed  sg    ~~#((3 t.%//1DO ??>>W$$NrQ   c                    U R                  S5      (       d  U R                  S5      (       a  [        R                  " 5       $  [        R                  " U 5      $ ! [         a     g f = f)Ns   https://s   http://)rM  r%   uncacheable_cachestatr  FileNotFoundError)r  s    rC   r"  filecachesubentry.stat  sV     ??;''4??:+F+F--//	>>$''  		s   A 
A&%A&)r  r  r  )r"  r   rS   r   r  )r  r]   rS   zOptional[typelib.CacheStat])rU   rV   rW   rX   r  __annotations__r   r  r  r  staticmethodr"  r^   rR   rQ   rC   r  r    s4    !%J%'?*  rQ   r  c                  6    \ rS rSrSSS jjrS	S jrS
S jrSrg)filecacheentryi  c                l    / U l         U H'  nU R                   R                  [        X25      5        M)     g r9   )_entriesru   r  )rB   pathsr"  r  s       rC   r   filecacheentry.__init__  s+    DMM  !24!>? rQ   c                X    U R                    H  nUR                  5       (       d  M    g   g)ztrue if any entry has changedTF)r  r  rB   r  s     rC   r  filecacheentry.changed  s#    ]]E}} # rQ   c                J    U R                    H  nUR                  5         M     g r9   )r  r  r  s     rC   r  filecacheentry.refresh  s    ]]EMMO #rQ   )r  NT)r"  r   rS   r   r  r  )rU   rV   rW   rX   r   r  r  r^   rR   rQ   rC   r  r    s    @
rQ   r  c                  T    \ rS rSr% SrS\S'   SS jrS rSS jrS r	SS
 jr
S rSrg	)	filecachei  a  A property like decorator that tracks files under .hg/ for updates.

On first access, the files defined as arguments are stat()ed and the
results cached. The decorated function is called. The results are stashed
away in a ``_filecache`` dict on the object whose method is decorated.

On subsequent access, the cached result is used as it is set to the
instance dictionary.

On external property set/delete operations, the caller must update the
corresponding _filecache entry appropriately. Use __class__.<attr>.set()
instead of directly setting <attr>.

When using the property API, the cached data is always used if available.
No stat() is performed to check if the file has changed.

Others can muck about with the state of the ``_filecache`` dict. e.g. they
can populate an entry before the property's getter is called. In this case,
entries in ``_filecache`` will be used during property operations,
if available. If the underlying file changes, it is up to external callers
to reflect this by e.g. calling ``delattr(obj, attr)`` to remove the cached
method result as well as possibly calling ``del obj._filecache[attr]`` to
remove the ``filecacheentry``.
zTuple[bytes, ...]r  c                    Xl         g r9   )r  )rB   r  s     rC   r   filecache.__init__  s    
rQ   c                b    U R                    Vs/ s H  o R                  X5      PM     sn$ s  snf r9   )r  r   )rB   objr  s      rC   tracked_pathsfilecache.tracked_paths"  s%    15<		#$<<<s   ,c                    [         e)zUsed to compute the runtime path of a cached file.

Users should subclass filecache and provide their own version of this
function to call the appropriate join function on 'obj' (an instance
of the class that its member function was decorated).
)NotImplementedError)rB   r  r9  s      rC   r   filecache.join%  s
     "!rQ   c                ~    Xl         UR                  U l        [        R                  " U R                  5      U l        U $ r9   )r   rU   snamer   r   r^  )rB   r   s     rC   r   filecache.__call__.  s/    	]]

 %%djj1	rQ   Nc                   Uc  U $ U R                   UR                  ;  d   eUR                  R                  U R                  5      nU(       a,  UR                  5       (       a  U R                  U5      Ul        OKU R                  U5      n[        US5      nU R                  U5      Ul        X1R                  U R                  '   UR                  UR                  U R                   '   UR                  $ r  )
r&  __dict__
_filecacher   r^  r  r   r  r   r  )rB   r  r7   r  r  s        rC   __get__filecache.__get__8  s    ;Kzz---""499-}} IIcN	&&s+E #5$/E		#EI(-NN499%#(99TZZ yyrQ   c                   U R                   UR                  ;  a6  U R                  U5      n[        US5      nXAR                  U R                   '   OUR                  U R                      nX$l        X!R
                  U R                  '   g re  )r^  r*  r   r  r  r)  r&  )rB   r  rJ  r  ces        rC   rd   filecache.setT  sg    99CNN* &&s+Eu-B(*NN499%		*B#(TZZ rQ   )r   r^  r  r&  )r  r]   rS   r   )r9  r]   r9   )rU   rV   rW   rX   rY   r  r   r   r   r   r+  rd   r^   rR   rQ   rC   r  r    s-    2 ="8)rQ   r  c           
     B   U R                   R                  SU5      nU(       d"  [        R                  " [	        S5      U-  5      e0 nS=pE UR                  S5      (       ay  USS n[        R                  " [        R                  " U5      SS[        R                  [        R                  [        R                  " U R                  5      S9nUR                  nO![        R                  " U R                   U5      nU H  nS	U;   a#  UR!                  5       R#                  S	S
5      u  pOUR!                  5       Sp[$        R&                  " U5      n [$        R&                  " U	5      U[)        X5      R+                  5       '   M     U(       a   UR3                  5         U(       a  UR7                  5         U(       aR  UR8                  S:w  aB  [        R                  " [	        S5      W[        R:                  " UR8                  5      4-  5      eU$ ! [        R,                  [        R.                  [        R0                  4 a     GMI  f = f! [4         a     Nf = f! U(       a"   UR3                  5         O! [4         a     Of = fU(       a  UR7                  5         f f = f)aC  Gather a map of rev -> value dict from the specified source

A source spec is treated as a URL, with a special case shell: type
for parsing the output from a shell command.

The data is parsed as a series of newline-separated records where
each record is a revision specifier optionally followed by a space
and a freeform string value. If the revision is known locally, it
is converted to a rev, otherwise the record is skipped.

Note that both key and value are treated as UTF-8 and converted to
the local encoding. This allows uniformity between local and
remote data sources.
s   extdatas   unknown extdata source '%s'Ns   shell:   Tr~   )shellbufsize	close_fdsstdoutr      r   rQ   r   s   extdata command '%s' failed: %s)r.   r   r   r  r   rM  
subprocessPopenr)   tonativestrclosefdsPIPEr3  r5  r$   openr   r   r   tolocalr  r  rq  r   r   communicater   close
returncodeexplainexit)
rw   sourcer  datar  proccmdr  krK   s
             rC   extdatasourcerG  b  s'     77>>*f-Dkk!:;fDEEDC$??9%%qr(C##$$S)"++!((3D ++C ((477D)CAqywwytQ/1wwy#1  #A191A1A!1DYt'++-.    "
 IIK1$kk01H((9:;
 	

 K% %%u'<'<e>N>NO       "   IIK sg   DI 0HI I 3II II 
IIJ$I54J5
J?JJJc                      \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
\S'     S         SS jjrS rS r S       SS jjr S       SS jjr	SS jr
SS jrSrg)progressi  r   r.   Optional[int]posr]   topicunittotalr   r5  Nc                |    Xl         SU l        X0l        X@l        XPl        UR                  SS5      U l        X l        g )Nr   s   progresss   debug)r.   rK  rL  rM  rN  r   r5  
_updatebar)rB   r.   	updatebarrL  rM  rN  s         rC   r   progress.__init__  s6     
	
]];9
#rQ   c                    U $ r9   rR   rA   s    rC   	__enter__progress.__enter__  s    rQ   c                $    U R                  5         g r9   )complete)rB   exc_type	exc_valueexc_tbs       rC   __exit__progress.__exit__  s    rQ   c                    Uc   eU(       a  X0l         Xl        U R                  U R                  U R                  X R                  U R                   5        U R
                  (       a  U R                  U5        g g r9   )rN  rK  rP  rL  rM  r5  _printdebug)rB   rK  itemrN  s       rC   rc   progress.update  sW     J

DHHdIItzzJ::T" rQ   c                B    U R                  U R                  U-   X#5        g r9   )rc   rK  )rB   stepr_  rN  s       rC   	incrementprogress.increment  s     	DHHtOT1rQ   c                    S U l         SU l        S U l        U R                  U R                  U R                   SU R                  U R                  5        g )NrQ   )rK  rM  rN  rP  rL  rA   s    rC   rW  progress.complete  s;    	


DHHc499djjIrQ   c           	        SnU R                   (       a  SU R                   -   nU(       a  SU-   nU R                  (       a]  SU R                  -  U R                  -  nU R                  R	                  SU R
                  XR                  U R                  X#4-  5        g U R                  R	                  SU R
                  XR                  U4-  5        g )NrQ   r6  rh  s   %s:%s %d/%d%s (%4.2f%%)
s   %s:%s %d%s
)rM  rN  rK  r.   r5  rL  )rB   r_  rM  pcts       rC   r^  progress._printdebug  s    99$))#D$;D::$(("TZZ/CGGMM,::tXXtzz4EF
 GGMM/TZZxx,NNOrQ   )rP  r5  rK  rL  rN  r.   rM  )rQ   N)
r.   r   rL  r]   rM  r]   rN  rJ  rS   r   )rK  r|   r_  r]   rN  rJ  rS   r   )r   rQ   N)rb  r|   r_  r]   rN  rJ  rS   r   r  )r_  r]   rS   r   )rU   rV   rW   rX   r  r   rT  r[  rc   rc  rW  r^  r^   rR   rQ   rC   rI  rI    s    L	L
KK #$$ 	$
 $ $ 
$  CG	#	##	#2?	#		# HL22#(27D2	2
JPrQ   rI  c                X    U R                  SS5      =(       d    U R                  SS5      $ )zDhelper function to know if a repo should be created as general deltar     generaldeltas   usegeneraldeltar   r-   s    rC   gdinitconfigrm    s-     ==O4 %9 rQ   c                &    U R                  SS5      $ )zhelper function to know if incoming deltas should be optimized

The `format.generaldelta` config is an old form of the config that also
implies that incoming delta-bases should be never be trusted. This function
exists for this purpose.
r  rk  rl  r-   s    rC   gddeltaconfigro    s     ==O44rQ   c                  F    \ rS rSrSrSrS	S
S jjrSSS jjrS	SS jjrSr	g)simplekeyvaluefilei  zA simple file with key=value lines

    Keys must be alphanumerics and start with a letter, values must not
    contain '
' characterss   __firstlineNc                    Xl         X l        g r9   )r&   r  )rB   r&   r  r@  s       rC   r   simplekeyvaluefile.__init__  s    	rQ   c                   U R                   R                  U R                  5      n0 nU(       a?  U(       d!  [        S5      n[        R
                  " U5      eUS   SS X0R                  '   US	  [        S U 5       5      nU R                  U;   a-  [        S5      n[        R
                  " X@R                  -  5      eUR                  U5        U$ ! [         a/  n[        R
                  " [        R                  " U5      5      eSnAff = f)zRead the contents of a simple key-value file

'firstlinenonkeyval' indicates whether the first line of file should
be treated as a key-value pair or reuturned fully under the
__firstline key.s   empty simplekeyvalue filer   Nr~   c              3  x   #    U  H0  oR                  5       (       d  M  US S R                  SS5      v   M2     g 7f)Nr~      =r   )r   r   )rJ   lines     rC   rL   *simplekeyvaluefile.read.<locals>.<genexpr>  s0      5:Tjjl(Sb	a((Us   ::s   %r can't be used as a key)r&   	readlinesr  r   r   CorruptedStatefirstlinekeyr`   rc   r   r*   r   )rB   firstlinenonkeyvallinesr8  e
updatedicts         rC   r  simplekeyvaluefile.read
  s     ""499-23**1--#(8CR=A a	C  5: J   J.23**1/@/@+@AAHHZ    	C&&z'>'>q'ABB	Cs   /A C 
D
*DD
c                   / nUb  UR                  SU-  5        UR                  5        H  u  pEX@R                  :X  a%  SU R                  -  n[        R                  " U5      eUSS R                  5       (       d  Sn[        R                  " U5      eUR                  5       (       d  Sn[        R                  " U5      eSU;   a  S	n[        R                  " U5      eUR                  S
XE4-  5        M     U R                  U R                  SSS9 nUR                  SR                  U5      5        SSS5        g! , (       d  f       g= f)a   Write key=>value mapping to a file
data is a dict. Keys must be alphanumerical and start with a letter.
Values must not contain newline characters.

If 'firstline' is not None, it is written to file before
everything else, as it is, not in a key=value formNr  s   key name '%s' is reservedr   r   s1   keys must start with a letter in a key-value files+   invalid key name in a simple key-value filer   s(   invalid value in a simple key-value files   %s=%s
s   wbT)moder  rQ   )ru   rg   r{  r   r}  isalphaisalnumr&   r  r  r   )rB   rC  	firstliner}  rF  rK   r~  r  s           rC   r  simplekeyvaluefile.write)  s     LL9,-JJLDA%%%043D3DD,,Q//Qq6>>##H,,Q//99;;B,,Q//z?,,Q//LLqf,- ! XXdiieX=HHSXXe_% >==s   !D<<
E
)r  r&   r9   )r  r]   rS   r   F)r|  r   )r  Optional[bytes]rS   r   )
rU   rV   rW   rX   rY   r{  r   r  r  r^   rR   rQ   rC   rq  rq    s"    
 "L>& &rQ   rq  )s   debugobsolete   pulls   pushs   serve   unbundle_reportobsoletedsourcer  r  _reportnewcssourcec                p   ^  U 4S jnU VVs/ s H  u  p4X2" U5      4PM     nnn[        T U5        gs  snnf )aD  Invokes the registered file prefetch functions, allowing extensions to
ensure the corresponding files are available locally, before the command
uses them.

Args:
  revmatches: a list of (revision, match) tuples to indicate the files to
  fetch at each revision. If any of the match elements is None, it matches
  all files.
c                   > U (       a9  [        U [        R                  5      (       d   e[        R                  " U S 5      $ [	        T5      $ )Nc                    g r9   rR   )r  r   s     rC   rf  1prefetchfiles.<locals>._matcher.<locals>.<lambda>d  s    rQ   )r   r  basematcherrs  r  )r   rw   s    rC   _matcherprefetchfiles.<locals>._matcher_  s?    a!5!56666 $$Q(<==D>!rQ   N)fileprefetchhooks)rw   
revmatchesr  r  r   revbadmatchess   `     rC   prefetchfilesr  T  s;    " AKK
c8E?+
MKdM* Ls   2_reportstroubledchangesetsc                  ^ ^^^^^^^ U4S jn/ mUUUU 4S jnUU4S j5       nU" [         5      (       a  UU4S j5       n[        R                  " T [        R                  5      (       a@  T R                  R                  SS5      (       a  / SQmU4S jmT" T 5      mUUUU4S	 j5       nU" [        5      (       a  US
 5       n	UU4S j5       n
gg)zregister a callback to issue a summary after the transaction is closed

If as_validator is true, then the callbacks are registered as transaction
validators instead
c                .   > [        U4S jU  5       5      $ )Nc              3  F   >#    U  H  nTR                  U5      v   M     g 7fr9   )rM  )rJ   rB  txnnames     rC   rL   ;registersummarycallback.<locals>.txmatch.<locals>.<genexpr>~  s     DG&7%%f--Gs   !)r#  )sourcesr  s    rC   txmatch(registersummarycallback.<locals>.txmatch}  s    DGDDDrQ   c                  >^ ^^ TR                   m[        R                  " TR                  5       5      mUU U4S jnS[	        T5      -  nT(       a  TR                  X!5        OTR                  X!5        TR                  U5        U$ )zdecorator for report callbacks.c                ^   > T" 5       nT(       a  Uc   eUR                  T5      nT" X5        g r9   )filtered)rX  rw   r  r   reporefs     rC   wrapped?registersummarycallback.<locals>.reportsummary.<locals>.wrapped  s.    9D'''}}Z0NrQ   s   %02i-txnreport)r  weakrefrefrN  rv   addvalidatoraddpostcloseru   )	r   r  newcatr  r  as_validator
categoriesotrrw   s	   `  @@rC   reportsummary.registersummarycallback.<locals>.reportsummary  sj     __
++doo/0	 #S_4V-V-&!rQ   c                  > UR                   R                  SS5      nUR                   R                  SS5      nUR                   R                  SS5      nUR                   R                  SS5      nU(       d  U(       d  U(       aZ  SnU(       a  [        S5      U-  n[        S5      nT(       a  [        S	5      nU c   eU R                  R	                  XrX4U4-  5        g g )
Ns   changegroup-count-changesetsr   s   changegroup-count-revisionss   changegroup-count-filess   changegroup-count-headsrQ   s    (%+d heads)s2   added %d changesets with %d changes to %d files%s
s3   adding %d changesets with %d changes to %d files%s
)changesr   r   r.   r'   )	rw   rX  cgchangesetscgrevisionscgfilescgheadshtextr   r  s	           rC   reportchangegroup2registersummarycallback.<locals>.reportchangegroup  s    zz~~&EqIjjnn%CQG**..!;Q?**..!;Q?;'E/*W4JKCOP###GGNN3e!LLM +2rQ   c                p  > [         R                  " X5      n[        UR                  R	                  SS5      5      nU(       a'  U R
                  R                  [        S5      U-  5        U(       aE  [        S5      nT(       a  [        S5      nU R
                  R                  U[        U5      -  5        g g )Ns
   obsmarkersrR   s   %i new obsolescence markers
s   obsoleted %i changesets
s   obsoleting %i changesets
)r   getobsoletedrv   r  r   r.   r'   r   )rw   rX  	obsoleted
newmarkersr   r  s        rC   reportobsoleted0registersummarycallback.<locals>.reportobsoleted  s    ,,T6IRZZ^^M2>?Jq!ABZOP459:CsS^34	 rQ   rI  s   evolution.report-instabilities))   orphanr  )s   phase-divergents   phasedivergent)s   content-divergents   contentdivergentc           	        > U R                   R                  n0 nT H2  u  p4[        [        [        R
                  " X5      5      U-
  5      X#'   M4     U$ r9   )r   r   rv   rd   r   r   )rw   r  countsinstabilityrT  instabilitytypess        rC   getinstabilitycounts5registersummarycallback.<locals>.getinstabilitycounts  sP    ~~22HF'7#&)((67(B'# (8 MrQ   c                   > T" U 5      nT H>  u  p4X#   T	U   -
  n[        XS5      nU(       d  M#  U R                  R                  U5        M@     g r9   )getinstabilitymessager.   r   )
rw   rX  newinstabilitycountsr  rT  deltar   r  r  oldinstabilitycountss
          rC   reportnewinstabilities7registersummarycallback.<locals>.reportnewinstabilities  sT    #7#= '7#(5*;78  ,E?3GGLL% (8rQ   c                   UR                   R                  S[        U 5      5      nU R                  5       nU[        U5      :  a  g[        R
                  " XS9nU(       Ga	  XR                  5          XR                  5          peXV:X  a  UnOSXV4-  n[        U R                  SU5      5      n[        U R                  SU5      5      n	U(       d  U	(       d  [        S5      U-  n
OjU(       a  U	(       a  [        S5      n
XX4-  n
OJU(       a  [        S	5      n
XU4-  n
O1U	(       a  [        S
5      n
XU	4-  n
OSn[        R                  " U5      eU R                  R                  U
5        UR                   R                  SS5      nUR                  SX,5      nU R                  nU Vs/ s H  oU;  d  M
  UPM     nnU(       a*  Sn
U R                  R                  U
[        U5      -  5        ggs  snf )z3Report the range of new revisions pulled/unbundled.   origrepolenN)starts   %s:%ss   %ld and draft()s   %ld and secret()s   new changesets %s
s*   new changesets %s (%d drafts, %d secrets)
s   new changesets %s (%d drafts)
s   new changesets %s (%d secrets)
s   entered unreachable conditions   revduplicatesrR   s   (%d: + %ld) and obsolete()s*   (%d other changesets obsolete on arrival)
)r  r   rv   rN  r"   spansetrA  rk  r  r   r   r}  r.   r'   r   )rw   rX  origrepolenr  r  minrevr   r  draftrs   r   errormsg
duplicatesobsaddedr   r  extinctaddeds                    rC   reportnewcs,registersummarycallback.<locals>.reportnewcs  s    **..TCK??$Dc$i' ##D<D!%hhj!14
3C#%H'6*::HDII&8$?@TYY':DAB23h>CvJKCe44C>?Ce,,C?@Cf--C?H00::s# (8"=Jyy-{H B'/?x!B;AxL? EsS%667  @s   )	G06G0c                  >^ UR                   R                  S[        U 5      5      m/ nUR                   R                  S/ 5       H9  u  nu  pEU[        R                  :w  a  M  UR                  U4S jU 5       5        M;     U(       d  g[        S5      nT(       a  [        S5      nU R                  R                  U[        U5      -  5        g)zNReport statistics of phase changes for changesets pre-existing
pull/unbundle.
r  s   phasesc              3  6   >#    U  H  oT:  d  M
  Uv   M     g 7fr9   rR   )rJ   r  r  s     rC   rL   Fregistersummarycallback.<locals>.reportphasechanges.<locals>.<genexpr>	  s      Jk8Is   		Ns   %d local changesets published
s&   %d local changesets will be published
)	r  r   rv   r   publicr  r   r.   r'   )	rw   rX  	publishedr  r  r  r   r  r  s	          @rC   reportphasechanges3registersummarycallback.<locals>.reportphasechanges	  s    
 **..TCKI$&JJNN9b$A js&--'   J JJ %B 67CBCGGNN3Y/0rQ   N)r  r   r<  r=  r.   r   r  )rw   r  r  r  r  r  r  r  r  r  r  r  r  r  r  s   ````       @@@@rC   registersummarycallbackr  t  s    E J 2 N N %&&			5 
		5 h'' 
''

: 
	  4D9			& 
		& !""	.	8 
.	8` 
	1 
	1i #rQ   c                .    U S:  a  [        S5      X4-  $ g)zfunction to return the message to show warning about new instabilities

exists as a separate function so that extension can wrap to show more
information like how to fix instabilitiesr   s   %i new %s changesets
Nr   )r  r  s     rC   r  r  !	  s$    
 qy*+u.BBB rQ   c                    [        U5      U::  d  U R                  R                  (       a  SR                  S U 5       5      $ SR                  S US U  5       5      n[	        S5      U[        U5      U-
  4-  $ )Nr6  c              3  8   #    U  H  n[        U5      v   M     g 7fr9   r   rJ   hs     rC   rL    nodesummaries.<locals>.<genexpr>,	  s     15aq5   c              3  8   #    U  H  n[        U5      v   M     g 7fr9   r  r  s     rC   rL   r  -	  s     <(;1eAhh(;r  s   %s and %d others)rv   r.   rv  r   r   )rw   r`  maxnumnodesr  s       rC   nodesummariesr  *	  sg    
5z[ DGGOOyy15111II<l{(;<<E !UCJ,D$EEErQ   c                0   US;   a  gU R                  U5      nUR                  5       nU Hh  nUR                  XsS9n[        U5      S:  d  M#  [	        S5      n	X-  n	[	        S5      n
U
[        U5      [        X5      4-  n
[        R                  " XS9e   g)z-check that no named branch has multiple heads)s   strips   repairN)closedr   s'   rejecting multiple heads on branch "%s"s   %d heads: %sr  )r  	branchmapbranchheadsrv   r   r  r   r  )rw   rX  r   accountclosedr  visiblebmr^  headsr   r   s              rC   enforcesingleheadr  1	  s    $$mmJ'G				Bt:u:>>?CKC_%DSZt!;<<D++c-- rQ   c                    U $ )zAllow extensions to wrap the sink returned by convcmd.convertsink()
before it is used, whether or not the convert extension was formally loaded.
rR   )sinks    rC   wrapconvertsinkr  C	  s	     KrQ   c           	        U(       d  U $ U R                   (       a!  U R                  R                  SS5      (       d  U $ U R                   S;  a  U $ [        5       nU H?  n [        R
                  " U5      nUR                  [        R                  " U5      5        MA     U(       d  U $ [        X5      nU(       d  U $ US:X  ao  U R                  5       nSR                  U Vs/ s H  n[        R                  " Xx   5      PM     sn5      n	U R                  R                  [!        S5      U	-  5        U R#                  SU5      $ ! [        R                   a     M  f = fs  snf )a  parse the user specs and unhide changesets whose hash or revision number
is passed.

hiddentype can be: 1) 'warn': warn while unhiding changesets
                   2) 'nowarn': don't warn while unhiding changesets

returns a repo object with the required changesets unhidden
rI  s   directaccess)r     visible-hiddenr   s   , s=   warning: accessing hidden changesets for write operation: %s
r  )r  r.   r   rd   r    r  r   r  rc   gethashlikesymbols_getrevsfromsymbolsrN  r   r   r   r   r   r  )
rw   r  
hiddentypesymbolsr  r  r  r  r  revstrs
             rC   unhidehashlikerevsr  J	  s:    ??$''"4"4# # ==eG	##D)D 	z44T:;  t-DW E1X--dg6EF# 		
 ==*D115  		 Fs    E!"EEEc                   [        5       nU R                  5       nUR                  nU R                  n[        U5      nU R                  R                  SS5      nU Hp  n [        U5      n	X::  a!  U(       d  M  X;  a  UR                  U	5        M5    [        X85      nUc  MG  UR                  U5      n
X;  d  M_  UR                  U
5        Mr     U$ ! [         a     NLf = f! [        R                  [        R                  4 a    Sn Nlf = f)zgparse the list of symbols and returns a set of revision numbers of hidden
changesets present in symbolsrI  s   directaccess.revnumsN)rd   rN  r   rv   r.   r   r|   re   r   rW  r   rq  r   r  )rw   r  r  r  unficlr   tiprevallowrevnumsr  rz   r  s              rC   r  r  	  s     5D??D^^F	B[F77%%o7NOL
	AA{#{ 	&t/A =**Q-C}+ . K  		
 !!5#8#89 	A	s*    C9CC"
CC"&D
Dc                6    U R                  [        U5      5      $ )zxSelect revisions reachable by a given bookmark

If the bookmarked revision isn't a head, an empty set will be returned.
)r  format_bookmark_revspec)rw   marks     rC   bookmarkrevsr	  	  s    
 99,T233rQ   c                >    SU -   n [         R                  " SU U U 5      $ )zKBuild a revset expression to select revisions reachable by a given
bookmarks   literal:sm   ancestors(bookmark(%s)) - ancestors(head() and not bookmark(%s)) - ancestors(bookmark() and not bookmark(%s)))r    r  )r  s    rC   r  r  	  s1     D  	6 	 rQ   c                $    US/:H  =(       d    X;   $ )zCheck if username is a member of userlist.

If userlist has a single '*' member, all users are considered members.
Can be overridden by extensions to provide more complex authorization
schemes.
   *rR   )r.   usernameuserlists      rC   ismemberr  	  s     v5!55rQ      RESOURCE_HIGHr|  RESOURCE_MEDIUMRESOURCE_LOW)s   lows   mediums   highzDict[bytes, int]RESOURCE_MAPPINGDEFAULT_RESOURCEc                `   ^  U 4S jnUb  U" SSU-  5      nUb  U$ U" SS5      nUb  U$ [         $ )zhreturn the resource profile for a dimension

If no dimension is specified, the generic value is returnedc                N   > TR                  XSS9n[        R                  U5      $ )Ns   default)r6   )r   r  r   )sectionr^  
value_namer.   s      rC   r   $get_resource_profile.<locals>.config	  s&    YYwjYA
##J//rQ   s   usages   resources.%ss	   resources)r  )r.   	dimensionr   rJ  s   `   rC   get_resource_profiler  	  sI    0 x9!<=L8\*ErQ   r9   )r.   r   rS   r   )r.   r   r   zCallable[[], int]rS   r|   )r   r]   rS   r   r   )r.   r   r   r]   rS   r   )r.   r   rS   zTuple[bool, bool]r  )r   r   )r  Iterable[int]rS   r]   )FNF)r0  r   r1  zOptional[List[bytes]]r2  r   rS   Iterable[bytes])rS   r]   )rS   r|   )r.   r   r  r|   r;  r]   rS   r]   rj  )rS  r]   rS   r   )r   N)r;  r]   rr  r|   )rx  r]   rS   r   )rx  r]   )r  r]   rS   zerror.FilteredRepoLookupError)r   Nr  )   i   )r  r|   r  r|   rS   r  )FN)r  r   r  r  rS   typelib.UiPathFn)rn   r]   r  r   rS   r   )r  r  rS   r  )rR   NFr  N)r  r   r6   r]   )rS   zmatchmod.exactmatcher)r  r]   r   r]   rS   r]   )r.   r   )r.   r   r  r]   rS   r]   )NNFNTr  )NN)rS  r]   r  r   rS   r|   )g        )r|  ro  rS   r|   )rS   zFTuple[List[bytes], List[bytes], List[bytes], List[bytes], List[bytes]])r  r   rS   zDict[bytes, bytes])r.   r   r  r   r  r  rS   r   r  r  )rB  r]   )rQ   F)r  r]   r  r   rS   r   )r  r|   r  r]   rS   r  )   )r  r|   rS   r]   )r   r]   rS   r   )r  r]   )rS   zSet[int])r  r]   )r  r]   rS   r]   )r.   r   r  r]   r  r  rS   r   )r.   r   r  r  rS   r|   )
__future__r   r  r   r  r!  r  r  r7  typingr  r   r   r   r   r   r	   r
   r   i18nr   r;  r   r   r   r   r   
thirdpartyr   TYPE_CHECKINGr4  r   r  r   r   r   r  r   r   r   r   r   r   r   r  r    r!   r"   r#   r$   r%   r&   
interfacesr'   istatusutilsr(   r)   r*   r   r+   scmplatformr,   r.   uimod	importmodr/   
importrustrm  termsizer  Statusrp   r{   r   r   r   r   r   r   r  r  r   r   r/  r>  r@  rC  rB  rW  r[  ru  ry  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  rf  rr  r  rt  rw  rx  r  r  r  r  r  r  r  r  r  r  r  r  rG  rI  rm  ro  rq  r  r  r  r  hooksr  r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r  r  r  rR   rQ   rC   <module>r1     s   #    	  	   	 	 	    
    * *  +)	 

9
%xd3
 dGW^^ G  G>34,(w t
4

/ 4 (-# $#L># '+	22 %2 	2
 2j=+@J&Z
@+F.2%4D< +.$''T& !&)-)) ') 	)X::.::F, 
	
# 	#
 #P 
	
	K 		K
 	K
.
3!"H4 4 t 
tx 
K K 	K 	K\ F#7K#7L9I2 +\@ $$ $ 
$ 
$B-D&I
-(/&9 9x $\) \)~AHBP BPJ5E& E&P'   # K +4 JJL  $( D ' ;@j1j137j1	j1ZCF.$22j F46 s  c  & "  ( # ' 04,rQ   