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/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

p��g�H����SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKJr SSKJ
r
JrJrJrJrJrJrJr SSKJr SSKJr S	rS
r"SS\R45r"S
S5r"SS\5r"SS5r\R>4Sjr "SS5r!SSK"J#r$ SSK"J%r%J&r&J'r'J(r(J)r)J*r* SSK"J+r+ g!\,a0r-\R\"\-5 SSK/J%r%J&r&J'r'J(r(J)r)J*r* \ r+\!r$Sr-C-gSr-C-ff=f)a$"DirState objects record the state of a directory and its bzr metadata.

Pseudo EBNF grammar for the state file. Fields are separated by NULLs, and
lines by NL. The field delimiters are ommitted in the grammar, line delimiters
are not - this is done for clarity of reading. All string data is in utf8.

::

    MINIKIND = "f" | "d" | "l" | "a" | "r" | "t";
    NL = "\\n";
    NULL = "\\0";
    WHOLE_NUMBER = {digit}, digit;
    BOOLEAN = "y" | "n";
    REVISION_ID = a non-empty utf8 string;

    dirstate format = header line, full checksum, row count, parent details,
     ghost_details, entries;
    header line = "#bazaar dirstate flat format 3", NL;
    full checksum = "crc32: ", ["-"], WHOLE_NUMBER, NL;
    row count = "num_entries: ", WHOLE_NUMBER, NL;
    parent_details = WHOLE NUMBER, {REVISION_ID}* NL;
    ghost_details = WHOLE NUMBER, {REVISION_ID}*, NL;
    entries = {entry};
    entry = entry_key, current_entry_details, {parent_entry_details};
    entry_key = dirname,  basename, fileid;
    current_entry_details = common_entry_details, working_entry_details;
    parent_entry_details = common_entry_details, history_entry_details;
    common_entry_details = MINIKIND, fingerprint, size, executable
    working_entry_details = packed_stat
    history_entry_details = REVISION_ID;
    executable = BOOLEAN;
    size = WHOLE_NUMBER;
    fingerprint = a nonempty utf8 sequence with meaning defined by minikind.

Given this definition, the following is useful to know::

    entry (aka row) - all the data for a given key.
    entry[0]: The key (dirname, basename, fileid)
    entry[0][0]: dirname
    entry[0][1]: basename
    entry[0][2]: fileid
    entry[1]: The tree(s) data for this path and id combination.
    entry[1][0]: The current tree
    entry[1][1]: The second tree

For an entry for a tree, we have (using tree 0 - current tree) to demonstrate::

    entry[1][0][0]: minikind
    entry[1][0][1]: fingerprint
    entry[1][0][2]: size
    entry[1][0][3]: executable
    entry[1][0][4]: packed_stat

OR (for non tree-0)::

    entry[1][1][4]: revision_id

There may be multiple rows at the root, one per id present in the root, so the
in memory root row is now::

    self._dirblocks[0] -> ('', [entry ...]),

and the entries in there are::

    entries[0][0]: b''
    entries[0][1]: b''
    entries[0][2]: file_id
    entries[1][0]: The tree data for the current tree for this fileid at /
    etc.

Kinds::

   b'r' is a relocated entry: This path is not present in this tree with this
        id, but the id can be found at another location. The fingerprint is
        used to point to the target location.
   b'a' is an absent entry: In that tree the id is not present at this path.
   b'd' is a directory entry: This path in this tree is a directory with the
        current file id. There is no fingerprint for directories.
   b'f' is a file entry: As for directory, but it's a file. The fingerprint is
        the sha1 value of the file's canonical form, i.e. after any read
        filters have been applied to the convenience form stored in the working
        tree.
   b'l' is a symlink entry: As for directory, but a symlink. The fingerprint is
        the link target.
   b't' is a reference to a nested subtree; the fingerprint is the referenced
        revision.

Ordering:

The entries on disk and in memory are ordered according to the following keys::

    directory, as a list of components
    filename
    file-id

--- Format 1 had the following different definition: ---

::

    rows = dirname, NULL, basename, NULL, MINIKIND, NULL, fileid_utf8, NULL,
        WHOLE NUMBER (* size *), NULL, packed stat, NULL, sha1|symlink target,
        {PARENT ROW}
    PARENT ROW = NULL, revision_utf8, NULL, MINIKIND, NULL, dirname, NULL,
        basename, NULL, WHOLE NUMBER (* size *), NULL, "y" | "n", NULL,
        SHA1

PARENT ROW's are emitted for every parent that is not in the ghosts details
line. That is, if the parents are foo, bar, baz, and the ghosts are bar, then
each row will have a PARENT ROW for foo and baz, but not for bar.


In any tree, a kind of 'moved' indicates that the fingerprint field
(which we treat as opaque data specific to the 'kind' anyway) has the
details for the id of this row in that tree.

I'm strongly tempted to add a id->path index as well, but I think that
where we need id->path mapping; we also usually read the whole file, so
I'm going to skip that for the moment, as we have the ability to locate
via bisect any path in any tree, and if we lookup things by path, we can
accumulate an id->path mapping as we go, which will tend to match what we
looked for.

I plan to implement this asap, so please speak up now to alter/tweak the
design - and once we stabilise on this, I'll update the wiki page for
it.

The rationale for all this is that we want fast operations for the
common case (diff/status/commit/merge on all files) and extremely fast
operations for the less common but still occurs a lot status/diff/commit
on specific files). Operations on specific files involve a scan for all
the children of a path, *in every involved tree*, which the current
format did not accommodate.
----

Design priorities:
 1. Fast end to end use for bzr's top 5 uses cases. (commmit/diff/status/merge/???)
 2. fall back current object model as needed.
 3. scale usably to the largest trees known today - say 50K entries. (mozilla
    is an example of this)


Locking:

 Eventually reuse dirstate objects across locks IFF the dirstate file has not
 been modified, but will require that we flush/ignore cached stat-hit data
 because we won't want to restat all files on disk just because a lock was
 acquired, yet we cannot trust the data after the previous lock was released.

Memory representation::

 vector of all directories, and vector of the childen ?
   i.e.
     root_entries = (direntry for root, [parent_direntries_for_root]),
     dirblocks = [
     ('', ['data for achild', 'data for bchild', 'data for cchild'])
     ('dir', ['achild', 'cchild', 'echild'])
     ]
    - single bisect to find N subtrees from a path spec
    - in-order for serialisation - this is 'dirblock' grouping.
    - insertion of a file '/a' affects only the '/' child-vector, that is, to
      insert 10K elements from scratch does not generates O(N^2) memoves of a
      single vector, rather each individual, which tends to be limited to a
      manageable number. Will scale badly on trees with 10K entries in a
      single directory. compare with Inventory.InventoryDirectory which has
      a dictionary for the children. No bisect capability, can only probe for
      exact matches, or grab all elements and sort.
    - What's the risk of error here? Once we have the base format being processed
      we should have a net win regardless of optimality. So we are going to
      go with what seems reasonable.

open questions:

Maybe we should do a test profile of the core structure - 10K simulated
searches/lookups/etc?

Objects for each row?
The lifetime of Dirstate objects is current per lock, but see above for
possible extensions. The lifetime of a row from a dirstate is expected to be
very short in the optimistic case: which we are optimising for. For instance,
subtree status will determine from analysis of the disk data what rows need to
be examined at all, and will be able to determine from a single row whether
that file has altered or not, so we are aiming to process tens of thousands of
entries each second within the dirstate context, before exposing anything to
the larger codebase. This suggests we want the time for a single file
comparison to be < 0.1 milliseconds. That would give us 10000 paths per second
processed, and to scale to 100 thousand we'll another order of magnitude to do
that. Now, as the lifetime for all unchanged entries is the time to parse, stat
the file on disk, and then immediately discard, the overhead of object creation
becomes a significant cost.

Figures: Creating a tuple from 3 elements was profiled at 0.0625
microseconds, whereas creating a object which is subclassed from tuple was
0.500 microseconds, and creating an object with 3 elements and slots was 3
microseconds long. 0.1 milliseconds is 100 microseconds, and ideally we'll get
down to 10 microseconds for the total processing - having 33% of that be object
creation is a huge overhead. There is a potential cost in using tuples within
each row which is that the conditional code to do comparisons may be slower
than method invocation, but method invocation is known to be slow due to stack
frame creation, so avoiding methods in these tight inner loops in unfortunately
desirable. We can consider a pyrex version of this with objects in future if
desired.

�N)�S_IEXEC�)�
cache_utf8�config�debug�errors�lock�osutils�trace�urlutils�)�	inventory)�InventoryTreeChange�ic��\rSrSrSrSrSrg)�DirstateCorrupt��z<The dirstate file (%(state)s) appears to be corrupt: %(msg)sc�Z�[RRU5 XlX lg�N)r�BzrError�__init__�state�msg)�selfrrs   �5/usr/lib/python3/dist-packages/breezy/bzr/dirstate.pyr�DirstateCorrupt.__init__�s����� � ��&��
���)rrN)�__name__�
__module__�__qualname__�__firstlineno__�_fmtr�__static_attributes__�rrrr�s��I�D�rrc�$�\rSrSrSrSrSrSrg)�SHA1Provider�z)An interface for getting sha1s of a file.c�,�[UR5e)z�Return the sha1 of a file given its absolute path.

:param abspath:  May be a filesystem encoded absolute path
     or a unicode path.
)�NotImplementedError�sha1�r�abspaths  rr*�SHA1Provider.sha1s��"�$�)�)�,�,rc�,�[UR5e)z�Return the stat and sha1 of a file given its absolute path.

:param abspath:  May be a filesystem encoded absolute path
     or a unicode path.

Note: the stat should be the stat of the physical file
while the sha may be the sha of its canonical content.
)r)�
stat_and_sha1r+s  rr/�SHA1Provider.stat_and_sha1s��"�$�"4�"4�5�5rr$N�rrr r!�__doc__r*r/r#r$rrr&r&�s��3�-�	6rr&c�$�\rSrSrSrSrSrSrg)�DefaultSHA1Provideriz7A SHA1Provider that reads directly from the filesystem.c�.�[R"U5$)z2Return the sha1 of a file given its absolute path.)r
�sha_file_by_namer+s  rr*�DefaultSHA1Provider.sha1s���'�'��0�0rc���[US5n[R"UR55n[R
"U5nSSS5 X44$!,(df   WW4$=f)z;Return the stat and sha1 of a file given its absolute path.�rbN)�open�os�fstat�filenor
�sha_file)rr,�file_obj�	statvaluer*s     rr/�!DefaultSHA1Provider.stat_and_sha1sW��
�'�4�
 �H�������!2�3�I��#�#�H�-�D�!����!�
 ��$���s�;A�
A$r$Nr1r$rrr4r4s��A�1�rr4c��\rSrSrSrSSSSSSS	.rS
SSS
SSS.r\RS\RS\RS0rSSS.rSr
SrSrSrSrSrSrSrSrSpSjrSrSqS jrS!rS"rS#rS$rS%rS&rS'rS(r S)r!S*r"S+r#S,r$S-r%SrS.jr&S/r'S0r(\)SsS1j5r*S2r+S3r,S4r-S5r.S6r/S7r0S8r1S9r2S:r3S;r4S<r5\4S=jr6S>r7S?r8S@r9SAr:SBr;SCr<SDr=SEr>SFr?SGr@SHrASIrBSJrCStSKjrD\ESsSLj5rF\)SM5rGSNrHSOrISPrJSQrKSRrLSSrMSTrNSUrO\ESuSVj5rPSWrQSXrRSYrSSZrTS[rUS\rVS]rWS^rXS_rYS`rZSar[Sbr\Scr]Sdr^Ser_Sfr`SvSgjraShrbSircSjrdSkreSlrfSmrgSnrhSorig)w�DirStatei#azRecord directory and metadata state for fast access.

A dirstate is a specialised data structure for managing local working
tree state information. Its not yet well defined whether it is platform
specific, and if it is how we detect/parameterize that.

Dirstates use the usual lock_write, lock_read and unlock mechanisms.
Unlike most bzr disk formats, DirStates must be locked for reading, using
lock_read.  (This is an os file lock internally.)  This is necessary
because the file can be rewritten in place.

DirStates must be explicitly written with save() to commit changes; just
unlocking them does not write the changes to disk.
�a�f�d�r�l�t)�absent�file�	directory�	relocated�symlink�tree-referencerJrKrLrNrMrO)rDrErFrHrGrI�y�n�TFirr
rrs xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)rDrrFrs#bazaar dirstate flat format 2
s#bazaar dirstate flat format 3
c�t�[RUl[RUlSUl/Ul/Ul/UlSUlXl	SUl
SUlSUlSUl
SUlSUl0Ul[R"UlX lS[(R*;aUR,UlOUR&R0UlSUlSUl[75UlX0l[<R>"[@RB"U55Ul"X@l#g)a�Create a  DirState object.

:param path: The path at which the dirstate file on disk should live.
:param sha1_provider: an object meeting the SHA1Provider interface.
:param worth_saving_limit: when the exact number of hash changed
    entries is known, only bother saving the dirstate if more than
    this count of entries have changed.
    -1 means never save hash changes, 0 means always save hash changes.
:param use_filesystem_for_exec: Whether to trust the filesystem
    for executable bit information
FN�	hashcache)$rC�
NOT_IN_MEMORY�
_header_state�_dirblock_state�_changes_aborted�
_dirblocks�_ghosts�_parents�_state_file�	_filename�_lock_token�_lock_state�	_id_index�_packed_stat_index�_end_of_header�_cutoff_time�_split_path_cache�BISECT_PAGE_SIZE�_bisect_page_size�_sha1_providerr�debug_flags�_sha1_file_and_mutter�
_sha1_filer*�_last_block_index�_last_entry_index�set�_known_hash_changes�_worth_saving_limitr�
LocationStackr�local_path_to_url�
_config_stack�_use_filesystem_for_exec)r�path�
sha1_provider�worth_saving_limit�use_filesystem_for_execs     rr�DirState.__init__^s��2&�3�3���'�5�5���!&�����������
���������������"&���"��� ���!#���!)�!:�!:���+���%�+�+�+�"�8�8�D�O�"�1�1�6�6�D�O�
"&���!%���#&�5�� �#5� �#�1�1�(�2L�2L�T�2R�S���(?�%rc�b�SRURRUR5$)Nz{}({!r}))�format�	__class__rr]�rs r�__repr__�DirState.__repr__�s#��� � ����!8�!8�$�.�.�I�IrNc�d�U(arURRUVs/sHo3SPM	 sn5 UR[R[R
4;a[RUlO[RUlU(a[RUlggs snf)z�Mark this dirstate as modified.

:param hash_changed_entries: if non-None, mark just these entries as
    having their hash modified.
:param header_modified: mark the header modified as well, not just the
    dirblocks.
rN)	rn�updaterWrCrU�IN_MEMORY_UNMODIFIED�IN_MEMORY_HASH_MODIFIED�IN_MEMORY_MODIFIEDrV)r�hash_changed_entries�header_modified�es    r�_mark_modified�DirState._mark_modified�s��� ��$�$�+�+�;O�,P�;O�a�q�T�;O�,P�Q��#�#��&�&��-�-�(��(0�'G�'G��$��$,�#>�#>�D� ��!)�!<�!<�D����-Qs�B-c�v�[RUl[RUl[	5Ulg)z!Mark this dirstate as unmodified.N)rCr�rVrWrmrnr|s r�_mark_unmodified�DirState._mark_unmodified�s(��%�:�:���'�<�<���#&�5�� rc��[R"U5upg[R"U5up�X�:wa U	(aUnO[R"U5eUS:XdUS:Xa[
R"U5eUS-U-RS5RS5n
[R"U
5upgUR[La#[SR[U555eSnURSUSS	9nUS
:wa�USSSS:Xa*USXgU4:waURUSS
SSU
S9 USSSnOf[R "USSUSS5n["R$USSSnSRX15n
[
R&"X-5eXgS4nUR)U5unnU(a�UR*USnUR-UU5unnU[/U5:aWUUSSSUSS:XaEUUSSSS;a[1S5eUS-
nU[/U5:aUUSSSUSS:XaMEOk[R"U5unnUR3UUS5unnnnU(d [R4"U[7U55eUR9UUU5 UR*USnXgU4nUcSn["R:nOUR<n[?U5nURA5n["RBUnUbUS(aSU-nOUSnS
USSS4US'US:XaUUUUSU4/U-4nOaUS:XaUUSSSU4/U-4nOMUS:XaUUUUSU4/U-4nO9US:XaUUUSSU4/U-4nO%[RD"SRU55eUR-UU5unnU(dURGUU5 O=UUSSSS:wa[SRXr55eUSSUUSS'US:XaUR9UUU
5 URI5 URJ(aURMURJU5 gg)a]Add a path to be tracked.

:param path: The path within the dirstate - b'' is the root, 'foo' is the
    path foo within the root, 'foo/bar' is the path bar within foo
    within the root.
:param file_id: The file id of the path being added.
:param kind: The kind of the path, as a string like 'file',
    'directory', etc.
:param stat: The output of os.lstat for the path.
:param fingerprint: The sha value of the file's canonical form (i.e.
    after any read filters have been applied),
    or the target of a symlink,
    or the referenced revision id for tree-references,
    or b'' for directories.
�.z..�/�utf8�must be a utf8 file_id not {}NrT)�fileid_utf8�include_deleted�NNr
rDrGr)�	path_utf8�packed_stat�fingerprintrz{}:{}�rDrGzadding already added path!�%s/%sFrKrLrNrOzunknown kind {!r}z {!r}({!r}) already added)'r
�split�normalized_filenamer�InvalidNormalizationr�InvalidEntryName�strip�encoder{�bytes�AssertionErrorrz�type�
_get_entry�update_minimal�pathjoinrC�_minikind_to_kind�DuplicateFileId�_find_block_index_from_keyrY�_find_entry_index�len�	Exception�_get_block_entry_index�NotVersionedError�str�
_ensure_block�NULLSTAT�st_size�	pack_stat�_empty_parent_info�_kind_to_minikindr�insertr�r`�_add_to_id_index) rrt�file_id�kind�statr��dirname�basename�	norm_name�
can_access�utf8path�rename_from�
file_id_entry�info�	first_key�block_index�present�block�entry_index�_�
parent_dir�parent_base�parent_block_idx�parent_entry_idx�parent_present�	entry_key�sizer��parent_info�minikind�
old_path_utf8�
entry_datas                                 r�add�DirState.add�s*��.$�M�M�$�/���!(� ;� ;�H� E��	�� ��$���1�1�$�7�7��s�?�h�$�.��,�,�T�2�2��c�M�H�,�3�3�C�8�?�?��G��#�M�M�(�3������E�)� �!@�!G�!G��W�
�!V�W�W�������w�PT��U�
��L�(��Q���"�1�%��-� ��#��7�'C�C��'�'�%�a�(��"%�$'�$,�(��#0��"2�1�Q�"7�K���'�'�
�a�(8��(;�]�1�=M�a�=P�Q���1�1�-��2B�1�2E�a�2H�I���~�~�d�1���/�/��>�>���,�	�#�>�>�y�I���W���O�O�K�0��3�E�!�3�3�I�u�E�N�K���c�%�j�(��+�&�q�)�!�A�.�)�A�a�.�@���%�a�(��+�A�.�l�B�#�$@�A�A��q� ��
�c�%�j�(��+�&�q�)�!�A�.�)�A�a�.�@��'.�m�m�G�&<�#�J���+�+�J��Q�G�
B��.��>�"��.�.�t�S��Y�?�?����/�1A�7�K�����,�Q�/����0�	��<��D�"�+�+�K��<�<�D�#�D�/�K��-�-�/���-�-�d�3���"��1�~� (�;� 6�
� +�A��
�"�M�1�e�S�A�K��N��6�>���{�D�%��E�����J��[�
 ���s�A�u�k�:�����J��Y�
���{�D�%��E�����J��%�
%���{�A�u�k�B�����J��/�/�"5�"<�"<�T�"B�C�C�#�5�5�i��G���W���L�L��j�1��[�!�!�$�Q�'��*�d�2�$�/�6�6�x�I���(2�!�}�Q�'7�E�+��q�!�!�$��;�����{�K��B������>�>��!�!�$�.�.�)�<�rc�,	�UR5 UR5 UR[R:wa$[SR
UR55eURn[R"UR55RnUR5S-nURnUS-
n0nS[U5-nSn	XVU4/n
URnUR!5nU
(Ga�U
R#5upVn
U
(aXV:�aM)U	S-
n	X�:�a[$R&"S5e[)XUU-U-
S-5nUR+U5 [-X�U-
S-5nUR/U5nUnUR1S5n[U5S:aUS-nU
R3XVU
45 M�SnUSR1S5n[U5U:a*U[US5S--
nUSR1S5nSn[U5S::aUS-nU
R3XVU
45 GMEUnUS(aUSS	-US-nOUSn[5U
U5nU
S
UnU
US
nU(Ga�[U5U:�Ga�[U5S-
nUUR1S5n[U5U:a7U[U5-[US5-
nUS-nUUR1S5nOU[U5-nUS(aUSS	-US-nOUSn[7UU5nUS
UnUUS
nU(GaUSU:XaUR3U5 USU:XaUR9SU5 UU/0nUU:wa!UR;U/5R3U5 [=US-U5HVnUUR1S5n U S(aU SS	-U S-n!OU Sn!UR;U!/5R3U 5 MX UHHn!UR?U!/5H/n U"U SS
5n"UR;U!/5R3U"5 M1 MJ U(aU
R3UUU45 U(aU
R3UUS-
U45 U
(aGM�U$)a.Bisect through the disk structure for specific rows.

:param paths: A list of paths to find
:return: A dict mapping path => entries for found entries. Missing
         entries will not be in the map.
         The list is not sorted, and entries will be populated
         based on when they were read.
�bad dirblock state {!r}r
�r�"Too many seeks, most likely a bug.r�
��/N���) �_requires_lock�_read_header_if_neededrWrCrUr�rzr\r;r<r=r��_fields_per_entryrbr�rf�_get_fields_to_entry�poprr�max�seek�min�readr��append�_bisect_path_left�_bisect_path_rightr��
setdefault�range�get)#r�paths�
state_file�	file_size�entry_field_count�low�high�found�	max_count�count�pending�	page_size�fields_to_entry�	cur_files�mid�	read_sizer��start�entries�first_entry_num�first_fields�after�
first_path�	first_loc�pre�post�last_entry_num�last_fields�	last_path�last_loc�middle_files�num�fieldsrt�entrys#                                   r�_bisect�DirState._bisect\s���	
�����#�#�%����8�#9�#9�9� �!:�!A�!A�$�BV�BV�!W�X�X�
�%�%�
��H�H�Z�.�.�0�1�9�9�	�!�2�2�4�q�8���!�!���1�}������U��O�	����u�%�&���*�*�	��3�3�5���#*�;�;�=� �C�y������Q�J�E�� ��o�o�&J�K�K��c�$�J��2�q�8�9�C��O�O�C� ��I�s�
�a�'7�8�I��O�O�I�.�E��E��k�k�%�(�G��7�|�a��
�Q��	�����9�5�6�� �O�"�1�:�+�+�E�2�L��<� �#4�4���W�Q�Z��1�,�,��&�q�z�/�/��6��"#���<� �A�%��Q��	�����9�5�6������?�!-�a��4�!7�,�q�/�!I�J�!-�a��J�-�i��D�	� �
��+��!���,����L�)�->�>�"%�W���!1��%�n�5�;�;�E�B���{�#�&7�7� �#�e�*�,�s�7�2�;�/?�?�E�"�a�'�N�")�.�"9�"?�"?��"F�K��#�e�*�,�E��q�>� +�A��� 5��A�� F�I� +�A��I�-�d�I�>��#�I�X����H�I����$�A��*�4��
�
�:�.�#�B�'�9�4����A�y�1�(�,��8�E�&��8��(�(��B�7�>�>�{�K�$�_�q�%8�.�I��")���!3�!3�E�!:��!�!�9�#)�!�9�t�#3�f�Q�i�#?�D�#)�!�9�D��(�(��r�2�9�9�&�A� J�!-��&+�i�i��b�&9�F�%4�F�1�2�J�$?�E�!�,�,�T�2�6�=�=�e�D�':�!-������t�T�2�3������U�Q�Y��4�5�M�g�V�rc��UR5 UR5 UR[R:wa$[SR
UR55eURn[R"UR55RnUR5S-nURnUS-
n0nS[U5-nSn	XVU4/n
URnUR!5nU
(Ga`U
R#5upVn
U
(aXV:�aM)U	S-
n	X�:�a[$R&"S5e[)XUU-U-
S-5nUR+U5 [-X�U-
S-5nUR/U5nUnUR1S5n[U5S:aUS-nU
R3XVU
45 M�SnUSR1S5n[U5U:a*U[US5S--
nUSR1S5nSn[U5S::aUS-nU
R3XVU
45 GMEUnUSn[4R6"U
U5nU
S	UnU
US	nU(Ga�[U5U:�Ga�[U5S-
nUUR1S5n[U5U:a7U[U5-[US
5-
nUS-nUUR1S5nOU[U5-nUSn[4R8"UU5nUS	UnUUS	nU(a�USU:XaUR3U5 US
U:XaUR;SU5 UU/0nUU:wa!UR=U/5R3U5 [?US-U5H;n UU R1S5n!UR=U!S/5R3U!5 M= UHHn"URAU"/5H/n!U"U!SS	5n#UR=U"/5R3U#5 M1 MJ U(aU
R3UUU45 U(aU
R3UUS-
U45 U
(aGM`U$)a5Bisect through the disk structure to find entries in given dirs.

_bisect_dirblocks is meant to find the contents of directories, which
differs from _bisect, which only finds individual entries.

:param dir_list: A sorted list of directory names ['', 'dir', 'foo'].
:return: A map from dir => entries_for_dir
r�r
r�rr�rr�r�Nr�)!r�r�rWrCrUr�rzr\r;r<r=r�r�rbr�rfr�r�rrr�r�r�r�r�r��bisect�bisect_left�bisect_rightr�r�r�r�)$r�dir_listr�r�r�r�r�r�r�r�r�r�r��cur_dirsr�r�r�r�r�r�r�r��	first_dirrrrrr�last_dirrrr�rr	�cur_dirr
s$                                    r�_bisect_dirblocks�DirState._bisect_dirblockssq��	
�����#�#�%����8�#9�#9�9� �!:�!A�!A�$�BV�BV�!W�X�X��%�%�
��H�H�Z�.�.�0�1�9�9�	�!�2�2�4�q�8���!�!���1�}������X��&�	����x�(�)���*�*�	��3�3�5���")�+�+�-��C�x��s�{���Q�J�E�� ��o�o�&J�K�K��c�$�J��2�q�8�9�C��O�O�C� ��I�s�
�a�'7�8�I��O�O�I�.�E��E��k�k�%�(�G��7�|�a��
�Q��	�����8�4�5�� �O�"�1�:�+�+�E�2�L��<� �#4�4���W�Q�Z��1�,�,��&�q�z�/�/��6��"#���<� �A�%��Q��	�����8�4�5����(��O�	�"�.�.�x��C�	��z�	�*�� �	�
�+����L�)�->�>�"%�W���!1��%�n�5�;�;�E�B���{�#�&7�7� �#�e�*�,�s�7�2�;�/?�?�E�"�a�'�N�")�.�"9�"?�"?��"F�K��#�e�*�,�E�&�q�>��!�.�.�t�X�>��#�I�X����H�I����$�A��)�3��
�
�9�-�#�B�'�8�3����A�x�0�'���7�E�&��8��(�(��2�6�=�=�k�J�$�_�q�%8�.�I��")���!3�!3�E�!:���(�(����B�7�>�>�v�F� J�$0��&+�i�i���&<�F�%4�F�1�2�J�$?�E�!�,�,�W�b�9�@�@��G�'=�$0������t�T�2�3������U�Q�Y��4�5�y�g�|�rc��0n[5n[5nURU5nU(GaK[5n[5nUR5H�nUH�up�X�U	'URU	SS5 SnU
H�nUSn
U
S:XaAU(aMU	up�n[R
"X�5nSnUU;aURU5 MMMOU
S:XdMW[R"US5nUSU;aM{UU;dM�URUS5 M� M� M� UR[U55nURUR[U555 URU5 U(aGMKU$)	a|Bisect for entries for all paths and their children.

This will use bisect to find all records for the supplied paths. It
will then continue to bisect for any records which are marked as
directories. (and renames?)

:param paths: A sorted list of (dir, name) pairs
     eg: [('', b'a'), ('', b'f'), ('a/b', b'c')]
:return: A dictionary mapping (dir, name, file_id) => [tree_info]
NrFrrFTrGr
)
rmr�valuesr�r
r�r��sortedr�r)rr�r��found_dir_names�processed_dirs�newly_found�pending_dirs�paths_to_search�
entry_list�dir_name_id�
trees_info�is_dir�	tree_infor��subdir�namer�rt�dir_names                   r�_bisect_recursive�DirState._bisect_recursive�sl�����%������l�l�5�)����5�L�!�e�O�)�0�0�2�
�/9�+�K�)3�+�&�#�'�'��B�Q��8�"�F�%/�	�#,�Q�<��#�t�+�%�!)�4?�1�F�'�#*�#3�#3�F�#A�D�%)�F�#�>�9� ,� 0� 0�� 6� :�%��-�(/�}�}�Y�q�\�'B�H�'��{�l�:� (�'��>� /� 3� 3�I�a�L� A�)&0�	0:�3�>�,�,�v�o�'>�?�K����t�5�5�f�\�6J�K�L��!�!�,�/�K�k�L�rc�^^�TR5 TR5n[U5S:agTR5 1SkmUU4SjnUSTR	5;a'[
R/nU"5H
nX4SSS&M OU"5HnUSSS2	M
 /TlUS/TlTRSS9 g)	z�Discard any parents trees beyond the first.

Note that if this fails the dirstate is corrupted.

After this function returns the dirstate contains 2 trees, neither of
which are ghosted.
r
N>�rDrDr��rGrG�rGrDc3�T># �TRH�n/n[US5H6up#Uv� USSSUSSS4T;dM%URU5 M8 U(dMV[U5[US5:Xa
USSS2	M{[	U5H	nUSU	M M� g7f)Nr
r)rY�	enumerater�r��reversed)r��deleted_positions�posr
�
dead_patternsrs    ��r�iter_entries_removable�?DirState._discard_merge_parents.<locals>.iter_entries_removables���������$&�!�"+�E�!�H�"5�J�C��K��a����A���a����A��7�=�H�)�0�0��5�#6�%�$��,�-��U�1�X��>�!�!�H�Q�K�#+�,=�#>�C� %�a���
�$?�)�s�AB(�B(�&AB(rrT�r�)
r��get_parent_idsr��_read_dirblocks_if_needed�
get_ghostsrC�NULL_PARENT_DETAILSrZr[r�)r�parentsr4�empty_parentr
r3s`    @r�_discard_merge_parents�DirState._discard_merge_parents	s����	
�#�#�%��%�%�'���w�<�!����&�&�(�P�
�	.��1�:����*�*�$�8�8�9�L�/�1��+�a�����2�0�1���!�H�Q�R�L�2���� �����
����D��1rc�|�[R/[UR5[UR5-
-$r)rCr:r�r[rZr|s rr��DirState._empty_parent_info4s-���,�,�-��T�]�]�1C�c�$�,�,�FW�1W�X�Xrc�V�US:Xa
US:XaUS:XagUS:XaUS:XaUS:XdIURURUSUSS5(d[SRU55eUR	USS45upEU(dURRXC/45 U$)a&Ensure a block for dirname exists.

This function exists to let callers which know that there is a
directory dirname ensure that the block for it exists. This block can
fail to exist because of demand loading, or because a directory had no
children. In either case it is not an error. It is however an error to
call this if there is no parent entry for the directory, and thus the
function requires the coordinates of such an entry to be provided.

The root row is special cased and can be indicated with a parent block
and row index of -1

:param parent_block_index: The index of the block in which dirname's row
    exists.
:param parent_row_index: The index in the parent block where the row
    exists.
:param dirname: The utf8 dirname to ensure there is a block for.
:return: The index for the block.
rrr
r�zbad dirname {!r})�endswithrYr�rzr�r�)r�parent_block_index�parent_row_indexr�r�r�s      rr��DirState._ensure_block7s���(�c�>�.�!�3�8J�a�8O��
�"�$�);�r�)A�g�QT�n��#�#���� 2�3�A�6�7G�H��K�A�N���%�%7�%>�%>�w�%G�H�H�#�>�>���c�?R�S����
�O�O�"�"�;�"�
�>��rc�z�USSSSS:wa [SRUSS55eS/4S/4/UlURSSnSnURnUHInUSSU:wa2/nUSSnURRX245 URnU"U5 MK UR	5 g)aaLoad new_entries into self.dirblocks.

Process new_entries into the current state object, making them the active
state.  The entries are grouped together by directory to form dirblocks.

:param new_entries: A sorted list of entries. This function does not sort
    to prevent unneeded overhead when callers have a sorted list already.
:return: Nothing.
rr�rrzMissing root row {!r}rr
N)r�rzrYr��"_split_root_dirblock_into_contents)r�new_entries�
current_block�current_dirname�append_entryr
s      r�_entries_to_current_state�"DirState._entries_to_current_state^s����q�>�!��Q�q�!�Z�/� �!8�!?�!?��A��q�@Q�!R�S�S� ��9�s�B�i�0�������*�1�-�
���$�+�+�� �E��Q�x��{�o�-� "�
�"'��(�1�+�����&�&��'G�H�,�3�3�����!�	
�/�/�1rc�\�URSS/4:wa'[SRURS55e/n/nURSSH4nUSS(dURU5 M#URU5 M6 SU4URS'SU4URS'g)z�Split the root dirblocks into root and contents-of-root.

After parsing by path, we end up with root entries and contents-of-root
entries in the same block. This loop splits them out again.
r
rzbad dirblock start {!r}rN)rY�
ValueErrorrzr�)r�
root_block�contents_of_root_blockr
s    rrH�+DirState._split_root_dirblock_into_contents{s����?�?�1��#�r��*��6�=�=�d�o�o�a�>P�Q�R�R��
�!#���_�_�Q�'��*�E���8�A�;��!�!�%�(�&�-�-�e�4�	+�
"�:�.������!�#9�:�����rc��[RRU5up#X#S4nURU5upVU(d/$/nURUSnURXH5up�U	[
U5:aKX�SSSUSS:Xa:URX�5 U	S-
n	U	[
U5:aX�SSSUSS:XaM:U$)z?Return a list with all the entries that match path for all ids.rr
rr)r;rtr�r�rYr�r�r�)rrtr�r��keyr�r��resultr�r�r�s           r�_entries_for_path�DirState._entries_for_path�s����G�G�M�M�$�/����#�&��#�>�>�s�C�����I�������,�Q�/���/�/��;����C��J�&�5�+=�a�+@��1�+E��Q�q��+Q��M�M�%�,�-��1��K��C��J�&�5�+=�a�+@��1�+E��Q�q��+Q��
rc��[US5n[US5HPup4URU5 SUS--nUSX%S-'SUS-X%S-'[RUSX%S-'MR SRU5$)z�Serialize entry to a NULL delimited line ready for _get_output_lines.

:param entry: An entry_tuple as defined in the module docstring.
rr
r��%drr�)�listr/�extendrC�	_to_yesno�join)rr
�entire_entry�tree_number�	tree_data�tree_offsets      r�_entry_to_line�DirState._entry_to_line�s���
�E�!�H�~��&/��a��&9�"�K����	�*��k�A�o�-�K�,5�a�L�L�q��)�,1�I�a�L�,@�L�q��)�,4�,>�,>�y��|�,L�L�q��)�':��z�z�,�'�'rc�>�SUR5-nSSU--S-$)z�How many null separated fields should be in each entry row.

Each line now has an extra '\\n' field which is not used
so we just skip over it

entry size::
    3 fields for the key
    + number of fields per tree_data (5) * tree count
    + newline
r
rrZ)�_num_present_parents)r�
tree_counts  rr��DirState._fields_per_entry�s+����2�2�4�4�
��1�z�>�!�A�%�%rc�R�URU5up4U(dU(dX[R"US5upVURXVS5S(d#[R
"USS[
U55eURRX1S/45 URU$)zmReturn the block that key should be present in.

:param key: A dirstate entry key.
:return: The block tuple.
rrr)	r�r
r�r�rr�r�rYr�)rrU�add_if_missingr�r�r��parent_names       r�_find_block�DirState._find_block�s��� $�>�>�s�C����!�,3�=�=��Q��+@�(���2�2�;�Q�O�PQ�R�!�2�2�3�q��8�S��Y�G�G��O�O�"�"�;�Q����=����{�+�+rc��USSS:XagURb1URURSUS:XaURS4$[URUSSURS9nU[UR5:=(a URUSUS:HnX lSUlX#4$![a Nvf=f)	zhFind the dirblock index for a key.

:return: The block index, True if the block for the key is present.
rrrG�rTTr
)�cacher�)rkrY�
IndexError�bisect_dirblockrdr�rl)rrUr�r�s    rr��#DirState._find_block_index_from_key�s���
�q��8�z�!��	��&�&�2��O�O�D�$:�$:�;�A�>�#�a�&�H��-�-�t�3�3�&��O�O�S��V�Q�d�.D�.D�
��
�#�d�o�o�.�.�
:�����,�Q�/�3�q�6�9�	�"-��!#����#�#��%�	��	�s�=B4�4
C�Cc�B�[U5nURbAURS-nUS:�a,X$S-
SU:aXUS::aX@lX$SU:HnXE4$[R"X!/45nXC:=(a
 X$SU:HnX@lXE4$![a NBf=f)zpFind the entry index for a key in a block.

:return: The entry index, True if the entry for the key is present.
r
r)r�rlrrrr)rrUr��	len_blockr�r�s      rr��DirState._find_entry_index�s���
��J�	�
	��%�%�1�"�4�4�q�8�� �!�O��A�o�(>�q�(A�C�(G��;�/��2�2�-8�*�#�0��3�s�:�G�&�/�/��(�(��b�	�:���)�J�e�.@��.C�s�.J��!,���#�#���	��	�s�A
B�
B�Bc�J�[RXS9n[R"5nUR	UR55 UR
5n[U5 /nUHYnURRRU5nURXx45 UR	UR55 M[ URU/5 URUR5 SSS5 U$!,(df   U$=f! UR5 e=f)aVCreate a dirstate from a bzr Tree.

:param tree: The tree which should provide parent information and
    inventory ids.
:param sha1_provider: an object meeting the SHA1Provider interface.
    If None, a DefaultSHA1Provider is used.
:return: a DirState object which is currently locked for writing.
    (it was locked by DirState.initialize)
)ruN)rC�
initialize�
contextlib�	ExitStack�
enter_context�	lock_readr7r��branch�
repository�
revision_treer��set_parent_trees�set_state_from_inventory�root_inventory�unlock)	�tree�dir_state_filenamerurV�
exit_stack�
parent_ids�parent_trees�	parent_id�parent_trees	         r�	from_tree�DirState.from_trees����$�$�%7�$�U��	��%�%�'�:��(�(����)9�:�!�0�0�2�
��J��!��!+�I�"&�+�+�"8�"8�"F�"F�y�"Q�K� �'�'��(@�A��,�,�[�-B�-B�-D�E�",��'�'��b�9��/�/��0C�0C�D�(� �
�!(�'� �
��	�
�M�M�O��s)�D�C	C=�3D�=
D�D�D�D"c�2�[[R"[R"[R"[R
"[R"[R"U5555555nSnURUSS9 U$)Nc�(�Uupp4UcSnUcSnXX44$)N�r$)�d�old_path�new_pathr��	new_entrys     r�	delta_key�1DirState._check_delta_is_valid.<locals>.delta_keyBs-��78�4�X������������;�;rT)rU�reverse)	r\r�_check_delta_unique_ids�_check_delta_unique_old_paths�_check_delta_unique_new_paths�_check_delta_ids_match_entry�_check_delta_ids_are_valid�(_check_delta_new_path_entry_both_or_None�sort)r�deltar�s   r�_check_delta_is_valid�DirState._check_delta_is_valid1s����-�-��7�7��;�;�!�>�>�%�@�@� )� R� R�$)�!"����
�
�
�� 	<�	�
�
�y�$�
�/��rc��UR5 0n0n[5n[5nURU5nUGHupgp�[U[5(d#[SR
[U555eX�;dX�;aURU=(d UUS5 UbURS5nXcU'OURU5 Ub�U	cURXxS5 URS5n[R"U5up�U(aURX�R45 X�U4n[RU	R n
U
S:XaU	R"=(d SnOSnUU
U	R$UU4X('SXg4;dGMOUR'SU5H�nUSS	U;dUSS	U;aMUSSnUSS
nUS
SSn
US
SSnUS
SSn[R("UU5nUX?SS	'U[+U5SnUU-nUUUSS	4n[R("UU5nUU
UUU4X/SS	'M� GM UR-XQS5 UR/UR155 UR3UR555 UR7US5 g![8R:a7nS
UlS[?U5;ae[8R@"USU35UeSnAff=f)z�Apply an inventory delta to the dirstate for tree 0.

This is the workhorse for apply_inventory_delta in dirstate based
trees.

:param delta: An inventory delta.  See Inventory.apply_delta for
    details.
r�zrepeated file_idN�utf-8�new_path with no entryrIrrrr
�rT�integrity error�error from _get_entry. )!r8rmr��
isinstancer�r�rzr��_raise_invalidr�r�r
r�r�rCr�r��reference_revision�
executable�_iter_child_entriesr�r��_check_delta_ids_absent�_apply_removals�items�_apply_insertionsr�_after_delta_check_parentsrrrXr��InconsistentDeltaDelta)rr��
insertions�removalsr;�new_idsr�r�r��	inv_entry�dirname_utf8r�rUr�r��child�
child_dirname�child_basenamer��old_child_path�child_suffix�new_child_dirname�new_child_pathr�s                        r�update_by_delta�DirState.update_by_deltaMs2��	
�&�&�(��
���
�%���%���*�*�5�1��6;�2�H���g�u�-�-�$�3�:�:�4��=�I����%�7�+>��#�#�H�$8��'�CU�V��#�#�?�?�7�3��$,��!����G�$��#��$��'�'��;S�T�#�?�?�7�3��)0���x�)@�&����K�K��/B�/B� C�D�#�w�7��#�5�5�i�n�n�E���t�#�"+�">�">�"E�#�K�"%�K����(�(���'�
�#��H�/�/�!�5�5�a��B�E��Q�x��{�j�0�E�!�H�Q�K�8�4K� �$)�!�H�Q�K�M�%*�1�X�a�[�N�$�Q�x��{�1�~�H�"'��(�1�+�a�.�K�!&�q��!��Q��J�%,�%5�%5�m�^�%T�N�,:�H�1�X�a�[�)�#0��X���#A�L�(0�<�(?�%�,�n�e�A�h�q�k�J�C�%,�%5�%5�6G��%X�N�� �"�#�&�/�J�Q�x��{�+�C�E7<�n	
�$�$�W�Q�7�	�� � ����!1�2��"�"�:�#4�#4�#6�7��+�+�G�Q�7�����		�$(�D�!� ��A��.���/�/��0���4���
��		�s�,AJ=�=L�2L�Lc	��[US[R"S5S9GHup#[R"U5upEURXES5upgp�URUSUn
U	(aW
SSSS;aURX2S5 UW
SS:wa(URUUSRU
SS55 URU
5 URUS	S5upgp�U(dM�URUSH-nUSSSS
;dMURUU
SSS5 M/ GM g![a URX2S5 N�f=f)NTr
)r�rUrzWrong path for old path.r�rz1Attempt to remove path has wrong id - found {!r}.rr-�:The file id was deleted but its children were not deleted.)r�operator�
itemgetterr
r�r�rYrrr�rz�_make_absent)rr�r�rtr�r��block_i�entry_i�	d_present�	f_presentr
�child_entrys            rr��DirState._apply_removals�s}��#�H�d��@S�@S�TU�@V�W�M�G� '�
�
�d� 3��G�59�5P�5P��1�6�2�G�i�
O�����0��3�G�<����a����A��,� >��#�#�D�3M�N��%��(�1�+�%��#�#���G�N�N��a������
���e�$�6:�5P�5P��c�1�6�2�G�i��y�$(�?�?�7�#;�A�#>�K�"�1�~�a�(��+�<�?��+�+� �!�!�H�Q�K�+��$?�?X���
O��#�#�D�3M�N�
O�s�D>�>E�Ec	���[U5Hup#pEnURX#XEUS9 M g![Ra( UR	WRS5WSS5 gf=f)N�r�r�rzMissing parent)rr�rr�r��decode)r�addsrUr�r�r�r�s       rr��DirState._apply_insertions�st��	T�EK�D�\�A��z�	��#�#��:�i�$��FR���'�'�	T����	� 0� 0�� 8�#�a�&�BR�S�	T�s�'*�9A&�%A&c	�P�UR5 UR5 UR/:wa[UR5e[UR5S:XaV[RnUR5HnUSRU5 M URRU5 X RS'URU5n/n/n/n[RnURn	Sn
[5n[5nUGHXup�nnUR ["La#[%SR'[)U555eUb1UUR*:wa!UR-X�SR'U55 UcSnOZUcUR-X�S5 U"U5n[.R0"U5unnU(aUR3UUR445 U
cSnOU"U
5nU
c/URSUX�"U5S45 UR3U5 GMUcURUSUSS45 GM.X�4U
:XaURUUX�"U545 GMRUR7U5 /nURUUUU	"U5S	45 [9[;UR=SU555nUH�nUSunnnU(a	US
-U-nOUnU(aUU[U5S-nO"US:Xa[%S5eU[U5S-SnURSUUSS
USSS	45 URUUUSS
SS	45 M� URUUUSS	45 GM[ UR?X�S5 UR7U5 URAU5 URCU5 UREUS5 URQSS9 SUl)g![FRHa7nSUl%S[MU5;ae[FRN"USU35UeSnAff=f)aWUpdate the parents of this tree after a commit.

This gives the tree one parent, with revision id new_revid. The
inventory delta is applied to the current basis tree to generate the
inventory for the parent new_revid, and all other parent trees are
discarded.

Note that an exception during the operation of this method will leave
the dirstate in a corrupt state where it should not be saved.

:param new_revid: The new revision id for the trees parent.
:param delta: An inventory delta (see apply_inventory_delta) describing
    the changes from the current left most parent revision to new_revid.
rr
)r�r�r�Nzmismatched entry file_id {!r}r�TFr�rz!cannot rename directory to itselfrr�r�r6)*r8r=rZr)�update_basis_by_deltar�r[rCr:�
_iter_entriesr�r�rr��_inv_entry_to_detailsrmr{r�r�rzr�r�r�r
r�r�r��_update_basis_apply_deletesr0r\r�r��_update_basis_apply_adds�_update_basis_apply_changesr�rrrXr�r�r�r`)rr��	new_revidr<r
r��changes�deletesr��inv_to_entry�	root_onlyr;r�r�r�r�r��
new_path_utf8r��
basename_utf8r��new_deletesr�r��
child_file_id�source_path�target_pathr�s                            rr��DirState.update_basis_by_delta�s4��	
�&�&�(��#�#�%��<�<�2��%�d�&@�&@�A�A��t�}�}���"�#�7�7�L��+�+�-���a�����-�.��M�M� � ��+�$�
�
�a���*�*�5�1���������"�"���1�1���	�
�%���%��6;�2�H���� � ��-�$�3�:�:�4��=�I����$��I�4E�4E�)E��#�#��'F�'M�'M�i�'X���� $�
��$��'�'��;S�T� &�x� 0�
�.5�m�m�M�.J�+��m� ��K�K��y�/B�/B� C�D��� $�
� &�x� 0�
�������=�'�<�	�3J�D�Q�����G�$��!����
�t�W�d�D�I�J��%��2����"�M�7�L��<S�T�� �0�0��9������%�%��$�Y�/����'�t�D�,D�,D�Q�
�,V�'W�X��)�E�CH��8�@�M�>�=�$�&3�d�&:�^�&K��&4��$�&3�k�#�m�BT�BV�6W�&W��(�C�/�"0�1T�"U�U�&1�#�m�2D�q�2H�2J�&K���K�K��{�E�!�H�Q�K��q��!��e� T�U��N�N�K��e�A�h�q�k�4�QV�#W�X�)����
�}�g�t�U�S�T�m7<�p	
�$�$�W�Q�7�	��,�,�W�5��)�)�$�/��,�,�W�5��+�+�G�Q�7�	
���D��1���������		�$(�D�!� ��A��.���/�/��0���4���
��		�s�>AO�P%�.2P � P%c�X�U(dgUR5nUH�nURUS5HsnURUSUSU5upxp�U
(dM(URUSUnUSSU:waMKUR	SUSS-RS5US5 Mu M� g)	zACheck that none of the file_ids in new_ids are present in a tree.Nr$rr
rr�r�zBThis file_id is new in the delta but already present in the target)�
_get_id_indexr�r�rYr�r�)rr�r��
tree_index�id_indexr�rUr�r�r�r�r
s            rr�� DirState._check_delta_ids_absent�s������%�%�'���G��|�|�G�R�0��9=�9T�9T���F�C��F�J�:�6��)�!������0��3�G�<����8�A�;�'�)���#�#���A�a��(�0�0��8��!��1�rc�>�SUl[R"XU5e)NT)rXr�InconsistentDelta)rrtr��reasons    rr��DirState._raise_invalid�s�� $����&�&�t�f�=�=rc
�X�URSS9 UGHup#pEn[R"U5upxXxU4n	URU	5up�U(dZ[R"U5up�UR	X�S5up�nnU(dURUUS5 UR
X�U5 URU
SnURU	U5unnU(a%Ub"URUUSRU55 U(aCUUnUSSSnUS:Xa	UUSS'O�US	:Xa
[5eURUUS
5 O�[US-
US-5H�nUS:dU[U5:�aMUUnUSSSXx4:waM.USSU:Xa[SRU	55eUSSSnUS
;dMgURUUSRUSS55 M� U	[RU/4nUR!UU5 USSSnUS:Xa�UR#5nUR%US5nUH�nUR	USUSS5unnnnU(dM*URUSUn U SSU:waMMU SSSn!U!S
;aURUUS5 U SSSun"n#U"(a	U"S-U#-n$OU#n$S	USSS4U SS'S	U$SSS4USS'M� OUS	:Xa
[5eUSn%U%S:XdGMUR
U
UU5 GM g)a�Apply a sequence of adds to tree 1 during update_basis_by_delta.

They may be adds, or renames that have been split into add/delete
pairs.

:param adds: A sequence of adds. Each add is a tuple:
    (None, new_path_utf8, file_id, (entry_details), real_add). real_add
    is False when the add is the second half of a remove-and-reinsert
    pair created to handle renames and deletes.
c��US$)Nr
r$)�xs r�<lambda>�3DirState._update_basis_apply_adds.<locals>.<lambda>�s���!�r�rUr
z;Unable to find block for this record. Was the parent added?Nz2considered a real add but still had old_path at {}rrDrGzEAn entry was marked as a new add but the basis target already existedrzI_find_entry_index didnt find a key match but walking the data did, for {}r�zWwe have an add record for path, but the path is already present with another file_id {}r$z-We found a tree0 entry that doesnt make senser�FrrF)r�r
r�r�r�r�r�rYr�rzr)r�r�r�rCr:r�r�r�)&rr�r�r�r��new_details�real_addr�r�r�r�r�r�r�r�r�r�r�r�r�r
�
basis_kind�maybe_index�maybe_entry�active_kindr��keysrUr�r�r�r��active_entry�real_active_kind�
active_dir�active_name�active_path�new_kinds&                                      rr��!DirState._update_basis_apply_adds�s��� 	
�	�	�n�	�%�CG�>�H��h� '�
�
�h� 7��G� �G�4�I�#'�#B�#B�9�#M� �K��+2�-�-��*@�'�
��/�/�
��K�F� �A�~�&��'�'� ��U��
�"�"�#3�w�O��O�O�K�0��3�E�#'�#9�#9�)�U�#K� �K����'��'�'� ��L�S�S�$�����k�*��"�1�X�a�[��^�
���%�"-�E�!�H�Q�K��4�'�-�/�/��'�'� ��@��$)��q��+��/�#J�K�"�Q��+��U��*C� �"'��"4�K�"�1�~�b�q�)�g�-@�@� �"�1�~�a�(�G�3�,�@�@F��y�@Q���"-�Q���!2�1�!5�J�!��5��+�+�$�#�J�JP�&� +�A��q� 1�K�	�$K�.#�X�%A�%A�;�$O�P�����[�%�0���(�1�+�a�.�K��d�"� �-�-�/��
 �|�|�G�R�0���C��3�3�C��F�C��F�A�F�;�G�W�i��%� �#'�?�?�7�#;�A�#>�w�#G�L�#�A��q�)�W�4�!�'3�A��q�'9�!�'<�$�'�<�7��+�+�$�#�K��/;�1�o�b�q�.A�+�J��!�&0�4�&7�+�&E��&1��*.��!�U�C�)H�L��O�A�&�#'��a���"D�E�!�H�Q�K�= �>��$�)�+�+�"�1�~�H��4���"�"�;��X�F�wCGrc��UHFup#pEURSXC5nUSbUSSSS;aURX4S5 XVSS'MH g)z�Apply a sequence of changes to tree 1 during update_basis_by_delta.

:param adds: A sequence of changes. Each change is a tuple:
    (path_utf8, path_utf8, file_id, (entry_details))
r
rNr�z$changed entry considered not present)r�r�)rr��	_old_pathr�r�r�r
s       rr��$DirState._update_basis_apply_changes0sc��:A�5�I���O�O�A�w�9�E��Q�x��5��8�A�;�q�>�\�#A��#�#��'M��&�!�H�Q�K�:Arc��[RnUGH�up4pVnXtSL:waURX5S5 [R"U5up�URX�S5up�p�U
(dURX5S5 URU
SUnUSSSnUSSU:waURX5S5 SnUSSSnUS	;a�US
:XakUSSSnURSUU5nUSSSS
:waURUUS5 O"USSSS	;aURUUS5 UUSS'URU
SU	US
:XaDURUSS45unnU(a&URUSnU(d
URU	O8X.SS'URUSS5unnnnU(aURUSnUH)nUSSSnUS	;dMURUUS5 M+ GM� g)a�Apply a sequence of deletes to tree 1 during update_basis_by_delta.

They may be deletes, or renames that have been split into add/delete
pairs.

:param deletes: A sequence of deletes. Each delete is a tuple:
    (old_path_utf8, new_path_utf8, file_id, None, real_delete).
    real_delete is True when the desired outcome is an actual deletion
    rather than the rename handling logic temporarily deleting a path
    during the replacement of a parent.
Nzbad delete deltar
z)basis tree does not contain removed entryrrzmismatched file_id in tree 1r$sarrGz-Dirstate did not have matching rename entriesz3Dirstate had a rename pointing at an inactive tree0rFrr�)	rCr:r�r
r�r�rYr�r�)rr��nullr�r�r�r��real_deleter�r�r�r��dir_present�file_presentr
r��	dir_block�old_kindr�r��dir_block_indexr�r�r�r�r�r��child_basis_kinds                            rr��$DirState._update_basis_apply_deletes?sn���+�+��;B�7�H��K��4�/�0��#�#�H�7I�J� '�
�
�h� 7��G��+�+�G�q�A�
@�K�k� ��#�#��'R���O�O�K�0��3�K�@�E���(�1�+�a�.�K��Q�x��{�g�%��#�#�H�7U�V��I��Q�x��{�1�~�H��e�#��$�&�"'��(�1�+�a�.�K�#'�?�?�1�g�{�#K�L�#�A��q�)�!�,��4��+�+�$�#�K��
&�a���+�A�.�%�7��+�+�$�#�Q��
*.�L��O�A�&��O�O�K�0��3�K�@��t�#�26�1P�1P�!�3��,�2�.�_�g��$(�O�O�O�$D�Q�$G�	�(� $���� @��#�a����9=�9T�9T��c�1�:�6���)�Y�� $���� 8�� ;�I�(��#.�q�>�!�#4�Q�#7� �#�5�0��'�'� ��T�� )�A<Crc���UHrup4URX$U5nUSc"URURS5US5 USUSS:wdMPURURS5US5 Mt g)a!Check that parents required by the delta are all intact.

:param parents: An iterable of (path_utf8, file_id) tuples which are
    required to be present in tree 'index' at path_utf8 with id file_id
    and be a directory.
:param index: The column in the dirstate to check for parents in.
r
Nr�zThis parent is not present.rrFzThis parent is not a directory.)r�r�r�)rr;�indexr�r�r
s      rr��#DirState._after_delta_check_parents�s���&-�!�L��O�O�E�L�A�E��Q�x���#�#� �'�'��/��:W���Q�x���q�!�T�)��#�#� �'�'��/��5��&-rc�r�XCRS-nUS:Xa�URcUR5 URUR:aWUR
UR:a<SUURUSSS[U54USS'URU/5 gggg![a gf=f)z�Note the sha1 of a file.

:param entry: The entry the sha1 is for.
:param sha1: The observed sha1.
:param stat_value: The os.lstat for the file.
��NrEr
rr)	�st_mode�KeyErrorrc�_sha_cutoff_time�st_mtime�st_ctimer�r�r�)rr
r*�
stat_value�_stat_to_minikindr�s      r�_observed_sha1�DirState._observed_sha1�s���	�(�);�);�h�)F�G�H��t��� � �(��%�%�'��#�#�d�&7�&7�7��'�'�$�*;�*;�;����&�&��!�H�Q�K��N��j�)���a�����#�#�U�G�,�<�8�	���	��	�s�B)�)
B6�5B6c�f�[[R"55S-
UlUR$)z�Return cutoff time.

Files modified more recently than this time are at risk of being
undetectably modified and so can't be cached.
r)�int�timercr|s rr�DirState._sha_cutoff_time�s(�� ��	�	��,�q�0���� � � rc�.�[R"U5$)z(Return the os.lstat value for this path.)r;�lstat)rr,r
s   r�_lstat�DirState._lstat�s���x�x�� � rc�j�[R"SU-5 URRU5$)Nzdirstate sha1 )r�mutterrgr*r+s  rri�DirState._sha1_file_and_mutter�s-��	���%��/�0��"�"�'�'��0�0rc�L�UR(a[[U-5$U$)zIs this file executable?)rs�boolr)r�mode�old_executables   r�_is_executable�DirState._is_executable�s ���(�(���$��'�'�!�!rc��[U[5(a[R"U5n[R"U5n[
R"5S;a%[R"U5RS5nU$)zRead the target of a symlink.)r��asciizUTF-8)	r�r�r;�fsencode�readlink�sys�getfilesystemencoding�fsdecoder�)rr,�old_link�targets    r�
_read_link�DirState._read_link�s_���g�s�#�#�
�k�k�'�*�G����W�%���$�$�&�.@�@��[�[��(�/�/��8�F��
rc�:�UR5 UR$)z>Return a list of the parent tree revision ids that are ghosts.)r�rZr|s rr9�DirState.get_ghosts�s���#�#�%��|�|�rc��UR[R:XaSUR[R:Xa5URRS5 URR
5$/nURURUR555 URURUR55 URUR55 URU5$)z5Serialise the entire dirstate to a sequence of lines.r)rVrCr�rWr\r��	readlinesr��_get_parents_liner7�_get_ghosts_linerZr]�_iter_entry_lines�_get_output_lines)r�liness  r�	get_lines�DirState.get_liness���
���(�"?�"?�?��$�$��(E�(E�E�
���!�!�!�$��#�#�-�-�/�/���
���T�+�+�D�,?�,?�,A�B�C�
���T�*�*�4�<�<�8�9�
���T�+�+�-�.��%�%�e�,�,rc�D�SRS[U5-/U-5$)z7Create a line for the state file for ghost information.r�r[�r_r�)r�	ghost_idss  rr=�DirState._get_ghosts_lines"���z�z�5�3�y�>�1�2�Y�>�?�?rc�D�SRS[U5-/U-5$)z9Create a line for the state file for parents information.r�r[rD)rr�s  rr<�DirState._get_parents_lines"���z�z�5�3�z�?�2�3�j�@�A�Arc�J�[URUR55$)zCreate lines for entries.)�maprdr�r|s rr>�DirState._iter_entry_liness���4�&�&��(:�(:�(<�=�=rc��UR5nUS:Xa[4SjnU$US:Xa[4SjnU$US:Xa[4SjnU$[4SjnU$)z�Get a function which converts entry fields into a entry record.

This handles size and executable, as well as parent records.

:return: A function which takes a list of fields, and returns an
    appropriate record for storing in memory.
rc�b�USUSUS4nUUSUSU"US5USS:HUS	4/4$)
Nrr
rrr�rZ�rP�r$�r	�_int�path_name_file_id_keys   r�fields_to_entry_0_parents�@DirState._get_fields_to_entry.<locals>.fields_to_entry_0_parents's`��)/���F�1�I�v�a�y�(I�%�)�#�1�I�"�1�I� ����O�"�1�I��-�"�1�I����rr
c��USUSUS4nUUSUSU"US5USS:HUS	4US
USU"US5US
S:HUS4/4$)Nrr
rrr�rZrNrPrO��	�
��r$rPs   r�fields_to_entry_1_parent�?DirState._get_fields_to_entry.<locals>.fields_to_entry_1_parent9s���)/���F�1�I�v�a�y�(I�%�)�#�1�I�"�1�I� ����O�"�1�I��-�"�1�I��#�1�I�"�1�I� ����,�"�2�J�$�.�"�2�J����rrc	���USUSUS4nUUSUSU"US5USS:HUS	4US
USU"US5US
S:HUS4USUSU"US5USS:HUS4/4$)Nrr
rrr�rZrNrPrOrVrWrXrYrZ�
����r$rPs   r�fields_to_entry_2_parents�@DirState._get_fields_to_entry.<locals>.fields_to_entry_2_parentsRs���)/���F�1�I�v�a�y�(I�%�)�#�1�I�"�1�I� ����O�"�1�I��-�"�1�I��#�1�I�"�1�I� ����,�"�2�J�$�.�"�2�J��#�2�J�"�2�J� ����,�"�2�J�$�.�"�2�J����rc
���USUSUS4n[S[U5S-
S5Vs/sH)nXXS-U"XS-5XS-S:HXS-4PM+ nnX$4$s snf)Nrr
rrrZrPr�)r�r�)r	rQrR�cur�treess     r�fields_to_entry_n_parents�@DirState._get_fields_to_entry.<locals>.fields_to_entry_n_parentsrs���)/���F�1�I�v�a�y�(I�%� %�Q��F��a���;�	� <��
���Q�w���V�!�G�_�-��Q�w��4�/��Q�w��� <��	�-�3�3��	s�0A)rgr)r�num_present_parentsrSr[rcrhs      rr��DirState._get_fields_to_entrysm��#�7�7�9���!�#�7:�

�-�,�
 �A�
%�69�
�,,�+�
 �A�
%�7:�
�:-�,�8;�
4�-�,rc�L�UR5 [UR5$)z=Return a list of the parent tree ids for the directory state.)r�r\r[r|s rr7�DirState.get_parent_ids�s���#�#�%��D�M�M�"�"rc�l�UR5 XS4nURU5upVU(dUSSS4$URUSnURXG5up�U[	U5:aHXxSSU:Xa:XxSUSS;aXXSS4$US-
nU[	U5:aXxSSU:XaM:XXSS4$)a�Get the coordinates for a path in the state structure.

:param dirname: The utf8 dirname to lookup.
:param basename: The utf8 basename to lookup.
:param tree_index: The index of the tree for which this lookup should
    be attempted.
:return: A tuple describing where the path is located, or should be
    inserted. The tuple contains four fields: the block index, the row
    index, the directory is present (boolean), the entire path is
    present (boolean).  There is no guarantee that either
    coordinate is currently reachable unless the found field for it is
    True. For instance, a directory not present in the searched tree
    may be returned with a value one greater than the current highest
    block offset. The directory present field will always be True when
    the path present field is True. The directory present field does
    NOT indicate that the directory is present in the searched tree,
    rather it indicates that there are at least some files in some
    tree present there.
rrFr
r�T)r8r�rYr�r�)	rr�r�r�rUr�r�r�r�s	         rr��DirState._get_block_entry_index�s���(	
�&�&�(���$��#�>�>�s�C������5�%�/�/�����,�Q�/��#�5�5�c�A����C��J�&�5�+=�a�+@��+C�x�+O��!�!�$�Z�0��3�<�G�"��t�;�;��1��K�	�C��J�&�5�+=�a�+@��+C�x�+O�
��u�4�4rc��UR5 Ub�[U[5(d/[R"SR[
U5U55e[R"U5upVURXVU5upxp�U
(dgURUSUnUSS(aUSUSS;d[S5eU(a)USSU:waSUl[R"S	5eU$UR5RUS
5nU(dgUH�n
URU
5up~U(dMURUSnUR!X�5up�U(dMMURUSUnUSUSS;aUs $USUSS:Xa
U(aUs $ gUSUSS
:wa$[SRX�SUSU55eUSUSnUR#XUS9s $ g)a3Get the dirstate entry for path in tree tree_index.

If either file_id or path is supplied, it is used as the key to lookup.
If both are supplied, the fastest lookup is used, and an error is
raised if they do not both point at the same row.

:param tree_index: The index of the tree we wish to locate this path
    in. If the path is present in that tree, the entry containing its
    details is returned, otherwise (None, None) is returned
    0 is the working tree, higher indexes are successive parent
    trees.
:param fileid_utf8: A utf8 file_id to look up.
:param path_utf8: An utf8 path to be looked up.
:param include_deleted: If True, and performing a lookup via
    fileid_utf8 rather than path_utf8, return an entry for deleted
    (absent) paths.
:return: The dirstate entry tuple for path, or (None, None)
zpath_utf8 is not bytes: {} {!r}r�r
rrr�zunversioned entry?Tz<integrity error ? : mismatching tree_index, file_id and pathr$�rFrErHrIrDrGz2entry {!r} has invalid minikind {!r} for tree {!r})r�r�)r8r�r�rrrzr�r
r�r�rYr�rXr�r�r�r�r�)rr�r�r�r�r�r�r�r�rrr
�
possible_keysrUr�r��	real_paths                 rr��DirState._get_entry�s>��*	
�&�&�(�� ��i��/�/��o�o�5�<�<�T�)�_�i�X���!(�
�
�i� 8��G��+�+�G�z�J�
@�K�k� �!��O�O�K�0��3�K�@�E��!�H�Q�K�E�!�H�Z�$8��$;�<�$O�$�%9�:�:����8�A�;�+�-�,0�D�)� �/�/�V����L� �.�.�0�4�4�[�"�E�M� �!�$��'+�'F�'F�s�'K�$��������4�Q�7��'+�'=�'=�c�'I�$���7� �O�O�K�8��;�K�H�E��Q�x�
�+�A�.�2J�J� %���Q�x�
�+�A�.�$�6�*�#(�L�)��Q�x�
�+�A�.�$�6�,�P�W�W� %�Q�x�
�';�A�'>�
����
!&�a��� 4�Q� 7�I��?�?�"�y�+���A%�Frc�N�Uc
[5nU"X5nS/4S/4/nUSSRSS[R4SSSS[R
4/45 UR
5 UR/U5 UR5 U$! UR5 e=f)a_Create a new dirstate on path.

The new dirstate will be an empty tree - that is it has no parents,
and only a root node - which has id ROOT_ID.

:param path: The name of the file for the dirstate.
:param sha1_provider: an object meeting the SHA1Provider interface.
    If None, a DefaultSHA1Provider is used.
:return: A write-locked DirState object.
rrr
rFF)
r4r�r�ROOT_IDrCr��
lock_write�	_set_data�saver�)�clsrtrurV�empty_tree_dirblockss     rry�DirState.initialize	s���"� �/�1�M��T�)��!$�b�	�C��9�5���Q���"�)�)��c�9�,�,�-��3��5�(�*;�*;�<��
�	
�	����	����R�!5�6��K�K�M��
��	��M�M�O��s�-"B�B$c���URn[RUnURnUS:XaSnSnSnO�US:Xa0URcSnOURRS5nSnSnOwUS:Xa7UR=(d SnUR=(d SnURnO:US:XaUR=(d SnSnSnO[S	RU55eX$XVU4$)
a	Convert an inventory entry (from a revision tree) to state details.

:param inv_entry: An inventory entry whose sha1 and link targets can be
    relied upon, and which has a revision set.
:return: A details tuple - the details for a single tree at a path +
    id.
rLrrFrNr�rKrOz
can't pack {})r�rCr��revision�symlink_targetr��	text_sha1�	text_sizer�r�r�rz)r�r�r�rbr�r�r�s       rr��DirState._inv_entry_to_details)	s����~�~���-�-�d�3���&�&�	��;���K��D��J�
�Y�
��'�'�/�!��'�6�6�=�=�f�E���D��J�
�V�^�#�-�-�4��K��&�&�+�!�D�"�-�-�J�
�%�
%�#�6�6�=�#�K��D��J��O�2�2�9�=�>�>��t��C�Crc#�# �/nU/nSnU(a�Un/nUH�nURUSS45upxUS:XaSn[UR5S:Xa gU(dMEURUn	U	SHZn
U
SUSnX�;aU
v� US:XdMU
SS(aU
SSS-U
SS-nOU
SSnURU5 M\ M� U(aM�gg7f)asIterate over all the entries that are children of path_utf.

This only returns entries that are present (not in b'a', b'r') in
tree_index. tree_index data is not refreshed, so if tree 0 is used,
results may differ from that obtained if paths were statted to
determine what ones were directories.

Asking for the children of a non-directory will return an empty
iterator.
r�rrr
NrFr�)r�r�rYr�)rr�r�r�next_pending_dirsrJrtr�r�r�r
r�s            rr��DirState._iter_child_entriesL	s�����&�K�����,�L� "��$��'+�'F�'F��c�SV�GW�'X�$���!�#�"#�K��4�?�?�+�q�0��������4��"�1�X�E� ��8�J�/��2�D��)�#���t�|� ��8�A�;�#(��8�A�;��#5��a����#C�D�#(��8�A�;�D�)�0�0��6�&�%� ��s�B	C�A
C�Cc#�p# �UR5 URHnUSShv�N M gN	7f)z�Iterate over all the entries in the dirstate.

Each yelt item is an entry in the standard format described in the
docstring of breezy.dirstate.
r
N)r8rY)rrLs  rr��DirState._iter_entriest	s1���	
�&�&�(����I� ��|�#�#�)�#�s�(6�4�
6c��URc20nUR5Hup#URX5 M XlUR$)z�Get an id index of self._dirblocks.

This maps from file_id => [(directory, name, file_id)] entries where
that file_id appears in one of the trees.
)r`r�r�)rr�rU�
_tree_detailss    rr��DirState._get_id_index~	sF���>�>�!��H�&*�&8�&8�&:�"���%�%�h�4�';�%�N��~�~�rc�\�USn[U5nX1;aU4X'gXnX$;aXB4-X'gg)z(Add this entry to the _id_index mapping.rN)�tuple�rr�r�r��
entry_keyss     rr��DirState._add_to_id_index�	sG���A�,���)�$�	��"�!*��H��!�*�J��*�$.��$=��!�+rc�d�USn[X5nURU5 [U5X'g)z�Remove this entry from the _id_index mapping.

It is an programming error to call this when the entry_key is not
already present.
rN)r\�remover�r�s     r�_remove_from_id_index�DirState._remove_from_id_index�	s5���A�,���(�+�,�
����)�$�!�*�-��rc�&�[R/nURS5 SRU5nURS[R
"U54-5 [
U5S-
nURSU4-5 URU5 U$)zvFormat lines for final output.

:param lines: A sequence of lines containing the parents list and the
    path lines.
rs
s
crc32: %d
rsnum_entries: %d
)rC�HEADER_FORMAT_3r�r_�zlib�crc32r�)rr@�output_lines�inventory_text�num_entriess     rr?�DirState._get_output_lines�	s���!�0�0�1��
���S��"����.�����N�d�j�j��.H�-J�J�K��%�j�1�n�����0�K�>�A�B����N�+��rc�4�SSSUS[RS4U4$)z%Return a deleted row for fileid_utf8.r�sRECYCLED.BINsfilerr)rCr�)rr�r;s   r�_make_deleted_row�DirState._make_deleted_row�	s3��
����
�����
���	rc�X�[UR5[UR5-
$)z0The number of parent entries in each record row.)r�r[rZr|s rrg�DirState._num_present_parents�	s���4�=�=�!�C����$5�5�5rc�2�Uc
[5nU"UUUUS9nU$)aRConstruct a DirState on the file at path "path".

:param path: The path at which the dirstate file on disk should live.
:param sha1_provider: an object meeting the SHA1Provider interface.
    If None, a DefaultSHA1Provider is used.
:param worth_saving_limit: when the exact number of hash changed
    entries is known, only bother saving the dirstate if more than
    this count of entries have changed. -1 means never save.
:param use_filesystem_for_exec: Whether to trust the filesystem
    for executable bit information
:return: An unlocked DirState object, associated with the given path.
)rvrw)r4)rzrtrurvrwrVs      r�on_file�DirState.on_file�	s/��(� �/�1�M����1�$;�	
���
rc�x�UR5 UR[R:Xa[	U5 gg)z�Read in all the dirblocks from the file if they are not in memory.

This populates self._dirblocks, and sets self._dirblock_state to
IN_MEMORY_UNMODIFIED. It is not currently ready for incremental block
loading.
N)r�rWrCrU�_read_dirblocksr|s rr8�"DirState._read_dirblocks_if_needed�	s1��	
�#�#�%����8�#9�#9�9��D�!�:rc��UR5 URR5nURS5n[	US5 USSUlURR5nURS5n[	US5 USSUl[RUl	URR5Ulg)z�This reads in the metadata header, and the parent ids.

After reading in, the file should be positioned at the null
just before the start of the first record in the file.

:return: (expected crc checksum, number of entries, parent list)
r�rr
r�rN)�
_read_preluder\�readliner�rr[rZrCr�rV�tellrb)r�parent_liner��
ghost_lines    r�_read_header�DirState._read_header�	s���	
�����&�&�/�/�1��� � ��'���D��G���Q�r�
��
��%�%�.�.�0�
�����&���D��G���A�b�z���%�:�:���"�.�.�3�3�5��rc��UR(d[R"U5eUR[R
:XaUR
5 gg)z/Read the header of the dirstate file if needed.N)r^r�ObjectNotLockedrVrCrUr�r|s rr��DirState._read_header_if_needed
sC������(�(��.�.�����!7�!7�7�����8rc�P�URR5nU[R:wa%[R
"SR
U55eURR5nURS5(d%[R
"SR
U55e[U[S5S5Ul
URR5nURS5(d[R
"S5e[U[S5S5Ulg)aBRead in the prelude header of the dirstate file.

This only reads in the stuff that is not connected to the crc
checksum. The position will be correct to read in the rest of
the file and check the checksum after this point.
The next entry in the file should be the number of parents,
and their ids. Followed by a newline.
zinvalid header line: {!r}scrc32: zmissing crc32 checksum: {!r}r�s
num_entries: zmissing num_entries lineN)r\r�rCr�rrrz�
startswithrr��crc_expected�_num_entries)r�header�crc_line�num_entries_lines    rr��DirState._read_prelude
s����!�!�*�*�,���X�-�-�-��/�/�"=�"D�"D�V�"L�M�M��#�#�,�,�.���"�"�:�.�.��/�/�"@�"G�"G��"Q�R�R����Z��2� >�?����+�+�4�4�6���*�*�+;�<�<��/�/�"<�=�=�� 0��5E�1F�� L�M��rc�T�UR5R[U5S5$)z Find a sha1 given a stat lookup.N)�_get_packed_stat_indexr�r�)rrt�stat_results   r�sha1_from_stat�DirState.sha1_from_stat"
s#���*�*�,�0�0��;�1G��N�Nrc��URc?0nUR5H#up#USSS:XdMUSSXSS'M% XlUR$)z+Get a packed_stat index of self._dirblocks.rrEr
r�)rar�)rr�_key�tree_detailss    rr��DirState._get_packed_stat_index&
sh���"�"�*��E�&*�&8�&8�&:�"����?�1�%��-�0<�Q���0B�E�q�/�!�,�-�';�',�#��&�&�&rc�b�UR(a[R"S5 gUR5(dgSnURS:wa;UR
R
5upX lURUlU(dgUR5nURRS5 URRU5 URR5 URR5 UR5 UR5 U(a;UR
R!5UlUR
RUlgg!U(a;UR
R!5UlUR
RUlff=f)aoSave any pending changes created during this session.

We reuse the existing file, because that prevents race conditions with
file creation, and use oslocks on it to prevent concurrent modification
and reads - because dirstate's incremental data aggregation is not
compatible with reading a modified file, and replacing a file in use by
another process is impossible on Windows.

A dirstate in read only mode should be smart enough though to validate
that the file has not changed, and otherwise discard its cache and
start over, to allow for fine grained read lock duration, so 'status'
wont block 'commit' - for example.
z4Not saving DirState because _changes_aborted is set.NF�wr)rXrr%�
_worth_savingr_r^�temporary_write_lock�fr\rAr��
writelines�truncate�flush�_maybe_fdatasyncr��restore_read_lock)r�grabbed_write_lock�new_lockr@s    rry�
DirState.save0
sV��� � �
�L�L�O�P��
�!�!�#�#��"�����s�"�+/�+;�+;�+P�+P�+R�(��
 (��'�z�z�D��%��	6��N�N�$�E����!�!�!�$����'�'��.����%�%�'����"�"�$��!�!�#��!�!�#�!�#'�#3�#3�#E�#E�#G�� �#'�#3�#3�#5�#5�� �"��!�#'�#3�#3�#E�#E�#G�� �#'�#3�#3�#5�#5�� �"�s�
BE*�*AF.c��URRS5(a/[R"URR55 gg)z4Flush to disk if possible and if not configured off.zdirstate.fdatasyncN)rrr�r
�	fdatasyncr\r=r|s rr��DirState._maybe_fdatasyncf
s<�����!�!�"6�7�7����d�.�.�5�5�7�8�8rc�$�UR[R:XdUR[R:XagUR[R:Xa5UR
S:Xag[
UR5UR
:�agg)z'Is it worth saving the dirstate or not?Tr�F)rVrCr�rWr�ror�rnr|s rr��DirState._worth_savingk
su��
���(�"=�"=�=��#�#�x�'B�'B�B�����8�#C�#C�C��'�'�2�-���4�+�+�,��0H�0H�H��rc�j�X lURSS9 [U5UlSUlSUlg)a�Set the full dirstate data in memory.

This is an internal function used to completely replace the objects
in memory state. It puts the dirstate into state 'full-dirty'.

:param parent_ids: A list of parent tree revision ids.
:param dirblocks: A list containing one tuple for each directory in the
    tree. Each tuple contains the directory path and a list of entries
    found in that directory.
Tr6N)rYr�r\r[r`ra)rr��	dirblockss   rrx�DirState._set_data�
s5��$�����D��1��Z�(��
����"&��rc��UR5 [U5(a[UR5eUR	SUS9nUSSU:Xag[U[5(d#[SR[U555eURU5 URSSU4SSUSSS	S
9 UR5 g)aChange the id of path to new_id in the current working tree.

:param path: The path inside the tree to set - b'' is the root, 'foo'
    is the path foo in the root.
:param new_id: The new id to assign to the path. This must be a utf8
    file id (not unicode, and not None).
rr�rNr�rrFr
r�)r�r�)
r8r�r)�set_path_idr�r�r�r�rzr�r�r�r�)rrt�new_idr
s    rr��DirState.set_path_id�
s���	
�&�&�(��t�9�9�%�d�&6�&6�7�7�����T��2����8�A�;�&� ���&�%�(�(� �!@�!G�!G��V��!U�V�V����%� ����
�#�v�����q��!��Q��	�	
�	
���rc
��UR5 0n0nUVVs/sHupVXR;dMUPM nnn[U5nUR5HKn	U	SSSS;aMU	SS/[R/U--X9S'URXIS5 MM [
U5GH�up�U
S-n
[R/X�-
-nSnUR5GH�up�U	RnU
RS5n[R"U5unnUU:XaUnOUnUUU4nURUS5nUHnUU:wdMSUSSS	4UUU
'M UU;aURU	5UUU
'M�/n[U
5H�n[U5(d!UR[R5 M4[![#U55nUUUSS
;aURUUU5 MpSR%USS5R'S5nURSUSSS	45 M� URURU	55 UR)U5 UUU'URUU5 GM� GM� UR+UR-55nUR/U5 UVVs/sHupVUPM	 snnUl[3U5UlUR7S
S9 X@lgs snnfs snnf)aSet the parent trees for the dirstate.

:param trees: A list of revision_id, tree tuples. tree must be provided
    even if the revision_id refers to a ghost: supply an empty tree in
    this case.
:param ghosts: A list of the revision_ids that are ghosts at the time
    of setting.
r
rr�Nr�r$rGFrr-r�rTr6)r8r�r�rCr:r�r/�iter_entries_by_dirr�r�r
r�r�r�r�r��next�iterr_r�r]�
_sort_entriesr�rMr[r\rZr�r`)rrg�ghosts�by_pathr��rev_idr�r��parent_countr
r��new_location_suffix�last_dirnamertr�r�r�r��
new_entry_keyr�r�r��lookup_index�a_keyrsrIs                          rr��DirState.set_parent_trees�
s%��	
�&�&�(�&����27�O����&�:N����O��<�(���'�'�)�E��Q�x��{�1�~��-��!&�q��!��
��,�,�1��1�!�G�!�H��

�!�!�(�!�H�5�*�!*�,� 7��J�#�a��J�
$,�#?�#?�"@��)�#�� �L�#�7�7�9��� �-�-�� �K�K��/�	�$+�M�M�)�$<�!����l�*�*�G�#*�L�!(�(�G� <�
�&�\�\�'�2�6�
�!+�I�!�M�1�!�%��!��:��	�*�:�6�",�&!�J�.�:>�9S�9S��:�G�M�*�:�6�#%�K�(-�j�(9�� #�:���'�.�.�x�/K�/K�L�%)��j�)9�$:�E�&�u�~�l�;�A�>�,�N�!,� 2� 2�7�5�>�,�3O� P�.2�Y�Y�u�Q�q�z�-B�,I�,I�$�,O�	� +� 2� 2�D�)�Q��s�3S� T�!):�" �&�&�t�'A�'A�%�'H�I��&�&�':�;�-8�G�M�*��)�)�(�M�B�Q :�!8�p�(�(�����9���&�&�{�3�49�:�E�L�F��E�:��
��F�|������D��1�!���]P��V;s�K3�K3�6K9c�$�0nU4Sjn[XS9$)z�Given a list of entries, sort them into the right order.

This is done when constructing a new dirstate from trees - normally we
try to keep everything in sorted blocks all the time, but sometimes
it's easier to sort after the fact.
c��USup#nXnXSU4$![a! [URS55nXQU'N.f=f)Nrr�)rr�r�)r
�_split_dirs�dirpath�fnamer�r�s      rr��$DirState._sort_entries.<locals>._keyWsV��&+�A�h�#�G�G�
-�#�,���'�*�*���
-��g�m�m�D�1�2��',�G�$�
-�s��(=�=r�)r)rr �
split_dirsr�s    rr��DirState._sort_entriesKs���
�$.�	+��j�+�+rc	� �S[R;a[R"SS5 S[R;nU(a[R"S5 UR5 UR
5n[[UR555n[U5n[U5nSnU(dU(Ga
U(aUSSSS;a
U"U5nM/U(a�USRS	5n[R"U5up�USRnX�U4n[R USR"n
U
S
:XaUSR$=(d SnOSnO	S=n=n	=n
=p�U(dXU(a&[R"S
UR'S	55 UR)UW
USR*UWSS9 U"U5nGO�U(ddU(aB[R"SUSSR'S	5USSR'S	55 UR-U5 U"U5nGO~X�S:Xa�USSSUSR*:wdUSSSW
:waQU(a&[R"SUR'S	55 UR)USW
USR*UWSS9 U"U5nU"U5nO�[/X�SS5(dX�SS:XafUSSUSSS:aWU(a&[R"SUR'S	55 UR)UW
USR*UWSS9 U"U5nObU(aB[R"SUSSR'S	5USSR'S	55 UR-U5 U"U5nU(aGMU(aGM
UR15 SUlSUlU(a[R"S5 gg)z�Set new_inv as the current state.

This API is called by tree transform, and will usually occur with
existing parent trees.

:param new_inv: The inventory object to set current state from.
�evilr
z?set_state_from_inventory called; please mutate the tree instead�dirstatezset_state_from_inventory trace:c�:�[U5$![a gf=fr)r��
StopIteration)�iterators r�advance�2DirState.set_state_from_inventory.<locals>.advance�s#��
��H�~�%�� �
��
�s�

�
�rr�r�rIrNzAppending from new '%s'.T)r�r�r��fullscanzTruncating from old '%s/%s'.rzUpdating in-place change '%s'.zInserting from new '%s'.zDeleting from old '%s/%s'.z"set_state_from_inventory complete.)rrhr�mutter_callsiter%r8r�r�r\r�r�r�r
r�r�rCr�r�r�r�r�r�r��
lt_by_dirsr�r`ra)r�new_inv�tracing�new_iterator�old_iterator�current_new�current_oldr�r��new_dirname�new_basenamer�r��current_new_minikindr�s               rr��!DirState.set_state_from_inventorycs���U�&�&�&��!�!��T�
��� 1� 1�1����L�L�:�;��&�&�(��2�2�4���D��!3�!3�!5�6�7���<�(���<�(��	��[��{�1�~�a�0��3�|�C�%�l�3���� +�A�� 5� 5�f� =�
�,3�M�M�-�,H�)��$�Q��/�/��!,�F� C�
�'/�'A�'A�+�a�.�BU�BU�'V�$�'�4�/�"-�a�.�"C�"C�"J�s�K�#&�K���
����l��V�
���L�L�2�M�4H�4H��4P���#�#�!�(�*�1�~�8�8�+� +�!�
$��&�l�3�� ���L�L�6�#�A��q�)�0�0��8�#�A��q�)�0�0��8��
�!�!�+�.�%�l�3���a�.�0� ��N�1�%�a�(�K��N�,E�,E�E�"�1�~�a�(��+�/C�C�����<�)�0�0��8���'�'�#�A��,�#.�q�>�#<�#<�"/�$/�!%�
(��&�l�3��%�l�3���K�Q���):�;�;��1�~�a�0�0�!�!�"�%��A��q�r�(:�:���L�L�2�M�4H�4H��4P���#�#�!�(�*�1�~�8�8�+� +�!�
$��&�l�3����L�L�4�#�A��q�)�0�0��8�#�A��q�)�0�0��8��
�!�!�+�.�%�l�3��]�k�[�[�^	
�������"&�����L�L�=�>�rc���UR5 SS[R4SSSS[R4/4nSU/4S/4/nUR/U5 UR
U5 URX#5 g)zuWipe the currently stored state and set it to something new.

This is a hard-reset for the data we are working with.
rrFrFN)r�rrvrCr�rxr�r�)r�working_invr��
parent_ghosts�
empty_rootr{s      r�set_state_from_scratch�DirState.set_state_from_scratchs���	
�����#�y�(�(�)��C��E�8�#4�#4�
5�6�
�
�"%�z�l� 3�c�2�Y�?�����r�/�0��%�%�k�2����l�:rc	��[5nUSSSHhnUSS;aURUS5 M"USS:XdM-UR[[R"US55USS4-5 Mj USU;nU(a�URUS5nUR
USUS5upgU(d[SRU55eUSRU5 URbURURUS5 UH�nURU5up�U(d[SRU55eUR
X�RU	S5up�U(d[SRU55eURU	SU
SnUSSS	:Xa[S
RU55e[RUS'M� UR!5 U$)z�Mark current_old - an entry - as absent for tree 0.

:return: True if this was the last details entry for the entry key:
    that is, if the underlying block has had the entry removed, thus
    shrinking in length.
r
Nrr�rGrzcould not find entry for {}�could not find block for {}rDzbad row {!r})rmr�r�r
r�rmr�r�rzr�r`r�r�rYrCr:r�)rr�all_remaining_keys�details�last_referencer�r�r��
update_key�update_block_index�update_entry_index�update_tree_detailss            rr��DirState._make_absents��!�U��"�1�~�a�b�)�G��q�z��-�"�&�&�{�1�~�6����t�#�"�&�&��'�-�-���
�3�4��A��q�8I�7K�K��*�%�Q��/A�A����$�$�[��^�4�E�#'�#9�#9�+�a�.�%�PQ�(�#S� �K��$�%B�%I�%I�+�%V�W�W��!�H�L�L��%��~�~�)��*�*�4�>�>�;�q�>�J�
-�J�*.�*I�*I�*�*U�'���$�%B�%I�%I�*�%U�V�V�*.�*@�*@��O�O�,>�?��B�+�'���$�%B�%I�%I�*�%U�V�V�"&�/�/�2D�"E�a�"H�"�#��#��#�1�%�a�(�D�0�$�^�%:�%:�;N�%O�P�P�%-�%A�%A���"�-� 	
�����rc	�H	�URU5Sn	Uc[RnURX5up�X$XcU4nUR	5n
U(GdU(d�URUSSS-U	5up�U[U	5:azX�nUSSSUSS:XaUUSSSS;a@UR
SUSS-RS5USS	RUSS55 US-
nOOU[U	5:aMzU
RUSS
5nU(dX/UR5-4nGO�X/4n[U5H�nURU5unnU(d[SRU55eURUSnURUU5unnU(d[SRU55eUc[S
5eUUnSUSSS4USS'URUUU
5(dM�URX5up�M� UR!5nU(a[#U5Sn[%SUS-5H�nURW5unnU(d[SRU55eURUURUS5unnU(d[SRU55eURUSUSUnUSS;aUSR'U5 M�[(R*"USS6nUSR'SUSSS45 M� U	R-U
U5 UR/X�5 O�X�U
SS'Uc[S
5eU
RUSS
5nUU;a[SRUU55eUH�nUU:wdMURU5unnU(d[SU5eURUURUS5up�U(d[SU5eSUSSS4URUSU
SS'M� USS:XaU[(R*"USS6SS4n URU 5unnU(d!URR-UU S/45 UR15 g)a�Update an entry to the state in tree 0.

This will either create a new entry at 'key' or update an existing one.
It also makes sure that any other records which might mention this are
updated as well.

:param key: (dir, name, file_id) for the new entry
:param minikind: The type for the entry (b'f' == 'file', b'd' ==
        'directory'), etc.
:param executable: Should the executable bit be set?
:param fingerprint: Simple fingerprint for new entry: canonical-form
    sha1 for files, referenced revision id for subtrees, etc.
:param packed_stat: Packed stat value for new entry.
:param size: Size information for new entry
:param path_utf8: key[0] + '/' + key[1], just passed in to avoid doing
        extra computation.
:param fullscan: If True then a complete scan of the dirstate is being
    done and checking for duplicate rows should not be done. This
    should only be set by set_state_from_inventory and similar methods.

If packed_stat and fingerprint are not given, they're invalidated in
the entry.
r
Nrr)rr�r�r�z7Attempt to add item at path already occupied by id {!r}r$rz1update_minimal: could not find other entry for {}zno pathrGFrz+update_minimal: could not find entry for {}z`We found the entry in the blocks, but the key is not in the id_index. key: {}, existing_keys: {}znot present: %rrF)rmrCr�r�r�r�r�r�rzr�r�r�r�r�rY�_maybe_remove_rowrgr\r�r�r
r�r�r�r�)!rrUr�r�r�r�r�r�r�r�r�r�r�r��	low_indexr�r
�
existing_keysr��	other_key�other_block_index�other_block�other_entry_index�other_entryrjr�rr�update_details�pointer_pathr�r��
subdir_keys!                                 rr��DirState.update_minimalNsH��D� � ��%�a�(����"�+�+�K� $�5�5�c�A����d��L���%�%�'����#�5�5�c�!�A�h��6G��O��	��#�e�*�,�!�,�E��Q�x��!�}��A�a��0� ��8�A�;�q�>��=�!�/�/�!)�C��!�H�!4� <� <�V� D� #�A��!*�*0�&��q��!��*=�	�"�Q��	�� �#�e�*�,�"%�L�L��Q���4�M� ����1H�1H�1J�!J�J�	�
 ��.�	�!&�}�!5�I�26�1P�1P�!�2�.�%�w�#�,�9�@�@��K���#'�/�/�2C�"D�Q�"G�K�15�1G�1G�!�;�2�.�%�w�#�,�O�V�V� )����
!�(�,�Y�7�7�#.�.?�"@�K�)-�y�!�U�C�(H�K��N�1�%��-�-�k�;L�h�W�W�*.�)?�)?��)K���Q�G"6�R'+�&?�&?�&A�#�&�!%�]� 3�A� 6�I�$)�!�-@�1�-D�$E�L�
37�2Q�2Q�!�3�/�&��#�,�9�@�@��K���37�2H�2H�!�4�?�?�3E�#F�q�#I�3�/�&��#�,�I�P�P� )����
&*�_�_�5G�%H��%K�*�&��&�%�&'�N�&�a�(�L�8�"�!��+�+�N�;�(/�'7�'7��1�Q��'H��!�!��+�+�T�<��E�3�,O�P�?%F�@
�L�L��i�0��!�!�(�0�(3�+��q�!�!�$�� �$�Y�/�/�$�L�L��Q���4�M��-�'�$�2�28�&��m�2L���
+�	���#�
,0�+J�+J�9�+U�(�K��"�,�->�	�J�J�+/�+A�+A�!�4�?�?�;�#?��#B�,�(�K�#�,�->�	�J�J��!����J�D�O�O�K�0��3�K�@��C�A�F�#+�2�q�>�T�!�!�*�*�C��!�H�5�s�C�@�J�#'�#B�#B�:�#N� �K������&�&�{�Z��]�B�4G�H����rc��SnXnUSHnUSS;dMSn O U(d&URU5 URX5S5 gg)z�Remove index if it is absent or relocated across the row.

id_index is updated accordingly.
:return: True if we removed the row, False otherwise
Fr
rr�T)r�r�)rr�rr��present_in_rowr
�columns       rr�DirState._maybe_remove_row
s[��������A�h�F��a�y��,�!%������I�I�e���&�&�x�q��:��rc
��^^^^�SSKJn TR5 [TR5S:�a4TRSSS:Xd[SU"TR5-5e[TR5S:�a4TRSSS:Xd[SU"TR5-5eTRSSVs/sHo"SR
S5PM nnU[U5:wa*[S	U"TR5-S
-U"U5-5eTRHxnUSH3mUSTSS:wdM[SRTU"U555e US[US5:wdMV[SRUSU"U555e UUUU4S
jnTR5S-n[U5Vs/sHn0PM nnTR5GHlmTSSn	[R"TSSTSS5m[TS5U:wa[SU"T5SU35eSn
[TS5H�umnUTnUSn
U
S;aU
S-
n
X�;a�X�up�U
S:Xa0Ub+[SRU	RS5TU55eM\U
S:Xa)USnUU:wa[SRU	TU55eM�UT:wa[SRTX�55eU"5 M�U
S:XaST4X�'M�U
S:XaUST4X�'M�TT4X�'U"5 M� X�:XdGMU[SRT55e TR b�TR R#5H�un	nUH�nUSU	:wa[SRU	U55eTR%U5unnU(d[SU5eTR'UTRUS5unnU(aM|[SU5e [U5[[)U55:wdM�[SRU55e ggs snfs snf)z�Check that invariants on the dirblock are correct.

This can be useful in debugging; it shouldn't be necessary in
normal code.

This must be called with a lock held.
r)�pformatrz'dirblocks don't start with root block:
r
z"dirblocks missing root directory:
Nr�z#dir names are not in sorted order:
z
keys:
z6entry key for {!r}doesn't match directory name in
{!r}z#dirblock for {!r} is not sorted:
{}c��>�TSSSS:XagTRTTSSS9nUS:Xa[SRTT55eUSTSS	:wa[S
RTU55eg)z�Check that the current entry has a valid parent.

This makes sure that the parent has a record,
and that the parent isn't marked as "absent" in the
current tree. (It is invalid to have a non-absent file in an absent
directory.)
rrrGNr�r�z"no parent entry for: {} in tree {}r
rFz:Parent entry for {} is not marked as a valid directory. {})r�r�rz)�parent_entryr
r�	this_pathr�s ����r�check_valid_parent�.DirState._validate.<locals>.check_valid_parentm
s�����Q�x��!�}�
�*���?�?�:��q��!��?�M�L��|�+�$�8�?�?�	�:�V����A��z�*�1�-��5�$�P�W�W�!�$����6rrz&wrong number of entry details for row
z,
expected r�rDz6file {} is absent in row {!r} but also present at {!r}r�rGz/file {} relocation in row {!r} but also at {!r}z<entry {!r} inconsistent with previous path {!r} seen at {!r}z$entry {!r} has no data for any tree.z'file_id {!r} did not match entry key {}zmissing block for entry key: %rzmissing entry for key: %rz)id_index contained non-unique data for {})�pprintr*r8r�rYr�r�rrzrgr�r�r
r�r/r�r`r�r�r�rm)rr*r��	dir_names�dirblockr.rhr��id_path_mapsr��absent_positions�
tree_state�
this_tree_mapr��
previous_path�previous_loc�target_locationr�r�r�r�r�r
r-r�s`                     @@@r�	_validate�DirState._validate1
s����&	#��&�&�(��t����!�#��?�?�1�%�a�(�C�/�$�>��d�o�o�.�/����t����!�#��?�?�1�%�a�(�C�/�$�9�G�D�O�O�<T�T���04���q�r�/B�C�/B�!�q�T�Z�Z��%�/B�	�C���y�)�)� �6��$�/�/�*�+����)�$�%��
����H�"�!����A�;�%��(�1�+�-�(�@�@F��!�7�8�#4�A���%���{�f�X�a�[�1�1�$�:�A�A� ���W�X�%6����(�$	�	�@�.�.�0�1�4�
�$)�*�$5�6�$5�q��$5��6��'�'�)�E��A�h�q�k�G��(�(��q��!��e�A�h�q�k�B�I��5��8�}�
�*�$�=�g�e�n�=M�"�:�,�0��� !��*3�E�!�H�*=�&�
�J� ,�Z� 8�
�%�a�=���|�+�$��)�$��+�2?�2H�/�M� �4�'�(�4�"0�!*�*0�&�$+�N�N�7�$;�U�M�+"�#��5�"�T�)�*4�Q�-��(�O�;�"0� Q� X� X�$+�U�M�!"�#��<�)�I�5�"0�!/�/5�v�$)�=�0"�#��+�,��4�'�15�y��
�.�!�T�)�1;�A��	�1I�
�.�1:�I�1E�
�.�*�,�]+>�^ �-�$�:�A�A�%�H���s*�x�>�>�%�'+�~�~�';�';�'=�#���!+�I�!��|�w�.�,�E�L�L� '�����,0�+J�+J�9�+U�(�K��"�,�=�y���,0�+A�+A�!�4�?�?�;�#?��#B�,�(�K��#�7�,�-H�)�T�T�)",�*�z�?�c�#�j�/�&:�:�(�C�J�J�:�V���/(>�&��sD��v7s�Q�Qc���[RUl[RUlSUl/Ul/Ul/UlSUlSUl	SUl
SUl0Ulg)z0Forget all state information about the dirstate.FN)
rCrUrVrWrXr[rZrYr`rarbrcrdr|s r�_wipe_state�DirState._wipe_state�
sb��%�3�3���'�5�5��� %�����
����������"&���"��� ���!#��rc�J�URb [R"UR5e[R"UR
5UlSUlURRUlUR5 [R"UR5$)z$Acquire a read lock on the dirstate.�r)r^r�LockContentionr	�ReadLockr]r_r�r\r=�LogicalLockResultr�r|s rr}�DirState.lock_read�
sy�����'��'�'��(8�(8�9�9�
 �=�=����8�������+�+�-�-��������%�%�d�k�k�2�2rc�`�URb [R"UR5e[R"UR
5UlSUlURRUlUR5 [R"URUR5$)z%Acquire a write lock on the dirstate.r�)r^rrAr	�	WriteLockr]r_r�r\r=rCr�r|s rrw�DirState.lock_writes������'��'�'��(8�(8�9�9�
 �>�>�$�.�.�9�������+�+�-�-��������%�%�d�k�k�4�3C�3C�D�Drc��URc[R"U5eSUlSUlURR5 SUl0Ulg)z$Drop any locks held on the dirstate.N)r^r�LockNotHeldr\r_r�rdr|s rr��DirState.unlocksS�����#��$�$�T�*�*�
 �����������!����!#��rc�R�UR(d[R"U5eg)z?Check that a lock is currently held by someone on the dirstate.N)r^rr�r|s rr��DirState._requires_lock s!������(�(��.�.� r)rfrXrrrcrWrYrbr]rZrVr`rnrkrlr_r^r�rar[rjrgrdr\rsror�rp�NF)Fr)NNF)NrT)FrNrNF)jrrr r!r2r�r�r��S_IFDIR�S_IFREG�S_IFLNKrr^rerUr�r�r�r�r:�HEADER_FORMAT_2r�rr}r�r�r�rrr(r=r�r�rMrHrWrdr�rmr�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�rrr"rir+r6r9rAr=r<r>r�r7r�r��classmethodryr�r�r�r�r�r�r?r�rgr�r8r�r�r�r�r�ryr�r�rxr�r�r�r�rr�r�rr:r=r}rwr�r�r#r$rrrCrC#s���
� ������
��������
��	
���d����d����d���
�D�)�I����M��������H�4��9�O�9�O�RV�<@�|J�=�6)�Z=�x{�zq�f;�z)2�VY�%�N2�:;�*�"(�&&�,�,$�B$�2����<�8]�~'�RT�d�L�0>�NG�`
&�T�l�2:K�-�<!�!�1�"��$�

-�@�B�>�e-�N#�
#5�LMR�S�j�%��%�N� D�� D�D&7�P$��>�$	.�� 
�6���� $����:	"�6�( �N�*O�'�16�l9�
�,'�$�4\"�|,�0^?�@;�&6�x���
���O�b�$u�n$�3�E�$�/rrCc	�j�XCRS-n[U5nUSSunnn	n
n[U[5(d[U5eUS:XaUS:XaSnXW:XaXk:XaUS:XagX�R:XaU$SnSn
US:Xa�URURU
5nURcUR5 URUR:aeURUR:aK[US5S:�a9USSSS	:wa*URU5nSUURUU4USS'GOLSS
URU[R4USS'Sn
GO#US:XaqSnSS
SSU4USS'US:waYUR!USSUSSS5unnnnUR#UU[$R&"USSUSS55 O�Sn
O�US:Xa�US:XaSn
UR)X(5nURcUR5 URUR:a1URUR:aSX�RSU4USS'O%SS
URS[R4USS'U
(aUR+U/5 U$![a gf=f)
aUpdate the entry based on what is actually on disk.

This function only calculates the sha if it needs to - if the entry is
uncachable, or clearly different to the first parent's entry, no sha
is calculated, and None is returned.

:param state: The dirstate this entry is in.
:param entry: This is the dirblock entry for the file in question.
:param abspath: The path on disk for this file.
:param stat_value: The stat value done on the path.
:return: None, or The sha1 hexdigest of the file (40 bytes) or link
    target of a symlink.
rNr
rrFrITrErDrFrH)rrr�r�r��	TypeErrorr�r+rcrrrr�rjrCr�r�r�r
r�r6r�)rr
r,rrr�r��saved_minikind�saved_link_or_sha1�saved_file_size�saved_executable�saved_packed_stat�link_or_sha1�worth_savingr�r�r�rrs                   r�py_update_entryr]&s��� �$�%7�%7�(�%B�C���J�'�K�	�a����
�������n�e�,�,���'�'��4��N�d�2����!�k�&F��t����0�0�0�%�%��L��L��4���)�)�*�*<�*<�>N�O�
����%��"�"�$����%�"4�"4�4��#�#�e�&8�&8�8��E�!�H�
��!��a����A��$�&�!�+�+�G�4�L����"�"����E�!�H�Q�K� ��j�&8�&8�*�h�FW�FW�X�E�!�H�Q�K� �L�	�T�	����S�!�U�K�8��a�����T�!�
�,�,�U�1�X�a�[�%��(�1�+�q�I�
@�K��k�<�
����[�'�*:�*:�5��8�A�;��a��QR��*T�
�!�L�	�T�	��T�!� �L��'�'��D�����%��"�"�$����%�"4�"4�4��#�#�e�&8�&8�8���/A�/A�5�+�V�E�!�H�Q�K���j�&8�&8�%��AR�AR�S�E�!�H�Q�K��
���e�W�%����o����s�J%�%
J2�1J2c�`�\rSrSr/SQrSr\R4SjrSr	Sr
SrSrS	r
S
rg)�ProcessEntryPythoni�)�include_unchanged�last_source_parent�last_target_parent�new_dirname_to_file_id�old_dirname_to_file_id�partial�search_specific_file_parents�search_specific_files�searched_exact_paths�searched_specific_files�seen_ids�source_indexr�target_indexr�rw�utf8_decode�want_unversionedc	��0Ul0UlUS1:gUlSS/UlSS/UlXlX l[RUl	[5Ul[5UlX0l
[5Ul[5UlX@lXPlX`lUS:wa[&R("S5eXplX�lg)Nr�rzunsupported target index)rdrcrerarbr`rw�codecs�utf_8_decodermrmrirhrgrfrjrrkrlrrrnr�)	rr`rwrgrrkrlrnr�s	         rr�ProcessEntryPython.__init__�s���')��#�&(��#�,���4���$(��,���#'��,���!2��'>�$�!�.�.���
(+�u��$�%(�E��!�%:�"�-0�E��)����
��
�(��(���1���/�/�"<�=�=� 0���	rc��URc[RnOUSURn1Skn1SknSnUSURnUSn	UbRX�;aMURS:Xd
[	5e[URXSUSS	9n
USURnUSn	OSn
USS
nUSnX�;GaSX�;GaMUS:XGa[R"URUS5(dURRUS5 USn
[RRU
5up�U"USSUSS5nURRURU
S9nUS
:Xa=[!URR"SR%USSUSSX�55eUSURnUSnOUSSnUSSnS=n
nUcSnSnSnGO'US
nUS:Xa)Uc
U"X�5=n
nX�R&U'US:waSnOSnSnO�US:Xa�US:waSnOQU
cGURR(R+US5unn
URR-XU5 X�S:gnUR.(a*[1[2R4USR6-5nOXUSnORUS:XaUS:waSnOX�S:gnSnO9US:XaUS:waSnOSnSnO%UcU"X�5n[8R:"UUS
5eUS:XaUc
U"X�5=n
nX�R<U
'U(a"X�R>S:XaUR>SnO<UR<UnUUSS
:XaSnOX�R>S'UUR>S'USSnUSS(a#UURBS:XaURBSnO=UR&UnUUSS
:XaSnOUURBS'UURBS'USnU=(d" UU:g=(d X�SS:g=(d UU:gnU(dURD(dgU
c"U"X�5=n
nURGU
S5SnUnO3URGU
S5SnU
U:XaUnOURGUS5Sn[RHUn[KUSS
UU4USUU4URGUS5SURGUSSS5S4UU4UU45U4$US;GaeX�;Ga_U"USSUSS5nURRURUSSS9SS
n U USS
:XaSn Ub�UR.(aT[1[2RL"USR65=(a  [2R4USR6-5nOUSn[KUSS
SURGUS5S4SSSU 4SURGUSSS5S4SUS
4SU45S4$[KUSS
SURGUS5S4SSSU 4SURGUSSS5S4S
S5S4$X�;a�U	S;a�U"USSUSS5n
URRURUSSS9SS
n U USS
:XaSn [KUSS
URGU
S5SS4SS U S4URGUSSS5SS4[RHUS4USS45S4$X�;aNU	S;aH[R"URUS5(dURRUS5 g
X�;aX�;ag
[	S!R%X�55e![@a0 URRURUS9nUSS
nGN�f=f![@aH URRURUS9nUS
:Xa[	SUSU35SeUSS
nGNff=f)"aCCompare an entry and real disk to generate delta information.

:param path_info: top_relpath, basename, kind, lstat, abspath for
    the path of entry. If None, then the path is considered absent in
    the target (Perhaps we should pass in a concrete entry for this ?)
    Basename is returned as a utf8 string because we expect this
    tuple will be ignored, and don't want to take the time to
    decode.
:return: (iter_changes_result, changed). If the entry has not been
    handled then changed is None. Otherwise it is False if no content
    or metadata changes have occurred, and True if any content or
    metadata change has occurred. If self.include_unchanged is True then
    if changed is not None, iter_changes_result will always be a result
    tuple. Otherwise, iter_changes_result is None unless changed is
    True.
Nr
>rFrErHrGrIrqr-rr�r)r,rrrGr�r�zQentry '{}/{}' is considered renamed from {!r} but source does not exist
entry: {}TFrLrFrKrErNrHrOrIz$Could not find target parent in wt: z
parent of: rM�surrogateescape)TTrD)FTrRzDdon't know how to compare source_minikind={!r}, target_minikind={!r})'rkrCr:rlr��update_entryrr
�
is_inside_anyrirgr�r;rtr�r�rr]rzrcrgr/rrwr(r�rrr�BadFileKindErrorrdrarrbr`rmr�r�S_ISREG)!rr
�	path_infor��source_details�_fdltr�_fdlt�_ra�target_details�target_minikindr[r��source_minikindr��old_dirname�old_basenamert�	old_entry�content_change�target_kind�target_execr@�source_parent_id�source_parent_entryr�target_parent_id�target_parent_entry�source_exec�changed�
old_path_u�path_u�source_kindr�s!                                 r�_process_entry�!ProcessEntryPython._process_entry�s 
��"���$�%�9�9�N�"�1�X�d�&7�&7�8�N�/��(�����q��$�"3�"3�4��(��+��� �_�%=��%�%��*�$�&�&�'��
�
�E�Q�<�I�a�L��L�#�1�X�d�&7�&7�8�N�,�Q�/�O��L���(�1�+��(��+���$��)A��$�&��,�,��0�0�.��2C����.�.�2�2�>�!�3D�E�*�!�,��,.�G�G�M�M�(�,C�)����a����U�1�X�a�[�9�� �J�J�1�1�$�2C�2C�x�1�X�	���,�)��
�
�,�,�$�$*�F�5��8�A�;��a����X�$U�	��"+�1��d�.?�.?�!@��"0��"3��#�A�h�q�k��$�Q�x��{��"&�&��4�� �!%��"��#��(��l���+�-��|�*2�;�*M�M��4�8?�/�/��5�&�$�.�)-��*/��"'�K� �F�*�&�$�.�)-��
(�/�!%�
�
� 9� 9� G� G�	�RS�� U�4�I�|�!�J�J�5�5�e�9�U�)5��9J�)J���3�3�'+�4�<�<�)�A�,�:N�:N�+N�&O��&4�Q�&7�� �I�-�&�$�.�)-��)5��9J�)J��"'�K� �$4�4�&�$�.�)-��).��"'�K��|�'��B�� �1�1�$�	�!��E�E��$�&��<�&.�{�&I�I�H�t�8?�+�+�H�5���/F�/F�q�/I� I�#'�#:�#:�1�#=� �A�'+�'B�'B�;�'O�$�$�u�Q�x��{�2�'+�$�1<�+�+�A�.�1A�D�+�+�A�.���(�1�+�K��Q�x��{�{�d�.E�.E�a�.H�H�#'�#:�#:�1�#=� �A�'+�'B�'B�;�'O�$�$�u�Q�x��{�2�'+�$�1<�D�+�+�A�.�1A�D�+�+�A�.�(��+�K��.�#�'7�7�.���8�A�;�.�.��+�-�	
��4�#9�#9�"��#�&.�{�&I�I�H�t�!%�!1�!1�(�<M�!N�q�!Q�J�'�F�!%�!1�!1�(�<M�!N�q�!Q�J��4�'�!+��!%�!1�!1�$�8I�!J�1�!M��&�8�8��I��*��!�H�Q�K���(�"� �%�'7�8��(�(��7H�I�!�L��(�(��q��!��6G�H��K��!�+�.� �+�.�������
$��)A��E�!�H�Q�K��q��!��5�D��
�
�-�-�d�.?�.?�5�QR�8�TU�;�-�W�����I��E�!�H�Q�K�'� �	��$��/�/�#'����Y�q�\�%9�%9�:�@� �L�L�9�Q�<�+?�+?�?�#�K�
#1��"3�K�*��!�H�Q�K��4�+�+�D�2C�D�Q�G�H��!��9�%��4�+�+�E�!�H�Q�K�9J�K�A�N�O��9�Q�<�(��;�'�	��	�	�+��!�H�Q�K��4�+�+�D�2C�D�Q�G�H��!��9�%��4�+�+�E�!�H�Q�K�9J�K�A�N�O� �!�	��	�	��
%�/�T�*A�
 ��a����U�1�X�a�[�9�H��
�
�-�-�d�.?�.?�5�QR�8�TU�;�-�W�����I��E�!�H�Q�K�'� �	�&��a�����!�!�(�,=�>�q�A�4�H����D�!��!�!�%��(�1�+�/@�A�!�D�d�K��+�+�O�<�d�C���"�D�)�	��	�	
��
%�/�T�*A�
�(�(��,�,�n�Q�.?����*�*�.�.�~�a�/@�A���
#��(>�
��
!�=�=C�V�#�>��
��k �A�*.�*�*�*?�*?��)�)�[�+@�+�'�(;�1�'=�a�'@�$�	A��" �
A�+/�*�*�*?�*?��)�)�[�+@�+�'�+�l�:�,�B�;�-�}�]b�\c�d��#�$�(;�1�'=�a�'@�$�
A�s%�^6�_3�66_0�/_0�3Aa�ac��U$rr$r|s r�__iter__�ProcessEntryPython.__iter__�s���rc�d�UR(aUR(dgURRUR5 URSnU(aRUR
R
S[R"U555 UR
RS5 gg)z�Check a result we will yield to make sure we are consistent later.

This gathers result's parents into a set to output later.

:param result: A result tuple.
Nr
c3�F# �UHnURSS5v� M g7f)r�rtN)r�)�.0�ps  r�	<genexpr>�DProcessEntryPython._gather_result_for_consistency.<locals>.<genexpr>
s&���5�=�A�����!2�3�3�=�s�!r)	rer�rjr�rtrfr�r
�parent_directories)rrVr�s   r�_gather_result_for_consistency�1ProcessEntryPython._gather_result_for_consistencys����|�|�6�>�>���
�
���&�.�.�)��;�;�q�>����-�-�4�4�5� �3�3�H�=�5�
�
�-�-�1�1�#�6�rc#�8# �[Rn[nURnURnUR
n[RnU(G	a'UR5nURS5nURU5 URRU5n	URRU5n
[R "U
5nSU[R""UR$5UU
4nUSS:Xa=URR'URS55(aUSSS-USS-nU	(d
U(dGMSnU	HKnU"X�5unnUcMS	nU(aUR/U5 U(dUR0(dMGUv� MM UR2(a�U(d�U(a{[5[6R8"USR$5=(a  [6R:USR$-5n[=SSU4S	S
SSU"U5S4SUS4SU45v� USS4nURR?U5unnUS
:XaUS-
nU(aUSS:XaSnOe[R@"X�S9n[CU5nUS
S
S:Xa9[DRF"USS5nUSUS
S:wa
[I5eUSU	U[YURRZ5:aO[R\"XpRRZUS
5(aURRZUnOSnUcUGbU(Ga=U(Ga5US
S
US
:wGa%U"US
S
US
5(Ga>S
nU[YUS5:GaUSUnUR2(a�USS:Xa@URR'US
RS55(aUSSS-USS-n[5[6R8"USR$5=(a  [6R:USR$-5n[=SSU"US
S5S
4S	S
SSU"USS5S
4SUS4SU45v� USS;aUSU	US-nUS-
nU[YUS5:aGM[CW5nO�USHJnU"US5unnUcMU(aUR/U5 U(dUR0(dMFUv� ML US-
nU[YURRZ5:aO[R\"XpRRZUS
5(aURRZUnOSnGMLS
nU(aU[YUS5:a	USUnOSnS	n S
nU(adU[YUS5:aRUSUnUSS:Xa@URR'US
RS55(aUSSS-USS-nOSnS	n!SnUcUGb�UcGOUcDU"UU5unnUb4U(aUR/U5 U(dUR0(aUv� O�US
SUS:wdUSUR`S
S;aXUSUS
S:aSn O�U"US5unnUb4U(aUR/U5 U(dUR0(aUv� Sn!OEU"UU5unnUb6S	nU(aUR/U5 U(dUR0(aUv� U (a&Ub#US-
nU[YUS5:a	USUnOSnOS	n U!(Ga@UGb<U(d�UR2(a�[5[6R8"USR$5=(a  [6R:USR$-5nU"US
S5S
n"[=SSU"4S	S
SSU"USS5S
4SUS4SU45v� USS;aUSU	US-nUSS:XaUSU	US-nUS-
nU[YUS5:aRUSUnUSS:Xa@URR'US
RS55(aUSSS-USS-nOSnSnOS	n!UbGM�UbGM�UbyUS-
nU[YURRZ5:aO[R\"XpRRZUS
5(aURRZUnOSnUb[CW5nUbGMUbGMU(aG	M'URc5HnUv� M	 g![(a,n
U
R*[*R,:XaSnSn
A
GN�eSn
A
ff=f![(a�n
[KU
SS5n[L[N4nU
R*[*R,[*RP[*RR4;aSnSn
A
GNV[TRVS:XaU
R*U;dUU;aSnSn
A
GN�eSn
A
ff=f![^a SnGN�f=f![^a SnGN0f=f7f)zIterate over the changes.r�rrrLN�rOrFT)FFr�r�rr
rO)�prefix)�.bzrr��winerror�win32rt)rLrOr�)2rprqr�r�rgrir
�	splitpathr�r�r�rrWr�r,r;r!�file_kind_from_stat_moder�_directory_is_tree_reference�OSError�errno�ENOENTr�r`rnr(r�rxrrr��_walkdirs_utf8r�rrr��getattr�ERROR_DIRECTORY�ERROR_PATH_NOT_FOUND�ENOTDIR�EINVALr1�platformr�rY�	is_insider�rl�_iter_specific_file_parents)#rrm�_lt_by_dirsr�rgrir��current_root�current_root_unicode�root_entries�root_abspath�	root_stat�
root_dir_infor��path_handledr
rVr��new_executable�initial_keyr�r��current_dir_info�dir_iterator�	bzr_index�
e_winerror�
win_errorsrJ�
path_index�current_path_info�
current_entryr��
advance_entry�advance_path�relpath_unicodes#                                   r�iter_changes�ProcessEntryPython.iter_changess�����)�)�� ���,�,�� $� :� :��"&�">�">���%�%�	�N$�1�4�4�6�L�#/�#6�#6�v�#>� �#�'�'��5� �:�:�7�7��E�L��9�9�,�,�-A�B�L�
��H�H�\�2�	�� ��4�4�Y�5F�5F�G�� �!�
�!��#�{�2��y�y�=�=�$�+�+�F�3���*�"�1�-�0C�C�m�TU�TV�FW�W�&� �
�� �L�%��"0��"F�����&�#'�L���;�;�F�C��$�"8�"8�"8�$��&��$�$�\�m�!%��L�L��q�!1�!9�!9�:�@����}�Q�'7�'?�'?�?�"��*���/�0��"� ��9�%9�:�2�>�?��=��+�,��>�*�	�	�(��c�2�K�!�Z�Z�B�B�;�O�N�K���a���q� ����q�!1�5E�!E�#'� �&�5�5�l�X��;�'+�L�'9�$�&(��*�1�-��4�$*�$6�$6�7G��7J�J�$W�	�+�A�.�y�9�!�<��G�"0�"2�2�,�Q�/�	�:��S����!6�!6�7�7�G�<M�<M��j�j�3�3�K�@��C�=�=�!%�
�
� 5� 5�k� B�
� $�
�"�.�-�2K�$�%�(��+�A�.�-��2B�B�"�#3�A�#6�q�#9�=��;K�L�L�&'�
�(�3�/?��/B�+C�C�0@��0C�J�0O�-�#�4�4�#4�Q�#7�;�#F�'+�y�y�'M�'M�(9�!�(<�(C�(C�F�(K�(&�(&�->�b�q�,A�.A�-B�.?���.C�-D�):�
26�$(�L�L�1B�1�1E�1M�1M�$N�%T�(,���7H��7K�7S�7S�(S�2"��':�$(�(,�(3�,=�a�,@�BS�)*�*+�)-�%&�%)�$2�$0�(,�(3�,=�a�,@�BS�)*�*+�)-�%&�&*�+<�Q�+?�$@�%)�>�$:�%'"�!"�, 1��3�7V�V�$4�Q�$7�
�$C� *�a��
�&�!�O�J�S)�3�/?��/B�+C�C�X4�/3�L�/A�,�.;�1�-=�M�/=�]�D�.Q�O�F�G�&�2�#*�$(�$G�$G��$O�#*�d�.D�.D�.D�*0�L�.>�$�q�(��&�� �J�J�1�1�*��%�/�/�(�*�*�*?�*?��*L�Q�*O���-1�J�J�,A�,A�+�,N�M�,0�M���� �[�3�}�Q�7G�3H�%H�$1�!�$4�[�$A�M�$(�M� $�
��
�#�
�S�9I�!�9L�5M�(M�(8��(;�J�(G�%�(��+�{�:��9�9�A�A�-�a�0�7�7��?���!2�"�1� 5�"5�!6�"3�A�B�"7�!8�.��)-�%�#��$��#�/�3D�3P�$�,��*�2�*8�)�+<�+����#�.�&� $� C� C�F� K�&�$�*@�*@�&,���&�q�)�!�,�0A�!�0D�D�
��I��'�'�I)�)*�I,�/;�I<�-�Q�/�-��2B�1�2E�E�-2�M�/=�]�D�.Q�O�F�G�&�2�#*�$(�$G�$G��$O�#*�d�.D�.D�*0�L�+0�L�*8�)�+<�+����#�.�+/�L�&� $� C� C�F� K�&�$�*@�*@�&,��$��)B�#�q�(��&��]�1�-=�)>�>�,9�!�,<�[�,I�M�,0�M�(,�
�#�(9�(E�+�#�4�4�15�$(�L�L�1B�1�1E�1M�1M�$N�%T�(,���7H��7K�7S�7S�(S�2"��3>�$5�a�$8�:K�3"�"#�3%��':�$(�%)�?�$;�$(�$2�$0�(,�(3�,=�a�,@�BS�)*�*+�)-�%&�&*�+<�Q�+?�$@�%)�>�$:�'"�!"�" 1��3��D�$4�Q�$7�
�$C� *�a��
�-�Q�/�3C�C� 0�� 3�J� ?�&�!�O�J�"�a��
�%��,<�Q�,?�(@�@�0@��0C�J�0O�-�0��3�{�B�#'�9�9�#I�#I�$5�a�$8�$?�$?��$G�$"�$"�):�"�1�(=�*=�)>�*;�A�B�*?�)@�%6��15�-�',��'+��]$�/�3D�3P�^!�,��1�$�K�"�S����)>�)>�%?�?�G�DU�DU�$�j�j�&;�&;�K�&H��&K�E�E�)-�
�
�(=�(=�k�(J�
�(,�
�#�/�0�+/��+=�(�W#�.�-�2K�U$�#�p
�6�6�8�F��L�9��Y
�
��7�7�e�l�l�*�$(�M���

��|��")��J��!=�J�"1�3G�!H�J��w�w�5�<�<�������"M�M�+/�(�����0����:�-��z�1I�+/�(���!��~ -�4�/3�,�4��Z)�0�+/�(�0�s��B;j�>f�Bj�'0j�C7j�g�H&j�i4�j�-.j�N3j�j�A?j�j�&j�,j�2j�<j�
g�" g	�j�g	�	g�j�
i1�Ai,�3j�9,i,�%j�+i,�,i1�1j�4j�j�j�j�j�j�j�jc	#�# �UR(GalURR5n[R"URU5(aMTXR
;aMeURRU5n/nSnUH�nUSURSS;aSnURU5 M1URcM@USURSS;dM[SnUSURSS:XaURU5 M�URRUSURS5 M� U(d[SRX55eURXRS	55nUGH�nUSS
UR ;aMUR#Xv5up�U	c[SRXU55eU	(GaQUR%U5 UR&SS:XGa,UR&SS:wGaUSURSS
:XaUSURSn
OUn
U
SS4nURR)U5up�US:XaUS-
nSnU[+URR,5:a9URR,Un[R."X�S5(dSnUbYUSHPnUSURSS;aMURR[R0"USSS
65 MR U	(dUR2(dGM�Uv� GM� UR
RU5 UR(aGMkgg7f)z$Iter over the specific file parents.Fr
rr�TNrDz1Missing entry for specific path parent {!r}, {!r}r�rzKGot entry<->path mismatch for specific path {!r} entry {!r} path_info {!r} rLrGr)rfr�r
rvrirhrrWrlr�rkr�r�rz�
_path_infor�rjr�r�r�r�r�rYr�r�r`)rr��path_entries�selected_entries�
found_item�candidate_entryryr
rVr��entry_path_utf8r�r�r�rJs               rr��.ProcessEntryPython._iter_specific_file_parents�sh����/�/�/��9�9�=�=�?�I��$�$�T�%A�%A�9�M�M���5�5�5���:�:�7�7�	�B�L�
 "���J�#/��"�1�%�d�&7�&7�8��;�<�O�!%�J�$�+�+�O�<��&�&�2��q�7I��%�%�8��8�(�8)�"&�J�&�q�)�$�*;�*;�<�Q�?�4�G�(�/�/��@��9�9�=�=�+�A�.�t�/@�/@�A�!�D��!$0�&�$�G�N�N�!����
���	�3C�3C�F�3K�L�I�)����8�A�;�$�-�-�/��"&�"5�"5�e�"G����?�(�:�:@�&�%�i�;�����7�7��?��{�{�1�~��4����Q��;�9V�!��8�D�$5�$5�6�q�9�T�A�.3�A�h�t�7H�7H�.I�!�.L�O�.7�O�'6��S�&A��)-���)N�)N�'�*���'�!�+�'�1�,�K�(,�
�&��T�Z�Z�-B�-B�)C�C�,0�J�J�,A�,A�+�,N�M�#*�#4�#4�_�TU�FV�#W�#W�04�
�(�4�)6�q�)9��#(��8�D�,=�,=�#>�q�#A�\�#Q�%-�!%� A� A� E� E�$+�$4�$4�e�A�h�r��l�$C�!"�*:��d�4�4�4� �L�a*�b
�%�%�)�)�)�4�{�/�/�/�s�CN�	N�$IN�5N�Nc���URRU5n[R"U5nURSS5SnUU[R"UR5UU4nUSS:XaGURRU5(a'URSSS-URSS-UlU$![a)nUR
[
R:XaSnAgeSnAff=f)	zjGenerate path_info for unicode_path.

:return: None if unicode_path does not exist, or a path_info tuple.
Nr�r
r�rrLr�r)
r�r,r;r!r�r�r��rsplitr
r�rr�r�)r�	utf8_path�unicode_pathr,r�r��
utf8_basename�dir_infos        rr��ProcessEntryPython._path_info�s���
�)�)�#�#�L�1��	��8�8�G�$�D�"�(�(��q�1�"�5�
����,�,�T�\�\�:���
���A�;�+�%��y�y�5�5�l�C�C��&�&�r��*�)�*��(�(���,�-��"�
���+�	��w�w�%�,�,�&����	�s�B?�?
C2�	C-�,C-�-C2)r`rarbrcrdrer�rfrgrhrirjrkrrlr�rwrmrnN)rrr r!�	__slots__rr
r�r�r�r�r�r�r�r#r$rrr_r_�s?���I�*+�Z9@�8H�8H�f�P	�7�*G�R_5�Brr_)�
ProcessEntryC)r�r�r�rsr�r�)ru)0r2rrprzr�r�r;r�r1rr�rr�rrrrr	r
rrr�
inventorytreerr�r�rrr&r4rCrr]r_�_dirstate_helpers_pyxr�r�r�r�r�rsr�r�ru�ImportErrorr��failed_to_load_extension�_dirstate_helpers_pyr$rr�<module>r�s���"J�X�
����	��
����P�P�P��.�
�����f�o�o��6�6�.�,��@4/�@4/�Hh:B�9S�9S�i�XJ�J�\(�F���D���(��$�$�Q�'���#�L�'�N��!(�s�$C�C7�&C2�2C7

Youez - 2016 - github.com/yon3zu
LinuXploit