403Webshell
Server IP : 217.160.0.244  /  Your IP : 216.73.217.138
Web Server : Apache
System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64
User : u100174116 ( 6746176)
PHP Version : 8.5.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/dulwich/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/dulwich/__pycache__/diff_tree.cpython-313.pyc
�

mEdg [���SrSSKrSSKJrJr SSKJr SSKJr SSK	J
r
 SSKJr SS	K
JrJrJrJrJr S
rSrSrS
rSrSr\\4r\"SSS5rSrSrSrSr"SS\"S/SQ55rS\ S\S\!\4Sjr"S\ S\S\S\!\#\\44Sjr$Sr%S0Sjr&Sr'S1S jr(S\)4S!jr*S"r+S2S#\S$\!\S%\4S&jjr,S'r-S(\S\.\/\/44S)jr0S*r1S2S+jr2S,r3"S-S.5r4\%r5\$r6\0r7SS/K8J0r0J%r%J$r$ g!\9a gf=f)3z&Utilities for diffing files and trees.�N)�defaultdict�
namedtuple)�BytesIO)�chain)�Optional�)�BaseObjectStore)�S_ISGITLINK�ObjectID�ShaFile�Tree�	TreeEntry�add�modify�delete�rename�copy�	unchanged�d�<��c�8�\rSrSrSr\S5r\S5rSrg)�
TreeChange�3z.Named tuple a single change between two trees.c�&�U"[[U5$�N)�
CHANGE_ADD�_NULL_ENTRY)�cls�news  �3/usr/lib/python3/dist-packages/dulwich/diff_tree.pyr�TreeChange.add6s���:�{�C�0�0�c�&�U"[U[5$r)�
CHANGE_DELETEr)r�olds  r!r�TreeChange.delete:s���=�#�{�3�3r#�N)	�__name__�
__module__�__qualname__�__firstlineno__�__doc__�classmethodrr�__static_attributes__r(r#r!rr3s+��8��1��1��4��4r#r)�typer&r �path�tree�returnc��/nU(dU$URSS9H#nURURU55 M% U$)NT)�
name_order)�	iteritems�append�in_path)r1r2�result�entrys    r!�
_tree_entriesr;?s>�� �F���
����4��0���
�
�e�m�m�D�)�*�1��Mr#�tree1�tree2c�d�[X5n[X5nS=pV[U5n[U5n/n	XW:a�Xh:a�X5n
XFnU
RUR:aU	RU
[45 US-
nOSU
RUR:�aU	R[U45 US-
nOU	RX�45 US-
nUS-
nXW:aXh:aM�[XW5HnU	RX<[45 M [Xh5HnU	R[XL45 M U	$)a�Merge the entries of two trees.

Args:
  path: A path to prepend to all tree entry names.
  tree1: The first Tree object to iterate, or None.
  tree2: The second Tree object to iterate, or None.

Returns:
  A list of pairs of TreeEntry objects for each pair of entries in
    the trees. If an entry exists in one tree but not the other, the other
    entry will have all attributes set to None. If neither entry's path is
    None, they are guaranteed to match.
rr)r;�lenr1r7r�range)
r1r<r=�entries1�entries2�i1�i2�len1�len2r9�entry1�entry2�is
             r!�_merge_entriesrJHs�� �T�)�H��T�)�H��K�B��x�=�D��x�=�D�
�F�
�)��	��������;�;����$��M�M�6�;�/�0��!�G�B�
�[�[�6�;�;�
&��M�M�;��/�0��!�G�B��M�M�6�*�+��!�G�B��!�G�B�
�)��	��2�_���
�
�x�{�K�0�1��
�2�_���
�
�{�H�K�0�1���Mr#c�N�URnUcg[R"U5$�NF)�mode�stat�S_ISDIR)r:rMs  r!�_is_treerPss"���:�:�D��|���<�<���r#c	#�# �U=(a [R=(d SnU=(a [R=(d Sn[SXA5[SXR54/nU(a�UR5upx[	U5n	[	U5n
U(aU	(aU
(aXx:XaMKU	=(a XR
=(d SnU
=(a XR
=(d SnUR=(d URn
UR[[X�U555 Xx4v� U(aM�gg7f)a�Recursively walk all the entries of two trees.

Iteration is depth-first pre-order, as in e.g. os.walk.

Args:
  store: An ObjectStore for looking up objects.
  tree1_id: The SHA of the first Tree object to iterate, or None.
  tree2_id: The SHA of the second Tree object to iterate, or None.
  prune_identical: If True, identical subtrees will not be walked.

Returns:
  Iterator over Pairs of TreeEntry objects for each pair of entries
    in the trees and their subtrees recursively. If an entry exists in one
    tree but not the other, the other entry will have all attributes set
    to None. If neither entry's path is None, they are guaranteed to
    match.
Nr#)
rN�S_IFDIRr�poprP�shar1�extend�reversedrJ)�store�tree1_id�tree2_id�prune_identical�mode1�mode2�todorGrH�is_tree1�is_tree2r<r=r1s              r!�
walk_treesr`zs����(�
&�$�,�,�/�4�E�
�
&�$�,�,�/�4�E�
�s�E�
,�i��U�.M�N�O�D�
��������F�#���F�#���x�H��9I���/�e�J�J�/�8�D���/�e�J�J�/�8�D���{�{�)�f�k�k�����H�^�D��?�@�A��n���$�s�D8D>�<D>c��URb,U(d+[R"UR5(a[$U$r)rMrNrOr)r:�
include_treess  r!�
_skip_treerc�s+���z�z��-�D�L�L����4L�4L����Lr#c#�b# �Ub!UbUbURUUUUS9Shv�N g[XX#(+S9nUH�up�X�:Xa	U(dM[X�5n[X�5n	U[:wa�U	[:wa�[R
"UR5[R
"U	R5:wa+U(d$[RU5v� [n[n
O7X�:Xa[n
O+[n
O$U[:wa[n
OU	[:wa[n
OM�[X�U	5v� M� gGN7f)a>Find the differences between the contents of two trees.

Args:
  store: An ObjectStore for looking up objects.
  tree1_id: The SHA of the source tree.
  tree2_id: The SHA of the target tree.
  want_unchanged: If True, include TreeChanges for unmodified entries
    as well.
  include_trees: Whether to include trees
  rename_detector: RenameDetector object for detecting renames.
  change_type_same: Whether to report change types in the same
    entry or as delete+add.

Returns:
  Iterator over TreeChange instances for each change between the
    source and target tree.
N��want_unchangedrb)rZ)
�changes_with_renamesr`rcrrN�S_IFMTrMrrr�CHANGE_UNCHANGED�
CHANGE_MODIFYr%)rWrXrYrf�rename_detectorrb�change_type_same�entriesrGrH�change_types           r!�tree_changesro�s���4�"�x�';��@T�"�7�7���)�'�	8�
�	
�	
�	��
��4F��G�"�����N���F�2���F�2���[� �V�{�%:����F�K�K�(�D�K�K����,D�D�(�!�'�'��/�/�$��(���!�.��+��
�{�
"�'�K�
�{�
"�$�K�
���f�5�5�9"�	
�s�D/�D,�DD/c�2�UHnU"U5U:wdM g g)NFTr()�seq�key�value�es    r!�_all_eqru�s��
���q�6�U�?���r#c�2�[USSX"US55$)Nrr)ru)rqrrs  r!�	_all_samerw�s���3�q�r�7�C��S��V��-�-r#rW�parent_tree_ids�tree_idc
#�^# �UVs/sH
n[XX#S9PM nn[U5m[U4Sj5n[U5HVupxUHKn	U	R[
:XaU	RRn
OU	RRn
X�U
U'MM MX SnSn[UR55H~up�[U5T:XdeUVs/sH	o�cMUPM nn[UU[
5(a[UU5(dUv� MYM[[UU5(dUv� MrSU;dMzUv� M� gs snfs snf7f)aGet the tree changes for a merge tree relative to all its parents.

Args:
  store: An ObjectStore for looking up objects.
  parent_tree_ids: An iterable of the SHAs of the parent trees.
  tree_id: The SHA of the merge tree.
  rename_detector: RenameDetector object for detecting renames.

Returns:
  Iterator over lists of TreeChange objects, one per conflicted path
  in the merge.

  Each list contains one element per parent, with the TreeChange for that
  path relative to that parent. An element may be None if it never
  existed in one parent and was deleted in two others.

  A path is only included in the output if it is a conflict, i.e. its SHA
  in the merge tree is not found in any of the parents, or in the case of
  deletes, if not all of the old SHAs match.
)rkc�>�S/T-$rr()�num_parentss�r!�<lambda>�(tree_changes_for_merge.<locals>.<lambda>s������$r#c�.�URR$r)r&rT��cs r!�old_sha�'tree_changes_for_merge.<locals>.old_sha!s���u�u�y�y�r#c��UR$r)r0r�s r!rn�+tree_changes_for_merge.<locals>.change_type$s���v�v�
r#N)
ror?r�	enumerater0r%r&r1r �sorted�itemsrurw)rWrxryrk�t�all_parent_changes�changes_by_pathrI�parent_changes�changer1r�rn�_�changesr��haver|s                 @r!�tree_changes_for_merger��s7����8!�� �A�	�U�w�H� ����o�&�K�=H�$�>�O�
'�'9�:���$�F��{�{�m�+��z�z�����z�z����'-�D�!�!�$�%�;����_�2�2�4�5�
���7�|�{�*�*�*�"�4�7�a��7��4��4��m�4�4��T�7�+�+��
�,��4��-�-��M�
��
 ��M�6��3��65�s)�E	�D?�B:E	�E� E�&AE	�6E	�@�objc��[[5n[5nSnURnURnUR
nURn[R"UR55HknURSS5n	U"U	5 US-
nU	S:XdU[:XdM4U"5n
U[U
5==[U
5-
ss'U"S5 U"5 SnMm US:�a&U"5nU[U5==[U5-
ss'U$)z�Count the blocks in an object.

Splits the data into blocks either on lines or <=64-byte chunks of lines.

Args:
  obj: The object to count blocks for.

Returns:
  A dict of block hashcode -> total bytes occurring.
rr�big�
)r�intr�write�seek�truncate�getvaluer�
from_iterable�
as_raw_chunks�to_bytes�_BLOCK_SIZE�hashr?)r��block_counts�block�n�block_write�
block_seek�block_truncate�block_getvaluer��cbrs�
last_blocks            r!�
_count_blocksr�:s���$/�s�#3�L��I�E�	�A��+�+�K����J��^�^�N��^�^�N�
�
 �
 ��!2�!2�!4�
5��
�Z�Z��5�
!���B��	�Q���
��;�!�{�*�"�$�E���e��%��U��3�%��q�M����A�6�	�1�u�#�%�
��T�*�%�&�#�j�/�9�&��r#c��[U5[U5:�aXpSnUR5H-up4URU5nU(dMU[XE5-
nM/ U$)a>Count the number of common bytes in two block count dicts.

Args:
  blocks1: The first dict of block hashcode -> total bytes.
  blocks2: The second dict of block hashcode -> total bytes.

Returns:
  The number of bytes in common between blocks1 and blocks2. This is
  only approximate due to possible hash collisions.
r)r?r��get�min)�blocks1�blocks2�scorer��count1�count2s      r!�
_common_bytesr�_sY���7�|�c�'�l�"�"��
�E� ����
�����U�#���6��S��(�(�E�)��Lr#c��Uc0nURU;a[U5X R'URU;a[U5X!R'[X RX!R5n[UR	5UR	55nU(d[
$[
[U5[
-U-5$)a�Compute a similarity score for two objects.

Args:
  obj1: The first object to score.
  obj2: The second object to score.
  block_cache: An optional dict of SHA to block counts to cache
    results between calls.

Returns:
  The similarity score between the two objects, defined as the
    number of bytes in common between the two objects divided by the
    maximum size, scaled to the range 0-100.
)�idr�r��max�
raw_length�
_MAX_SCOREr��float)�obj1�obj2�block_cache�common_bytes�max_sizes     r!�_similarity_scorer�us��������w�w�k�!�,�T�2��G�G���w�w�k�!�,�T�2��G�G�� ��W�W�!5�{�7�7�7K�L�L��4�?�?�$�d�o�o�&7�8�H�����u�\�"�Z�/�(�:�;�;r#c�t�URRnURRnUcUnUcUnX4$r)r&r1r )r:�path1�path2s   r!�_tree_change_keyr��s8���I�I�N�N�E��I�I�N�N�E��}����}����>�r#c��\rSrSr%Sr\\\S'\\\S'\\\S'\\\	\4\S'\
\\S4SS	jjr
SS
jrSrSSjrSS
jrSSjrSSjrSrSrSSjrSSjrSSjrSrSSjrSSjrSrg)�RenameDetectori�z7Object for handling rename detection between two trees.�_adds�_deletes�_changes�_candidatesFNc�N�XlX lX@lX0lXPlSUlg)a0Initialize the rename detector.

Args:
  store: An ObjectStore for looking up objects.
  rename_threshold: The threshold similarity score for considering
    an add/delete pair to be a rename/copy; see _similarity_score.
  max_files: The maximum number of adds and deletes to consider,
    or None for no limit. The detector is guaranteed to compare no more
    than max_files ** 2 add/delete pairs. This limit is provided
    because rename detection can be quadratic in the project size. If
    the limit is exceeded, no content rename detection is attempted.
  rewrite_threshold: The threshold similarity score below which a
    modify should be considered a delete/add, or None to not break
    modifies; see _similarity_score.
  find_copies_harder: If True, consider unmodified files when
    detecting copies.
FN)�_store�_rename_threshold�_rewrite_threshold�
_max_files�_find_copies_harder�_want_unchanged)�selfrW�rename_threshold�	max_files�rewrite_threshold�find_copies_harders      r!�__init__�RenameDetector.__init__�s(��2��!1��"3��#��#5� �$��r#c�.�/Ul/Ul/Ulgr)r�r�r��r�s r!�_reset�RenameDetector._reset�s����
���
���
r#c�^�URbBUR[:wd.URRUR
R:XagURURRnURUR
Rn[X#5UR:$rL)r�r0rjr&rTr r�r�)r�r��old_obj�new_objs    r!�
_should_split�RenameDetector._should_split�sw���#�#�+��{�{�m�+��z�z�~�~������/���+�+�f�j�j�n�n�-���+�+�f�j�j�n�n�-�� ��2�T�5L�5L�L�Lr#c��UR[:XaURRU5 gUR[:XaUR
RU5 gUR
U5(aqUR
R[RUR55 URR[RUR55 gUR(aUR[:XdUR[:XaUR
RU5 gURRU5 gr)r0rr�r7r%r�r�rrr&rr r�rirjr�)r�r�s  r!�_add_change�RenameDetector._add_change�s����;�;�*�$��J�J���f�%�
�[�[�M�
)��M�M� � ��(�
�
�
��
'�
'��M�M� � ��!2�!2�6�:�:�!>�?��J�J���j�n�n�V�Z�Z�8�9��$�$����8H�)H�
�[�[�M�
)�

�M�M� � ��(��M�M� � ��(r#c��UR=(d URn[URUUUURS9HnURU5 M g)Nre)r�r�ror��_include_treesr�)r�rXrYrfr�s     r!�_collect_changes�RenameDetector._collect_changes�sP���1�1�I�T�5I�5I��"��K�K���)��-�-�
�F�
���V�$�
r#c��URVs/sH o3RRU;dMUPM" snUlURVs/sH oDRRU;dMUPM" snUlgs snfs snfr)r�r r1r�r&)r��	add_paths�delete_paths�a�ds     r!�_prune�RenameDetector._prune�sY��!%���K��A�u�u�z�z��/J�a��K��
�$(�M�M�T�M�q�U�U�Z�Z�|�5S��M�T��
��L��Ts�A<�A<�B�-Bc	��[[5nURH4nXRRRUR5 M6 [[5nURHInUR[:HnX4RRRURU45 MK [5n[5nUR5GH[up�Xn
[X�5H�uup�n[R"UR5[R"UR5:waMLU(aUR!UR"5 UR!UR"5 U=(a [$=(d [&n
UR(R[+X�U55 M� [-U
5[-U	5-
nU	SSnUS:�dGMX�*SHGnUR!UR"5 UR(R[+[&X�55 MI GM^ UR/Xg5 g)Nr)r�listr�r rTr7r�r0r%r&�setr��ziprNrhrMrr1�
CHANGE_RENAME�CHANGE_COPYr�rr?r�)r��add_mapr�
delete_mapr�	is_deleter�r�rT�sha_deletes�sha_addsr&r �new_type�num_extra_addss               r!�_find_exact_renames�"RenameDetector._find_exact_renames�s����d�#���:�:�C��G�G�K�K� �'�'����0�� ��&�
��m�m�F����}�4�I��z�z�~�~�&�-�-�v�z�z�9�.E�F�	$��E�	��u�� *� 0� 0� 2��C��|�H�),�[�)C�%� ��#��;�;�s�x�x�(�D�K�K����,A�A��� �$�$�S�X�X�.��
�
�c�h�h�'�%�7�-�G�K���
�
�$�$�Z��s�%C�D�*D�!��]�S��-=�=�N��a�.��#�C���!�#�O�$4�5�C��M�M�#�(�(�+��M�M�(�(��K��)J�K�6�!3�$	
���I�,r#c�x�[UR5[UR5-URS-:*$)N�)r?r�r�r�r�s r!�_should_find_content_renames�+RenameDetector._should_find_content_renamess,���4�:�:���T�]�]�!3�3�t����7I�I�Ir#c��U(a4URRURR:Xa[$UR[
:wa[$[$r)r&r1r rjr0r%r�r�)r��check_pathsrrs    r!�_rename_type�RenameDetector._rename_types>���6�:�:�?�?�c�g�g�l�l�:�!� �
�[�[�M�
)����r#c��/=olUR5(dg0nURSLnURGHKn[	UR
R5(aM*UR
RnURUn[U5X%'URH�n[R"UR
R5[R"URR5:waM[URURRn[XhUS9n	X�R:�dM�URX4U5n
[!X�R
UR5nUR#U	*U45 M� GMN g)N)r�)r�rr�r�r
r&rMrTr�r�r�rNrhr r�rrr7)r��
candidatesr�rrr�r�rr�r�r�rs            r!�_find_content_rename_candidates�.RenameDetector._find_content_rename_candidates&s&��(*�*�
�%��0�0�2�2�����,�,�D�8���m�m�F��6�:�:�?�?�+�+���j�j�n�n�G��k�k�'�*�G�#0��#9�K� ��z�z���;�;�v�z�z���/�4�;�;�s�w�w�|�|�3L�L���+�+�c�g�g�k�k�2��)�'��T���1�1�1�#�0�0��c�J�H�'��*�*�c�g�g�F�F��%�%��v�v�&6�7�"�
$r#c��URR5 [5n[5nURH�up4URRnXR;aM"UR
RnURnXa;a%[[UR
UR5nU[:waURU5 URU5 URRU5 M� URX!5 gr)
r��sortr�r r1r&r0rr�rr�r7r�)r�r�r�r�r��new_path�old_path�	orig_types        r!�_choose_content_renames�&RenameDetector._choose_content_renamesCs���	
�������u���E�	��)�)�I�A��z�z���H��$���z�z���H����I��'�#�K����V�Z�Z�H���K�'�� � ��*��M�M�(�#��M�M� � ��(�*�	
���I�,r#c�X�URcg0nURVs0sHo"RRU_M nnURH�nUR
RnUR
U5nUcM/[R"URR5[R"UR
R5:XdM�[[URUR
5X'M� URVs/sH owR
RU;dMUPM" snUlURVs/sH owR
RU;dMUPM" snUlU=RUR5-
slgs snfs snfs snfr)r�r�r&r1r�r r�rNrhrMrrjr��values)r��modifiesr�r�rr1rr�s        r!�_join_modifies�RenameDetector._join_modifies[s#���"�"�*����-1�]�]�;�]��e�e�j�j�!�m�]�
�;��:�:�C��7�7�<�<�D��^�^�D�)�F��!�d�k�k�&�*�*�/�/�&B�d�k�k������G�'�",�M�6�:�:�s�w�w�!O���
�"&���J��A�u�u�z�z��/I�a��J��
�$(�M�M�P�M�q�U�U�Z�Z�x�5O��M�P��
��
�
����*�*�
��<��K��Ps� F�
F"�.F"�
F'�+F'c���/nURUR5 URUR5 URUR5 UR	[
S9 U$)N)rr)rUr�r�r�rr�)r�r9s  r!�_sorted_changes�RenameDetector._sorted_changesmsK�����
�
�d�j�j�!��
�
�d�m�m�$��
�
�d�m�m�$����(��)��
r#c��UR(agURVs/sHoR[:wdMUPM snUlgs snfr)r�r�r0ri)r�r�s  r!�_prune_unchanged�RenameDetector._prune_unchangedus5������$(�M�M�P�M�q�V�V�?O�5O��M�P��
��Ps
�A�Ac��UR5 X0lX@lURX5 UR	5 UR5 UR
5 UR5 UR5 UR5$)zAIterate TreeChanges between two tree SHAs, with rename detection.)
r�r�r�r�r�rrrrr)r�rXrYrfrbs     r!rg�#RenameDetector.changes_with_renameszsr��	
���
�-��+�����h�1�� � �"��,�,�.��$�$�&����������#�#�%�%r#)r�r�r�r�r�r�r�r�r�r�r�)r3N)FF)r)r*r+r,r-r�r�__annotations__�tupler��RENAME_THRESHOLD�	MAX_FILES�REWRITE_THRESHOLDr�r�r�r�r�r�r�rrrrrrrrgr/r(r#r!r�r��s���A��
����:����:����e�C��O�,�-�-�
*��+� �
%�
�%�@�
	M�)�&	%�U�-�BJ�
�8�:-�0+�$�Q�GL�
&r#r�)r�rPrJ)F)FNFFr):r-rN�collectionsrr�ior�	itertoolsr�typingr�object_storer	�objectsr
rrr
rrrjr%r�r�ri�RENAME_CHANGE_TYPESrr�r r!r"r�bytesr�r;rrJrPr`rcro�boolrurwr�r��dictr�r�r�r�r�r��_is_tree_py�_merge_entries_py�_count_blocks_py�dulwich._diff_tree�ImportErrorr(r#r!�<module>r2s���,-��/����)�D�D��
��
��
��
�����$�k�2����d�D�)��
�
����	���	4��L�*@�A�	4����T��d�9�o��(�
�(��(�%)�(�	�%�	�9�$�
%�&�(�V�"�J�����B6�J���.��	?��?��(�^�?��?�D��"�w�"�4��S��>�"�J�,<�8�k&�k&�^��"�� ��	����
�	��	�s�)
C4�4C=�<C=

Youez - 2016 - github.com/yon3zu
LinuXploit