403Webshell
Server IP : 74.208.236.16  /  Your IP : 216.73.216.220
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u102440577 ( 7172810)
PHP Version : 8.4.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/mercurial/__pycache__/crecord.cpython-313.pyc
�

6�h�&��
�SSKJr SSKrSSKrSSKrSSKJr SSKJrJ	r	J
r
JrJ
r
JrJr SSKJr \R$r\"S5r\"S5r\"S	5rSSKrSSKr\R "S
S\
R45rSr"S
S5r"SS\\5r"SS\5r"SS\5r "SS\5r!S"Sjr"S"Sjr#Sr$S"Sjr%\"S5\"S5\"S5\"S5S.r&"S S!5r'g!\\4a SrN�f=f)#�)�annotationsN�)�_)�
diffhelper�encoding�error�patch�pycompat�scmutil�util)�
stringutils�# 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.
c��\rSrSrSrSrg)�
fallbackerror�BzDError that indicates the client should try to fallback to text mode.�N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��3/usr/lib/python3/dist-packages/mercurial/crecord.pyrrBs��Nrrc�D�[=(a URS5S:H$)z�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.
s
chunkselectorscurses)�curses�	interface)�uis r�checkcursesrIs���A�b�l�l�#3�4�	�A�Arc�`�\rSrSrSr\S5rSrSrSr	Sr
SrS	rSS
jr
SSjrS
rg)�	patchnode�RzNabstract class for patch graph nodes
(i.e. patchroot, header, hunk, hunkline)
c��g�Nrr��selfs r�content�patchnode.contentWs��rc��[S5e�N�&method must be implemented by subclass��NotImplementedErrorr$s r�
firstchild�patchnode.firstchild[���!�"K�L�Lrc��[S5er)r+r$s r�	lastchild�patchnode.lastchild^r/rc��[S5e)z8Return a list of all of the direct children of this noder*r+r$s r�allchildren�patchnode.allchildrenas��!�"K�L�Lrc��[S5e)z�
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.
r*r+r$s r�nextsibling�patchnode.nextsiblinge���"�"K�L�Lrc��[S5e)z�
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.
r*r+r$s r�prevsibling�patchnode.prevsiblingmr9rc��[S5er)r+r$s r�
parentitem�patchnode.parentitemur/rc��URnU(a=U(a6UR5nUc!UR5R5nU$U$UR	5nUbU$UR5nUbU$UR5R5nUbU$UR5R5R5$![a SnN�f=f![a SnU$f=f![a gf=f)a@
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.
FN)�folded�AttributeErrorr7r>r-)r%�
skipfolded�
itemfolded�nextitem�items     rrE�patchnode.nextitemxs
��	����J��*��'�'�)�H���$�#���0�<�<�>�H��O�8�O��?�?�$�D������#�#�%�D�����

����(�4�4�6���#��K����(�3�3�5�A�A�C�C��9�	��J�	��&�$�#�H��O�$��."�
��
�s:�C�C�="C1� +C1�C�C�C.�-C.�1
C>�=C>Nc���UR5nUbNUR5nUb9UR(d(UR5nUbUR(dU$U$U$UR5$)z�
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.
)r;r1rAr>)r%rCr;�prevsiblinglastchild�prevsiblinglclcs     r�previtem�patchnode.previtem�ss���&�&�(���"�#.�#8�#8�#:� �$�0�+�:L�:L�"6�"@�"@�"B��#�/�.�5�5�*�*�/�/�"�"���� � rr�T�N)rrrrr�propertyr&r-r1r4r7r;r>rErKrrrrr r RsJ�������M�M�M�M�M�M�,�\!rr c��\rSrSrSrSrSrg)r	�z0
list of header objects representing the patch.
c�D�URU5 UH	nXlM grN)�extendr	)r%�
headerlist�headers   r�__init__�patch.__init__�s�����J���F��L�rrN)rrrrrrVrrrrr	r	�s��� rr	c�^�\rSrSrSrSr\S5rSrSr	Sr
SrS	rS
r
SrSrS
rg)�uiheader��z)
patchnode class wrapping a patch.header
c��XlSUlSUlSUlSUlSUlURVs/sHn[X 5PM snUlgs snf�NTF)�nonuiheader�applied�partialrAr	�
neverunfolded�hunks�uihunk)r%rU�hs   rrV�uiheader.__init__�sU��!�������������
�"���/3�z�z�:�z�!�f�Q�o�z�:��
��:s�Ac�"�UR5$rN)�filenamer$s rr&�uiheader.content�s���}�}��rc�X�[5nURU5 UR5$rN��stringio�pretty�getvalue�r%�xs  r�	prettystr�uiheader.prettystr�� ���J�����A���z�z�|�rc��[UR5nURRU5nX!S-
:aURUS-nU$g�Nr)�lenr	�index)r%�numheadersinpatch�indexofthisheader�
nextheaders    rr7�uiheader.nextsibling�sM����
�
�O�� �J�J�,�,�T�2���1�4�4����$5��$9�:�J���rc�n�URRU5nUS:�aURUS-
nU$g�Nrr)r	ru)r%rw�previousheaders   rr;�uiheader.prevsibling�s<�� �J�J�,�,�T�2���q� �!�Z�Z�(9�A�(=�>�N�!�!�rc��g)zR
there is no 'real' parent item of a header that can be selected,
so return None.
Nrr$s rr>�uiheader.parentitem�s��
rc�T�[UR5S:�aURS$g��Dreturn the first child of this item, if one exists.  otherwise
None.rN�rtrar$s rr-�uiheader.firstchilds%���t�z�z�?�Q���:�:�a�=� �rc�T�[UR5S:�aURS$g��Creturn the last child of this item, if one exists.  otherwise
None.r���Nr�r$s rr1�uiheader.lastchilds%���t�z�z�?�Q���:�:�b�>�!�rc��UR$�z8return a list of all of the direct children of this node)rar$s rr4�uiheader.allchildrens���z�z�rc�.�[URU5$rN)�getattrr]�r%�names  r�__getattr__�uiheader.__getattr__s���t�'�'��.�.r)r^rArar`r]r_r	N)rrrrrrVrOr&ror7r;r>r-r1r4r�rrrrrYrY�sH���;�$�����
������/rrYc�R�\rSrSrSrSr\S5rSrSr	Sr
SrS	rS
r
Srg)
�
uihunklineiz#represents a changed line in a hunkc�8�XlSUlX lSUlgr\)�linetextr^�hunkrA)r%r�r�s   rrV�uihunkline.__init__!s�� �
�����	���rc��UR$rN�r�r$s rr&�uihunkline.content*s���}�}�rc��UR$rNr�r$s rro�uihunkline.prettystr.s���}�}�rc���[URR5nURRRU5nX!S-
:aURRUS-nU$grs)rtr��changedlinesru)r%�numlinesinhunk�indexofthisline�nextlines    rr7�uihunkline.nextsibling1s\���T�Y�Y�3�3�4���)�)�0�0�6�6�t�<���a�/�/��y�y�-�-�o��.A�B�H��O�rc��URRRU5nUS:�aURRUS-
nU$gr{)r�r�ru)r%r��previouslines   rr;�uihunkline.prevsibling;sF���)�)�0�0�6�6�t�<���Q���9�9�1�1�/�A�2E�F�L���rc��UR$�z%return the parent to the current item)r�r$s rr>�uihunkline.parentitemCs���y�y�rc��g)r�Nrr$s rr-�uihunkline.firstchildG���rc��g)r�Nrr$s rr1�uihunkline.lastchildMr�r)r^rAr�r�N)rrrrrrVrOr&ror7r;r>r-r1rrrrr�r�s<��-�����������rr�c��\rSrSrSrSrSr\S5rSr	Sr
SrS	rS
r
SrSrS
rSr\rSrSrSrSrSrg)rbiTz9ui patch hunk, wraps a hunk and keep track of ui behavior�c���XlURVs/sHn[X05PM snUlX lUR
UlSUlSUlSUl	gs snfr\)
�_hunkr�r�r�rU�removed�originalremovedrAr^r_)r%r�rU�lines    rrV�uihunk.__init__YsW���
�@D�	�	�J�	��Z��3�	�J�����#�|�|�������������Ks�Ac�@�UR(aUR$S$r#)�procr$s rr&�uihunk.contenths�� �I�I�t�y�y�.�3�.rc���[URR5nURRRU5nX!S-
:aURRUS-nU$grs)rtrUraru)r%�numhunksinheader�indexofthishunk�nexthunks    rr7�uihunk.nextsiblingls]���t�{�{�0�0�1���+�+�+�+�1�1�$�7����1�1��{�{�(�(��1�)<�=�H��O�rc��URRRU5nUS:�aURRUS-
nU$gr{)rUraru)r%r��previoushunks   rr;�uihunk.prevsiblingvsF���+�+�+�+�1�1�$�7���Q���;�;�,�,�_�q�-@�A�L���rc��UR$r�)rUr$s rr>�uihunk.parentitem~s���{�{�rc�T�[UR5S:�aURS$gr��rtr�r$s rr-�uihunk.firstchild�s+���t� � �!�A�%��$�$�Q�'�'�rc�T�[UR5S:�aURS$gr�r�r$s rr1�uihunk.lastchild�s+���t� � �!�A�%��$�$�R�(�(�rc��UR$r�)r�r$s rr4�uihunk.allchildren�s��� � � rc��[URVs/sH>nUR(dMUR5R	S5(dM<UPM@ sn5n[URVs/sH>nUR(dMUR5R	S5(dM<UPM@ sn5nX#4$s snfs snf)zchangedlines -> (n+,n-)�+�-)rtr�r^ro�
startswith)r%�l�add�rems    r�countchanges�uihunk.countchanges�s�����*�*�
�*�A��9�9��!"����!9�!9�$�!?��*�
�
����*�*�
�*�A��9�9��!"����!9�!9�$�!?��*�
�
���x���
��
s"�C�"C�C�3C�"C�2Cc��URUR-
n[UR5[UR5-U-nUR(a&URS[
R:XaUS-nX R-nX R-nURURpeUS:waUS:XaUS-nUS:XaUS:�aUS-nSUUUUUR=(a SUR-4-nU$)Nr�rrs@@ -%d,%d +%d,%d @@%s
� )r�r�rt�before�afterr�MISSING_NEWLINE_MARKER�added�fromline�toliner�)r%�removedconvertedtocontext�
contextlen�fromlen�tolenr�r��
fromtolines        r�
getfromtoline�uihunk.getfromtoline�s���$(�$8�$8�4�<�<�$G�!�
�����s�4�:�:��.�1J�J�	��:�:�$�*�*�R�.�J�,M�,M�M��!�O�J��|�|�+���Z�Z�'�� �=�=�$�+�+�&��q�=��!�|��A�
����z�f�q�j��!���/������I�I�,�4�$�)�)�+�3
�
�
��rc���UR5uUlUlURUR	55 /nUR
HfnUR
5nUR(aURU5 M7URS5(dMOURSUSS-5 Mh URSRURU-UR-55 g)Nr�r�rr)
r�r�r��writer�r�ror^�appendr��joinr�r�)r%�fp�hunklinelist�changedline�changedlinestrs     rr��uihunk.write�s���#'�#4�#4�#6� ��
�D�L�
����#�#�%�&��� �,�,�K�(�2�2�4�N��"�"��#�#�N�3��*�*�4�0�0��#�#�D�>�!�"�+=�$=�>�-�	������$�+�+��4�t�z�z�A�B�Crc�X�[5nURU5 UR5$rNrirms  rro�uihunk.prettystr�rqrc	�L�/n/nSnURH�nURnUR[R:XaSnM1UR(aZURS5(aUR
USS5 MnURS5(aUR
USS5 M�M�URS5(dM�UR
USS5 UR
USS5 M� UVs/sHnSU-PM
 snUVs/sHnSU-PM
 sn-nU(aU(aUS	SS	US	'URn[R"URURURURURXxR5$s snfs snf)
aSreturn 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.
        FTr�rNr�s-%ss+%sr�)r�r�rr�r^r�r�r��patchmod�
recordhunkrUr�r�r�r�r�)	r%�dels�adds�noeolr��textr�r�rcs	         r�reversehunk�uihunk.reversehunk�sZ��>�������%�%�D��=�=�D��}�}�
� A� A�A�����|�|��?�?�4�(�(��K�K��Q�R��)��_�_�T�*�*��K�K��Q�R��)�+�����&�&����D���H�%����D���H�%�&�%)�)�D�q���
�D�)��,F��A�V�a�Z��,F�F���T��B�x���}�D��H��J�J���"�"�
�H�H�a�h�h��
�
�A�F�F�A�H�H�d�G�G�
�	
��*��,Fs�7F�F!c�.�[URU5$rN)r�r�r�s  rr��uihunk.__getattr__s���t�z�z�4�(�(rc�@�SUR5UR4-$)Nz<hunk %r@%d>)rfr�r$s r�__repr__�uihunk.__repr__s�������$�-�-� @�@�@r)	r�r�r^r�rArUr�r_r�N)rrrrr�
maxcontextrVrOr&r7r;r>r-r1r4r�r�r�rkror�r�r�rrrrrbrbTso��C��J�
��/��/������!��$ �DD�"�F��
6
�p)�Arrbc���[U5nUVs/sH&n[U[R5(dM$UPM( nn[	U5S:Xa/04$UVs/sHn[U5PM nnU"XUS9n/n	UH�n
U
R(dMU
R5(d>[	U
RVs/sHofR(dMUPM sn5S:�dMiU	RU
5 SnU
RH`nUR(a1U	RU5 U(aU=RU-
sl
MCMEX�RUR-
-
nMb M� X�4$s snfs snfs snf)z:interactively filter patch chunks into applied-only chunksr)�	operation)
�list�
isinstancer�rUrtrYr^�specialrar�r�r�r�)
r�chunks�
chunkselectorr��c�headersrc�	uiheaders�ret�appliedhunklist�hdr�	fixoffset�hnks
             r�filterpatchr!s2��
�&�\�F�!�C�&�Q�J�q�(�/�/�$B�q�&�G�C��7�|�q���2�v�
�&-�.�g���!��g�I�.����
;�C��O����;�;�;��K�K�M�M�S�S�Y�Y�!D�Y��)�)�!�Y�!D�E��I��"�"�3�'��I��y�y���;�;�#�*�*�3�/�!��
�
�i�/�
�!����s�y�y�!8�8�I�!�
�"
�!�!��7D��
/��"Es�#E+�E+�E0�6E5
�E5
c�r�UR[S55 [XU5n[5=pE[	[
S5(a$[
R"[
R5n[R"5 [R"UR5 SSS5 URbUReXELa%[
R
"[
RU5 UR$!,(df   N]=f!XELa&[
R
"[
RU5 ff=f)z_
curses interface to get selection of chunks, and mark the applied flags
of the chosen chunks.
sstarting interactive selection
�SIGTSTPN)r�r�curseschunkselector�object�hasattr�signal�	getsignalrr�
with_lc_ctyper�wrapper�main�initexc�opts)rrTr�r�origsigtstp�sentinels      rrrDs���
�H�H�Q�2�
3�4�'�
�	�B�M�#�X�%�K��v�y�!�!��&�&�v�~�~�6��7�
�
�
�
!��N�N�=�-�-�.�"�� � �,��'�'�'�-��&��M�M�&�.�.�+�6�����"�
!���&��M�M�&�.�.�+�6�'�s$�,D
�!C9�"!D
�9
D�D
�
,D6c�^^�UU4SjnU$)Nc�>�T"T/UQ70UD6$rNr)�args�kwargs�f�testfns  ��r�u�testdecorator.<locals>.u[s�����)�$�)�&�)�)rr)r rr!s`` r�
testdecoratorr#Zs���*�
�Hrc���[X!U5n"SS5nU"5UlU(a�[RR	U5(av[U5nUR
5Vs/sHowRS5PM nnSSS5 URWRS5SS9(a
UR$M3UR$s snf!,(df   NS=f)z]
test interface to get selection of chunks, and mark the applied flags
of the chosen chunks.
c� �\rSrSrSrSrSrg)�&testchunkselector.<locals>.dummystdscrihc��grNrr$s r�clear�,testchunkselector.<locals>.dummystdscr.cleari���rc��grNrr$s r�refresh�.testchunkselector.<locals>.dummystdscr.refreshlr*rrN)rrrrr(r,rrrr�dummystdscrr&hs��	�	rr.�
NTr��test)r�stdscr�os�path�exists�open�	readlines�rstrip�handlekeypressed�popr)	r rrTr�rr.�testfrn�testcommandss	         r�testchunkselectorr=as���
(�
�	�B�M���'�=�M��
�"�'�'�.�.��(�(�
�&�\�U�49�O�O�4E�F�4E�q�H�H�T�N�4E�L�F����-�-�l�.>�.>�q�.A��-�M������������G��\�s�C�,C�C�C�
C#sSelect hunks to applysSelect hunks to discardsSelect hunks to keepsSelect hunks to record)sapplysdiscardskeepNc��\rSrSrS7SjrSrSrSrSrS8Sjr	S	r
S
rSrSr
S
rS7SjrSrSrSrS9SjrSrS:SjrSrSrSrSrS;SjrS;SjrS<SjrS=SjrS>SjrSrSr S?S jr!S@S!jr"S"r#SAS#jr$S$r%S%r&S&r'S'r(S(r)S)r*S*r+S+r,S9S,jr-S-r.S.r/S?S/jr0S?S0jr1S1r2S2r3S8S3jr4S4r5S5r6S6r7g)Bri�Nc��[U5UlX l0UlSUl/UlUHCnUR
R
U5 UR
RUR5 ME 0Ul	0Ul
[R"URRSS55nUSLUlURSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlS	UlU[8;a[:R<"S
U-5eX0lSUl g)NsuiscolorFrr��rrTsunexpected operation: %s)!r	rTrr�errorstr�	chunklistr�rSra�
colorpairs�colorpairnamesr
�	parsebool�config�usecolor�currentselecteditem�lastapplieditem�selecteditemstartline�selecteditemendline�headerindentnumchars�hunkindentnumchars�hunklineindentnumchars�firstlineofpadtoprint�numpadlines�numstatuslines�linesprintedtopadsofar�commenttext�waslasttoggleallapplied�_headermessagesr�ProgrammingErrorr��regex)r%rTrr�rc�uicolors      rrV�curseschunkselector.__init__�sL���
�+�������	���
�����A��N�N�!�!�!�$��N�N�!�!�!�'�'�*����� ����&�&�t�w�w�~�~�e�X�'F�G���u�,��
�$(�?�?�1�#5�� �#���&'��"�#'�� �%&��!�"#���&'��#�&'��"� ������'(��#����(,��$��O�+��(�(�+�i�7��
�#����
rc�R�URnUR5nUcUnX lg)a
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)rHrK�r%�currentitemrEs   r�uparrowevent� curseschunkselector.uparrowevent�s0���.�.���'�'�)����#�H�#+� rc��URnUR5nUcUR5nUcUnX lUR5 g)z�
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)rHr;r>�recenterdisplayedarear[s   r�uparrowshiftevent�%curseschunkselector.uparrowshiftevent�sP���.�.���*�*�,����"�-�-�/�H���#�H�#+� ��"�"�$rc�R�URnUR5nUcUnX lg)a7
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)rHrEr[s   r�downarrowevent�"curseschunkselector.downarrowevent�s.���.�.���'�'�)����"�H�#+� rc���URnUR5nUcUR5R5nUcUnX lUR	5 g![a SnN*f=f)z�
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)rHr7r>rBr`r[s   r�downarrowshiftevent�'curseschunkselector.downarrowshifteventst���.�.���*�*�,����
 �&�1�1�3�?�?�A����"�H�#+� ��"�"�$��"�
 ���
 �s�A�A*�)A*c�`^�URmU4SjnTR5nUb/U"U5(d"UR5nUbU"U5(dM"UcTnO5UR5nUb"UR(aUR	U5 X0lU(dUR5 gg)Nc�.>�[U[T55$rN)r�type)rFr\s �r�<lambda>�2curseschunkselector.nextsametype.<locals>.<lambda>s���
�4��k�1B� Cr)rHrEr>rA�togglefoldedr`)r%r1�sametyperE�parentr\s     @r�nextsametype� curseschunkselector.nextsametypes�����.�.��C���'�'�)���"�8�H�+=�+=��(�(�*�H��"�8�H�+=�+=���"�H��(�(�*�F��!�f�m�m��!�!�&�)�#+� ���&�&�(�rc��URnUR5nUR(aURU5 UcUnX lg)z<
select (if possible) the first of this item's child-items.
N)rHr-rArnr[s   r�rightarrowevent�#curseschunkselector.rightarrowevent)sG���.�.���)�)�+��������k�*���"�H�#+� rc��URn[U[5(d!UR(dUR	US9 gUR5nUc"UnUR(dUR	US9 X lg)z�
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.
�rFN)rHrr�rArnr>r[s   r�leftarrowevent�"curseschunkselector.leftarrowevent:st���.�.���+�z�2�2��%�%��!�!�{�!�3���)�)�+����"�H��?�?��!�!�x�!�0�#+� rc���URn[U[5(a!UR(dUR	US9 gUR5nUcOUnMXlg)zg
select the header of the current item (or fold current item if the
current item is already a header).
rwN)rHrrYrArnr>r[s   r�leftarrowshiftevent�'curseschunkselector.leftarrowshifteventSsg��
�.�.���k�8�,�,��%�%��!�!�{�!�3���"�-�-�/�H����&���$/� rc��URnURnURnX0R-UR-
S-
nUS-nUS-
nX&:�aURX&-
5 gX:aURX-
5 gg)z6scroll the screen to fully show the currently-selectedrr�N)rJrKrO�yscreensizerQ�scrolllines)r%�selstart�selend�padstart�padend�padstartbuffered�padendbuffereds       r�updatescroll� curseschunkselector.updatescrollis����-�-���)�)���-�-���,�,�,�t�/B�/B�B�Q�F��$�a�<���!����"����V�4�5�
�
(����X�8�9�)rc��U=RU-
slURS:aSUlURURS-
:�aURS-
Ulgg)z>scroll the screen up (down) by numlines when numlines >0 (<0).rrN)rOrP)r%�numliness  rr�curseschunkselector.scrolllines{sZ���"�"�h�.�"��%�%��)�)*�D�&��%�%��(8�(8�1�(<�<�)-�)9�)9�A�)=�D�&�=rc��UcURnXlUR(+Ul[U[5(a�SUlUR(a5URH$nSUlURH
nSUlM M& gURH+nSUlSUlURH
nSUlM M- g[U[5(GaSUlURHnURUlM URRVs/sHo"RPM nnSU;nSU;nURRVs/sHo"R
PM nnSU;nU(aCURR5(d#SURlSURlggSURlU=(d U(+URlg[U[5(Ga�URRV	s/sHo�RPM nn	SU;nSU;nU(a#SURlSURlOLU(a#SURlSURlO"SURlSURlURRRVs/sHo"RPM n
nSU
;nSU
;nURRRVs/sHo"R
PM n
nSU
;nU(aaURRR5(d7SURRlSURRlggSURRlU=(d U(+URRlggs snfs snfs sn	fs snfs snf)zz
toggle the applied flag of the specified item.  if no item is specified,
toggle the flag of the currently selected item.
NFT)
rHrIr^rrYr_rar�rbrUrr�r�)r%rFr�hunkline�siblingappliedstatus�allsiblingsapplied�nosiblingsapplied�siblingspartialstatus�somesiblingspartial�ln�parentsiblingsapplied�noparentsiblingsapplied�allparentsiblingsapplied�parentsiblingspartial�someparentsiblingspartials               r�toggleapply�curseschunkselector.toggleapply�s_��
�<��+�+�D�#'� ��<�<�'����d�H�%�%� �D�L��|�|��:�:�C�"&�C�K�$'�$4�$4��+/��(�%5�&� �:�:�C�"'�C�K�"'�C�K�$'�$4�$4��+0��(�%5�	&���f�
%�
%� �D�L� �-�-��#'�<�<�� �.�<@�;�;�;L�;L�#M�;L�C�K�K�;L� �#M�&+�/C�&C��%)�-A�%A��<@�K�K�<M�<M�$N�<M�S�[�[�<M�!�$N�"&�*?�"?��
!��{�{�*�*�,�,�*/�D�K�K�'�*/�D�K�K�'�-�'+����#�'�A�/A�+A����#���j�
)�
)�9=���9O�9O�#P�9O�2�J�J�9O� �#P�&+�/C�&C��%)�-A�%A��!�$)��	�	�!�$)��	�	�!�#�$(��	�	�!�$)��	�	�!�$(��	�	�!�$(��	�	�!�(,�y�y�'7�'7�'=�'=�%�'=����'=�
"�%�,0�3H�+H�#�,1�5J�,J�$�(,�y�y�'7�'7�'=�'=�%�'=����'=�
"�%�)-�0E�(E�%�'��y�y�'�'�/�/�1�1�/4�D�I�I�$�$�,�/4�D�I�I�$�$�,�2�
,0��	�	� � �(�-�M�5M�1M��	�	� � �(�G*��)$N��%O��"$Q��%��%s�#O'�O,�!O1�O6�O;c�0�UR(a8URH'nUR(dMURU5 M) O7URH'nUR(aMURU5 M) UR(+Ulg)z%toggle the applied flag of all items.N)rTrTr^r�)r%rFs  r�	toggleall�curseschunkselector.toggleall�sj���'�'������<�<�<��$�$�T�*�(������|�|�|��$�$�T�*�(�,0�+G�+G�'G��$rc��URHBnUR5H+nUR5HnURU5 M M- MD g)zH
Flip all selections. Every selected line is unselected and vice
versa.
N)rTr4r�)r%rUr�r�s    r�flipselections�"curseschunkselector.flipselections�sF��
�o�o�F��*�*�,�� �,�,�.�D��$�$�T�*�/�-�&rc�B�UR(aURUR:XaUR5 gURnURnSHHnUR5nU(a#XB:waUR5nU(aXB:waMU(a OX!p!MJ W(dgUnURR(+nXBR5:waEURU:waURUS9 UR5nXBR5:waMDgg)zGtoggle applied on or off for all items in range [lastapplied,
current].N)sforwardsreverserw)rIrHr�rEr^)r%�	startitem�enditem�	directionrE�desiredstates      r�toggleallbetween�$curseschunkselector.toggleallbetween�s����$�$��'�'�4�+?�+?�?�
������(�(�	��*�*��1�I� �)�)�+�H��x�2�#�,�,�.���x�2���!(�w�2��
��� �3�3�;�;�;���*�*�,�,����<�/�� � �h� �/��(�(�*�H��*�*�,�,rc���UcURnU(d&[U[5(a�UR(a�[U[5(dUR	5=UlnOUR(aSUl[U[5(a-UR5HnUR(+UlM [U[[45(aUR(+Ulgg)zEtoggle folded flag of specified item (defaults to currently
selected)NF)rHrrYr`r>r4rArb)r%rF�
foldparent�childs    rrn� curseschunkselector.togglefolded!s����<��+�+�D��*�T�8�4�4��9K�9K��d�H�-�-�26�/�/�2C�C��(�4��#�#�%*��"��$��)�)�!�-�-�/�E�'+�{�{�?�E�L�0��d�X�v�.�/�/�"�k�k�/�D�K�0rc��UR5up4URnURS5n[R"U5nXVU-U--
nUSU--$)z�
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.
�r�)�getyx�xscreensize�
expandtabsr�colwidth)r%�instr�window�y�xstart�width�strwidth�	numspacess        r�alignstring�curseschunkselector.alignstring5s^���L�L�N�	��� � ��� � ��#���$�$�U�+����/�5�8�9�	��t�i�'�'�'rc�f�URS5n[R"SSURS55nUbUnOPUbURUnO=UcSnUcSnX44UR
;aUR
X44nOUR
X45nUc/nUS:aUHnX�-nM	 O2[R[R4HnX�;dM
X�-nM URR5up�SnU
(a,[U5nURS5n[U5nUU-
nU(a&UR[R "U5U5 X�-
nU
(aTU[R"-nU(a2[%W5H#nUR'[R(U5 M% US	W--
nU	(aBU(a%UR+SU5nURUU5 OUR+X�5nUU-
nU[U5-UR,-nU=R.U-
slU$)
a�
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.
r�s[\x00-\x08\x0a-\x1f]c	�z�S[R"[[UR	55S-55-$)N�^�@)r
�sysbytes�chr�ord�group��ms rrl�1curseschunkselector.printstring.<locals>.<lambda>hs(��d�X�.�.�s�3�q�w�w�y�>�B�3F�/G�H�Hr�
r��rs 
r�)r��re�sub�striprDrC�getcolorpairr�A_UNDERLINE�A_BOLD�chunkpadr�rtr8�addstrr�strfromlocal�	A_REVERSE�range�addch�ACS_CKBOARDr�r�rR)r%r�r��fgcolor�bgcolor�pair�pairname�attrlist�towin�align�
showwhtspc�	colorpair�textattrr�r��t�origlen�strippedlen�numtrailingspaces�wscolorpair�i�extrawhitespace�linesprinteds                       r�printstring�curseschunkselector.printstringDs��@���q�!���v�v�$�H��J�J�u��
�����I�
�
!��+�+�H�5�I����������!�T�_�_�4� �O�O�W�,>�?�	� �-�-�g�?�	����H��s�?�$���%�	�%�$�/�/����?���'��)�I�@��M�M�'�'�)�	������$�i�G��;�;�v�&�D��d�)�K� '�+� 5����M�M�(�/�/��5�y�A�	�	���#�f�&6�&6�6�K���0�1�A��L�L��!3�!3�[�A�2�
��)�)�)�A���"&�"2�"2�3��"?���
�
�o�y�9�#'�"2�"2�1�"=��
�� �A���Q���D�,<�,<�<���#�#�|�3�#��rc
�J�URRn[S5n[S5n[[	U5[	U55nSUU(aUOU4-n[
URS[S5[S5[S5[S5U[S	5/nU$)
z-> [str]. return segmentssspace/enter: selectsspace/enter: deselects%-*sr�s[x]=selected **=collapseds
c: confirmsq: aborts arrow keys: move/expand/collapses?: help)rHr^r�maxrtrUr�)r%�selected�spaceselect�
spacedeselect�spacelen�
selectedlabel�segmentss       r�_getstatuslinesegments�*curseschunkselector._getstatuslinesegments�s����+�+�3�3���.�/���2�3�
��s�;�'��]�);�<����%�M�;�#
�
�
�

�D�N�N�+��
�*�+�
�m��
�k�N�
�1�2��
�j�M�	
���rc��URbUR[S5/nO�UR5nURn/nUnUHxn[R
"U5nSSU=(a USS;--nXF-[
U5-U:�aURU5 UnMYUS==Xu--
ss'XF[
U5--
nMz [
U5UR:wa@[
U5UlURRURUR5 UVs/sH&n[R"X�RS-
5PM( sn$s snf)z<() -> [str]. return short help used in the top status windowsPress any key to continuer�rrs-[r�)
rArr�r�rr�rtr�rQ�	statuswin�resizer
�ellipsis)	r%�linesr�r��	lastwidth�s�w�sepr�s	         r�_getstatuslines�#curseschunkselector._getstatuslines�s-���=�=�$��]�]�A�&B�$C�D�E��2�2�4�H��$�$�E��E��I����%�%�a�(���a�1�#:��1��U�):�;�<���=�3�s�8�+�u�4��L�L��O� !�I��"�I���(�I��S��X��-�I���u�:��,�,�,�"%�e�*�D���N�N�!�!�$�"5�"5�t�7G�7G�H�FK�L�e��
�#�#�A�'7�'7�!�';�<�e�L�L��Ls�!-Ec	��URR5 URR5 URnUR	5HnU"URUSS9 M URR5 URbgUR5 UR5 URRURSURSURUR-
URS-
5 g![Ra N�f=f![Ra gf=f)N�legend�r�rr)r��eraser�r�r�r,rrrA�	printitemr�rOrQr~r�)r%r�r�s   r�updatescreen� curseschunkselector.updatescreen�s
���������
�
�����&�&��	��,�,�.���D�N�N�D�9�E�/��N�N�"�"�$��=�=�$��	��N�N�������M�M�!�!��*�*���#�#��� � �4�#6�#6�6�� � �1�$�

���|�|�	��	��"�|�|�	��	�s&�AD
�A8D'�
D$�#D$�'D>�=D>c�p�UR(a,[U[5(dUR(aSnOSnOSnUR(a/US-
n[U[
5(aURnX#S--
nU$US-
n[U[
5(aUS-
nU$![a	 US-
nU$f=f)z`
create a string to prefix a line with which indicates whether 'item'
is applied and/or folded.
s[~]s[x]s[ ]s**r�s  )r^rr�r_rArY�
changetyperB)r%rF�checkbox�
filestatuss    r�getstatusprefixstring�)curseschunkselector.getstatusprefixstring�s����<�<��d�J�/�/�D�L�L�!��!���H�	��{�{��E�!���d�H�-�-�!%���J��T� 1�1�H����E�!���d�H�-�-���%�H�����	����H���	�s�>B"�B"�"B5�4B5c	���SnUR5nURRU5nUS:wa<UR(d+XPR	UR
SUR-USS9-
nURU=(a S=(d S[R/S9nSn	URU5n
UR(aU(aURS	5nX�S-nOX�R5-nXPR	UR
X�US
9-
nUR(aU(aL[W5S:�a=USSH4n
S
U	[U
5--U
-nXPR	UR
X�US
9-
nM6 U$)z�
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.
rr�_F�r�r��selected�normal�r�r�r��r�r�rNr�)rorBrurAr�r�r�r�rr�r�splitrfrt)r%rUr�r��
ignorefolding�outstrr��
chunkindexr��indentnumcharsr�textlist�linestrr�s              r�printheader�curseschunkselector.printheaderso�������!���^�^�)�)�&�1�
���?�6�=�=��&�&��
�
�t�d�&6�&6�6�e�5�'��
�F��%�%��)�k�6�Y�&�-�-��&�
�	����-�-�f�5���}�}�
��z�z�%�(�H��!��,�G����!2�2�G��"�"��M�M�7�%�#�
�	
���}�}�
��8�}�q� �$�Q�R�L�D�"�n�s�8�}�&D�E��L�G��.�.��
�
�w�e�/���F�)��
rc���SnURRRU5nUS:wa+XPRURSUR
-USS9-
nUR
U=(a S=(d S[R/S9nURU5nSUR-U-n	S	UR5RS
5-n
XPRURX�SS9-
nXPRURX�US9-
nUR(a	U(dU$URH=nSUR[!U5--U-nXPRURX�S9-
nM? U$)
z!includes start/end line indicatorrrr�Frr
rrs   r�r�r�)rUrarur�r�r�r�rr�rrMr�r�rAr�rNrt)
r%r�r�r�rr�	hunkindexr�r�
lineprefix�frtoliner�rs
             r�printhunklinesbefore�(curseschunkselector.printhunklinesbeforeFs�����K�K�%�%�+�+�D�1�	���>��&�&��
�
�t�d�&6�&6�6�e�5�'��
�F��%�%��)�k�6�Y�&�-�-��&�
�	�
�-�-�d�3���D�3�3�3�h�>�
��D�.�.�0�6�6�u�=�=���"�"��M�M�:�%�#�
�	
��	�"�"��M�M�8�5�#�
�	
���;�;�}��M��K�K�D���3�3�c�(�m�C�D�t�K�
�
�&�&�t�}�}�g�&�K�K�F�	 ��
rc��SnUR(a	U(dU$URU5nURH=nSUR[	U5--U-nX@RURXrS9-
nM? U$)Nrr�r)rArr�rNrtr�r�)r%r�r�rrrr�rs        r�printhunklinesafter�'curseschunkselector.printhunklinesafterrs{�����;�;�}��M��-�-�d�3���J�J�D���3�3�c�(�m�C�D�t�K�
�
�&�&�t�}�}�g�&�K�K�F�	��
rc	��SnURU5nUR5RS5nU(aURSS9nOqUR	S5(aURSS9nOKUR	S5(aURSS9nO%UR	S	5(aURS
S9nSUR
-U-nX@R
URX�SS
9-
nX@R
URUWUSS9-
nU$)Nrr�r
�r�r��additionr��deletion�\rr�FrT)r�r�r�)rror�r�r�rNr�r�)	r%r�r�r�rrrr�rs	         r�printhunkchangedline�(curseschunkselector.printhunkchangedline�s �����-�-�h�7���$�$�&�,�,�U�3����)�)�{�)�;�I�
�
�
��
%�
%��)�)�{�)�;�I�
�
�
��
%�
%��)�)�{�)�;�I�
�
�
��
&�
&��)�)�y�)�9�I��D�7�7�7�(�B�
��"�"��M�M�:�%�#�
�	
��	�"�"��M�M�7��%�D�#�
�	
���
rc��UcURnU(aSUl/nURXX5US9 SRU5$)z�
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)
rrr)rTrR�_curseschunkselector__printitemr�)r%rFr�recursechildrenr�rs      rr�curseschunkselector.printitem�sM���<��?�?�D��*+�D�'���������	�	
��x�x���rc���URR5up[SURUR-
5nURURS--nX:=(d X:�$)Nr�)r�r��minrOr~)r%r�r�miny�maxys     r�outofdisplayedarea�&curseschunkselector.outofdisplayedarea�s_���}�}�"�"�$����1�d�0�0�4�3C�3C�C�D���)�)�D�,<�,<�q�,@�@���x�#�1�8�#rc��XRLnU(a?U(a8URUlURUSS9nURU-S-
UlU$)NF�r-r)rHrRrJ�getnumlinesdisplayedrK)r%rFr-r��selecteditemliness     r�handleselection�#curseschunkselector.handleselection�sc���3�3�3����)-�)D�)D�D�&� $� 9� 9��e�!:�!���*�*�->�>��B�
�$��rc	��U(aUR5(agURX5n[U[5(a#U(aUHnUR	XrX4U5 M [U[
5(aNUR
URXXRS95 U(a&URHnUR	X�X4U5 M U$[U[5(a�URR(aU(amUR
URXXRS95 U(aEURHn	UR	X�X4U5 M UR
URXUS95 U$[U[5(aAUR R(aU(aUR
UR#XUS95 U$)aC
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.
N)r�rr)r4r:rr	r,rYr�rrarbrUrArr�r"r�r�r))
r%rFrr-rr�r�r	rr�s
          r�__printitem�curseschunkselector.__printitem�s����T�,�,�.�.���'�'��>���d�E�"�"���C��$�$��O�U�� �
�d�H�%�%��M�M�� � ��%�!��
�
��:�:�C��$�$��O�U��&�<�
�5��f�
%�
%����#�#�
�
�M�M��)�)��%�*��
�
��*�*�A��$�$��/�5��+��
�
��,�,���-����
���j�
)�
)����!�!�m��M�M��)�)�$��)�F�
��
rc�X�URXUSS9n[U5UR-nU$)a!
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.
Fr)rrtr�)r%rFrr-�patchdisplaystringr�s      rr8�(curseschunkselector.getnumlinesdisplayeds<��"�^�^����,�
���)�*�d�.>�.>�>���rc��[R"UR5uUlUlUR
R
URUR5 URSS9S-Ul	[R"URUR5Ulg![Ra gf=f)zhandle window resizingT�rrN)r�termsizerr�r~r�r�rQr8rPr�newpadr�r)r%�n�frames   r�sigwinchhandler�#curseschunkselector.sigwinchhandlers���	�18�1A�1A�$�'�'�1J�.�D��d�.��N�N�!�!�$�"5�"5�t�7G�7G�H�#�8�8�t�8�L�q�P�D��"�M�M�$�*:�*:�D�<L�<L�M�D�M���|�|�	��	�s�B$B'�'B>�=B>c���UbX0R;aURUnO�UcSnUcSnX4UR;aURX4nO�[UR5S-nUR(ac[R
"XaU5 [R"U5=oPRX4'Ub#[R"U5URU'O:SnUb$US:Xa[RnXpRU'U=oPRX4'Uc/nUS:aUHnXX-nM	 U$[R[R4Hn	X�;dM
XY-nM U$)a,
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.
r�rrr
r�)
rDrCrtrGr�	init_pair�
color_pairr�r�r�)
r%r�r�r�r�r��	pairindex�cvalr��
textattribs
          rr�� curseschunkselector.getcolorpair#sm��$
��$�*=�*=�"=��+�+�D�1�I����������!�T�_�_�4� �O�O�W�,>�?�	�����0�1�4�	��=�=��$�$�Y��A��)�)�)�4�5�I��� �*�!��'�4:�4E�4E�i�4P��+�+�D�1���D��'��;�.�#)�#3�#3�D�48�+�+�D�1�FJ�J�I����0B� C����H��s�?�$���%�	�%��� &�1�1�6�=�=�A�
��)��+�I�B��rc�(�UR"U0UD6 g)zsame as getcolorpair.N)r�)r%rrs   r�
initcolorpair�!curseschunkselector.initcolorpair^s�����4�*�6�*rc�(�[S5n[R"URSSS5nUR	S5nUS/URUR
-
[
U5-
S-
--nUHnURX$SS9 M UR5 URRS5 UR5 S	S	S	5 g	![Ra N\f=f!,(df   g	=f![Ra g	f=f)
z<print a help window to the screen.  exit after any keypress.s�            [press any key to return to the patch-display]

The curses hunk selector 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 (such as commit,
shelve, or revert). After confirming the selected changes, the
unselected changes are still present in your working copy, so you can
use the hunk selector multiple times to split large changes into
smaller changesets. the following are valid keystrokes:

              x [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
                      X : (un-)select all items between current and most-recent
    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
                      g : go to the top
                      G : go to the bottom
                      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 all selections
                      c : confirm selected changes
                      r : review/edit and confirm selected changes
                      / : regex search for code or filename
                      n : next search result for code or filename
                      N : previous search result for code or filename
                      q : quit without confirming (no changes will be made)
                      ? : help (what you're currently reading)rr�r�rr�r��crecordN)
rr�newwinr~rrQrtr�rr,r�timeblockedsection�getkey)r%�helptext�helpwin�	helplinesr�s     r�
helpwindow�curseschunkselector.helpwindowbs���� 
B�"
��H�-�-�� 0� 0�!�Q��:���N�N�5�)�	�������t�2�2�2�S��^�C�a�G�!
�
�	�	�!��� � ��� �C�"�	����	����+�+�J�7���� �8�7��	�|�|�	��	��8�7���|�|�	��	�sB�0C�C:�5C)�C:�C&�%C&�)
C7�3C:�7C:�:D�Dc�r�[R"5 [R"5 URR	UR
URR
55Ul[R"5 URR5 URRS5 g)z?Create a temporary commit message editing window on the screen.rN)r�raw�
def_prog_moder�editrS�username�cbreakr2r,�keypadr$s r�commitMessageWindow�'curseschunkselector.commitMessageWindow�sn��	�
�
�������7�7�<�<��(8�(8�$�'�'�:J�:J�:L�M����
�
�������������1�rc��URSUlURnUR5nUcOUnMXlg)zD
Handle 'g' to navigate to the top most file in the ncurses window.
rN)rTrHr>r[s   r�handlefirstlineevent�(curseschunkselector.handlefirstlineevent�sL��$(�?�?�1�#5�� ��.�.���"�-�-�/�H����&���$/� rc��URnUR5nUbUR5nUcOUnUbMXlUR5 g)a}
Handle 'G' to navigate to the bottom most file/hunk/line depending
on the whether the fold is active or not.

If the bottom most file is folded, it navigates to that file and
stops there. If the bottom most file is unfolded, it navigates to
the bottom most hunk in that file and stops there. If the bottom most
hunk is unfolded, it navigates to the bottom most line in that hunk.
N)rHrEr`r[s   r�handlelastlineevent�'curseschunkselector.handlelastlineevent�s[���.�.���'�'�)���"�"�+�+�-�H����&���"�$/� ��"�"�$rc��[R"URSSS5nURS5nUHnUR	X$SS9 M URR5 UR5 URRS5 [URR55nSSS5 U$![R
a N�f=f!,(df   W$=f![a SnU$f=f)zEdisplay an informational window, then wait for and return a
keypress.rr�r
r�rUN)
rrVr~rr�rr2r,rrWr��getch�
ValueError)r%�
windowtext�
confirmwinr�r��responses      r�confirmationwindow�&curseschunkselector.confirmationwindow�s����]�]�4�#3�#3�Q��1�=�
�	��$�$�U�+�E���� � ��K� �H��	
����������	����+�+�J�7��t�{�{�0�0�2�3��8�
����|�|�	��	��
8�7�
����	��H���	�sA�*C�:C/�$C�9C/�C�C�
C,�'C/�,C/�/C?�>C?c��[S5nURRS5 URU5nSSS5 WcSnUR	5RS5(agg!,(df   N9=f)zHask for 'y' to be pressed to confirm selected. return True if
confirmed.s�If you answer yes to the following, your currently chosen patch chunks
will be loaded into an editor. To modify the patch, make the changes in your
editor and save. To accept the current patch as-is, close the editor without
saving.

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]?
rUNrFr�TF)rrrWrs�lowerr�)r%�confirmtextrrs   r�reviewcommit� curseschunkselector.reviewcommit�sn���	
�
���W�W�
'�
'�
�
3��.�.�{�;�H�4����H��>�>��&�&�s�+�+���4�
3�s�A,�,
A:c�B�URSS9 UR5 g)z�
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.
FrN)rr�r$s rr`�)curseschunkselector.recenterdisplayedarea�s��	
���U��#����rc�p�SnSnUcURn[U[5(ag[U[5(aUR	5n[U[
5(dgUR	5RRU5nURURpvU"X5nUcU(dU"U5 gURn	U	RRU5n
U	RSU
nU	RU
S-SnUSn
U
RVs/sHn[X�5PM nn[UVs/sHo�RPM sn5n[UVs/sHo�RPM sn5nUU-
UU-
-
nUHnU=RU-
slM UH
nSUl
M X�-U-U	lUR5(a
X�/-U-U	lX�l[U	R5U:�aU	RUUlU(d	U"U5 ggs snfs snfs snf)z#
edit the currently selected chunk
c�P�URSS9S-Ul[R"URUR5UlUR
5 URR5 URR5 URRS5 g)NTrCr)r8rPrrEr�r�r�r2r,r�rdr$s r�updateui�0curseschunkselector.toggleedit.<locals>.updateuisy��#�8�8�t�8�L�q�P�D��"�M�M�$�*:�*:�D�<L�<L�M�D�M������K�K���!��N�N�"�"�$��K�K���q�!rc��Uc@URR[S55 URRS5 gURR	5(a@URR[S55 URRS5 g[5nUR[[-5 URRU5 URU5 URRUR5SSS9nURR5 URR!5 UR#5Vs/sH nUR%S5(aMUS-PM" nn[&R("U5$![RaOnURUl
SnAURR5 URR!5 gSnAff=f!URR5 URR!5 f=fs snf)Ns cannot edit patch for whole filer�s!cannot edit patch for binary filersdiff)�action�#)rr�rrU�binaryrj�diffhelptext�hunkhelptextrarlr�Abort�messagerAr2r(r,�
splitlinesr�r��
parsepatch)r%�chunkr	�excr�s     r�editpatchwitheditor�;curseschunkselector.toggleedit.<locals>.editpatchwitheditors����}����
�
�a� C�D�E����
�
�e�$���|�|�"�"�$�$����
�
�a� D�E�F����
�
�e�$���J�E��K�K��|�3�4��L�L���u�%��K�K���
&������U�^�^�%5�s�7��K��
���!�!�#����#�#�%�
"�,�,�.��.�D����t�,���u��.�
��
�&�&�u�-�-���;�;�
� #����
�����!�!�#����#�#�%��
�����!�!�#����#�#�%��s6�6)F%�&I�	I�%H�9H�
H�H�H�6INrrF)rHrrYr�r>rbrarur�r�rU�sumr�rA�
emptypatchrt)r%rFr1r~r��	itemindex�beforeadded�
beforeremoved�
newpatchesrU�editedhunkindex�hunksbefore�
hunksafter�newpatchheaderrc�newhunks�newadded�
newremoved�offsets                   r�
toggleedit�curseschunkselector.toggleedits���
	"� 	.�D�<��+�+�D��d�H�%�%���d�J�'�'��?�?�$�D��$��'�'���O�O�%�+�+�1�1�$�7�	�%)�Z�Z����]�(��4�
������������ �,�,�,�,�T�2���l�l�#3�O�4���\�\�/�A�"5�"7�8�
�#�A���/=�/C�/C�D�/C�!�F�1�%�/C��D���2��A����2�3���X�6�X��)�)�X�6�7�
��[�(�Z�-�-G�H���A�
�H�H���H���A��A�H��"�-�
�:����?�?���&��/�*�<�F�L�#)� ��v�|�|��y�(�'-�|�|�I�'>�D�$���T�N���!E��2��6s�H)�=H.�"H3c�d�URnU(dgUHnUR(dM g gr\)rTra)r%rFrUs   rr��curseschunkselector.emptypatchZs,���������F��|�|�|���rc��[R"SURURS-
S5nUR	S5 [R
"5 [R"S5 UR5=(d SUl[R"5 [R"S5 URUR5(dFURU[S5SSS9 UR5S;aUR5S;aMAURR5 URR!5 g)	Nrr�/sPattern not found (press ENTER)r�F�r�r��r/�	KEY_ENTER)rrVr�r~�echochar�echo�curs_set�getstrrW�noecho�
showsearchr�rrXr2r(r,)r%�wins  r�handlesearch� curseschunkselector.handlesearchcs����m�m�A�t�/�/��1A�1A�A�1E�q�I�����S�����
�������Z�Z�\�)�T��
��
�
����������t�z�z�*�*������4�5�"��	
�
��*�*�,�&9�9���*�*�,�&9�9�������������rc��U(dgU(aSOSn[URU5"SS9nSn[R"U5nU(aAUR	UR
5nU(aX@lO[XC5"SS9nU(aMAURnU(a.U(a'SUlUR5nU(a	U(aM'U$)NrErKF)rC)r�rHr��compile�searchr&rAr>)r%rW�forward�moveattrr\�matches�unfoldeds       rr��curseschunkselector.showsearch{s�����!(�:�j���d�6�6��A��
�����
�
�5�!����l�l�;�#6�#6�7�G��+6�(��!�+�8�E�J�K��k��+�+���(�#�H�O��*�*�,�H��(�(��rc��UR(dgURURUS9(d�[R"SURUR
S-
S5nUR
X1SSS9 UR5S;aUR5S;aMAURR5 URR5 gg)N�r�rrr�Fr�r�)rWr�rrVr�r~r�rXr2r(r,)r%�
failuremsgr�r�s    r�searchdirection�#curseschunkselector.searchdirection�s����z�z�����t�z�z�7��;��-�-��4�#3�#3�T�5E�5E��5I�1�M�C����S�y���N��*�*�,�&9�9���*�*�,�&9�9���K�K�����K�K���!�<rc�6�UR[S5SS9 g)Ns$Next pattern not found (press ENTER)Tr��r�rr$s r�handlenextsearch�$curseschunkselector.handlenextsearch�s �����
�5�6��	�	
rc�6�UR[S5SS9 g)Ns(Previous pattern not found (press ENTER)Fr�r�r$s r�handleprevsearch�$curseschunkselector.handleprevsearch�s �����
�9�:�E�	�	
rc�L�US;aUR5 g!US;aUR5 g!US;aUR5 g!US;aUR5 g!US;aUR	5 g!US;aUR5 g!US;aUR
5 g!US;a[R"[S	55eUS
;aUR5 g!US;agUS
;a&UR5(aSURS'gg!U(aUS;aSURS'gUS;aUR5 g!US;a UR5 URUS9 g!US;aUR5 g!US;aUR!5 g!US;aUR#US9 g!US;aUR%5 g!US;aUR%SS9 g!US;aUR'5 g!US;aUR)5 g!US;aUR+5 g!US;aUR-5 g!US;aUR/5 g!US;aUR15 g!US;aEUR35 UR4R75 UR4R95 g!U[:R<R?S 54;aPURAURB5 UR4R75 UR4R95 g!g!)"zL
Perform actions based on pressed keys.

Return true to exit the main loop.
)�k�KEY_UP)�K�	KEY_PPAGE)�j�KEY_DOWN)�J�	KEY_NPAGE)r��	KEY_RIGHT)rc�KEY_LEFT)�H�	KEY_SLEFT)�qs	user quit)�a)rT)�rsreview)�R)� rnr�r0)�X)�A)�e)r)�F)r�r�)r�)rF)�N)�g�KEY_HOME)�G�KEY_END)�?�LN)"r]rardrgrtrxr{r�
CanceledErrorrr�rxrr�rqr�r�r�rnrer�r�r�rhrkr\r2r(r,r�ascii�ctrlrrJ)r%�
keypressedr1s   rr9�$curseschunkselector.handlekeypressed�s�����(�����
�-�
-��"�"�$�
�,�
,����!�
�-�
-��$�$�&�
�-�
-�� � �"�
�,�
,����!�
�-�
-��$�$�&�
�5�
 ��%�%�a��o�6�6�
�5�
 ����!�
�5�
 ��
�5�
 �� � �"�"�'+��	�	�)�$��#��j�E�)�#'�D�I�I�i� ��
�:�
%�����
�.�
.��������4��(�
�5�
 ��!�!�#�
�5�
 ��N�N��
�5�
 ��O�O��O�&�
�5�
 �����
�5�
 ������.�
�5�
 ��$�$�&�
�5�
 �����
�5�
 ��!�!�#�
�5�
 ��!�!�#�
�,�
,��%�%�'�
�+�
+��$�$�&�
�5�
 ��O�O���K�K�����K�K���!�
�F�L�L�-�-�c�2�3�
3�
���T�7�7�8��K�K�����K�K���!�4rc�v�[5=p#[[S5(a/[R"[RUR5nURU5X#La&[R"[RU5 $$!X#La&[R"[RU5 ff=f)z@
method to be wrapped by curses.wrapper() for selecting chunks.
�SIGWINCH)rrrr�rH�_main)r%r2�origsigwinchrs    rr�curseschunkselector.main�s���
#)�(�*���6�:�&�&�!�=�=����$�:N�:N�O�L�	=��:�:�f�%��+��
�
�f�o�o�|�<�,��|�+��
�
�f�o�o�|�<�,�s�B�,B8c��XlSUlURR5uUlUl[
R"5 [
R"5 URR5 [
R"S5 URSSSS9 UR[
R[
RSS9 UR[
RSSS9 UR[
R SSS9 UR[
R[
R"SS9 [
R$"UR&SSS5UlUR(R+S	5 [
R,"S
UR5UlUR1S	S9S
-Ul[
R,"UR2UR5UlUR1UR8SS
9UlUR=5 UR>RAS5 UR(RC5nSSS5 URDb	SUl"MfURGW5(aOMURHS:waC[JRL"SSURH5nUS:waURHURNS'ggg![
Ra SUl	GN�f=f![
Ra GN�f=f![
Ra [5[7S55Ulgf=f!,(df   GN=f![
Ra SnGNf=f)NFrrr%r
r'r&r�TrrCs&this diff is too large to be displayedr7rUsfoobarrs(?m)^\s.*(\n|$)smessage)(r2r�getmaxyxr~r�r�start_color�use_default_colorsrrGr(r�rR�COLOR_WHITE�
COLOR_MAGENTA�	COLOR_RED�COLOR_GREEN�
COLOR_BLUErVrQr�rdrEr�r8rPrrrHrKrrrWrXrAr9rSr�r�r)r%r2r��whitespaceremoveds    rr��curseschunkselector._mains�������-1�[�[�-A�-A�-C�*���$�*�����	"��%�%�'�	
������	��O�O�A��	
���4��I��6�������� 4� 4�;�	�	
�	
���6�+�+�T���D����6�-�-�t�+��F�������� 1� 1�	�	�	
� ���t�':�':�A�q�!�D��������d�#��
�
�a��)9�)9�:��
� �4�4�4�4�H�1�L���	�"�M�M�$�*:�*:�D�<L�<L�M�D�M�$(�#<�#<��$�$�e�$=�$
�� ������
'��W�W�/�/�
�;�!%���!6�!6�!8�J�<��=�=�,�$(�D�M��-�
�$�$�Z�0�0������s�"� "���#�S�$�*:�*:�!��!�C�'�(,�(8�(8��	�	�*�%�(�	#��A�|�|�	"�!�D�M�	"���|�|�	��	��:�|�|�	�(��;�<��D�L�
�		��<�;��
�<�<�
'�&�
�
'�s`�K�;L�;0L�M �7M�M �K=�<K=�L�L�-M�
M�
M�M � M:�9M:)rBr�rDrCrSrHrArOrLrTrMrNrrIrRrPrQr�rrWrKrJr�r2rrGrTr�r~rN)F)NF)NNNNNTTF)FTF)TF)FT)NFTTrM)NFT)NNNN)8rrrrrVr]rardrgrqrtrxr{r�rr�r�r�r�rnr�r�r�r�rrrrr"r)rr4r:r,r8rHr�rRr\rerhrkrsrxr`r�r�r�r�r�r�r�r9rr�rrrrrr�sW��B�H,�&%�&,�$%�,)�&,�",�2/�,:�$>�\�|
H�+�(+�T*�(
(�&��
������c�J�0M�0�>�DAF�+�\?D�*�X
��4KO� �($��CG�@�F?C��&�?C�9�v+�5�n�/� %�.�*�0�W�r��0�4"�
�

�
E"�N=�O9rrrN)(�
__future__rr3r�r�i18nr�rrrr	r�r
rr�utilsr
rjr�r��
patchhelptextr�curses.ascii�ImportErrorrBr�rrr r�rYr�rbrrr#r=rUrrrr�<module>r�sB��#�	�	�
�������=�=�������������
����
�L�L�
O�E�K�K�O�B�l!�l!�^	 �I�t�	 �N/�y�N/�b3��3�lJA�Y�JA�Z "�F�,
��6�(�)��,�-�
�&�
'�
�%�
&�	��N9�N9��K	�^�$��
�F��s�C5�5
D�D

Youez - 2016 - github.com/yon3zu
LinuXploit