HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib64/python2.7/site-packages/mercurial/crecord.pyo
�
1�3\c@@s+ddlmZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZm
Z
mZddlmZejZejejd�ed�Zed	�Zed
�ZyddlZej
WnBek
r#yddlZej
Wq$ek
reZq$XnXde
jfd��YZd
�Zdefd��YZdee fd��YZdefd��YZ!defd��YZ"defd��YZ#dd�Z%dd�Z&d�Z'dd�Z(ied�d6ed�d6ed �d6Z)d!efd"��YZ*dS(#i(tabsolute_importNi(t_(tencodingterrortpatchtscmutiltutil(t
stringutilus�# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed from the patch.
s,#
# If the patch applies cleanly, the edited hunk will immediately be
# added to the record list. If it does not apply cleanly, a rejects file
# will be generated. You can use that when you try again. If all lines
# of the hunk are removed, then the edit is aborted and the hunk is left
# unchanged.
s�#
# If the patch applies cleanly, the edited patch will immediately
# be finalised. If it does not apply cleanly, rejects files will be
# generated. You can use those when you try again.
t
fallbackerrorcB@seZdZRS(sDError that indicates the client should try to fallback to text mode.(t__name__t
__module__t__doc__(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRDscC@sto|jd�dkS(s�Return True if the user wants to use curses

    This method returns True if curses is found (and that python is built with
    it) and that the user has the correct flag for the ui.
    t
chunkselectortcurses(R
t	interface(tui((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytcheckcursesIst	patchnodecB@sYeZdZd�Zd�Zd�Zd�Zd�Zd�Ze	d�Z
d�ZRS(	sVabstract class for patch graph nodes
    (i.e. patchroot, header, hunk, hunkline)
    cC@std��dS(Ns&method must be implemented by subclass(tNotImplementedError(tself((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
firstchildVscC@std��dS(Ns&method must be implemented by subclass(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt	lastchildYscC@std��dS(s8Return a list of all of the direct children of this nodes&method must be implemented by subclassN(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytallchildren\scC@std��dS(s�
        Return the closest next item of the same type where there are no items
        of different types between the current item and this closest item.
        If no such item exists, return None.
        s&method must be implemented by subclassN(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytnextsibling`scC@std��dS(s�
        Return the closest previous item of the same type where there are no
        items of different types between the current item and this closest item.
        If no such item exists, return None.
        s&method must be implemented by subclassN(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprevsiblinghscC@std��dS(Ns&method must be implemented by subclass(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
parentitempscC@sy
|j}Wntk
r&t}nX|r�|r�|j�}|dkr~y|j�j�}Wq~tk
rzd}q~Xn|S|j�}|dk	r�|S|j�}|dk	r�|Sy<|j�j�}|dk	r�|S|j�j�j�SWntk
r
dSXdS(sx
        Try to return the next item closest to this item, regardless of item's
        type (header, hunk, or hunkline).

        If skipfolded == True, and the current item is folded, then the child
        items that are hidden due to folding will be skipped when determining
        the next item.

        If it is not possible to get the next item, return None.
        N(tfoldedtAttributeErrortFalseRtNoneRR(Rt
skipfoldedt
itemfoldedtnextitemtitem((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR ss2





cC@sx|j�}|dk	rn|j�}|dk	rg|jrg|j�}|dk	r`|jr`|S|Sqn|Sn|j�S(s�
        Try to return the previous item closest to this item, regardless of
        item's type (header, hunk, or hunkline).

        If it is not possible to get the previous item, return None.
        N(RRRRR(RRtprevsiblinglastchildtprevsiblinglclc((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprevitem�s	

(R	R
RRRRRRRtTrueR R$(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRQs						.RcB@seZdZd�ZRS(s8
    list of header objects representing the patch.
    cC@s+|j|�x|D]}||_qWdS(N(textendR(Rt
headerlisttheader((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt__init__�s

(R	R
RR)(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�stuiheadercB@s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
sIpatch header

    xxx shouldn't we move this to mercurial/patch.py ?
    cC@sb||_t|_t|_t|_d|_t|_g|j	D]}t
||�^q@|_	dS(N(tnonuiheaderR%tappliedRtpartialRRRt
neverunfoldedthunkstuihunk(RR(th((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR)�s						cC@s t�}|j|�|j�S(N(tstringiotprettytgetvalue(Rtx((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt	prettystr�s	
cC@sNt|j�}|jj|�}||dkrF|j|d}|SdSdS(Ni(tlenRtindexR(Rtnumheadersinpatchtindexofthisheadert
nextheader((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�scC@s;|jj|�}|dkr3|j|d}|SdSdS(Nii(RR8R(RR:tpreviousheader((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�s
cC@sdS(sj
        there is no 'real' parent item of a header that can be selected,
        so return None.
        N(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�scC@s(t|j�dkr |jdSdSdS(sDreturn the first child of this item, if one exists.  otherwise None.iN(R7R/R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�scC@s(t|j�dkr |jdSdSdS(sCreturn the last child of this item, if one exists.  otherwise None.ii����N(R7R/R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRscC@s|jS(s8return a list of all of the direct children of this node(R/(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR	scC@st|j|�S(N(tgetattrR+(Rtname((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt__getattr__
s(R	R
RR)R6RRRRRRR?(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR*�s			
					t
uihunklinecB@sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s#represents a changed line in a hunkcC@s(||_t|_||_t|_dS(N(tlinetextR%R,thunkRR(RRARB((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR)s			cC@s|jS(N(RA(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR6scC@sWt|jj�}|jjj|�}||dkrO|jj|d}|SdSdS(Ni(R7RBtchangedlinesR8R(Rtnumlinesinhunktindexofthislinetnextline((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRscC@sA|jjj|�}|dkr9|jj|d}|SdSdS(Nii(RBRCR8R(RREtpreviousline((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR(s
cC@s|jS(s%return the parent to the current item(RB(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR0scC@sdS(sDreturn the first child of this item, if one exists.  otherwise None.N(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR4scC@sdS(sCreturn the last child of this item, if one exists.  otherwise None.N(R(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR9s(
R	R
RR)R6RRRRR(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR@s				
			R0cB@s�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
e
Zd�Zd
�Zd�Zd�ZRS(s:ui patch hunk, wraps a hunk and keep track of ui behavior icC@se||_g|jD]}t||�^q|_||_|j|_t|_t|_	t
|_dS(N(t_hunkRBR@RCR(tremovedtoriginalremovedR%RR,RR-(RRBR(tline((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR)Bs	(			cC@sWt|jj�}|jjj|�}||dkrO|jj|d}|SdSdS(Ni(R7R(R/R8R(Rtnumhunksinheadertindexofthishunktnexthunk((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRQscC@sA|jjj|�}|dkr9|jj|d}|SdSdS(Nii(R(R/R8R(RRMtprevioushunk((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR[s
cC@s|jS(s%return the parent to the current item(R((R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRcscC@s(t|j�dkr |jdSdSdS(sDreturn the first child of this item, if one exists.  otherwise None.iN(R7RCR(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRgscC@s(t|j�dkr |jdSdSdS(sCreturn the last child of this item, if one exists.  otherwise None.ii����N(R7RCR(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRnscC@s|jS(s8return a list of all of the direct children of this node(RC(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRuscC@s�tg|jD]+}|jr
|j�ddkr
|^q
�}tg|jD]+}|jrN|j�ddkrN|^qN�}||fS(schangedlines -> (n+,n-)it+t-(R7RCR,R6(Rtltaddtrem((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytcountchangesys
%%cC@s|j|j}t|j�t|j�|}|jrY|jddkrY|d8}n||j}||j}|j|j}}|dkr�|dkr�|d8}n|dkr�|dkr�|d8}q�nd|||||jo�d|jf}|S(Ni����s\ No newline at end of file
iis@@ -%d,%d +%d,%d @@%s
t (	RJRIR7tbeforetaftertaddedtfromlinettolinetproc(Rtremovedconvertedtocontextt
contextlentfromlenttolenRZR[t
fromtoline((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
getfromtoline�s"



cC@s�|j�\|_|_|j|j��g}x^|jD]S}|j�}|jrf|j|�q;|ddkr;|jd|d�q;q;W|jdj	|j
||j��dS(NiRQRVit(RURYRItwriteRbRCR6R,tappendtjoinRWRX(Rtfpthunklinelisttchangedlinetchangedlinestr((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRd�s	cC@s t�}|j|�|j�S(N(R2R3R4(RR5((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR6�s	
cC@s$g}g}x�|jD]�}|j}|jry|ddkrR|j|d�q�|ddkr�|j|d�q�q|ddkr|j|d�|j|d�qqWg|D]}d|^q�g|D]}d|^q�}|j}tj|j|j|j	|j
|j||j�S(sSreturn a recordhunk which is the reverse of the hunk

        Assuming the displayed patch is diff(A, B) result. The returned hunk is
        intended to be applied to B, instead of A.

        For example, when A is "0
1
2
6
" and B is "0
3
4
5
6
", and
        the user made the following selection:

                 0
            [x] -1           [x]: selected
            [ ] -2           [ ]: not selected
            [x] +3
            [ ] +4
            [x] +5
                 6

        This function returns a hunk like:

                 0
                -3
                -4
                -5
                +1
                +4
                 6

        Note "4" was first deleted then added. That's because "4" exists in B
        side and "-4" must exist between "-3" and "-5" to make the patch
        applicable to B.
        iRPiRQs-%ss+%s(
RCRAR,ReRHtpatchmodt
recordhunkR(R[RZR\RWRX(RtdelstaddsRKttextRRRBR1((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytreversehunk�s 		8	cC@st|j|�S(N(R=RH(RR>((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR?�scC@sd|j�|jfS(Ns<hunk %r@%d>(tfilenameRZ(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt__repr__�s(R	R
Rt
maxcontextR)RRRRRRRURbRdR3R6RpR?Rr(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR0>s"		
										0	c
C@s]t|�}g|D]}t|tj�r|^q}t|�dkrSgifSg|D]}t|�^qZ}|||d|�}g}	x�|D]�}
|
jr�|
j�s�tg|
jD]}|jr�|^q��dkr�|	j	|
�d}xY|
jD]K}|jr4|	j	|�|rH|j
|7_
qHq�||j|j7}q�Wq�q�W|	|fS(s:interactively filter patch chunks into applied-only chunksit	operation(
tlistt
isinstanceRkR(R7R*R,tspecialR/ReR[RIRY(
RtchunksRRttctheadersR1t	uiheaderstrettappliedhunklistthdrt	fixoffsetthnk((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytfilterpatch�s&+

	=
	
cC@s�|jtd��t|||�}t�}}tjtd�rYtjtj�}nz/t	j
|j�|jdk	r�|j�nWd||k	r�tjtj|�nX|jS(sk
    curses interface to get selection of chunks, and mark the applied flags
    of the chosen chunks.
    sstarting interactive selection
tSIGTSTPN(RdRtcurseschunkselectortobjectRtsafehasattrtsignalt	getsignalR�R
twrappertmaintinitexcRtopts(RR'RtRtorigsigtstptsentinel((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR
s
c@s��fd�}|S(Nc@s��||�S(N((targstkwargs(tfttestfn(s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytu"s((R�R�R�((R�R�s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
testdecorator!scC@s�t|||�}|r�tjj|�r�t|d�}g|j�D]}|jd�^qF}|j�x/tr�|j	|j
d�dt�rnPqnqnWn|jS(si
    test interface to get selection of chunks, and mark the applied flags
    of the chosen chunks.
    trbs
ittest(R�tostpathtexiststopent	readlinestrstriptcloseR%thandlekeypressedtpopR�(R�RR'RtRttestfR5ttestcommands((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyttestchunkselector&s(
	sSelect hunks to applytapplysSelect hunks to discardtdiscardsSelect hunks to recordR�c	B@s�eZd+d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d+d�Zd�Zd+ed
�Zd�Zd+d+d+d+d+eeed�Zd�Zd�Zd�Zd�Zeeed�Zeeed�Zeed�Zeed�Zd+eeed�Zd�Zd�Zed�Z d+eed�Z!d�Z"d+d+d+d+d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d+ed&�Z+d'�Z,ed(�Z-d)�Z.d*�Z/RS(,cC@sQt|�|_||_i|_d|_g|_x1|D])}|jj|�|jj|j	�q:Wi|_
i|_tj
|jjdd��}|tk	|_|jd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_t|_|tkrDtj d|��n||_!dS(	NRtcoloriiiiRcsunexpected operation: %s("RR'RR�Rterrorstrt	chunklistReR&R/t
colorpairstcolorpairnamesRt	parsebooltconfigRtusecolortcurrentselecteditemtselecteditemstartlinetselecteditemendlinetheaderindentnumcharsthunkindentnumcharsthunklineindentnumcharstfirstlineofpadtoprinttnumpadlinestnumstatuslinestlinesprintedtopadsofartcommenttextR%twaslasttoggleallappliedt_headermessagesRtProgrammingErrorRt(RR'RRtR1tuicolor((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR)<s8				
														cC@s7|j}|j�}|dkr*|}n||_dS(sM
        try to select the previous item to the current item that has the
        most-indented level.  for example, if a hunk is selected, try to select
        the last hunkline of the hunk prior to the selected hunk.  or, if
        the first hunkline of a hunk is currently selected, then select the
        hunk itself.
        N(R�R$R(RtcurrentitemR ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytuparrowevent~s
		cC@s\|j}|j�}|dkr0|j�}n|dkrE|}n||_|j�dS(s�
        select (if possible) the previous item on the same level as the
        currently selected item.  otherwise, select (if possible) the
        parent-item of the currently selected item.
        N(R�RRRtrecenterdisplayedarea(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytuparrowshiftevent�s			cC@s7|j}|j�}|dkr*|}n||_dS(sg
        try to select the next item to the current item that has the
        most-indented level.  for example, if a hunk is selected, select
        the first hunkline of the selected hunk.  or, if the last hunkline of
        a hunk is currently selected, then select the next hunk, if one exists,
        or if not, the next header if one exists.
        N(R�R R(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytdownarrowevent�s
			cC@s�|j}|j�}|dkrTy|j�j�}WqTtk
rPd}qTXn|dkri|}n||_|j�dS(s�
        select (if possible) the next item on the same level as the currently
        selected item.  otherwise, select (if possible) the next item on the
        same level as the parent item of the currently selected item.
        N(R�RRRRR�(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytdownarrowshiftevent�s	

		c@s�|j��fd�}�j�}x)|dk	rO||�rO|j�}q'W|dkre�}n1|j�}|dk	r�|jr�|j|�n||_|j�dS(Nc@st|t���S(N(Rvttype(R!(R�(s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt<lambda>�Rc(R�R RRRttogglefoldedR�(RtsametypeR tparent((R�s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytnextsametype�s			cC@sP|j}|j�}|jr.|j|�n|dkrC|}n||_dS(sL
        select (if possible) the first of this item's child-items.
        N(R�RRR�R(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytrightarrowevent�s			cC@s�|j}t|t�s8|js8|jd|�dSn|j�}|dkru|}|jsu|jd|�qun||_dS(s�
        if the current item can be folded (i.e. it is an unfolded header or
        hunk), then fold it.  otherwise try select (if possible) the parent
        of this item.
        R!N(R�RvR@RR�RR(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytleftarrowevent�s			cC@st|j}t|t�r8|js8|jd|�dSnx,trf|j�}|dkr]Pq;|}q;W||_dS(s
        select the header of the current item (or fold current item if the
        current item is already a header).
        R!N(R�RvR*RR�R%RR(RR�R ((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytleftarrowshiftevents			
cC@s�|j}|j}|j}||j|jd}|d}|d}||krg|j||�n ||kr�|j||�ndS(s6scroll the screen to fully show the currently-selectediiN(R�R�R�tyscreensizeR�tscrolllines(Rtselstarttselendtpadstarttpadendtpadstartbufferedtpadendbuffered((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytupdatescrolls			

cC@sW|j|7_|jdkr*d|_n|j|jdkrS|jd|_ndS(s>scroll the screen up (down) by numlines when numlines >0 (<0).iiN(R�R�(Rtnumlines((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�0s
cC@s7|dkr|j}n|j|_t|t�r�t|_|jr�x}|jD],}t|_x|j	D]}t|_qiWqPWq3x�|jD]5}t|_t|_x|j	D]}t|_q�Wq�Wnjt|t
�r�t|_x|j	D]}|j|_q�Wg|jjD]}|j^q}t|k}t|k}g|jjD]}|j^qH}t|k}|r�|jj�s�t|j_t|j_q�q3t|j_|p�||j_nut|t
�r3g|jj	D]}	|	j^q�}t|k}t|k}|r(t|j_t|j_n9|rIt|j_t|j_nt|j_t|j_g|jjjD]}|j^qq}
t|
k}t|
k}g|jjjD]}|j^q�}
t|
k}|r|jjj�s0t|jj_t|jj_q0q3t|jj_|p$||jj_ndS(s�
        toggle the applied flag of the specified item.  if no item is specified,
        toggle the flag of the currently selected item.
        N(RR�R,RvR*RR-R/R%RCR0R(RwR@RB(RR!R�thunklinetsiblingappliedstatustallsiblingsappliedtnosiblingsappliedtsiblingspartialstatustsomesiblingspartialtlntparentsiblingsappliedtnoparentsiblingsappliedtallparentsiblingsappliedtparentsiblingspartialtsomeparentsiblingspartial((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyttoggleapply8sr
						"""""cC@sw|jr9xZ|jD]}|jr|j|�qqWn-x*|jD]}|jsC|j|�qCqCW|j|_dS(s%toggle the applied flag of all items.N(R�R'R,R�(RR!((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt	toggleall�s			cC@s�|dkr|j}n|s6t|t�r�|jr�t|t�s[|j�|_}n|jrpt|_nt|t�r�x$|j�D]}|j|_q�Wq�nt|tt	f�r�|j|_ndS(sEtoggle folded flag of specified item (defaults to currently selected)N(
RR�RvR*R.RRRRR0(RR!t
foldparenttchild((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR��s	cC@s_|j�\}}|j}|jd�}tj|�}||||d}|d|dS(s�
        add whitespace to the end of a string in order to make it fill
        the screen in the x direction.  the current cursor position is
        taken into account when making this calculation.  the string can span
        multiple lines.
        iiRVs
(tgetyxtxscreensizet
expandtabsRtcolwidth(Rtinstrtwindowtytxstarttwidthtstrwidtht	numspaces((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytalignstring�s	cC@s�|jd�}tjdd�|jd��}|d
k	rE|}n�|d
k	ra|j|}ng|d
krvd}n|d
kr�d}n||f|jkr�|j||f}n|j||�}|d
kr�g}n|dkrxQ|D]}||O}q�Wn6x3tj	tj
fD]}||kr||O}qqW|jj�\}
}d}|
r�t
|�}|jd�}t
|�}||}n|r�|j||�n||7}|
r|tjB}|r�x*t|�D]}|jtj|�q�Wn|d	|7}n|	r\|r=|jd|�}|j||�n|j||�}||7}n|t
|�|j}|j|7_|S(s
        print the string, text, with the specified colors and attributes, to
        the specified curses window object.

        the foreground and background colors are of the form
        curses.color_xxxx, where xxxx is one of: [black, blue, cyan, green,
        magenta, red, white, yellow].  if pairname is provided, a color
        pair will be looked up in the self.colorpairnames dictionary.

        attrlist is a list containing text attributes in the form of
        curses.a_xxxx, where xxxx can be: [bold, dim, normal, standout,
        underline].

        if align == True, whitespace is added to the printed string such that
        the string stretches to the right border of the window.

        if showwhtspc == True, trailing whitespace of a string is highlighted.
        is[\x00-\x08\x0a-\x1f]cS@sdtt|j��d�S(Nt^i@(tchrtordtgroup(tm((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR��Rcs
i����iRcs 
RVN(R�tretsubtstripRR�R�tgetcolorpairR
tA_UNDERLINEtA_BOLDtchunkpadR�R7R�taddstrt	A_REVERSEtrangetaddchtACS_CKBOARDR�R�R�(RR�Rotfgcolortbgcolortpairtpairnametattrlistttowintalignt
showwhtspct	colorpairttextattrR�R�tttoriglentstrippedlentnumtrailingspacestwscolorpairtitextrawhitespacetlinesprinted((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprintstring�s^					




c	C@s�|jj}td�}td�}tt|�t|��}d||rQ|n|f}t|jdtd�td�td�td�|td	�g}|S(
s-> [str]. return segmentssspace/enter: selectsspace/enter: deselects%-*sRQs[x]=selected **=collapseds
c: confirmsq: aborts arrow keys: move/expand/collapses?: help(R�R,RtmaxR7R�Rt(Rtselectedtspaceselectt
spacedeselecttspacelent
selectedlabeltsegments((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt_getstatuslinesegmentss
				c	C@sH|jdk	r'|jtd�g}n�|j�}|j}g}|}x�|D]�}tj|�}dd|o}|ddk}||t|�|kr�|j|�|}qO|dc||7<||t|�7}qOWt|�|j	krt|�|_	|j
j|j	|j�ng|D]}tj
||jd�^q%S(s<() -> [str]. return short help used in the top status windowsPress any key to continueRViis-[i����N(R�RRRR�RR�R7ReR�t	statuswintresizeRtellipsis(	RtlinesRR�t	lastwidthtstwtsepRR((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt_getstatuslines+s$	

	cC@s�|jj�|jj�|j}y>x*|j�D]}||j|dd�q3W|jj�Wntjk
rwnX|jdk	r�dSyJ|j
�|j�|jj|jd|j
d|j|j
|j�Wntjk
r�nXdS(NRtlegendi(RteraseR�RR$trefreshR
RR�Rt	printitemR�R�R�R�R�(RRRK((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytupdatescreenCs(

	

	
cC@s�|jr4t|t�r+|jr+d}q:d}nd}yi|jr||d7}t|t�r�|j}||d7}q�n&|d7}t|t�r�|d7}nWntk
r�|d7}nX|S(sx
        create a string to prefix a line with which indicates whether 'item'
        is applied and/or folded.
        s[~]s[x]s[ ]s**RVs  (R,RvR@R-RR*t
changetypeR(RR!tcheckboxt
filestatus((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytgetstatusprefixstring^s"				
	

c	C@s�d}|j�}|jj|�}|dkri|jri||j|jd|jd|dt�7}n|jd|r~dp�dd	t	j
g�}d}	|j|�}
|js�|r�|jd
�}|
|d}n|
|j
�}||j|j|d|d|�7}|js|r�t|�dkr�xR|dD]C}
d
|	t|
�|
}||j|j|d|d|�7}q:Wq�n|S(s�
        print the header to the pad.  if countlines is True, don't print
        anything, but just count the number of lines which would be printed.
        RciRRRR>RtnormalRs
RiRV(R6R�R8RRR�R�RR�R
R�R-tsplitRqR7(RR(RRt
ignorefoldingtoutstrRot
chunkindexR	tindentnumcharsR+ttextlisttlinestrRK((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprintheaders.
c
C@sid}|jjj|�}|dkrV||j|jd|jd|dt�7}n|jd|rkdpndd	tj	g�}|j
|�}d|j|}	d
|j�j
d�}
||j|j|	d|dt�7}||j|j|
d|d|�7}|jr|r|SxK|jD]@}d|jt|�|}||j|j|d|�7}q!W|S(
s!includes start/end line indicatorRciRVRRR>RR.Rs   s
R(R(R/R8RR�R�RR�R
R�R-R�RbR�RRWR�R7(
RRBRRR0R1t	hunkindexR	R+t
lineprefixtfrtolineRKR5((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprinthunklinesbefore�s(

#cC@s{d}|jr|r|S|j|�}xK|jD]@}d|jt|�|}||j|j|d|�7}q3W|S(NRcRVR(RR-RXR�R7RR�(RRBRR0R1R+RKR5((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprinthunklinesafter�s#c	
C@sd}|j|�}|j�jd�}|rE|jdd�}nl|jd�ri|jdd�}nH|jd�r�|jdd�}n$|jd	�r�|jdd
�}nd|j|}||j|j|d|d
t�7}||j|j|d|d|dt	�7}|S(NRcs
R>RRPtadditionRQtdeletions\R.RVRRRR(
R-R6R�R�t
startswithR�RR�RR%(	RR�RRR1R+R5R	R8((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytprinthunkchangedline�s"
cC@sY|dkr|j}n|r*d|_ng}|j||||d|�dj|�S(s�
        use __printitem() to print the the specified item.applied.
        if item is not specified, then print the entire patch.
        (hiding folded elements, etc. -- see __printitem() docstring)
        iRRcN(RR'R�t_curseschunkselector__printitemRf(RR!R0trecursechildrenRR1((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR(�scC@sX|jj�\}}td|j|j�}|j|jd}||kpW||kS(Nii(R�R�tminR�R�(RR�Rtminytmaxy((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytoutofdisplayedareascC@sW||jk}|rS|rS|j|_|j|dt�}|j|d|_n|S(NRAi(R�R�R�tgetnumlinesdisplayedRR�(RR!RARtselecteditemlines((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pythandleselections	c
C@s�|r|j�rdS|j||�}t|t�rm|rmx*|D]}|j|||||�qDWqmnt|t�r�|j|j||d|d|��|r�x-|jD]}|j|||||�q�Wq�n�t|t	�r||j
js�|r||j|j||d|d|��|r�x*|j
D]}	|j|	||||�q1W|j|j|d|d|��q�nDt|t�r�|jjs�|r�|j|j||d|��n|S(s{
        recursive method for printing out patch/header/hunk/hunk-line data to
        screen.  also returns a string with all of the content of the displayed
        patch (not including coloring, etc.).

        if ignorefolding is True, then folded items are printed out.

        if recursechildren is False, then only print the item without its
        child items.
        NRR0(RERHRvRR@R*ReR6R/R0R(RR:RCR;R@RBR?(
RR!R0RAR1RRR~R�RR((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt__printitems<




cC@s2|j|||dt�}t|�|j}|S(sY
        return the number of lines which would be displayed if the item were
        to be printed to the display.  the item will not be printed to the
        display (pad).
        if no item is given, assume the entire patch.
        if ignorefolding is True, folded items will be unfolded when counting
        the number of lines.
        R(R(RR7R�(RR!R0RAtpatchdisplaystringR�((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyRFHscC@s�yytj�tj|j�\|_|_|jj|j	|j�|j
dt�d|_tj
|j|j�|_Wntjk
r�nXdS(shandle window resizingR0iN(R
tendwinRttermsizeRR�R�RRR�RFR%R�tnewpadR�R(Rtntframe((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytsigwinchhandlerYs
c
C@s�|dk	r+||jkr+|j|}n|dkr@d}n|dkrUd}n||f|jkr�|j||f}n�t|j�d}|jr�tj|||�tj|�}|j||f<|dk	rHtj|�|j|<qHnQd}|dk	r1|dkr!tj}n||j|<n|}|j||f<|dkr]g}n|dkr�xQ|D]}||O}qpWn6x3tj	tj
fD]}	|	|kr�||	O}q�q�W|S(s�
        get a curses color pair, adding it to self.colorpairs if it is not
        already defined.  an optional string, name, can be passed as a shortcut
        for referring to the color-pair.  by default, if no arguments are
        specified, the white foreground / black background color-pair is
        returned.

        it is expected that this function will be used exclusively for
        initializing color pairs, and not curses.init_pair().

        attrlist is used to 'flavor' the returned color-pair.  this information
        is not stored in self.colorpairs.  it contains attribute values like
        curses.A_BOLD.
        i����iiRiN(RR�R�R7R�R
t	init_pairt
color_pairR�R�R�(
RRRR>RR	t	pairindextcvalR
t
textattrib((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�ds:			 	
cO@s|j||�dS(ssame as getcolorpair.N(R�(RR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
initcolorpair�scC@s�td�}tj|jddd�}|jd�}|dg|j|jt|�d}y+x$|D]}|j||dd�qiWWntjk
r�nX|j	�y'|j
jd��|j�Wd	QXWntjk
r�nXd	S(
s<print a help window to the screen.  exit after any keypress.sG            [press any key to return to the patch-display]

crecord allows you to interactively choose among the changes you have made,
and confirm only those changes you select for further processing by the command
you are running (commit/shelve/revert), after confirming the selected
changes, the unselected changes are still present in your working copy, so you
can use crecord multiple times to split large changes into smaller changesets.
the following are valid keystrokes:

                [space] : (un-)select item ([~]/[x] = partly/fully applied)
                [enter] : (un-)select item and go to next item of same type
                      A : (un-)select all items
    up/down-arrow [k/j] : go to previous/next unfolded item
        pgup/pgdn [K/J] : go to previous/next item of same type
 right/left-arrow [l/h] : go to child item / parent item
 shift-left-arrow   [H] : go to parent header / fold selected header
                      f : fold / unfold item, hiding/revealing its children
                      F : fold / unfold parent item and all of its ancestors
                 ctrl-l : scroll the selected line to the top of the screen
                      m : edit / resume editing the commit message
                      e : edit the currently selected hunk
                      a : toggle amend mode, only with commit -i
                      c : confirm selected changes
                      r : review/edit and confirm selected changes
                      q : quit without confirming (no changes will be made)
                      ? : help (what you're currently reading)is
RViRR%tcrecordN(
RR
tnewwinR�R/R�R7RRR'Rttimeblockedsectiontgetkey(Rthelptextthelpwint	helplinesRK((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
helpwindow�s"		 

cC@smtj�tj�tj�|jj|j|jj��|_tj�|j	j
�|j	jd�dS(s?Create a temporary commit message editing window on the screen.iN(R
trawt
def_prog_modeRKRteditR�tusernametcbreaktstdscrR'tkeypad(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytcommitMessageWindow�s


$

cC@s�tj|jddd�}y:|jd�}x$|D]}|j||dd�q4WWntjk
rknX|jj�|j�y2|jj	d��t
|jj��}WdQXWntk
r�d}nX|S(sEdisplay an informational window, then wait for and return a keypress.is
RRRWN(R
RXR�R/RRRdR'RRYR�tgetcht
ValueErrorR(Rt
windowtextt
confirmwinRRKtresponse((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytconfirmationwindow�s




cC@sjtd�}|jjd��|j|�}WdQX|dkrId}n|j�jd�rbtStSdS(sPask for 'y' to be pressed to confirm selected. return True if
        confirmed.sif you answer yes to the following, the your currently chosen patch chunks
will be loaded into an editor.  you may modify the patch from the editor, and
save the changes if you wish to change the patch.  otherwise, you can just
close the editor without saving to accept the current patch as-is.

note: don't add/remove lines unless you also modify the range information.
      failing to follow this rule will result in the commit aborting.

are you sure you want to review/edit and confirm the selected changes [yn]?
RWNRNR�(	RRRYRlRtlowerR>R%R(RtconfirmtextRk((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytreviewcommit�s
		cC@s�yttj�d �}Wntk
r3d}nX|dkrOtd�}n\|jd�dkr}t|d<td�}n.|jd�tkr�d|d<td�}n|s�|j|�ndS(	s�Toggle the amend flag.

        When the amend flag is set, a commit will modify the most recently
        committed changeset, instead of creating a new changeset.  Otherwise, a
        new changeset will be created (the normal commit behavior).
        iig��Q��@sRThe amend option is unavailable with hg versions < 2.2

Press any key to continue.tamends�Amend option is turned on -- committing the currently selected changes will not create a new changeset, but instead update the most recently committed changeset.

Press any key to continue.s�Amend option is turned off -- committing the currently selected changes will create a new changeset.

Press any key to continue.N(	tfloatRtversionRhRtgetRR%Rl(RR�R�tvertmsg((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyttoggleamends



cC@s|jdt�|j�dS(s
        once we scrolled with pg up pg down we can be pointing outside of the
        display zone. we print the patch with towin=False to compute the
        location of the selected item even though it is outside of the displayed
        zone and then update the scroll.
        RN(R(RR�(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�"scC@s?d�}d�}|dkr*|j}nt|t�r=dSt|t�r[|j�}nt|t�sndS|j�jj|�}|j	|j
}}|||�}|dkr�|s�||�ndS|j}	|	jj|�}
|	j|
 }|	j|
d}|d}
g|
jD]}t||	�^q}tg|D]}|j	^q=�}tg|D]}|j
^q_�}||||}x|D]}|j
|7_
q�Wx|D]}t|_q�W||||	_|j�r�||g||	_n|	|_t|	j�|kr(|	j||_n|s;||�ndS(s3
        edit the currently selected chunk
        cS@sl|jdt�d|_tj|j|j�|_|j�|jj	�|j
j	�|jjd�dS(NR0i(RFR%R�R
RMR�R�R�RdR'RRe(R((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pytupdateui0s


cS@s3|dkr6|jjtd��|jjd�dS|jj�ro|jjtd��|jjd�dSt�}|jtt�|jj|�|j|�y%|jj	|j
�ddd�}Wn&tjk
r�}t
|�|_dSXg|j�D]}|jd�s|d^q}tj|�S(Ns cannot edit patch for whole files
s!cannot edit patch for binary fileRctactiontdifft#(RRRdRR(tbinaryR2tdiffhelptextthunkhelptextRaR4RtAborttstrR�t
splitlinesR>Rkt
parsepatch(RtchunkRtexcRK((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyteditpatchwitheditor8s(	
%Nii(RR�RvR*R@RR0R/R8RYRIR(tsumR[RRt
emptypatchR7(RR!R�RwR�t	itemindextbeforeaddedt
beforeremovedt
newpatchesR(teditedhunkindexthunksbeforet
hunksaftertnewpatchheaderR1tnewhunkstnewaddedt
newremovedtoffset((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt
toggleedit,sL		
	

%""


	cC@s5|j}|stSx|D]}|jrtSqWtS(N(R'R%R/R(RR!R(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�~s	
	cC@s�|d%kr|j�n|d&kr2|j�nj|d'krK|j�nQ|d(krd|j�n8|d)kr}|j�n|d*kr�|j�n|d+kr�|j�n�|d,kr�tjt	d���n�|d-kr�|j
|j|�n�|d.krtS|r|d/krtS|d0krG|j
�r�t|jd<tSnU|rj|d1krjt|jd<tS|d2ks�|r�|d3kr�|j�n|d4kr�|j�|j�n�|d5kr�|j�n�|d6kr�|jd|�n�|d7kr	|j�n�|d8kr(|jd t�nt|d9krA|j�n[|d:krt|j�|jj�|jj�n(tj|�d;kr�|j|j�nd$S(<sd
        Perform actions based on pressed keys.

        Return true to exit the main loop.
        tktKEY_UPtKt	KEY_PPAGEtjtKEY_DOWNtJt	KEY_NPAGERRt	KEY_RIGHTR1tKEY_LEFTtHt	KEY_SLEFTtqs	user quittaRytXtrtreviewtRRVtTOGGLEs
t	KEY_ENTERtAteR�R�tFR�R�t?s^LN(R�R�(R�R�(R�R�(R�R�(RRR�(R1R�(R�R�(R�(R�(Ry(R�(R�(R�(RV(R�(s
R�(R�(R�(R�(R�(R�(R�(s^L(R�R�R�R�R�R�R�RR~RRvR�R%RoR�R�R�R�R�RfR^RdtclearR'R
tunctrlR�R�(Rt
keypressedR�((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR��sd
















cC@sut�}}tjtd�r:tjtj|j�}nz|j|�SWd||k	rptjtj|�nXdS(sP
        method to be wrapped by curses.wrapper() for selecting chunks.
        tSIGWINCHN(R�RR�R�R�RPt_main(RRdtorigsigwinchR�((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR��s
cC@s�||_d|_|jj�\|_|_tj�ytj�Wntj	k
rdt
|_nX|jdddd�|jtj
tjdd�|jtjddd�|jtjddd�|jtj
tjdd�tj|jddd�|_|jjd�tjd|j�|_|jd	t�d|_ytj|j|j�|_Wn*tj	k
r�ttd
��|_dSX|j|jdt
�|_x�tr;|j�yJ|j j!d��|jj"�}WdQX|j#dk	rd|_#w�nWntj	k
r$d
}nX|j$|�r�Pq�q�W|j%dkr�t&j'dd|j%�}|dkr�|j%|j(d<q�ndS(NR>R.RR=R<R%iiR0s&this diff is too large to be displayedRARWtfoobarRcs(?m)^\s.*(
|$)tmessage()RdRR�tgetmaxyxR�R�R
tstart_colortuse_default_colorsRRR�RVtCOLOR_WHITEt
COLOR_MAGENTAt	COLOR_REDtCOLOR_GREENt
COLOR_BLUERXR�RReRMR�RFR%R�RRR�R�R)RRYRZR�R�R�R�R�R�(RRdR�twhitespaceremoved((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR��sT		

	
	

N(0R	R
RR)R�R�R�R�R�R�R�R�R�R�R�R�RR�R�R%RRR$R)R-R6R:R;R?R(RERHR@RFRPR�RVR^RfRlRoRvR�R�R�R�R�R�(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyR�;sbB										X			V				!'$
				1		8		.					
R		:	(+t
__future__RtlocaleR�R�R�ti18nRRcRRRRkRRtutilsRR2t	setlocaletLC_ALLR|R}t
patchhelptextR
tImportErrortwcursesRR~RRR�RRuR*R@R0RR�RR�R�R�R�(((s7/usr/lib64/python2.7/site-packages/mercurial/crecord.pyt<module>sP(				

	j
K.�!