403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.224
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/breezy/bzr/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/breezy/bzr/tests/__pycache__/test_dirstate.cpython-313.pyc
�

p��g_����SrSSKrSSKrSSKJrJrJrJrJr SSKJ	r
 SSKJrJr SSK
Jr SS	KJrJrJrJr "S
S\R&5r\r"SS
\R,5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r "S S!\R,5r!"S"S#\RD5r#"S$S%5r$"S&S'\R,5r%"S(S)\5r&"S*S+\5r'"S,S-\5r("S.S/\5r)"S0S1\R&5r*"S2S3\RV5r,"S4S55r-"S6S7\R&5r.g)8zGTests of the dirstate functionality being built for WorkingTreeFormat4.�N�)�
controldir�errors�
memorytree�osutils�tests)�revision)�features�test_osutils)�load_tests_apply_scenarios�)�dirstate�	inventory�
inventorytree�
workingtree_4c��\rSrSrSrSrg)�
TestErrors�)c�h�[R"SS5nURS[U55 g)Nz.bzr/checkout/dirstateztrailing garbage: "x"zWThe dirstate file (.bzr/checkout/dirstate) appears to be corrupt: trailing garbage: "x")r�DirstateCorrupt�assertEqualDiff�str)�self�errors  �@/usr/lib/python3/dist-packages/breezy/bzr/tests/test_dirstate.py�test_dirstate_corrupt� TestErrors.test_dirstate_corrupt*s4���(�(�$�&=�
��	
���
<���J�	
��N)�__name__�
__module__�__qualname__�__firstlineno__r�__static_attributes__rrrrr)s��
rrc�^�\rSrSrSr\R"5rSrSr	U4Sjr
SrSrSr
SrS	rS
rSrSrS
rU=r$)�TestCaseWithDirState�8zDHelper functions for creating DirState objects with various content.Nc�l>�[TU]5 UR[SUR	55 g)N�_selected_dir_reader)�super�setUp�overrideAttrr�_dir_reader_class)r�	__class__s �rr+�TestCaseWithDirState.setUpAs(���
��
�����'�#9�4�;Q�;Q�;S�Trc�D�[RRS5nU$)z#Return a locked but empty dirstate.r)r�DirState�
initialize�r�states  r�create_empty_dirstate�*TestCaseWithDirState.create_empty_dirstateEs���!�!�,�,�Z�8���rc��SnSSSSSU4/4n/nURSU/45 URS/45 UR5nUR/U5 UR5 U$! UR	5 e=f)z5Return a write-locked state with a single root entry.� AAAAREUHaIpFB2iKAAADAQAtkqUAAIGk�rr�a-root-value�drrF)�appendr5�	_set_data�	_validate�unlock�r�packed_stat�root_entry_direntry�	dirblocksr4s     r�create_dirstate_with_root�.TestCaseWithDirState.create_dirstate_with_rootJs���9��'��s�A�u�k�2�
�
���	����#� 3�4�5�6����#�r��#��*�*�,��	��O�O�B�	�*��O�O�����	��L�L�N��s�"A+�+A>c���SnSSSSSU4/4nUR5n[UR5nUSSRU5 UR	/U5 U$! UR5 e=f)z2Return a locked DirState with a root and a subdir.r8�r�subdir�	subdir-idr;rrF�)rD�list�
_dirblocksr<r=r?)rrA�subdir_entryr4rCs     r�$create_dirstate_with_root_and_subdir�9TestCaseWithDirState.create_dirstate_with_root_and_subdir_s���9��*��s�A�u�k�2�
�
���.�.�0��	��U�-�-�.�I��a�L��O�"�"�<�0��O�O�B�	�*����	��L�L�N��s�>A�A1c��SnSnSSSSSU4/4nSSSSSU4/4nS	SSSSU4/4nS
SUSSU4/4nS
SUSSU4/4nSSSSSU4/4nSSUSSU4/4n	SSUSSU4/4n
SSUSSU4/4n/nURSU/45 URSXEXg/45 URSX�/45 URSX�/45 [RRS5n
U
R	5 U
R/U5 U
$! U
R
5 e=f)aZThis dirstate contains multiple files and directories.

 /        a-root-value
 a/       a-dir
 b/       b-dir
 c        c-file
 d        d-file
 a/e/     e-dir
 a/f      f-file
 b/g      g-file
 b/h\xc3\xa5  h-\xc3\xa5-file  #This is u'\xe5' encoded into utf-8

Notice that a/e is an empty directory.

:return: The dirstate, still write-locked.
r8� xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr9r;rrF�r�a�a-dir�r�b�b-dir�r�c�c-file�f�
�rr;�d-file��rS�e�e-dir�rSr[�f-file��rV�g�g-file)rV�hå�	h-å-file�(rSrVr)r<rr1r2r>r=r?)rrA�null_sha�
root_entry�a_entry�b_entry�c_entry�d_entry�e_entry�f_entry�g_entry�h_entryrCr4s              r�create_complex_dirstate�,TestCaseWithDirState.create_complex_dirstaters���":��6��'��s�A�u�k�2�
�
�
�
"��s�A�u�k�2�
�
��
"��s�A�u�k�2�
�
��
#��x��U�K�8�
�
��
#��x��U�K�8�
�
��
#��s�A�u�k�2�
�
��
$��x��U�K�8�
�
��
$��x��U�K�8�
�
��
5��x��U�K�8�
�
���	����#�
�|�,�-����#��'�C�D�E����$�� 2�3�4����$�� 2�3�4��!�!�,�,�Z�8��
����	��O�O�B�	�*����	��L�L�N��s�"C6�6D	c��URURSL5 URUSUR55 UR/UR	55 URUS[UR
555 UR5 UR5 A[RRS5nUR5 URUS[UR
555 UR5 g!UR5 f=f!UR5 f=f)a�Check that state has current state expected_result.

This will check the current state, open the file anew and check it
again.
This function expects the current state to be locked for writing, and
will unlock it before re-opening.
This is required because we can't open a lock_read() while something
else has a lock_write().
    write => mutually exclusive lock
    read => shared lock
NrrJr)
�
assertTrue�_lock_token�assertEqual�get_parent_ids�
get_ghostsrK�
_iter_entries�saver?rr1�on_file�	lock_read)r�expected_resultr4s   r�check_state_with_reopen�,TestCaseWithDirState.check_state_with_reopen�s���	
����)�)��5�6�	����_�Q�/��1E�1E�1G�H����R��!1�!1�!3�4����_�Q�/��e�6I�6I�6K�1L�M��J�J�L��L�L�N���!�!�)�)�*�5��
����	����_�Q�/��e�6I�6I�6K�1L�M��L�L�N��
�L�L�N��
�L�L�N�s�A?D�,D1�D.�1Ec�0�URS5n/SQn/SQnURUVs/sHnSU-PM
 sn5 URS5 URUVs/sHoDR	S5PM snUS9 URSS	S
9 S	nUR
S5nURS5n[R"U5n[U5n	URS5n
[R"U
5n[U
5nURS
5n
[R"U
5n[U
5nURS5n[R"U5n[U5nURS5n[R"U5n[U5n[RRnSSSSSU4SSSSU4/4SSSSSU4SX�SU4/4SSSSSU4SSSSU4/4SSSSSU4SX�SU4/4SSSSSU4SSSSU4/4SSSSSU4SX�SU4/4SSSSSU4SUUSU4/4SSSSSU4SUUSU4/4S.n[RRUS5nUR5 UR!5 [RR#S5nUR%5 UR'UR 5 UR)[RR*UR,5 SUlUUU4$s snfs snf!UR!5 f=f) zOCreate a dirstate with a few files and directories.

a
b/
  c
  d/
    e
b-c
f
�tree)�azb/�b/czb/d/�b/d/e�b-c�f)�a-id�b-id�c-id�d-id�e-id�b-c-id�f-idztree/�	TREE_ROOT�/��ids�initialsrev-1��rev_idr�r�r�r�r��rrr�r;rrF)rrSr�r[)rrVr�)rVrYr�)rVr;r�)�b/drar�)r�b-cr�)rr[r�)rrSrV�b/cr��b/d/er�r[r��)�make_branch_and_tree�
build_tree�set_root_id�add�rstrip�commit�
get_transport�	get_bytesr�
sha_string�lenrr1�NULLSTAT�	from_treerr?r�r��
addCleanupr{�
NOT_IN_MEMORY�_dirblock_state�_bisect_page_size)rr��paths�file_ids�p�revision_id�t�a_text�a_sha�a_len�c_text�c_sha�c_len�e_text�e_sha�e_len�b_c_text�b_c_sha�b_c_len�f_text�f_sha�f_len�	null_stat�expectedr4s                         r�create_basic_dirstate�*TestCaseWithDirState.create_basic_dirstate�sy���(�(��0��?��T�����e�4�e���1��e�4�5�����&�����/��A�(�(�3�-��/�X��>����I�h��/������v�&�����S�!���"�"�6�*���F������U�#���"�"�6�*���F������W�%���"�"�6�*���F����;�;�u�%���$�$�X�.���h�-�����S�!���"�"�6�*���F����%�%�.�.�	�)��3��5�)�4��3��5�+�6���%��3��5�)�4��5���<���%��3��5�)�4��3��5�+�6���&��3��5�)�4��5���<���&��3��5�)�4��3��5�+�6���(��3��5�)�4��5���<���)��3��5�)�4��7�G�U�K�@���%��3��5�)�4��5�%���<���e9
��t�!�!�+�+�D�*�=��	��J�J�L��L�L�N��!�!�)�)�*�5��
����������%�����*�*�8�8�%�:O�:O�P�
#&����U�H�$�$��K5��/��p
�L�L�N�s�K9�K>�L�Lc��UR5upnUR/SQ5 UR/SQ/SQS9 SHunX4nUS-nUS[RR
USS/4X4'USSUSSUSS	S-4nUUSS[RR
/4X6'Mw UR
5 [RRUS
5nUR5 UR
5 UR5 XU4$!UR
5 f=f!UR5 f=f)z�Create a dirstate with a deleted and added entries.

This grabs a basic_dirstate, and then removes and re adds every entry
with a new file id.
)r�r�r��b/dr��br�)r�r�r�r�r�r�r�)sa-id2sb-id2sc-id2sd-id2se-id2sb-c-id2sf-id2r�)rSrVr�r�r�r�r[�2rrJr
r)
r��	unversionr�rr1�NULL_PARENT_DETAILSr?r�rr�)	rr�r4r��path�orig�path2�new_key�	new_states	         r�create_duplicated_dirstate�/TestCaseWithDirState.create_duplicated_dirstate^sW��!%� :� :� <���X�	
���D�E����9��	�	
�I�D��>�D��4�K�E��Q���"�"�6�6��Q���
�C��H�N��A�w�q�z�4��7�1�:�t�A�w�q�z�D�/@�A�G���a����X�.�.�B�B�C��H�O�I�"	����		� �)�)�3�3�D�*�E�I�
#���� �� � �"�
�O�O���H�$�$��� � �"��
�O�O��s$� D2�(D�8D2�D/�/D2�2Ec�v�UR5upnURSS5 URSS5 USnUSSUSS/4US'S	USSS
/4US'USnUSS
USS/4US'SUSSS/4US'USnUSSUSS/4US'SUSSS/4US'UR5 [RRUS5nUR
5 UR5 UR5 XU4$!UR5 f=f!UR5 f=f)zkCreate a dirstate with a few internal renames.

This takes the basic dirstate, and moves the paths around.
r�zb/gr��hrSr)�r�b/grFrrJ)rVrgr�)r�rSrFrr�r�)r��hrFr)rr�r�)r�r�rFrr�r�)r��h/erFr)r�rar�)r�r�rFrr�r)r��
rename_oner?rr1r�rr�)rr�r4r��old_a�old_d�old_er�s        r�create_renamed_dirstate�,TestCaseWithDirState.create_renamed_dirstate�s���
!%� :� :� <���X�����U�#�����s�#�������(�%B�E�!�H�Q�K�$P�Q����!�
�1�X�a�[�5�6�
������ ��!�!�H�'B�E�!�H�Q�K�&P�Q���� �
�1�X�a�[�7�8�
����
��"��#�A�h�)F��a��QR��(T�U����!�
�1�X�a�[�9�:�
����
	����	� �)�)�3�3�D�*�E�I�
#���� �� � �"��O�O���H�$�$��� � �"���O�O��s$�; D&�D�,D&�D#�#D&�&D8r)r r!r"r#�__doc__r�dir_reader_scenarios�	scenariosr-�_native_to_unicoder+r5rDrNrvr�r�r�r�r$�
__classcell__�r.s@rr&r&8s[���N��1�1�3�I�����U��
�*�&U�n�@s%�j4%�l(%�(%rr&c�J�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
g)
�TestTreeToDirStatei�c��URS5n/SSURS54SSSS[RR4/4/4n[RRUS5nUR
5 URX#5 g)	�9We should be able to create a dirstate for an empty tree.r�r�r;rFrN)r��path2idrr1r�r�r>r��rr�r�r4s    r�test_empty_to_dirstate�)TestTreeToDirState.test_empty_to_dirstate�s����(�(��0����#�t�|�|�B�/�0�!���!�$�-�-�6�6����

�
��"�!�!�+�+�D�*�=��
�����$�$�_�<rc��URS5nURS5n[R"[R
"UR55 U/SSURS54SSSS[RR4SSSSU4/4/4n[RRUS5nURX45 UR5 UR5 UR5 g!UR5 f=f)	Nr��
first postrr�r;rFr)r�r�r�	pack_stat�os�stat�basedirr�r1r�r�r�r�r>r?�rr�r�r�r4s     r� test_1_parents_empty_to_dirstate�3TestTreeToDirState.test_1_parents_empty_to_dirstate�s����(�(��0�����\�*�����2�7�7�4�<�<�0�1�
�H��#�t�|�|�B�/�0�!���!�$�-�-�6�6���s�A�u�f�5�	��
�
��$�!�!�+�+�D�*�=���$�$�_�<�
����	��O�O���L�L�N��E�L�L�N�s�C8�8D
c	�f�URS5nURS5nURRS5R	5nURSSS9nURUR5 X$/SSURS54S	SS
S[RR4S	SS
SU4S	SS
SU4/4/4n[RRUS5nURXV5 UR5 UR5 UR5 g!UR5 f=f)
Nr�r��tree2�second postT)�allow_pointlessrr�r;rFr)r�r�r�sprout�open_workingtree�merge_from_branch�branchr�rr1r�r�r�r�r>r?�rr�r�r��rev_id2r�r4s       r� test_2_parents_empty_to_dirstate�3TestTreeToDirState.test_2_parents_empty_to_dirstate�s&���(�(��0�����\�*�����&�&�w�/�@�@�B���,�,�}�d�,�C�����u�|�|�,�
���#�t�|�|�B�/�0�!���!�$�-�-�6�6���s�A�u�f�5��s�A�u�f�5�
�
�
�
��&�!�!�+�+�D�*�=���$�$�_�<�
����	��O�O���L�L�N��E�L�L�N�s�=D�D0c��URS5nURS/5 /SSURS54SSSS[RR
4/4/4n[RR
US5nURX#5 g	)
r�r�ztree/unknownrr�r;rFrN)r�r�r�rr1r�r�r�r�s    r�+test_empty_unknowns_are_ignored_to_dirstate�>TestTreeToDirState.test_empty_unknowns_are_ignored_to_dirstates����(�(��0������(�)���#�t�|�|�B�/�0�!���!�$�-�-�6�6����

�
��"�!�!�+�+�D�*�=���$�$�_�<rc�l�URS5nURS/5 URSSS9 U$)Nr��tree/a file�a file�	a-file-idr�)r�r�r�)rr�s  r�get_tree_with_a_file�'TestTreeToDirState.get_tree_with_a_file3s5���(�(��0�������(�����|��,��rc�6�UR5n/SSURS54SSSS[RR4/4SSSSS[RR4/4/4n[RRUS5nUR
X#5 g	)
r�rr�r;rF�r�a filerr[rN)rr�rr1r�r�r�r�s    r�%test_non_empty_no_parents_to_dirstate�8TestTreeToDirState.test_non_empty_no_parents_to_dirstate9s����(�(�*����#�t�|�|�B�/�0�!���!�$�-�-�6�6����3��s�A�u�h�.?�.?�.H�.H�I���
�
��.�!�!�+�+�D�*�=���$�$�_�<rc	��UR5nURS5nURS/5 U/SSURS54SSSS[R
R4SSSSU4/4SS	SSS[R
R4S	S
SSU4/4/4n[R
RUS5nURX45 g)
Nr��r	snew content
rr�r;rFrr[�(c3ed76e4bfd45ff1763ca206055bca8e9fc28aa8�r)	rr��build_tree_contentsr�rr1r�r�r�r�s     r�$test_1_parents_not_empty_to_dirstate�7TestTreeToDirState.test_1_parents_not_empty_to_dirstateWs����(�(�*�����\�*��	
� � �"C�!D�E�
�H��#�t�|�|�B�/�0�!���!�$�-�-�6�6���s�A�u�f�5�	��3��s�A�u�h�.?�.?�.H�.H�I� �G��!�"��	��
�
��>�!�!�+�+�D�*�=���$�$�_�<rc
�|�UR5nURS5nURRS5R	5nURS/5 URS5nUR
UR5 URS/5 X$/SSURS54SSS	S
[RR4SSS	S
U4SSS	S
U4/4SSSS	S
[RR4SS
SS
U4SSSS
U4/4/4n[RRUS5nURXV5 g)Nr�r�)ztree2/a filesmerge content
r�rrr�r;rFrr[rrs(314d796174c9412647c3ce07dfb5d36a94e72958�r)rr�rr�r�rr�rr�rr1r�r�r�rs       r�$test_2_parents_not_empty_to_dirstate�7TestTreeToDirState.test_2_parents_not_empty_to_dirstate�sp���(�(�*�����\�*�����&�&�w�/�@�@�B��	
� � �"F�!G�H��,�,�}�-�����u�|�|�,�	
� � �"C�!D�E�
���#�t�|�|�B�/�0�!���!�$�-�-�6�6���s�A�u�f�5��s�A�u�f�5�
�
�3��s�A�u�h�.?�.?�.H�.H�I� �G��!�"��!�G��!�#����#
�&
��N�!�!�+�+�D�*�=���$�$�_�<rc��/n[S5H�nURSU35nURSUS3/5 URS/SU-/S9 SU-nUR	SUS	9 URXCRRRU545 M� [RRS
5nURU/5 UR5 UR5 g!UR5 f=f)N�r�z/name�names	file-id%dr�srevid-%d�messager�r)�ranger�r�r�r�r<r�
repository�
revision_treerr1r2�set_parent_treesr>r?)r�parents�ir�r�r4s      r�test_colliding_fileids�)TestTreeToDirState.test_colliding_fileids�s���
���q��A��,�,�t�A�3�Z�8�D��O�O��1�#�U�O��
�

�H�H�f�X�L�1�$4�#5�H�6�%��/�K��K�K�	�+�K�6��N�N��k�k�4�4�B�B�;�O�P�
���!�!�,�,�Z�8��	��"�"�7�B�/��O�O���L�L�N��E�L�L�N�s�>"C1�1DrN)r r!r"r#r�r�rrrrrrr(r$rrrr�r��s2��=�2�> �D=�2�=�<'=�R5=�nrr�c�8�\rSrSrSrSrSrSrSrSr	Sr
g	)
�TestDirStateOnFilei�c�p�URS/5 URS5nURS/S/S9 URS5 [R
R
US5nUR5 UR5 [R
RS5nUR5 U$)N�a-file�.r�r�z
add a-filer)r�r�r�r�rr1r�rr?r�r��rr�r4s   r�create_updated_dirstate�*TestDirStateOnFile.create_updated_dirstate�s�������
�#��(�(��-�����(��'���+����L�!��!�!�+�+�D�*�=��
�
�
��
�����!�!�)�)�*�5��
�����rc���URS5n[RRUS5nUR	5nUR5 UR
SSRU54/5 /SSURS54SSSS[RR4/4/4n[RRS5nUR5 URXB5 g)	Nr�zdirstate.from_treerrr�r;rF)
r�rr1r��	get_linesr?r�joinr�r�r��
lock_writer�)rr�r4�linesr�s     r�test_construct_with_path�+TestDirStateOnFile.test_construct_with_path�s����(�(��0���!�!�+�+�D�2F�G�����!��
����� � �:�s�x�x���"?�!@�A�
��#�t�|�|�B�/�0�
�s�A�u�h�.?�.?�.H�.H�I���

�

���!�!�)�)�*�5��
�����$�$�_�<rc���URS5n[RRUS5nUR	5 UR5 g!UR5 f=f)Nr�r)r�rr1r�rr?r/s   r�test_can_save_clean_on_file�.TestDirStateOnFile.test_can_save_clean_on_file�sM���(�(��0���!�!�+�+�D�*�=��	��J�J�L�
�L�L�N��E�L�L�N�s�A�A&c��UR5nURSSS9nURSUSSS5 URSU5 UR	5 U=R
S-
sl[R"S5n[R"XSU5nURS	U5 URURUSSS5 UR[RRUR5 AUR5 UR5 [RR!S
5nUR#5 URSSS9nURURUSSS5 UR5 g!UR5 f=f!UR5 f=f)Nr�a-file��	path_utf8rJr
�NN�$@r-�(ecc5374e9ed82ad3ea3b4d452ea995a5fd3e70e3r)r0�
_get_entryr{�assertNotEqual�_sha_cutoff_time�_cutoff_timer��lstatr�update_entry�st_sizer1�IN_MEMORY_HASH_MODIFIEDr�rr?r�r�)rr4�entry�st�sha1sums     r�test_can_save_in_read_lock�-TestDirStateOnFile.test_can_save_in_read_locks����,�,�.��	��$�$�Q�)�$�<�E����Q��a����A��/�����e�4��"�"�$����$�&�����(�#�B��+�+�E�(�B�G�G����H�'�R�
���R�Z�Z��q��!��Q��8�����!�!�9�9�5�;P�;P�
��
�J�J�L��L�L�N��!�!�)�)�*�5��
����	��$�$�Q�)�$�<�E����R�Z�Z��q��!��Q��8��L�L�N��
�L�L�N��
�L�L�N�s�DF$�5F9�$F6�9Gc���UR5nURSSS9nURSUSSS5 UR5 U=RS-
sl[
R"S5n[R"XSU5nURSU5 UR[RRUR5 [RRS	5nUR5 UR5 UR5 UR5 [RRS	5nUR5 URSSS9nURSUSSS5 UR5 g
!UR5 f=f!UR5 f=f!UR5 f=f)z:If dirstate is locked, save will fail without complaining.rr=r>rrJrAr-rBrN)r0rCr{rErFr�rGrrHr1rJr�r�r�rr?)rr4rKrLrM�state2s      r�!test_save_fails_quietly_if_locked�4TestDirStateOnFile.test_save_fails_quietly_if_locked.s����,�,�.�� 	��$�$�Q�)�$�<�E����S�%��(�1�+�a�.�1��"�"�$����$�&�����(�#�B��+�+�E�(�B�G�G����H�'�R�����!�!�9�9�5�;P�;P�
��&�&�.�.�z�:�F�����

 ��
�
���
�
���L�L�N��!�!�)�)�*�5��
����	��$�$�Q�)�$�<�E����S�%��(�1�+�a�.�1��L�L�N���
�
����L�L�N��
�L�L�N�s0�C3F8�F#�F8�'+G
�#F5�5F8�8G
�
Gc���URSS/5 [RRS5nUR	SSSSS5 UR5 UR
5 SSSSS	S
[RR4/4/4SSSSS	S
[RR4/4/4/n[RRS5nUR5 UR5 URX!R5 UR	S
SSSS5 SUl
UR5 UR
5 [RRS5nUR5 UR5 URX!R5 UR
5 g!UR
5 f=f!UR
5 f=f!UR
5 f=f)Nr-za-dir/rr�filerr�r;rF)rr=rr[za-dirsa-dir-id�	directoryT)r�rr1r2r�rr?r�r�r5�_read_dirblocks_if_neededr{rL�_changes_abortedr�)rr4�expected_blockss   r�$test_save_refuses_if_changes_aborted�7TestDirStateOnFile.test_save_refuses_if_changes_aborted\s�������8�,�-��!�!�,�,�Z�8��	��I�I�h��f�d�C�@��J�J�L��L�L�N�
�1���Q��x�/@�/@�/I�/I�J�K���
��7���Q��x�/@�/@�/I�/I�J�K���
�
��*�!�!�)�)�*�5��
����		��+�+�-����_�.>�.>�?�
�I�I�g�{�K��s�C�%)�E�"��J�J�L��L�L�N��!�!�)�)�*�5��
����	��+�+�-����_�.>�.>�?��L�L�N��W
�L�L�N��F
�L�L�N��
�L�L�N�s$�%F6�#AG�:+G �6G�G� G2rN)r r!r"r#r0r7r:rNrRrZr$rrrr+r+�s"���=�8	�$�L,�\3rr+c��\rSrSrSrSrg)�TestDirStateInitializei�c��/SSSSS[RR4/4/4n[RRS5nUR	U[R5 UR5nUR
5 URSRU5S5 UR5 URX5 g!UR
5 f=f)Nr�r;rrFr)rr1r�r2�assertIsInstancer3r?�assertFileEqualr4r�r�)rr�r4r6s    r�test_initialize�&TestDirStateInitialize.test_initialize�s����-�!���!�$�-�-�6�6����

�
��"�!�!�,�,�Z�8��	��!�!�%��):�):�;��O�O�%�E��L�L�N�	
���S�X�X�e�_�j�9�
�����$�$�_�<��

�L�L�N�s�0C	�	CrN)r r!r"r#rar$rrrr]r]�s��=rr]c��\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrSrSrSrSrSrg)�TestDirStateManipulationsi�c���URS5nUR5 URUR5 UR	S5 URS5nX4$)N�tree1r��foo)�make_branch_and_memory_treer5r�r?r�r�)rrf�revid1s   r�make_minimal_tree�+TestDirStateManipulations.make_minimal_tree�sO���0�0��9��
����������%�
�	�	�"�
����e�$���}�rc���UR5nURUR5 UR5nUR	SS/[U55 UR
SSSSS5 UR	/SQ[U55 URSS	S
S9 UR	/SQ[U55 UR	S/[US55 UR5 g)Nr:rIz	file-name�file-idrUr�)r:rmrI)r�new-namermr[rnr>)	rNr�r?�
_get_id_indexr{�sortedr��update_minimalr>)rr4�id_indexs   r�$test_update_minimal_updates_id_index�>TestDirStateManipulations.test_update_minimal_updates_id_index�s����9�9�;��������%��&�&�(�����/�<�8�&��:J�K�
�	�	�+�z�6�4��<����D�f�X�FV�W�
���*�D�K�	�	
�	
���D�f�X�FV�W����8�9�6�(�:�BV�;W�X�
���rc�2�UR5upURnURS5n/SSU4SSSS[RR
4/4/4n[RR
S5nURU5 UR[RRUR5 UR[RRUR5 URXV5 g! UR5 e=f�Nr�rr;rFr)rj�root_inventoryr�rr1r�r2�set_state_from_inventoryr{�IN_MEMORY_UNMODIFIED�
_header_state�IN_MEMORY_MODIFIEDr�r�r?�rrfri�inv�root_idr�r4s       r�3test_set_state_from_inventory_no_content_no_parents�MTestDirStateManipulations.test_set_state_from_inventory_no_content_no_parents�s���.�.�0�
���"�"���+�+�b�/����#�w�'��C��E�8�+<�+<�+E�+E�F�G��
�
���!�!�,�,�Z�8��
	A��*�*�3�/�����!�!�6�6��8K�8K�
�
����!�!�4�4�e�6K�6K�
�
�(�(��@��	��L�L�N��s
�8A9D�Dc�6�UR5upURnURS5n/SSU4SSSS[RR
4/4/4n[RR
S5nURU//5 UR[RRUR5 UR[RRUR5 URXV5 g! UR5 e=frv)rjrwr�rr1r�r2�set_state_from_scratchr{r{rzr�r�r?r|s       r�&test_set_state_from_scratch_no_parents�@TestDirStateManipulations.test_set_state_from_scratch_no_parents�s���.�.�0�
���"�"���+�+�b�/����#�w�'��C��E�8�+<�+<�+E�+E�F�G��
�
���!�!�,�,�Z�8��	A��(�(��b�"�5����X�.�.�A�A�5�CV�CV�W�����!�!�4�4�e�6K�6K�
�
�(�(��@��	��L�L�N��s
�8A;D�Dc��UR5upURnURS5nURRRU5nSSSS[RR4nSSSSU4nU/SSU4Xg/4/4n[RRS5n	U	RX2U4//5 UR[RRU	R5 UR[RRU	R5 URX�5 g! U	R!5 e=f)Nr�r;rrFr)rjrwr�rr#r$rr1r�r2r�r{r{rzr�r�r?)
rrfrir}r~�	rev_tree1rq�parent_entryr�r4s
          r�,test_set_state_from_scratch_identical_parent�FTestDirStateManipulations.test_set_state_from_scratch_identical_parents,���.�.�0�
���"�"���+�+�b�/���L�L�+�+�9�9�&�A�	���a���(9�(9�(B�(B�C���c�1�e�V�4��!�(�s�C��&9�G�;R�%S�$T�T���!�!�,�,�Z�8��	A��(�(��	�/B�.C�R�H����X�.�.�A�A�5�CV�CV�W�����!�!�4�4�e�6K�6K�
�
�(�(��@��	��L�L�N��s
�'A=D6�6E	c��URS5nUR5 SnURSU4/5 URSSS9 [R
"S5n[R"U5n[R"U5n[U5nURSSSS	S
[RR4/4URRS	S55 URR!SSS
UUUS5 URSSXVS
U4/4URRS	S55 UR#5nUR%UR'S55 UR%UR)S55 UR+SS
S5 URR-5 URR/U5 URR-5 SSS5 UR15 URnUR-5 URS	SS9n	URSSW[W5S
[R"W54/4U	5 SSS5 g!,(df   N�=f!,(df   g=f)Nr.scontents of foorg�foo-idr�)r�foor�r[rrFr��barrU�bar-idr>)r�r5rr�r�r�rr�rr�r�r{r1r��	_dirstaterCrq�_get_root_inventoryry�has_id�has_filename�add_pathr>rxr�)
rr��foo_contents�foo_stat�
foo_packed�foo_sha�foo_sizer}r4�	foo_tuples
          r�1test_set_state_from_inventory_preserves_hashcache�KTestDirStateManipulations.test_set_state_from_inventory_preserves_hashcachesX��
�(�(��-��
�_�_�
�.�L��$�$�u�l�&;�%<�=��H�H�U�	�H�*��w�w�u�~�H�!�+�+�H�5�J��(�(��6�G��<�(�H�
����
�C��E�8�+<�+<�+E�+E�F�G�
����)�)�!�Y�7�

�
�N�N�)�)�(�������
�
����
�G�u�j�A�B�
����)�)�!�Y�7�

��*�*�,�C��O�O�C�J�J�y�1�2��O�O�C�,�,�U�3�4��L�L���	�2��N�N�$�$�&��N�N�3�3�C�8��N�N�$�$�&�s�v�^�^�
��N�N�E��O�O���(�(��f�(�=�I�����!�#���-�!�$�.�.�x�8���
� �#
��
�w�
��v�
�s�GI-�A$I>�-
I;�>
Jc�~�URS5nUR/SQ5 UR5 UR/SQ/SQS9 UR	SSS9 URS	5nURnUR5 S
S
US4SS
SSS/nS
S
US4SS
S/n[RRS5nURU5 /nUR5H#nURUSUSSSS-5 M% URXG5 URS5 URU5 /nUR5H#nURUSUSSSS-5 M% URXW5 UR5 g!UR5 f=f!UR5 f=f)Nrf)ztree1/a/z
tree1/a/b/z
tree1/a-b/z
tree1/a/b/fooz
tree1/a-b/bar)r�za/bza-bza/b/fooza-b/bar)r�r��a-b-idr�r�r��rev1srev1r�r�rr;)rrSr�r;)r�a-br�r;)rSrVr�r;)�a/br�r�r[)r�sbarr�r[rrrJr�)r�r�r5r�r�r�rwr?rr1r2rxr~r<r{�delete)	rrfr~r}�expected_result1�expected_result2r4�valuesrKs	         r�)test_set_state_from_inventory_mixed_paths�CTestDirStateManipulations.test_set_state_from_inventory_mixed_pathsts����)�)�'�2�����V�	
�	����		��I�I�9�G�
�
�
�L�L���L�0��m�m�B�'�G��&�&�C��L�L�N�
�#�w��%�&�*�'�-�-�

���#�w��%�&�*�-�	
���!�!�,�,�Z�8��
	��*�*�3�/��F��,�,�.���
�
�e�A�h��q��!��R�a��8�9�/����-�6��J�J�w���*�*�3�/��F��,�,�.���
�
�e�A�h��q��!��R�a��8�9�/����-�6��L�L�N��;
�L�L�N��:
�L�L�N�s�AF�=CF*�F'�*F<c�&�[RRS5nSS/4nURU/[	UR555 URX!R
SSS95 URX!R
SSS95 URS	UR
SS
S95 URSS
5 SS/4nU/nURU[	UR555 URX1R
SSS95 URX1R
SS
S95 URS	UR
SSS95 UR5 UR5 [RRS5nUR5 UR5 URU[	UR555 UR5 g!UR5 f=f!UR5 f=f)
z9The id of a path can be changed trivally with no parents.rr��r;rrFrQrrr>r���fileid_utf8r@�second-root-id)rrr�N)
rr1r2r{rKr~rC�set_path_idrr?r�r�r>)rr4rm�new_root_entry�
expected_rowss     r�test_set_path_id_no_parents�5TestDirStateManipulations.test_set_path_id_no_parents�s����!�!�,�,�Z�8��	�2�5U�4V�W�J����j�\�4��0C�0C�0E�+F�G����Z�)9�)9�!�s�)9�)K�L����Z�)9�)9�!��)9�)V�W�����e�.�.�q�>O�.�P�
�
���c�#4�5�-�1�2��N�,�,�M����]�D��1D�1D�1F�,G�H����^�-=�-=�a�3�-=�-O�P����� 0� 0��@Q� 0� R�
�
����e�.�.�q�l�.�K�
�
�J�J�L��L�L�N��!�!�)�)�*�5��
����	��O�O�����]�D��1D�1D�1F�,G�H��L�L�N��
�L�L�N��
�L�L�N�s�D>G)�9G>�)G;�>Hc��URS5nURS5 URSSS9 URRRS5n[RRS5nUR5 URSU4//S9 SS	S
/4nURXCRSSS
95 URXCRSSS95 URSURSSS95 URSS5 UR5 SSS
/4nSSS/4nXe/nUR5 URU[UR555 URXcRSSS
95 URXSRSSS
95 URSURSSS95 URXSRSSS95 URXcRSSS95 URSURSSS95 UR!5 UR#5 [RR%S5nUR'5 UR5 URU[UR555 UR#5 UR)5 UR5 URSS5 UR5 UR#5 g!UR#5 f=f!UR#5 f=f!UR#5 f=f)z0Set the root file id in a dirstate with parents.�mtr�rg�parent-revidr�r)�ghostsr�r��r;rrFr�rrr>r�r@�Asecond-root-id�rSrrFr)rrr�)r;rrFrrJstree-root-2N)r�r�r�rr#r$rr1r2r>r%r{rCr�rKr~rr?r�r�r5)rr��rtr4rm�old_root_entryr�r�s        r�test_set_path_id_with_parents�7TestDirStateManipulations.test_set_path_id_with_parents�s��
�
&�
&�t�
,��
���|�$�
�	�	�%��	�0�
�Y�Y�
!�
!�
/�
/��
@���!�!�,�,�Z�8��
����-	��"�"�_�b�$9�#:�2�"�F�(�4�:���J�
���Z�)9�)9�!�s�)9�)K�L����Z�)9�)9�!��)9�)V�W�����e�.�.�q�>P�.�Q�
�
���c�#5�6��O�O��)�+�-S�T��N�
/�+�-G�H��N�,�<�M��O�O�����]�D��1D�1D�1F�,G�H����^�-=�-=�a�3�-=�-O�P����^�-=�-=�a�3�-=�-O�P�����e�.�.�q�l�.�K�
�
���� 0� 0��� 0� M�
�
���� 0� 0��@R� 0� S�
�
����e�.�.�q�>P�.�Q�
�
�J�J�L��L�L�N��!�!�)�)�*�5��
����	��O�O�����]�D��1D�1D�1F�,G�H��L�L�N�
����	��O�O�����c�>�2��O�O���L�L�N��!
�L�L�N��
�L�L�N��
�L�L�N�s%�F-L�59L'�2L<�L$�'L9�<Mc
���URS5nUR5 URS5 URS5nUR	5 UR
RRS5R5n[RRU5nUR5 URS5nURS5nUR	5 [RRS5nUR!SU5 UR#X!R
R$R'U54XTR
R$R'U54S4S/5 UR)5 UR+5 UR)5 UR	5 [RR-S5nUR5 UR/X%S/UR155 [3UR555 UR#X!R
R$R'U54S4S/5 UR#X!R
R$R'U54XTR
R$R'U54SUR
R$R'[6R8544S/5 UR/X%S/UR155 UR/S/UR;55 UR/SSU4S	SS
S[RR<4S	SS
SU4S	SS
SU4/4/[3UR5555 UR	5 g!UR	5 f=f!UR	5 f=f!UR	5 f=f!UR	5 f=f)Nrfr�rgr�rr)�	ghost-revNr�r;rF)rhr5r�r�r?rr�clone�open_branchr�
MemoryTree�create_on_branchr�rr1r2r�r%r#r$r>rr�r{r|rKr~�
_mod_revision�
NULL_REVISIONr}r�)rrfri�branch2r��revid2r~r4s        r� test_set_parent_trees_no_content�:TestDirStateManipulations.test_set_parent_trees_no_contentsN���0�0��9��
����	��I�I�b�M��\�\�%�(�F��L�L�N��,�,�)�)�/�/��8�D�D�F���%�%�6�6�w�?��
����	��\�\�%�(�F��m�m�B�'�G��L�L�N��!�!�,�,�Z�8��	����c�7�+��"�"��\�\�4�4�B�B�6�J�K��\�\�4�4�B�B�6�J�K�(��
��

�
�O�O���J�J�L��O�O���L�L�N��!�!�)�)�*�5��
����+	����f�l�;�U�=Q�=Q�=S�T���$�$�&�'��"�"��\�\�4�4�B�B�6�J�K�(����
�
�"�"��\�\�4�4�B�B�6�J�K��\�\�4�4�B�B�6�J�K�$����/�/�=�=�)�7�7���	���
�
���f�l�;�U�=Q�=Q�=S�T����l�^�U�-=�-=�-?�@�����c�7�+�!�3��5�(�2C�2C�2L�2L�M�!�3��5�&�9�!�3��5�&�9���	��U�(�(�*�+�
�
�L�L�N��Q
�L�L�N��
�L�L�N��$
�L�L�N��\
�L�L�N�s1�"N�8"N1�
B O�*F!O�N.�1O�O�O-c
��URS5nUR5 URS5 URS/S/S/5 URSS5 UR	S5nUR5 URRRS5R5n[RRU5nUR5 URSS	5 UR	S5nURS5nUR5 X%/S
S
U4SS
SS
[RR 4SS
SS
U4SS
SS
U4/4SSSSSS
U4SSSS
U4/4/4n[RR#S5nUR%S
U5 UR'X!RR(R+U54XTRR(R+U544/5 UR-Xx5 g!UR5 f=f!UR5 f=f! UR5 e=f)Nrfr�r
rUrmsfile-contentrgr�snew file-contentrr;rF)rrrmr�r[s(2439573625385400f2a669657a7db6ae7515d371�s(542e57dc1cda4af37cb8e55ec07ce60364bb3c7d�r)rhr5r��put_file_bytes_non_atomicr�r?rrr�r�rr�r�r�rr1r�r2r�r%r#r$r�)	rrfrir�r�r�r~r�r4s	         r�,test_set_parent_trees_file_missing_from_tree�FTestDirStateManipulations.test_set_parent_trees_file_missing_from_treebsC��
�0�0��9��
����	��I�I�b�M��I�I�x�j�6�(�Z�L�9��+�+�H�o�F��\�\�%�(�F��L�L�N��,�,�)�)�/�/��8�D�D�F���%�%�6�6�w�?��
����	��+�+�H�6I�J��\�\�%�(�F��m�m�B�'�G��L�L�N����#�w�'��s�A�u�h�.?�.?�.H�.H�I��s�A�u�f�5��s�A�u�f�5���1�2� �G��!�"��!�G��!�"����
� 
��B�!�!�,�,�Z�8��	A����c�7�+��"�"��\�\�4�4�B�B�6�J�K��\�\�4�4�B�B�6�J�K���
�
�(�(��@��w
�L�L�N��
�L�L�N��Z	��L�L�N��s%�A
H	� 4H�	A.H3�	H�H0�3Ic	���URS/5 [R"S5n[RRS5nSSSSS[RR4/4SS	S
SS[R"U54/4/nURSSS
US
5 URU[UR555 UR5 UR5 [RRS5nUR5 UR!UR5 URU[UR555 g!UR5 f=f)Nr
rr�r;rrFrr[�11111111111111111111�rrU)r�r�rGrr1r2r�r�r�r{rKr~rr?r�r�r�)rr�r4�expected_entriess    r�)test_add_path_to_root_no_parents_all_data�CTestDirStateManipulations.test_add_path_to_root_no_parents_all_data�s=��	
����
�#��x�x��!���!�!�,�,�Z�8��)��3��5�(�*;�*;�*D�*D�E��
�/��!��� �*�*�4�0���
�
��(	��I�I�h��f�d�I�F����-�t�E�4G�4G�4I�/J�K��J�J�L��L�L�N��!�!�)�)�*�5��
����������%����)�4��0C�0C�0E�+F�G��	
�L�L�N�s
�	AE�E-c	��URSS/5 [RRS5nUR	UR
5 UR
[RURSSSSS5 g)z�Adding a path to an unversioned directory should error.

This is a duplicate of TestWorkingTree.test_add_in_unversioned,
once dirstate is stable and if it is merged with WorkingTree3, consider
removing this copy of the test.
zunversioned/zunversioned/a filerrrUN)
r�rr1r2r�r?�assertRaisesr�NotVersionedErrorr�r3s  r�&test_add_path_to_unversioned_directory�@TestDirStateManipulations.test_add_path_to_unversioned_directory�si��	
����)=�>�?��!�!�,�,�Z�8��������%�����$�$��I�I� �����	
rc	��URS/5 [R"S5nSSSSS[RR
4/4SSSSS[R"U54/4/n[RRS	5nURSS
SUS5 URU[UR555 UR5 UR5 [RRS	5nUR5 UR!UR5 UR#5 URU[UR555 g!UR5 f=f)N�a dir/�a dirr�r;rrF�r�a dir�a dir idrr�rV)r�r�rGrr1r�r�r2r�r{rKr~rr?r�r�r�r>)rr�r�r4s    r�.test_add_directory_to_root_no_parents_all_data�HTestDirStateManipulations.test_add_directory_to_root_no_parents_all_data�sA��	
����
�#��x�x�� ��)��3��5�(�*;�*;�*D�*D�E��
�-��3��5�(�*<�*<�T�*B�C��
�

���!�!�,�,�Z�8��	��I�I�g�{�K��t�D����-�t�E�4G�4G�4I�/J�K��J�J�L��L�L�N��!�!�)�)�*�5��
����������%�
�������)�4��0C�0C�0E�+F�G��
�L�L�N�s
�	AE+�+E=c	��UR[R"UR55 [R
"X!5 [R"U5nSSSSS[RR4/4SURS5S4SURS5US	S[R"U54/4/n[RRS
5nURUSSX2RS55 URU[UR!555 UR#5 UR%5 [RR'S
5nUR)5 UR+UR$5 URU[UR!555 g!UR%5 f=f)Nr�r;rrF�UTF-8s	a link id�l�r�symlink)�requireFeaturer
�SymlinkFeature�test_dirr�r�rGrr1r��encoder�r2r�r{rKr~rr?r�r�r�)r�	link_name�targetr�r�r4s      r�-_test_add_symlink_to_root_no_parents_all_data�GTestDirStateManipulations._test_add_symlink_to_root_no_parents_all_data
s���	
���H�3�3�D�M�M�B�C�
�
�
�6�%��x�x�	�"��)��3��5�(�*;�*;�*D�*D�E��
��i�&�&�w�/��>���
�
�g�.��Q��� �*�*�4�0���
�
��(�!�!�,�,�Z�8��	��I�I�i��y�$�
�
�g�@V�W����-�t�E�4G�4G�4I�/J�K��J�J�L��L�L�N��!�!�)�)�*�5��
����������%����)�4��0C�0C�0E�+F�G��	
�L�L�N�s
� AG�Gc�(�URSS5 g)Nza linkr�)r��rs r�,test_add_symlink_to_root_no_parents_all_data�FTestDirStateManipulations.test_add_symlink_to_root_no_parents_all_data6s���:�:�8�X�Nrc�f�UR[R5 URSS5 g)Nu€linku	targ€et)r�r
�UnicodeFilenameFeaturer�r�s r�4test_add_symlink_unicode_to_root_no_parents_all_data�NTestDirStateManipulations.test_add_symlink_unicode_to_root_no_parents_all_data9s*�����H�;�;�<��:�:��!6�	
rc
�r�URSS/5 [R"S5n[R"S5nSSSSS[RR
4/4S	SSSS[R"U54/4S
SSS
S[R"U54/4/n[RRS5nURSSSUS5 URSSSUS5 URU[UR555 UR5 UR5 [RRS5nUR5 UR!UR5 URU[UR555 g!UR5 f=f)Nr�za dir/a filer�r�r;rrFr�)r�rrr[r��rr�rVrrU)r�r�rGrr1r�r�r2r�r{rKr~rr?r�r�r�)r�dirstat�filestatr�r4s     r�0test_add_directory_and_child_no_parents_all_data�JTestDirStateManipulations.test_add_directory_and_child_no_parents_all_data?s�������>�2�3��(�(�7�#���8�8�N�+��)��3��5�(�*;�*;�*D�*D�E��
�-��3��5�(�*<�*<�W�*E�F��
�4��!��� �*�*�8�4���
�
��4�!�!�,�,�Z�8��	��I�I�g�{�K��$�G��I�I�n�l�F�H�i�P����-�t�E�4G�4G�4I�/J�K��J�J�L��L�L�N��!�!�)�)�*�5��
����������%����)�4��0C�0C�0E�+F�G��	
�L�L�N�s
�=A#F$�$F6c�l�[RRS5nSS/4nURSSSSS5 UR	SSS	5nURX25 UR
5 UR5 UR5 UR5 URUR5 UR
5 UR	SSS	5nURX45 URX25 UR	SSS
9nURX25 g!UR5 f=f)NrrG)�t�subtree-123123rFrQ�subdirrIztree-referencer�rrHr�)rr1r2r�rCr{r>rr?r�r�)rr4�expected_entryrK�entry2s     r�test_add_tree_reference�1TestDirStateManipulations.test_add_tree_referencems���!�!�,�,�Z�8��*�
U�V�
��	��I�I�h��.>��FW�X��$�$�Q��i�@�E����U�3��O�O���J�J�L��L�L�N�
����������%�
�����!�!�!�\�9�=������'�����/��!�!�!��!�>������/��
�L�L�N�s�AD!�!D3c	�4�[RRS5nURUR5 UR[RURSSSSS5 UR[RURSSSSS5 g)Nrr.sass-idrVz..)	rr1r2r�r?r�r�BzrErrorr�r3s  r�test_add_forbidden_names�2TestDirStateManipulations.test_add_forbidden_names�st���!�!�,�,�Z�8��������%�����O�O�U�Y�Y��Y��T�4�	
�	
����O�O�U�Y�Y��i��d�D�	
rc��URS5nURS/5 UR5 URS/S/S9 UR	S5nUR
n[RRS5nURU5 URSUS5 URU5 S	S	US
4S/n/nUR5H#nURUSUS
SSS
-5 M% URXV5 UR5 SSS5 g!UR5 f=f!,(df   g=f)Nrfztree1/br�r�r�r�rr�rr;)rrSr�r[rrJ)r�r�r5r�r�rwrr1r2rx�renamer~r<r{r?)rrfr~r}r4r�r�rKs        r�)test_set_state_with_rename_b_a_bug_395556�CTestDirStateManipulations.test_set_state_with_rename_b_a_bug_395556�s,���)�)�'�2�������$�
�
�
�
��I�I�s�e�'��I�+��m�m�B�'�G��&�&�C��%�%�0�0��<�E�
��.�.�s�3��
�
�7�G�S�1��.�.�s�3��#�w��-�.�$� ���"�0�0�2�E��M�M�%��(�U�1�X�a�[��!�_�"<�=�3�� � �!1�:�����) �
��(�����) �
�s%�AD:�BD%�D:�%D7�7D:�:
ErN)r r!r"r#rjrsrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
r$rrrrdrd�s�����A�<A�6A�,Y�v,�\$�LF�PP�dHA�Z&H�P
�( H�D'H�RO�
�,H�\0�4
�rrdc�&�\rSrSrSrSrSrSrg)�TestDirStateHashUpdatesi�c��URSUS9n[R"U5n[R"X[R
R
U5U5$)Nrr>)rCr�rGrrHr��abspath)rr4r�rKr�s     r�do_update_entry�'TestDirStateHashUpdates.do_update_entry�sF��� � ��d� �3���x�x��~���$�$�U�2�7�7�?�?�4�3H�$�O�Orc�l�URRS5 URR5$)ajRead the content of the dirstate file.

On Windows when one process locks a file, you can't even open() the
file in another process (to read it). So we go directly to
state._state_file. This should always be the exact disk representation,
so it is reasonable to do so.
DirState also always seeks before reading, so it doesn't matter if we
bump the file pointer.
r)�_state_file�seek�readr3s  r�_read_state_content�+TestDirStateHashUpdates._read_state_content�s-��	�����q�!�� � �%�%�'�'rc��URS5nURSS/5 UR5 URSS/SS/S9 UR	S5 [
R
UR5RSS	9nUR5 UR5 URUR5 UR5 URS
5 UR[RR UR"5 UR%U5nUR'US5 URS[)UR*55 UR[RR,UR"5 UR/5 UR[RR,UR"5 URX0R%U55 UR[RR,UR"5 UR'US
5 URS[)UR*55 UR/5 UR[RR UR"5 URS[)UR*55 g)Nr.�c�dr�r�r�zadd c and dr
)�worth_saving_limitr_rYrJr;r)r�r�r5r�r��InstrumentedDirStater��current_dirstate�	_filenamer?r�rW�adjust_timer{rr1ryr�rrr��_known_hash_changesrJr)rr�r4�contents    r�&test_worth_saving_limit_avoids_writing�>TestDirStateHashUpdates.test_worth_saving_limit_avoids_writing�s"���(�(��-������c�
�#��������#�s��'�7�!3��4����M�"�$�,�,��!�!�#�-�-�!�-�
��	
���
�
����������%�
�'�'�)�
���#������*�*�?�?��AV�AV�W��*�*�5�1�����U�D�)�����C�� 9� 9�:�;�������5�5�u�7L�7L�	
�	�
�
��	
������5�5�u�7L�7L�	
�	
����":�":�5�"A�B�������5�5�u�7L�7L�	
�	
���U�D�)�����C�� 9� 9�:�;�
�
�
������*�*�?�?��AV�AV�W�����C�� 9� 9�:�;rrN)r r!r"r#rrr"r$rrrr
r
�s��P�
(�#<rr
c�2�\rSrSrSrSrSrSrSrSr	g)	�TestGetLinesi�c��UR5nUR/SQUR55 UR5 g!UR5 f=f)N)s#bazaar dirstate flat format 3
scrc32: 41262208
snum_entries: 2
s}0
0
a-root-valued0nAAAAREUHaIpFB2iKAAADAQAtkqUAAIGk
subdirsubdir-idd0nAAAAREUHaIpFB2iKAAADAQAtkqUAAIGk
)rNr{r3r?r3s  r�test_get_line_with_2_rows�&TestGetLines.test_get_line_with_2_rows�sI���9�9�;��	����
����!�

�
�L�L�N��E�L�L�N�s�"A�Ac���UR5nURSURURSSS55 UR	5 g!UR	5 f=f)Ns6a-root-valued0nAAAAREUHaIpFB2iKAAADAQAtkqUAAIGkrrJ)rDr{�_entry_to_linerLr?r3s  r�test_entry_to_line�TestGetLines.test_entry_to_line�s`���.�.�0��	����8��$�$�U�%5�%5�a�%8��%;�A�%>�?�
�
�L�L�N��E�L�L�N�s�4A�A)c���SnSSSSSU4S/4n[RRS5nURS	UR	U55 UR5 g!UR5 f=f)
Nr8r9r;rrF�rSsdirname/basenamerFrrsNa-root-valued0nAAAAREUHaIpFB2iKAAADAQAtkqUAAIGkadirname/basename0n�rr1r2r{r*r?�rrArmr4s    r�test_entry_to_line_with_parent�+TestGetLines.test_entry_to_line_with_parent	s|��9��'��s�A�u�k�2�:�
�
�
��!�!�,�,�Z�8��	����7��$�$�Z�0�	
�
�L�L�N��E�L�L�N�s�!A � A2c���SnSSSSSU4SS/4n[RRS	5nURS
UR	U55 UR5 g!UR5 f=f)Nr8r9r;rrF)r;rrFsrev_idr.rs\a-root-valued0nAAAAREUHaIpFB2iKAAADAQAtkqUAAIGkd0nrev_idadirname/basename0nr/r0s    r�6test_entry_to_line_with_two_parents_at_different_paths�CTestGetLines.test_entry_to_line_with_two_parents_at_different_pathss��9��'��s�A�u�k�2�0�:�	
�
�
��!�!�,�,�Z�8��		����7��$�$�Z�0�
�
�L�L�N��E�L�L�N�s�!A!�!A3c���Sn/nSSSSSU4/4/nURSU45 SSSSSU4/4nS	S
SSSU4/4nURSXE/45 S
S
SSSU4/4nURSU/45 [RRS5nUR	/U5 USXEU/nURU[
UR555 UR5 g!UR5 f=f)Nr8r9r;rrFr�rG)rsafilesafile-idr[s	sha1value�")rHs2files2file-id�r�r)	r<rr1r2r=r{rKr~r?)	rrArC�root_entriesrM�afile_entry�file_entry2r4r�s	         r�test_iter_entries�TestGetLines.test_iter_entries6s?��:���	�,��3��5�+�6��
�
��	���"�l�+�,�
+��s�A�u�k�2�
�
��
)��|�R���<�
�
��	���"�|�9�:�;�
/��|�R���<�
�
��	���(�[�M�2�3��!�!�,�,�Z�8��	��O�O�B�	�*� ,�Q���K�X�����-�t�E�4G�4G�4I�/J�K��L�L�N��E�L�L�N�s
�	AC�C/rN)
r r!r"r#r'r+r1r4r<r$rrrr%r%�s���(	��*�0*rr%c�,�\rSrSrSrSrSrSrSrg)�TestGetBlockRowIndexicc	�F�URXX44URXgU55 U(a#URUn	URXiS5 U(aLU(aDURUSUn
URXjSS5 URXzSS5 ggg)NrrJ)r{�_get_block_entry_indexrL)r�block_index�	row_index�dir_present�file_presentr4�dirname�basename�
tree_index�block�rows           r�assertBlockRowIndexEqual�-TestGetBlockRowIndex.assertBlockRowIndexEqualds���	
���
�[�?��(�(��J�G�	
���$�$�[�1�E����W�A�h�/��<��"�"�;�/��2�9�=�C����W�!�f�Q�i�0����X�1�v�a�y�1�(�;rc
�J�UR5nURUR5 URSSSSUSSS5 URSSSSUSSS5 URSSSSUSSS5 URS	SSSUS
SS5 URS	SSSUSSS5 g)NrJrTrrHFsbdirszdirr
rSr�)rNr�r?rKr3s  r�test_simple_structure�*TestGetBlockRowIndex.test_simple_structure{s����9�9�;��������%��%�%�a��D�$��s�I�q�Q��%�%�a��D�%���W�a�P��%�%�a��D�%���W�a�P��%�%�a��E�5�%��v�q�Q��%�%�a��E�5�%��F�TU�Vrc
�
�UR5nURUR5 URSSSSUSSS5 URSSSSUSSS5 URSSSSUSSS5 URSSSSUSSS5 URSS	SSUSS
S5 URSSSSUSSS5 URSSSSUSSS5 URS	SSSUSS
S5 URS	SSSUSSS5 g)NrTrrJrSrVr
rYrr;rar[rgri�rvr�r?rKr3s  r�test_complex_structure_exists�2TestGetBlockRowIndex.test_complex_structure_exists�s���,�,�.��������%��%�%�a��D�$��s�C��K��%�%�a��D�$��s�D�!�L��%�%�a��D�$��s�D�!�L��%�%�a��D�$��s�D�!�L��%�%�a��D�$��s�D�!�L��%�%�a��D�$��t�T�1�M��%�%�a��D�$��t�T�1�M��%�%�a��D�$��t�T�1�M��%�%�a��D�$��t�\�ST�Urc
�
�UR5nURUR5 URSSSSUSSS5 URSSSSUSSS5 URSSSSUSSS5 URSSSSUSS	S5 URS
SSSUSSS5 URSSSSUSSS5 URSSSSUS
SS5 URSSSSUSSS5 URSSSSUSSS5 g)NrTrrJF�_saa�rir
rSrsbb�a/erarQr3s  r�test_complex_structure_missing�3TestGetBlockRowIndex.test_complex_structure_missing�s���,�,�.��������%�	
�%�%�a��D�$��s�C��K��%�%�a��D�%���T�1�M��%�%�a��D�%���U�A�N��%�%�a��D�%���\�ST�U��%�%�a��E�5�%��t�Q�O��%�%�a��E�5�%���a�P��%�%�a��E�5�%���a�P��%�%�a��E�5�%���q�Q��%�%�a��E�5�%��t�Q�OrrN)	r r!r"r#rKrNrRrXr$rrrr?r?cs��2�.W�V�Prr?c�2�\rSrSrSrSrSrSrSrSr	g)	�TestGetEntryi�c��URXeS9nUcURSU5 gUSnURXU4USS5 g)zACheck that the right entry is returned for a request to getEntry.r>Nr@rr)rCr{)	rrFrG�file_idr4r��indexrK�curs	         r�assertEntryEqual�TestGetEntry.assertEntryEqual�sN��� � �� �7���?����\�5�1���(�C����g��9�3�r��7�Crc�6�UR5nURUR5 URSSSUSS5 URSSSUSS5 URSSSUSS5 URSSSUSS5 URSSSUSS5 g)	Nrr:rrHrIsmissingsmissing/foos
subdir/foo)rNr�r?r`r3s  rrN�"TestGetEntry.test_simple_structure�s����9�9�;��������%����c�3����Q�G����c�9�l�E�9�a�P����d�D�$��z�1�E����d�D�$��~�q�I����d�D�$��}�a�Hrc���UR5nURUR5 URSSSUSS5 URSSSUSS5 URSSSUSS5 URSSS	USS5 URSS
SUS
S5 URSSS
USS5 URSSSUSS5 URSSSUSS5 URSSSUSS5 g)Nrr:rrSrTrVrWrYrZr;r^rarbrWr[rdsa/frgrhr�rirjsb/hå�rvr�r?r`r3s  rrR�*TestGetEntry.test_complex_structure_exists�s����,�,�.��������%����c�3����Q�G����c�4��5�$��B����c�4��5�$��B����c�4��E�4��C����c�4��E�4��C����d�D�(�E�6�1�E����d�D�)�U�F�A�F����d�D�)�U�F�A�F�����,� 2�E�>�1�	
rc�
�UR5nURUR5 URSSSUSS5 URSSSUSS5 URSSSUSS5 URSSSUSS5 g)NrUrs_år�sc/drer3s  rrX�+TestGetEntry.test_complex_structure_missing�s����,�,�.��������%����d�D�$��t�Q�?����d�D�$��|�Q�G����d�D�$��v�q�A����d�D�$��v�q�Arc�8�UR5nUR5 UR5 A[RRS5nUR
5 UR[RRUR5 UR[RRUR5 URSSSUSS5 UR5 g!UR5 f=f!UR5 f=f)z0Calling get_entry will load data if it needs to.rrr:rN)rDrr?rr1r�r�r{r�rzr�r`r3s  r�test_get_entry_uninitialized�)TestGetEntry.test_get_entry_uninitialized�s����.�.�0��	��J�J�L��L�L�N���!�!�)�)�*�5��
����	����X�.�.�<�<�e�>Q�>Q�R����X�.�.�<�<�e�>S�>S�T��!�!�#�s�O�U�C��K��L�L�N��
�L�L�N��
�L�L�N�s�C2�#A>D�2D�DrN)
r r!r"r#r`rNrRrXrjr$rrrr[r[�s��D�I�

�B�rr[c�&�\rSrSrSrSrSrSrg)�TestIterChildEntriesi�c��SnSn[RRnSSSSSU4S/4nS	SSSSU4S/4nS
SSSSU4S/4nSSUS
SU4S/4nSSUSSU4S/4nSSSSSU4S/4n	SSUSSU4S/4n
SSUSSU4U/4nSSUSSU4U/4nSUS/4n
SUS/4nSSS/4n/nURSU/45 URSXVXx/45 URSX�/45 URS X�X�U/45 [RR	S!5nUR5 UR
S"/U5 UU4$! UR5 e=f)#a(This dirstate contains multiple files and directories.

 /        a-root-value
 a/       a-dir
 b/       b-dir
 c        c-file
 d        d-file
 a/e/     e-dir
 a/f      f-file
 b/g      g-file
 b/h\xc3\xa5  h-\xc3\xa5-file  #This is u'\xe5' encoded into utf-8

Notice that a/e is an empty directory.

There is one parent tree, which has the same shape with the following variations:
b/g in the parent is gone.
b/h in the parent has a different id
b/i is new in the parent
c is renamed to b/j in the parent

:return: The dirstate, still write-locked.
r8rQr9r;rrFr�rRrUrXr[r\)r�sb/jrFrr]r_)r[r;r_Fr�r`rcre)r[r[r_Fr�rf)rVris
h-å-file1rk)rVris
h-å-file2)r[r�r_Fr�)rV�isi-file)rV�jrZ)r�rYrFr)r[rpr_Fr�rSrVrsparent)rr1r�r<r2r>r=r?)rrArlr�rmrnrorprqrrrsrt�h_entry1�h_entry2�i_entry�j_entryrCr4s                  r�create_dirstate_with_two_trees�3TestIterChildEntries.create_dirstate_with_two_trees�sN��.:��6��&�/�/�C�C��'��s�A�u�k�2�6�
�
�
�
"��s�A�u�k�2�6�
�
��
"��s�A�u�k�2�6�
�
��
#��x��U�K�8�-�
�
��
#��x��U�K�8�8�
�
��
#��s�A�u�k�2�6�
�
��
$��x��U�K�8�8�
�
��
$��x��U�K�8�#�
�
��
6��x��U�K�8�#�
�
��
6�#�8�
�
��
$�#�8�
�
��
$�+�8�
�
���	����#�
�|�,�-����#��'�C�D�E����$�� 2�3�4����$��H�w� O�P�Q��!�!�,�,�Z�8��
����	��O�O�Y�K��3��i����	��L�L�N��s�D0�0Ec	�T�UR5upURUR5 /nURUSSS5 URUSSS5 URUSSS5 UR	U[UR
SS555 g)NrrJr
rVrV�rur�r?r<r{rK�_iter_child_entries�rr4rCr�s    r�test_iter_children_b�)TestIterChildEntries.test_iter_children_b]s����>�>�@���������%������y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2�����$�u�/H�/H��D�/Q�*R�Src	�X�UR5upURUR5 /nURUSSS5 URUSSS5 URUSSS5 URUSSS5 URUSSS5 URUSSS5 URUSSS5 URUSSS5 UR	U[UR
SS555 g)NrJrrr
rVrrxrzs    r�test_iter_child_root�)TestIterChildEntries.test_iter_child_rootfs"���>�>�@���������%������y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2����y��|�A��q�1�2�����$�u�/H�/H��C�/P�*Q�RrrN)r r!r"r#rur{r~r$rrrrmrm�s��z �xT�Srrmc�$�\rSrSrSrSrSrSrg)�TestDirstateSortOrderiuz3Test that DirState adds entries in the right order.c�P�/SQnSn[RRS5nURUR5 [
R"S5nUHvnURS5RSS5S-nUS-nURS5RSS5S-nURXVS	XB5 URXxS
XB5 Mx /SQn	Sn
UR[X�S
9U	5 URVs/sHoUSPM	 nnURX�5 gs snf)z�Add entries in lexicographical order, we get path sorted order.

This tests it to a depth of 4, to make sure we don't just get it right
at a single depth. 'a/a' should come before 'a-a', even though it
doesn't lexicographically.
)r��a/aza/a/aza/a/a/a�a-aza/a-aza/a/a-az	a/a/a/a-arr�utf-8�/rU�-id�/frVrU)
rrrS�a/asa/a/asa/a/a/as	a/a/a/a-asa/a/a-asa/a-a�a-ac�$�URS5$)Nr�)�split)r�s rr��5TestDirstateSortOrder.test_add_sorting.<locals>.split�s���7�7�4�=� r)�keyrN)
rr1r2r�r?r�r�r��replacer�r{rprL)r�dirsrlr4�	fake_statr�d_id�	file_pathr]r�r��dirblock_namess            r�test_add_sorting�&TestDirstateSortOrder.test_add_sortingxs
��	
�����!�!�,�,�Z�8��������%��G�G�J�'�	��A��8�8�G�$�,�,�T�4�8�6�A�D��D��I��&�&�w�/�7�7��d�C�f�L�G��I�I�a�{�I�@��I�I�i�&�)�F��
��	!�	
�����4�h�?�(-�(8�(8�9�(8�1�A�$�(8��9�����2��:s�D#c�
�/SQnSn[RRS5nURUR5 [
R"S5nUHvnURS5RSS5S-nUS-nURS5RSS5S-nURXVS	XB5 URXxS
XB5 Mx /SQn	URVs/sHoUSPM	 n
nURX�5 URS
5nUR[R5nUR!SU4//5 URVs/sHoUSPM	 n
nURX�5 gs snfs snf)z>After calling set_parent_trees() we should maintain the order.)r�r�r�rrr�r�rUr�r�rVrU)rrrSr�r�r�repoznull:N)rr1r2r�r?r�r�r�r�r�rLr{�make_repositoryr$r�r�r%)
rr�rlr4r�rr�r�r]r�r�r��
empty_trees
             r�#test_set_parent_trees_correct_order�9TestDirstateSortOrder.test_set_parent_trees_correct_order�s^��"�����!�!�,�,�Z�8��������%��G�G�J�'�	��A��8�8�G�$�,�,�T�4�8�6�A�D��D��I��&�&�w�/�7�7��d�C�f�L�G��I�I�a�{�I�@��I�I�i�&�)�F��4��(-�(8�(8�9�(8�1�A�$�(8��9�����2��#�#�F�+���'�'�
�(C�(C�D�
�
����*� 5�6��;�(-�(8�(8�9�(8�1�A�$�(8��9�����2��:��:s�%E;�FrN)r r!r"r#r�r�r�r$rrrr�r�us��=�/3�b3rr�c�n^�\rSrSrSrSU4SjjrU4SjrSrU4SjrU4Sjr	U4Sjr
S	rS
rU=r
$)ri�z1An DirState with instrumented sha1 functionality.c�p>�[TU]UUUUS9 SUl/UlX lUR
Ulg)N)r�use_filesystem_for_execr)r*�__init__�_time_offset�_log�_sha1_provider�_sha1_file_and_log�
_sha1_file)rr��
sha1_providerrr�r.s     �rr��InstrumentedDirState.__init__�sG���	�����1�$;�		�	
������	�+���1�1��rc�H>�[TU]5nXR-Ulg�N)r*rEr�rF)r�	timestampr.s  �rrE�%InstrumentedDirState._sha_cutoff_time�s!����G�,�.�	�%�(9�(9�9��rc�r�URRSU45 URRU5$)N�sha1)r�r<r�r�)rrs  rr��'InstrumentedDirState._sha1_file_and_log�s0���	�	���&�'�*�+��"�"�'�'��0�0rc�\>�URRSX45 [TU]
X5$)N�	read_link)r�r<r*�
_read_link)rr�old_linkr.s   �rr��InstrumentedDirState._read_link�s*����	�	���+�w�9�:��w�!�'�4�4rc�\>�URRSU45 [TU]
X5$)NrG)r�r<r*�_lstat)rrrKr.s   �rr��InstrumentedDirState._lstat�s)����	�	���'�7�+�,��w�~�g�-�-rc�\>�URRSX45 [TU]
X5$)N�is_exec)r�r<r*�_is_executable)r�mode�old_executabler.s   �rr��#InstrumentedDirState._is_executable�s*����	�	���)�T�:�;��w�%�d�;�;rc�<�U=RU-
slSUlg)z�Move the clock forward or back.

:param secs: The amount to adjust the clock by. Positive values make it
seem as if we are in the future, negative values make it seem like we
are in the past.
N)r�rF)r�secss  rr� InstrumentedDirState.adjust_time�s��	
���T�!�� ��r)rFr�r�r�r�)rT)r r!r"r#r�r�rEr�r�r�r�rr$r�r�s@rrr�s5���;�RV�
2�:�1�5�.�<�!�!rrc�.�\rSrSrSrSr\S5rSrg)�	_FakeStati�z7A class with the same attributes as a real stat result.c�L�XlX lX0lX@lXPlX`lgr�)rI�st_mtime�st_ctime�st_dev�st_ino�st_mode)r�size�mtime�ctime�dev�inor�s       rr��_FakeStat.__init__�s �����
��
������rc��[URURURURUR
UR5$r�)r�rIr�r�r�r�r�)rLs r�	from_stat�_FakeStat.from_stat	s4����J�J����R�[�[�"�)�)�R�Y�Y��
�
�
�	
r)r�r�r�r�r�rIN)	r r!r"r#r�r��staticmethodr�r$rrrr�r��s��A���
��
rr�c�&�\rSrSrSrSrSrSrg)�TestPackStati	c�P�URU[R"U55 g)z5Check the packed and serialized form of a stat value.N)r{rr�)rr��
stat_values   r�assertPackStat�TestPackStat.assertPackStat		s������8�#5�#5�j�#A�Brc�t�[SSSSSS5nURSU5 SUlURS	U5 S
UlURSU5 SUlURS
U5 SUlURSU5 SUlURSU5 SUlURSU5 g)Ni�iV��EiY��E�	��,c餁s AAAay0Xm4FZF5uBZAAADCQBjLNIAAIGk�X� AAAbWEXm4FZF5uBZAAADCQBjLNIAAIGki\��E� AAAbWEXm4FxF5uBZAAADCQBjLNIAAIGkif��E� AAAbWEXm4FxF5uBmAAADCQBjLNIAAIGkixs AAAbWEXm4FxF5uBmAAADeABjLNIAAIGki�,cs AAAbWEXm4FxF5uBmAAADeABjLNQAAIGki�s AAAbWEXm4FxF5uBmAAADeABjLNQAAIHk)r�r�rIr�r�r�r�r��rrLs  r�test_pack_stat_int�TestPackStat.test_pack_stat_int
	s���
�t�Z��S�'�8�
L�����?��D���
����?��D� ������?��D� ������?��D���	����?��D���	����?��D���
����?��Drc��[SSSSSS5nURSU5 SUlURS	U5 S
UlURSU5 SUlURSU5 S
UlURSU5 g)zzOn some platforms mtime and ctime are floats.

Make sure we don't get warnings or errors, and that we ignore changes <
1s
r�g��y�Ag@�y�Ar�r�r�r�g�y�Ar�g��y�Ar�g��y�Ag����y�AN)r�r�r�r�r�s  r�test_pack_stat_float�!TestPackStat.test_pack_stat_float$	s����t�\�<��g�x�
P�����?��D�"������?��D�"������?��D�$������?��D�$������?��DrrN)r r!r"r#r�r�r�r$rrrr�r�	s��C�E�.Err�c�x�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrSrg)�
TestBisecti:	z0Test the ability to bisect into the disk format.c�,^�URU5nUR[U5[U55 0n[XB5H!upxUcM
[	U4SjU55Xg'M# UHnXWR5 M URXe5 g)agAssert that bisecting for paths returns the right result.

:param expected_map: A map from key => entry value
:param map_keys: The keys to expect for each path
:param state: The DirState object.
:param paths: A list of paths, these will automatically be split into
              (dir, name) tuples, and sorted according to how _bisect
              requires.
Nc3�.># �UH
nTUv� M g7fr�r��.0�k�expected_maps  �r�	<genexpr>�*TestBisect.assertBisect.<locals>.<genexpr>S	�����#B�T��L��O�T���)�_bisectr{r��ziprp�sort�	rr��map_keysr4r��resultr�r��keyss	 `       r�assertBisect�TestBisect.assertBisect=	s�������u�%��	
����X���E�
�3����e�.�J�D��|��#�#B�T�#B�B�H�N�	/��D��L�����	
����*rc�,^�URU5nUR[U5[U55 0n[XB5H!upxUcM
[	U4SjU55Xg'M# UHnXWR5 M URXe5 g)a5Assert that bisecting for dirbblocks returns the right result.

:param expected_map: A map from key => expected values
:param map_keys: A nested list of paths we expect to be returned.
    Something like [['a', 'b', 'f'], ['b/c', 'b/d']]
:param state: The DirState object.
:param paths: A list of directories
Nc3�.># �UH
nTUv� M g7fr�rr�s  �rr��3TestBisect.assertBisectDirBlocks.<locals>.<genexpr>l	r�r�)�_bisect_dirblocksr{r�r�rpr�r�s	 `       r�assertBisectDirBlocks� TestBisect.assertBisectDirBlocks\	s�����(�(��/������X���E�
�3����e�.�J�D��|��#�#B�T�#B�B�H�N�	/�
�D��L�����	
����*rc�v�0nUHnXnUup�X�U'M URU5n
URXZ5 g)a�Assert the return value of a recursive bisection.

:param expected_map: A map from key => entry value
:param map_keys: A list of paths we expect to be returned.
    Something like ['a', 'b', 'f', 'b/d', 'b/d2']
:param state: The DirState object.
:param paths: A list of files and directories. It will be broken up
    into (dir, name) pairs and sorted before calling _bisect_recursive.
N)�_bisect_recursiver{)rr�r�r4r�r�r�rK�dir_name_id�
trees_infor�s           r�assertBisectRecursive� TestBisect.assertBisectRecursiver	sK�����C� �%�E�&+�#�K�$.�[�!��
�(�(��/������*rc��UR5upnURUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 g	)
z"Find a single record using bisect.rrSrVr�r�r�r�r[N�r�r��rr�r4r�s    r�test_bisect_each�TestBisect.test_bisect_each�	s��� $� :� :� <���X�	
���(�c�U�G�U�S�E�:����(�d�V�H�e�d�V�<����(�d�V�H�e�d�V�<����(�f�X�J���x�@����(�f�X�J���x�@����(�h�Z�L�%�(��D����(�f�X�J���x�@����(�d�V�H�e�d�V�<rc���UR5upnURUS/S/S//U/SQ5 URUS/S/S//U/SQ5 URUS/S/S	//U/S
Q5 g)z=Bisect can be used to find multiple records at the same time.rSrVr[�rSrVr[r�r�)r[r�r�r�r�)rVr�r�Nrr	s    r�test_bisect_multi�TestBisect.test_bisect_multi�	s��� $� :� :� <���X����(�d�V�d�V�d�V�$<�e�EW�X������v��x�(��4�e�=U�	
�	
�����v��x�&��2�E�;Q�	
rc�P�UR5upnSUlURUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS	//US	/5 URUS/S/S	//U/S
Q5 URUS/S/S	//U/SQ5 URUS/S/S//U/SQ5 g
)z.Test bisect when there is only 1 page to read.i�rrSrVr�r�r�r�r[r
)r�r�r[)rVr�r�N�r�r�r�r	s    r�test_bisect_one_page�TestBisect.test_bisect_one_page�	s[�� $� :� :� <���X�"&������(�c�U�G�U�S�E�:����(�d�V�H�e�d�V�<����(�d�V�H�e�d�V�<����(�f�X�J���x�@����(�f�X�J���x�@����(�h�Z�L�%�(��D����(�f�X�J���x�@����(�d�V�H�e�d�V�<����(�d�V�d�V�d�V�$<�e�EW�X������x�(��d�V�4�e�=U�	
�	
�����v��x�&��2�E�;Q�	
rc��UR5upnURUS//US/5 URUSS//US/5 URUSS//US/5 URUSS//US/5 URUSS	//US/5 URUS
S//US
/5 URUSS
//US/5 URUSS//US/5 g)z3When bisecting for a path, handle multiple entries.rrS�a2rV�b2r��b/c2r��b/d2r��b/d/e2r��b-c2r[�f2N)r�r�r	s    r�test_bisect_duplicate_paths�&TestBisect.test_bisect_duplicate_paths�	s��� $� ?� ?� A���X�	
���(�c�U�G�U�S�E�:����(�d�E�]�O�U�T�F�C����(�d�E�]�O�U�T�F�C����(�f�g�%6�$7����I����(�f�g�%6�$7����I����(�h�	�%:�$;�U�X�J�O����(�f�g�%6�$7����I����(�d�E�]�O�U�T�F�Crc��UR5upnSUlURUS/US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS	//US	/5 URUS
//US
/5 g)z8If the page size is too small, we will auto increase it.�2N�b/erSrVr�r�r�r�r[rr	s    r�test_bisect_page_size_too_small�*TestBisect.test_bisect_page_size_too_small�	s��� $� :� :� <���X�"$������(�T�F�E�F�8�<����(�d�V�H�e�d�V�<����(�d�V�H�e�d�V�<����(�f�X�J���x�@����(�f�X�J���x�@����(�h�Z�L�%�(��D����(�f�X�J���x�@����(�d�V�H�e�d�V�<rc��UR5upnURUS/US/5 URUS/US/5 URUS/US/5 URUS/US/5 URUS/SS//U/SQ5 g)	z6Test that bisect return None if it cannot find a path.Nr�sb/foosbar/foosb-c/foorSr�)rSr�r�rr	s    r�test_bisect_missing�TestBisect.test_bisect_missing�	s��� $� :� :� <���X����(�T�F�E�F�8�<����(�T�F�E�H�:�>����(�T�F�E�J�<�@����(�T�F�E�J�<�@������v�t�f�X�.��7M�	
rc�>�UR5upnURUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 URUS//US/5 g)z!Check that we find a renamed row.rSr�r�r�r�r�N)r�r�r	s    r�test_bisect_rename�TestBisect.test_bisect_rename�	s��� $� <� <� >���X�	
���(�d�V�H�e�d�V�<����(�f�X�J���x�@����(�f�X�J���x�@����(�d�V�H�e�d�V�<�	
���(�h�Z�L�%�(��D����(�f�X�J���x�@rc��UR5upnURU/SQ/US/5 URU/SQ/US/5 URUSS//US/5 URU/SQ/SQSS//U/SQ5 g)	N)	rrSrrVrr�rr[rr)r�rr�rrVr�rr�)rrVr�)r�r�r	s    r�test_bisect_dirblocks� TestBisect.test_bisect_dirblocks�	s��� $� ?� ?� A���X��"�"��
J�K��
�E�		
�	
�"�"��9�:�E�D�6�	
�	
�"�"�8�x��.C�-D�e�f�X�V��"�"��M�2��9�%�
�

��		
rc�8�UR5upnURUS/S/USS/5 URUS/US/5 URUS/US/5 URUS/US/5 URUS/US/5 URUS/US/5 g)Nr�r�r rSr�rYr[)r�r�r	s    r�test_bisect_dirblocks_missing�(TestBisect.test_bisect_dirblocks_missing
s��� $� :� :� <���X��"�"���z�4�(�%�&�&�1A�	
�	
�"�"�8�d�V�U�T�F�C��"�"�8�d�V�U�V�H�E��"�"�8�d�V�U�T�F�C��"�"�8�d�V�U�X�J�G��"�"�8�d�V�U�T�F�Crc�d�UR5upnURUS/US/5 URUS/US/5 URUS/US/5 URUS/US/5 URUSS/US/5 URU/SQUS/5 URU/SQUS	/5 g)
NrSr�r�r�r�)rVr�r�r�rV)rrSrVr�r[r�r�r�r�r�rr	s    r�test_bisect_recursive_each�%TestBisect.test_bisect_recursive_each
s��� $� :� :� <���X��"�"�8�d�V�U�T�F�C��"�"�8�f�X�u�v�h�G��"�"�8�h�Z���
�K��"�"�8�f�X�u�v�h�G��"�"�8�f�h�-?����Q��"�"��6���v�	
�	
�"�"��E��
�E�		
rc��UR5upnURUSS/USS/5 URUSS/USS/5 g)NrSr�r�r�r0r	s    r�test_bisect_recursive_multiple�)TestBisect.test_bisect_recursive_multiple
sR�� $� :� :� <���X��"�"�8�d�F�^�U�T�6�N�S��"�"��v�x�(�%�&�(�1C�	
rc���UR5upnURU/US/5 URU/US/5 URU/US/5 URUS/USS/5 g)Nr;r rgrSr0r	s    r�test_bisect_recursive_missing�(TestBisect.test_bisect_recursive_missing$
sq�� $� :� :� <���X��"�"�8�R����?��"�"�8�R����A��"�"�8�R����?��"�"�8�d�V�U�T�4�L�Irc��UR5upnURUSS/US/5 URUSS/US/5 URU/SQUS/5 g)NrSr�)rSrVr�r�r�r�r�r�rV)r�rr	s    r�test_bisect_recursive_renamed�(TestBisect.test_bisect_recursive_renamed+
si�� $� <� <� >���X�	
�"�"�8�d�F�^�U�T�F�K��"�"�8�d�F�^�U�V�H�M�	
�"�"��H��
�F�		
rrN)r r!r"r#r�r�r�rr
rrrr!r$r'r*r-r1r4r7r:r$rrrr�r�:	sY��:�+�>+�,+�(=�

�
�(D�=�

�A�
�.
D�
�"
�J�

rr�c�,�\rSrSrSrSrSrSrSrg)�TestDirstateValidationi;
c���UR5nUR5 UR5 UR5 UR5 UR5 g!UR5 f=fr�)rvr>r?r�r3s  r�test_validate_correct_dirstate�5TestDirstateValidation.test_validate_correct_dirstate<
sO���,�,�.��
����
����
����	��O�O���L�L�N��E�L�L�N�s�A#�#A5c��UR5upnUR5 URSnUSRSSS/45 UR	[
UR5nUR[U5S5 g)N���rJ)r�saaaar�r�z
not sorted�	r�rWrLr<r��AssertionErrorr>�assertContainsRer�rr�r4r��
last_dirblock�es      r�test_dirblock_not_sorted�/TestDirstateValidation.test_dirblock_not_sortedG
s��� $� <� <� >���X�
�'�'�)��(�(��,�
�	�a����(�+�-G�H�
�	
�
���n�e�o�o�>�����c�!�f�l�3rc��UR5upnUR5 URSnUSRSSS/45 UR	[
UR5nUR[U5S5 g)NrBrJ)r�zr�r�zdoesn't match directory namerCrFs      r�test_dirblock_name_mismatch�2TestDirstateValidation.test_dirblock_name_mismatchV
s��� $� <� <� >���X�
�'�'�)��(�(��,�
��a����$�+�-G�H�
�	
�
���n�e�o�o�>�����c�!�f�&D�Erc��UR5upnUR5 URSnUSRSSS/45 UR	[
UR5nUR[U5S5 g)NrBrJ)r�rLr�r�zfile a-id is absent in rowrCrFs      r�test_dirblock_missing_rename�3TestDirstateValidation.test_dirblock_missing_renamed
s��� $� <� <� >���X�
�'�'�)��(�(��,�
�	�a����%�+�-G�H�
�	
�
���n�e�o�o�>�����c�!�f�&B�CrrN)	r r!r"r#r?rIrMrPr$rrrr=r=;
s��	�
4�F�
Drr=c��\rSrSrSrSrg)�TestDirstateTreeReferenceit
c��URSSS9nURSSS9nURS5 URU5 URS5 [R
R
US5nSnS	US
/4/4nURXSRU55 UR5 g!UR5 f=f)Nr�zdevelopment-subtree)�formatztree/subtree�subtree�subtreer)rrVrVr)r�rrFrQ)
r�r��
add_referencer�rr1r�r{�_find_blockr?)rr�rWr4r�r�s      r�test_reference_revision_is_none�9TestDirstateTreeReference.test_reference_revision_is_noneu
s����(�(��8M�(�N���+�+��#8�,�
��	���J�'����7�#�������!�!�+�+�D�*�=��+����N�O�
P�Q�
��
	����X�'8�'8��'=�>��L�L�N��E�L�L�N�s�? B0�0CrN)r r!r"r#rZr$rrrrSrSt
s��rrSc�8�\rSrSrSrSrSrSrSrSr	Sr
g	)
�TestDiscardMergeParentsi�
c��UR5nURUR5 UR5 UR	5 gr�)r5r�r?�_discard_merge_parentsr>r3s  r�test_discard_no_parents�/TestDiscardMergeParents.test_discard_no_parents�
s6���*�*�,��������%�
�$�$�&�
���rc��SnSSSSSU4SSSSU4/4n/nURSU/45 URS/45 UR5nURUR5 UR	S/USS5 UR5 UR
5 UR5 URX4R5 g)Nr8r9r;rrF�	parent-id�	r<r5r�r?r=r>r_r{rLr@s     r�test_discard_one_parent�/TestDiscardMergeParents.test_discard_one_parent�
s���9��'��s�A�u�k�2��s�A�u�k�2�
�
���	����#� 3�4�5�6����#�r��#��*�*�,��������%�
�����	�!��5�
����
�$�$�&�
��������$4�$4�5rc���SnSSSSSU4SSSSU4SSSSU4/4nSSSSSU4SSSSU4/4n/nURSU/45 URS/45 UR5nURUR5 UR	SS/USS5 UR5 UR
5 UR5 SU/4S/4/nURXeR5 g)	Nr8r9r;rrFrc�	merged-idrd)rrArB�expected_root_entry_direntryrCr4�expected_dirblockss       r�test_discard_simple�+TestDiscardMergeParents.test_discard_simple�
s#��9��'��s�A�u�k�2��s�A�u�k�2��s�A�u�k�2�
�
��
(��s�A�u�k�2��s�A�u�k�2�
�(
�$��	����#� 3�4�5�6����#�r��#��*�*�,��������%�
����|�4�i��l�C�
����	�$�$�&�
����"�%A�$B�C�c�2�Y�O�����+�-=�-=�>rc��[RRnSSSSU4nSSSSU4n[RRnSnSnSnSXRX"/4/4SXtXC/4XcX3/4/4/nUR	5n	URU	R5 U	RS	S
/USS5 U	R5 SXRU/4/4SXcU/4/4/n
U	R5 U	R5 URX�R5 g)zBIf entries are only in a merge, discard should remove the entries.r;rrFr[r9�rsfile-in-rootr)rsfile-in-merged�	b-file-idrcrhN�rr1r�r�r5r�r?r=r>r_r{rL)rr��present_dir�present_file�absent�root_key�file_in_root_key�file_in_merged_keyrCr4�
exp_dirblockss           r�test_discard_absent�+TestDiscardMergeParents.test_discard_absent�
s3���%�%�.�.�	��S�!�U�I�6���c�1�e�Y�7���"�"�6�6��.��?��C��
�H�K�E�F�G�H��'�&�)G�H�%�l�'Q�R��
�	
�	��*�*�,��������%�
����|�4�i��l�C�
�����H�K�8�9�:�;��%�l�'C�D��
�
�
�	�$�$�&�
��������(8�(8�9rc
�4�[RRnSSSSU4nSSSSU4n[RRnSnSnSnS	nS
n	Sn
SXRX"/4/4SU	XCS/4U
US
U/4XcX3/4USXC/4UX4S/4/4/nSXRU/4/4SX�U/4XcU/4X�U/4/4/nUR	5n
URU
R5 U
RSS/USS5 U
R5 U
R5 U
R5 URX�R5 g)Nr;rrFr[r9rn)r�file-sro)r�file-tro)r�	file-in-1�	c-file-id)r�	file-in-2r~)r�rr~)r�r}r~)r�r|ro)r�r{rorcrhrp)rr�rqrrrsrtru�file_rename_s_key�file_rename_t_key�key_in_1�key_in_2rCrwr4s              r�test_discard_renamed�,TestDiscardMergeParents.test_discard_renamed�
s����%�%�.�.�	��S�!�U�I�6���c�1�e�Y�7���"�"�6�6��.��?��:��:��4��4���H�K�E�F�G�H��!��/Q�R��
!��!C�\�R��&�l�'Q�R�)�8�&�O��
*�%�/N�O���
�
�	�4�H�K�8�9�:�;����5�6�%�l�'C�D�&�v�(>�?��
�

�
��*�*�,��������%�
����|�4�i��l�C�
����
�$�$�&�
��������(8�(8�9rc	��[RRnSSSSU4nSSSSU4n[RRnSnSnSnS	nS
n	SXRX"/4/4SXbX"/4/4SXtXC/4X�XC/4X�XC/4/4/n
SXRU/4/4SXbU/4/4S/4/nUR	5nURUR5 URSS
/U
SS5 UR5 UR5 UR5 URX�R5 g)Nr;rrFr[r9)r�sub�dir-id)r�schild1s	child1-id)r�schild2s	child2-id)r�schild3s	child3-idr�rcrhrp)
rr�rqrrrsrt�
subdir_key�
child1_key�
child2_key�
child3_keyrCrwr4s
             r�test_discard_all_subdir�/TestDiscardMergeParents.test_discard_all_subdir+s[���%�%�.�.�	��S�!�U�I�6���c�1�e�Y�7���"�"�6�6��.��-�
�6�
�6�
�6�
��H�K�E�F�G�H�
�J�k� G�H�I�J���&�!?�@��&�!?�@��&�!?�@��
�
�	��H�K�8�9�:�;�
�J�k� :�;�<�=�
�R�L�
�
�
�*�*�,��������%�
����|�4�i��l�C�
����
�$�$�&�
��������(8�(8�9rrN)r r!r"r#r`rerkrxr�r�r$rrrr]r]�
s#���6�.?�B$:�L9:�v#:rr]c� �\rSrSrSrSrSrg)�Test_InvEntryToDetailsiQc���[RRU5nURX5 UupEpgnUR	U[
5 UR	U[
5 UR	U[
5 gr�)rr1�_inv_entry_to_detailsr{r_�bytes)	rr��	inv_entry�details�minikind�fingerprintr��
executable�	tree_datas	         r�
assertDetails�$Test_InvEntryToDetails.assertDetailsRsf���#�#�9�9�)�D������+�@G�<���)����h��.����k�5�1����i��/rc��[R"SSS5nSUlSnX!lUR	SURS5SS	S4U5 g)
Nslink-file-idunam€eslink-parent-idslink-revision-idu
link-targ€tr�r�rF)r�
InventoryLinkr	�symlink_targetr�r�)rr�r�s   r�test_unicode_symlink�+Test_InvEntryToDetails.test_unicode_symlink\sX���+�+��0�2C�
�	�1�	��*��#)� ����
�6�=�=��)�1�e�5H�I�9�	
rrN)r r!r"r#r�r�r$rrrr�r�Qs��0�	
rr�c�&�\rSrSrSrSrSrSrg)�TestSHA1Providerihc��[R"5nUR[URS5 UR[UR
S5 g)Nrg)r�SHA1Providerr��NotImplementedErrorr��
stat_and_sha1)rr�s  r�!test_sha1provider_is_an_interface�2TestSHA1Provider.test_sha1provider_is_an_interfaceis>���!�!�#�����-�q�v�v�u�=����-�q����Frc���SnURSU4/5 [R"U5n[R"5nURX#R
S55 g)N�&test
with
all
possible line endings
rg)rrr�r�DefaultSHA1Providerr{r�)r�text�expected_shar�s    r�test_defaultsha1provider_sha1�.TestSHA1Provider.test_defaultsha1provider_sha1nsO��>��� � �5�$�-��1��)�)�$�/���(�(�*������v�v�e�}�5rc�R�SnURSU4/5 [R"U5n[R"5nURS5upEUR
[U5S:�5 UR[U5UR5 URX%5 g)Nr�rgr\)
rrr�rr�r�ryr�r{rI)rr�r�r��	statvaluer�s      r�&test_defaultsha1provider_stat_and_sha1�7TestSHA1Provider.test_defaultsha1provider_stat_and_sha1us���>��� � �5�$�-��1��)�)�$�/���(�(�*���/�/�%�0��	�����I��"�,�-�����T��I�$5�$5�6�����,rrN)r r!r"r#r�r�r�r$rrrr�r�hs��G�
6�-rr�c�*�\rSrSrSrSrSrSrSrg)�_Repoi�z3A minimal api to get InventoryRevisionTree to work.c�d�[RRS5nURUlg)N�default)r�format_registry�make_controldir�repository_format�_format)r�default_formats  rr��_Repo.__init__�s%��#�3�3�C�C�I�N��%�7�7��rc��gr�rr�s rr��_Repo.lock_read����rc��gr�rr�s rr?�_Repo.unlock�r�r)r�N)	r r!r"r#r�r�r�r?r$rrrr�r��s��=�8�
�
rr�c���\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!S r"S!r#S"r$S#r%g$)%�TestUpdateBasisByDeltai�c��URS5(aSnUSSnOSn[R"U5upgXFnU(a[R"X'U5n	X$U'O%[R"X'U5n	SU	l	SU	l
X9lU	$![a+ [R"U5RS5S-nN�f=f)	Nr�TrBFr�r�rr)�endswithrr��KeyErrorrGr�r�InventoryDirectory�
InventoryFile�	text_size�	text_sha1r	)
rr�r]r��dir_ids�is_dirrFrG�dir_id�ies
          r�
path_to_ie�!TestUpdateBasisByDelta.path_to_ie�s����=�=�����F����9�D��F�#�M�M�$�/���	H��%�F���-�-�g��H�B�#�D�M��(�(��F�C�B��B�L��B�L����	���	H��%�%�g�.�5�5�g�>��G�F�	H�s�B�2C�Cc	��SS0n[R"SU5nUH�n[U5S:XaUupgUnOUupgnUS:XaPURURR
	XtRlURURU'XsS'MtUR
URXgX�55 M� [R"[5XA5$)Nr��root-idr
)r�	Inventoryr��_byid�rootr]r�r�r�InventoryRevisionTreer�)	rr��shaper�r}�infor�r]�	ie_rev_ids	         r�create_tree_from_shape�-TestUpdateBasisByDelta.create_tree_from_shape�s����z�"���!�!�*�f�5���D��4�y�A�~� $�
��"�	�+/�(��y��r�z��I�I�c�h�h�.�.�/�#*��� �%(�X�X��	�	�'�"�%�����G�G�D�O�O�D�9�F�G���2�2�5�7�C�H�Hrc��[R"SS9upUR[RU5 [R
"U5 [RRU5nURUR5 U$)Nzbzr-dirstate)�prefix)
�tempfile�mkstempr�r��remove�closerr1r2r?)r�fdr�r4s    rr5�,TestUpdateBasisByDelta.create_empty_dirstate�s\���#�#�>�:�������	�	�4�(�
������!�!�,�,�T�2��������%��rc���SS0n/nUHcupVnUbURS5(aUSSnUcURUSUS45 M>URXgX#5nURXVXx45 Me U$)z8Translate a 'delta shape' into an actual InventoryDelta.r�r�Nr�rB)r�r<r�)	r�deltar�r��	inv_delta�old_path�new_pathr]r�s	         r�create_inv_delta�'TestUpdateBasisByDelta.create_inv_delta�s����z�"���	�+0�'�H���#��(9�(9�#�(>�(>�$�C�R�=����� � �(�D�'�4�!@�A������F�D�B����h�'�>�?�,1��rc��URSU5nURSU5nURSU5nUR5nURURSU4//5 URR	UR5nURUS5 UR
5 [R"US[5S5n	UR/[U	RU555 UR5n
U
RURSU4//5 URU
RUR5 U$)aAssert that update_basis_by_delta works how we want.

Set up a DirState object with active_shape for tree 0, basis_shape for
tree 1. Then apply the delta from basis_shape to target_shape,
and assert that the DirState is still valid, and that its stored
content matches the target_shape.
�active�basis�targetN)r�r5r�rw�_make_delta�update_basis_by_deltar>r�DirStateRevisionTreer�r{rK�iter_changesrL)r�active�basisr��active_tree�
basis_tree�target_treer4r��
dirstate_treerQs           r�assertUpdate�#TestUpdateBasisByDelta.assertUpdate�s6���1�1�)�V�D���0�0��5�A�
��1�1�)�V�D���*�*�,��
�$�$��&�&�(�J�)?�(@�"�	
��*�*�6�6�z�7P�7P�Q��
�#�#�E�9�5�
����%�:�:��9�e�g�t�
�
�
	
����T�-�"<�"<�[�"I�J�K��+�+�-���%�%��&�&�)�[�)A�(B�B�	
�	
����*�*�E�,<�,<�=��rc�^�URSU5nURSU5nURUS5nUR5nURURSU4//5 UR[RURUS5 URUR5 g)a�Test that we raise InconsistentDelta when appropriate.

:param active: The active tree shape
:param basis: The basis tree shape
:param delta: A description of the delta to apply. Similar to the form
    for regular inventory deltas, but omitting the InventoryEntry.
    So adding a file is: (None, 'path', b'file-id')
    Adding a directory is: (None, 'path/', b'dir-id')
    Renaming a dir is: ('old/', 'new/', b'dir-id')
    etc.
r�r�r�N)r�r�r5r�rwr�r�InconsistentDeltar�ryrX)rr�r�r�r�r�r�r4s        r�assertBadDelta�%TestUpdateBasisByDelta.assertBadDelta�s����1�1�)�V�D���0�0��5�A�
��)�)�%��;�	��*�*�,��
�$�$��&�&�(�J�)?�(@�"�	
�	
����$�$�e�&A�&A�9�i�	
�	
����.�.�/rc�(�UR/S//S9 g�N�rUrm�r�r�r��r�r�s r�&test_remove_file_matching_active_state�=TestUpdateBasisByDelta.test_remove_file_matching_active_states!������'�(��	�	
rc�*�URS/S//S9 grrr�s r�(test_remove_file_present_in_active_state�?TestUpdateBasisByDelta.test_remove_file_present_in_active_states$�����(�)�'�(��	�	
rc�*�URS/S//S9 g�N��
other-filermrrrr�s r�2test_remove_file_present_elsewhere_in_active_state�ITestUpdateBasisByDelta.test_remove_file_present_elsewhere_in_active_states$�����.�/�'�(��	�	
rc�*�URS/S//S9 g)N�rU�	file-id-2rrrr�s r�+test_remove_file_active_state_has_diff_file�BTestUpdateBasisByDelta.test_remove_file_active_state_has_diff_file#s$�����*�+�'�(��	�	
rc�,�URSS/S//S9 g)Nrrrrrr�s r�>test_remove_file_active_state_has_diff_file_and_file_elsewhere�UTestUpdateBasisByDelta.test_remove_file_active_state_has_diff_file_and_file_elsewhere*s'�����*�,F�G�'�(��	�	
rc�*�URS//S/S9 grrr�s r�#test_add_file_matching_active_state�:TestUpdateBasisByDelta.test_add_file_matching_active_state1s$�����(�)��(�)�	�	
rc�,�UR/S/SS/S9 g)N)�dir/r�)rr�r�)zdir/filermrrr�s r�4test_add_file_in_empty_dir_not_matching_active_state�KTestUpdateBasisByDelta.test_add_file_in_empty_dir_not_matching_active_state8s'������&�'�1�3K�L�	�	
rc�(�UR//S/S9 grrr�s r�%test_add_file_missing_in_active_state�<TestUpdateBasisByDelta.test_add_file_missing_in_active_state?s!�������(�)�	�	
rc�*�URS//S/S9 grrr�s r�'test_add_file_elsewhere_in_active_state�>TestUpdateBasisByDelta.test_add_file_elsewhere_in_active_stateFs$�����.�/��(�)�	�	
rc�,�URSS//S/S9 g)Nrrrrrr�s r�;test_add_file_active_state_has_diff_file_and_file_elsewhere�RTestUpdateBasisByDelta.test_add_file_active_state_has_diff_file_and_file_elsewhereMs'�����.�0F�G��(�)�	�	
rc�,�URS/S/S/S9 grrr�s r�&test_rename_file_matching_active_state�=TestUpdateBasisByDelta.test_rename_file_matching_active_stateTs'�����.�/�'�(�.�/�	�	
rc�*�UR/S/S/S9 g)Nrrrrr�s r�(test_rename_file_missing_in_active_state�?TestUpdateBasisByDelta.test_rename_file_missing_in_active_state[s$������'�(�.�/�	�	
rc�,�URS/S/S/S9 g)N)�thirdrmrrrrr�s r�2test_rename_file_present_elsewhere_in_active_state�ITestUpdateBasisByDelta.test_rename_file_present_elsewhere_in_active_statebs'�����)�*�'�(�.�/�	�	
rc�,�URS/S/S/S9 g)Nrrrrrr�s r�2test_rename_file_active_state_has_diff_source_file�ITestUpdateBasisByDelta.test_rename_file_active_state_has_diff_source_fileis'�����*�+�'�(�.�/�	�	
rc�,�URS/S/S/S9 g)N�r
rrrrrr�s r�2test_rename_file_active_state_has_diff_target_file�ITestUpdateBasisByDelta.test_rename_file_active_state_has_diff_target_fileps'�����0�1�'�(�.�/�	�	
rc�2�URSS/SS/SS/S9 g�Nrr6rrrrr�s r�)test_rename_file_active_has_swapped_files�@TestUpdateBasisByDelta.test_rename_file_active_has_swapped_filesws0�����(�*F�G�'�)E�F�*�,F�G�	�	
rc�2�URSS/SS/SS/S9 gr:rr�s r�(test_rename_file_basis_has_swapped_files�?TestUpdateBasisByDelta.test_rename_file_basis_has_swapped_files~s0�����(�*F�G�)�+E�F�(�*F�G�	�	
rc���URSS/SS/SS/S9 URSS/SS/SS/S9 UR/SS/SS/S9 URSS/SS/SS/S9 UR/SQSS/SS/S9 g)	N)�dir1/r�)�	dir1/filerm)�dir2/r�)�	dir2/filermr)zdir3/r�)z	dir3/filerm))rAsdir1-id)rBsfile1-id)rCsdir2-id)rDsfile2-idrr�s r�#test_rename_directory_with_contents�:TestUpdateBasisByDelta.test_rename_directory_with_contents�s������(�*C�D�'�)B�C�(�*C�D�	�	
�
	
���(�*C�D�'�)B�C�(�*C�D�	�	
�
	
����'�)B�C�(�*C�D�	�	
�
	
���(�*C�D�'�)B�C�(�*C�D�	�	
�
	
����(�)B�C�(�*C�D�	�		
rc�,�URS/S/S/S9 g)Nr)r
rUrm�r�r�r��r�r�s r�test_invalid_file_not_present�4TestUpdateBasisByDelta.test_invalid_file_not_present�s'�����(�)�'�(�5�6�	�	
rc�T�URS/S/S/S9 URS/S/S/S9 g)Nr)NrUrrHr�NrUrmrIr�s r�test_invalid_new_id_same_path�4TestUpdateBasisByDelta.test_invalid_new_id_same_path�sN�����(�)�'�(�/�0�	�	
�	
���*�+�)�*�-�.�	�	
rc�,�URS/S/S/S9 g)NrrMrHrIr�s r�test_invalid_existing_id�/TestUpdateBasisByDelta.test_invalid_existing_id�s'�����(�)�'�(�-�.�	�	
rc�v�UR//S/S9 URS//S/S9 URSS//S/S9 g)N)N�
path/path2rmrH)zpath/spath-id)rTrmrIr�s r�test_invalid_parent_missing�2TestUpdateBasisByDelta.test_invalid_parent_missing�sk������R�(H�'I�	�	
�
	
���)�*��3�4�	�	
�
	
���)�+E�F��3�4�	�	
rc��URSS/SS/SS/S9 URSS/SS/SS/S9 UR/SS/SS/S9 URSS/SS/SS/S9 g)N)r�A-id)zdir/B�B-id)r�C-idr)rsD-idrr�s r�test_renamed_dir_same_path�1TestUpdateBasisByDelta.test_renamed_dir_same_path�s���	
���%�'9�:�$�&8�9�%�'9�:�	�	
�
	
���%�'9�:�$�&8�9�%�'9�:�	�	
�
	
����$�&8�9�%�'9�:�	�	
�
	
���%�'9�:�$�&8�9�%�'9�:�	�	
rc��UR/SQ/SQ/SQS9 UR/SQ/SQ/SQS9 UR//SQ/SQS9 UR/SQ/SQ/SQS9 g)N))�A/rX)�A/B/rY�zA/B/CrZ))r^rY)r_rXr`r))zD/rX)zD/E/rY)�FrZrr�s r�test_parent_child_swap�-TestUpdateBasisByDelta.test_parent_child_swap�sx�����K�J�K�	�	
�
	
���K�J�K�	�	
�
	
����J�K�	�	
�
	
���G�J�K�	�	
rc��URSS/SS/SS/S9 URSS/SS/SS/S9 URSS/SS/SS/S9 g)N)r�r�r)r�starget-root-idr)rUr�)r�sactive-root-idrr�s r�test_change_root_id�*TestUpdateBasisByDelta.test_change_root_id
s������$�&:�;�#�%9�:�+�-A�B�	�	
�
	
���+�-A�B�#�%9�:�+�-A�B�	�	
�
	
���+�-A�B�#�%9�:�+�-A�B�	�	
rc�*�UR/S/S/S9 grrr�s r�!test_change_file_absent_in_active�8TestUpdateBasisByDelta.test_change_file_absent_in_active
s$������2�3�=Q�<R�	�	
rc�R�URS//S/S9 URS/S/S/S9 g)Nr)rUrUrmrHrrIr�s r�test_invalid_changed_file�0TestUpdateBasisByDelta.test_invalid_changed_file
sK�����(�)��/�0�	�	
�
	
���(�)�-�.�/�0�	�	
rrN)&r r!r"r#r�r�r5r�r�r�rrrrrrrr r#r&r)r,r0r3r7r;r>rErJrNrQrUr[rbrerhrkr$rrrr�r��s����*I�&�� �B0�<
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�@
�
�
�
�"
�0
�,
�"
�


rr�)/r�r�r�r�rrrrrr	r�r
r�tests.scenariosrrrrr�TestCaser�
load_tests�TestCaseWithTransportr&r�r+r]rdr
r%r?r[rmr�r1rr�r�r�r=rSr]r��TestCaseInTempDirr�r�r�rrr�<module>rrs���"N�	��>�>�)�+�9�@�@�	
����	
�(�
�D%�5�6�6�D%�NQ�-�Q�h|�-�|�~=�1�=�Bz� 4�z�z6<�2�6<�rw�'�w�t>P�/�>P�B9�'�9�xRS�/�RS�jM3�E�7�7�M3�`.!�8�,�,�.!�b
�
�$/E�5�.�.�/E�d~
�%�~
�B6D�1�6D�r� 4��,D:�2�D:�N
�U�^�^�
�.-�u�.�.�-�0
�
�R
�U�^�^�R
r

Youez - 2016 - github.com/yon3zu
LinuXploit