§
    cÌc8= ã                   óî  — d Z ddlZddlZddlZddlZddlZddlZddlmZ ddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZmZmZmZmZmZmZmZ ddlmZ d	Zd
Z G d„ dej        ¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ d¦  «        Zej         fd„Z! G d„ d¦  «        Z"	 ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z+m,Z, dS # e-$ r/Z. ej/        e.¦  «         ddl0m$Z$m%Z%m&Z&m'Z'm(Z(m)Z) e!Z,e"Z+Y dZ.[.dS dZ.[.ww xY w)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é   )Ú	inventoryÚstatic_tupleé   )Ú
cache_utf8ÚconfigÚdebugÚerrorsÚlockÚosutilsÚtraceÚurlutils)ÚInventoryTreeChangeé   i  c                   ó   — e Zd ZdZd„ ZdS )ÚDirstateCorruptz<The dirstate file (%(state)s) appears to be corrupt: %(msg)sc                 ó`   — t           j                             | ¦  «         || _        || _        d S ©N)r   ÚBzrErrorÚ__init__ÚstateÚmsg)Úselfr   r   s      ú5/usr/lib/python3/dist-packages/breezy/bzr/dirstate.pyr   zDirstateCorrupt.__init__  s*   € ÝŒ× Ò  Ñ&Ô&Ð&ØˆŒ
ØˆŒˆˆó    N)Ú__name__Ú
__module__Ú__qualname__Ú_fmtr   © r   r   r   r     s(   € € € € € àI€Dðð ð ð ð r   r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚSHA1Providerz)An interface for getting sha1s of a file.c                 ó*   — t          | j        ¦  «        ‚)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     r   r&   zSHA1Provider.sha1  s   € õ " $¤)Ñ,Ô,Ð,r   c                 ó*   — t          | j        ¦  «        ‚)a'  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     r   r*   zSHA1Provider.stat_and_sha1  s   € õ " $Ô"4Ñ5Ô5Ð5r   N©r   r   r   Ú__doc__r&   r*   r!   r   r   r#   r#     s8   € € € € € Ø3Ð3ð-ð -ð -ð	6ð 	6ð 	6ð 	6ð 	6r   r#   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚDefaultSHA1Providerz7A SHA1Provider that reads directly from the filesystem.c                 ó*   — t          j        |¦  «        S )z2Return the sha1 of a file given its absolute path.)r   Úsha_file_by_namer'   s     r   r&   zDefaultSHA1Provider.sha1%  s   € åÔ'¨Ñ0Ô0Ð0r   c                 óÎ   — t          |d¦  «        5 }t          j        |                     ¦   «         ¦  «        }t	          j        |¦  «        }ddd¦  «         n# 1 swxY w Y   ||fS )z;Return the stat and sha1 of a file given its absolute path.ÚrbN)ÚopenÚosÚfstatÚfilenor   Úsha_file)r   r(   Úfile_objÚ	statvaluer&   s        r   r*   z!DefaultSHA1Provider.stat_and_sha1)  s™   € å�'˜4Ñ Ô ð 	. HÝœ §¢Ñ!2Ô!2Ñ3Ô3ˆIÝÔ# HÑ-Ô-ˆDð	.ð 	.ð 	.ñ 	.ô 	.ð 	.ð 	.ð 	.ð 	.ð 	.ð 	.øøøð 	.ð 	.ð 	.ð 	.ð ˜$ˆÐs   ‘;AÁAÁANr+   r!   r   r   r.   r.   "  s8   € € € € € ØAÐAð1ð 1ð 1ðð ð ð ð r   r.   c                   ó   — e Zd ZdZdddddddœZd	d
dddddœZej        dej        dej	        diZ
dddœZdZdZdZdZdZdZ ej        ddddd¦  «        ZdZdZ	 	 dpd„Zd„ Zdqd!„Zd"„ Zd#„ Zd$„ Zd%„ Zd&„ Zd'„ Zd(„ Z d)„ Z!d*„ Z"d+„ Z#d,„ Z$d-„ Z%d.„ Z&drd/„Z'd0„ Z(d1„ Z)e*dsd2„¦   «         Z+d3„ Z,d4„ Z-d5„ Z.d6„ Z/d7„ Z0d8„ Z1d9„ Z2d:„ Z3d;„ Z4d<„ Z5d=„ Z6e
fd>„Z7d?„ Z8d@„ Z9dA„ Z:dB„ Z;dC„ Z<dD„ Z=dE„ Z>dF„ Z?dG„ Z@dH„ ZAdI„ ZBdJ„ ZCdK„ ZD	 	 dtdL„ZEeFdsdM„¦   «         ZGe*dN„ ¦   «         ZHdO„ ZIdP„ ZJdQ„ ZKdR„ ZLdS„ ZMdT„ ZNdU„ ZOdV„ ZPeF	 	 dudW„¦   «         ZQdX„ ZRdY„ ZSdZ„ ZTd[„ ZUd\„ ZVd]„ ZWd^„ ZXd_„ ZYd`„ ZZda„ Z[db„ Z\dc„ Z]dd„ Z^de„ Z_df„ Z`dg„ Za	 	 dvdh„Zbdi„ Zcdj„ Zddk„ Zedl„ Zfdm„ Zgdn„ Zhdo„ Zid S )wÚDirStatea¢  Record 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-referencerB   rC   rD   rF   rE   rG   )r<   r=   r>   r@   r?   rA   ó   yó   n©TFi   r   r   r   r   s    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr   Fs   #bazaar dirstate flat format 2
s   #bazaar dirstate flat format 3
Tc                 ó<  — t           j        | _        t           j        | _        d| _        g | _        g | _        g | _        d| _        || _	        d| _
        d| _        d| _        d| _        d| _        d| _        i | _        t           j        | _        || _        dt(          j        v r| j        | _        n| j        j        | _        d| _        d| _        t7          ¦   «         | _        || _        t=          j        tA          j!        |¦  «        ¦  «        | _"        || _#        dS )aE  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)$r;   Ú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        r   r   zDirState.__init__l  s  € õ0 &Ô3ˆÔÝ'Ô5ˆÔð !&ˆÔØˆŒØˆŒØˆŒØˆÔØˆŒØˆÔØˆÔØˆŒà"&ˆÔØ"ˆÔØ ˆÔØ!#ˆÔÝ!)Ô!:ˆÔØ+ˆÔØ�%Ô+Ð+Ð+Ø"Ô8ˆDŒOˆOà"Ô1Ô6ˆDŒOð
 "&ˆÔØ!%ˆÔå#&¡5¤5ˆÔ à#5ˆÔ Ý#Ô1µ(Ô2LØñ3ô 3ñ ô ˆÔà(?ˆÔ%Ð%Ð%r   c                 ó0   — | j         j        ›d| j        ›d�S )Nú(ú))Ú	__class__r   rU   ©r   s    r   Ú__repr__zDirState.__repr__ª  s"   € àŒ^Ô$Ð$Ð$ d¤n n nð6ð 	6r   Nc                 ó   — |rU| j                              d„ |D ¦   «         ¦  «         | j        t          j        t          j        fv rt          j        | _        nt          j        | _        |rt          j        | _        dS dS )a  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.
        c                 ó   — g | ]
}|d          ‘ŒS )r   r!   )Ú.0Úes     r   ú
<listcomp>z+DirState._mark_modified.<locals>.<listcomp>¹  s   € Ð4Ð4Ð4˜!��1”Ð4Ð4Ð4r   N)	rf   ÚupdaterO   r;   rM   ÚIN_MEMORY_UNMODIFIEDÚIN_MEMORY_HASH_MODIFIEDÚIN_MEMORY_MODIFIEDrN   )r   Úhash_changed_entriesÚheader_modifieds      r   Ú_mark_modifiedzDirState._mark_modified®  sš   € ð  ð 	?ØÔ$×+Ò+Ø4Ð4Ð3Ð4Ñ4Ô4ñ6ô 6ð 6àÔ#­Ô(>Ý(0Ô(Eð(Gð Gð Gõ (0Ô'G�Ô$øõ $,Ô#>ˆDÔ Øð 	=Ý!)Ô!<ˆDÔÐÐð	=ð 	=r   c                 óp   — t           j        | _        t           j        | _        t	          ¦   «         | _        dS )z!Mark this dirstate as unmodified.N)r;   r|   rN   rO   re   rf   rt   s    r   Ú_mark_unmodifiedzDirState._mark_unmodifiedÈ  s*   € å%Ô:ˆÔÝ'Ô<ˆÔÝ#&¡5¤5ˆÔ Ð Ð r   c                 ó 
  — t          j        |¦  «        \  }}t          j        |¦  «        \  }}	||k    r|	r|}nt          j        |¦  «        ‚|dk    s|dk    rt          j        |¦  «        ‚|dz   |z                        d¦  «                             d¦  «        }
t          j        |
¦  «        \  }}|j	        t          ur/t          d                     t          |¦  «        ¦  «        ¦  «        ‚d}|                      d|d¬	¦  «        }|d
k    rÔ|d         d         d         dk    r@|d         |||fk    r0|                      |d         ddd|
¬¦  «         |d         dd…         }n|t          j        |d         d         |d         d         ¦  «        }t"          j        |d         d         d                  }d                     ||¦  «        }t          j        ||¦  «        ‚||df}|                      |¦  «        \  }}|rÇ| j        |         d         }|                      ||¦  «        \  }}|t/          |¦  «        k     r‡||         d         dd…         |dd…         k    re||         d         d         d         dvrt1          d¦  «        ‚|dz  }|t/          |¦  «        k     r"||         d         dd…         |dd…         k    °ennt          j        |¦  «        \  }}|                      ||d¦  «        \  }}}}|s"t          j        |t7          | ¦  «        ¦  «        ‚|                      |||¦  «         | j        |         d         }|||f}|€d}t"          j        }n|j        }t?          |¦  «        }|                       ¦   «         }t"          j!        |         }|� |d         rd|z  }n|d         }d|dddf|d<   |dk    r||||d|fg|z   f}nS|dk    r||ddd|fg|z   f}n?|dk    r||||d|fg|z   f}n+|dk    r|||dd|fg|z   f}nt          j"        d|z  ¦  «        ‚|                      ||¦  «        \  }}|s| #                    ||¦  «         nQ||         d         d         d         dk    rt          d|›d|›d�¦  «        ‚|d         d         ||         d         d<   |dk    r|                      |||
¦  «         |  $                    ¦   «          | j%        r|  &                    | j%        |¦  «         dS dS )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 {}Nr   T)Úfileid_utf8Úinclude_deleted©NNr   r<   r?   r   )Ú	path_utf8Úpacked_statÚfingerprintr   z{}:{}©r<   r?   zadding already added path!ó   %s/%sFrC   rD   rF   rG   zunknown kind %rú rq   z) already added)'r   ÚsplitÚnormalized_filenamer   ÚInvalidNormalizationr   ÚInvalidEntryNameÚstripÚencoders   ÚbytesÚAssertionErrorÚformatÚtypeÚ
_get_entryÚupdate_minimalÚpathjoinr;   Ú_minikind_to_kindÚDuplicateFileIdÚ_find_block_index_from_keyrQ   Ú_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�   rX   Ú_add_to_id_index) r   rl   Ú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   ÚaddzDirState.addÎ  s	  € õ. $œM¨$Ñ/Ô/Ñˆ�õ !(Ô ;¸HÑ EÔ EÑˆ	�:Ø˜Ò Ð Øð 8Ø$��åÔ1°$Ñ7Ô7Ð7ð �sŠ?ˆ?˜h¨$Ò.Ð.ÝÔ,¨TÑ2Ô2Ð2ð ˜c‘M HÑ,×3Ò3°CÑ8Ô8×?Ò?ÀÑGÔGˆÝ#œM¨(Ñ3Ô3Ñˆ�àÔ¥EÐ)Ð)Ý Ø/×6Ò6µt¸G±}´}ÑEÔEñGô Gð Gð ˆØŸšØ˜7°Dð (ñ :ô :ˆà˜LÒ(Ð(Ø˜QÔ Ô" 1Ô%¨Ò-Ð-Ø  Ô#¨°¸7Ð'CÒCÐCà×'Ò'¨°aÔ(8Ø(,Ø25Ø47Ø4<ð	 (ñ *ô *ð *ð #0°Ô"2°1°Q°3Ô"7�KøåÔ'Ø! !Ô$ QÔ'¨°qÔ)9¸!Ô)<ñ>ô >�åÔ1°-ÀÔ2BÀ1Ô2EÀaÔ2HÔI�Ø—~’~ d¨DÑ1Ô1�ÝÔ/°¸Ñ>Ô>Ð>Ø˜h¨Ð,ˆ	Ø#×>Ò>¸yÑIÔIÑˆ�WØð 	Là”O KÔ0°Ô3ˆEØ!×3Ò3°I¸uÑEÔE‰NˆK˜Ø¥ U¡¤Ò+Ð+Ø˜Ô% aÔ(¨¨1¨Ô-°¸1¸Q¸3´Ò?Ð?Ø˜Ô% aÔ(¨Ô+¨AÔ.°lÐBÐBå#Ð$@ÑAÔAÐAØ˜qÑ �ð ¥ U¡¤Ò+Ð+Ø˜Ô% aÔ(¨¨1¨Ô-°¸1¸Q¸3´Ò?Ð?øõ '.¤m°GÑ&<Ô&<Ñ#ˆJ˜à×+Ò+¨J¸ÀQÑGÔGñ BÐÐ.°°>à!ð @ÝÔ.¨tµS¸±Y´YÑ?Ô?Ð?Ø×ÒÐ/Ð1AÀ7ÑKÔKÐKØ” Ô,¨QÔ/ˆØ˜h¨Ð0ˆ	Øˆ<ØˆDÝ"Ô+ˆKˆKà”<ˆDÝ# D™/œ/ˆKØ×-Ò-Ñ/Ô/ˆÝÔ-¨dÔ3ˆØÐ"Ø˜1Œ~ð /Ø (¨;Ñ 6��à +¨A¤�Ø" M°1°e¸SÐAˆK˜‰NØ�6Š>ˆ>Ø"Ø˜;¨¨e°[ÐAð%àñ% ð  ˆJˆJð �[Ò Ð Ø"Ø˜3  5¨+Ð6ð%àñ% ð  ˆJˆJð �YÒÐØ"Ø˜;¨¨e°[ÐAð%àñ% ð  ˆJˆJð Ð%Ò%Ð%Ø"Ø˜;¨¨5°+Ð>ð%àñ% ð  ˆJˆJõ ”/Ð"3°dÑ":Ñ;Ô;Ð;Ø#×5Ò5°iÀÑGÔGÑˆ�WØð 	8Ø�LŠL˜ jÑ1Ô1Ð1Ð1à�[Ô! !Ô$ QÔ'¨Ô*¨dÒ2Ð2Ý$�nØ&. h h°°°ð&9ñ :ô :ð :à'1°!¤}°QÔ'7ˆE�+Ô˜qÔ! !Ñ$à�;ÒÐà×Ò˜{¨K¸ÑBÔBÐBØ×ÒÑÔÐØŒ>ð 	=Ø×!Ò! $¤.°)Ñ<Ô<Ð<Ð<Ð<ð	=ð 	=r   c                 óh
  — |                       ¦   «          |                      ¦   «          | j        t          j        k    rt          d| j        z  ¦  «        ‚| j        }t          j        | 	                    ¦   «         ¦  «        j
        }|                      ¦   «         dz   }| j        }|dz
  }i }dt          |¦  «        z  }d}	|||fg}
| j        }|                      ¦   «         }|
�rN|
                     ¦   «         \  }}}|r||k    rŒ$|	dz  }	|	|k    rt#          j        d¦  «        ‚t'          |||z   |z
  dz  ¦  «        }|                     |¦  «         t+          |||z
  dz   ¦  «        }|                     |¦  «        }|}|                     d¦  «        }t          |¦  «        dk     r|dz  }|
                     |||f¦  «         Œäd}|d                              d¦  «        }t          |¦  «        |k     r8|t          |d         ¦  «        dz   z  }|d                              d¦  «        }d}t          |¦  «        dk    r|dz  }|
                     |||f¦  «         �Œ~|}|d         r|d         d	z   |d         z   }n|d         }t3          ||¦  «        }|d
|…         }||d
…         }|�rKt          |¦  «        |k    �r7t          |¦  «        dz
  }||                              d¦  «        }t          |¦  «        |k     rI|t          |¦  «        z   t          |d         ¦  «        z
  }|dz  }||                              d¦  «        }n|t          |¦  «        z   }|d         r|d         d	z   |d         z   }n|d         }t5          ||¦  «        }|d
|…         }||d
…         }|�rP|d         |k    r|                     |¦  «         |d         |k    r|                     d|¦  «         ||gi}||k    r)|                     |g ¦  «                             |¦  «         t;          |dz   |¦  «        D ]k}||                              d¦  «        } | d         r| d         d	z   | d         z   }!n| d         }!|                     |!g ¦  «                             | ¦  «         Œl|D ]W}!|                     |!g ¦  «        D ]>}  || dd
…         ¦  «        }"|                     |!g ¦  «                             |"¦  «         Œ?ŒX|r|
                     |||f¦  «         |r|
                     ||dz
  |f¦  «         |
�°N|S )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 %rr   é   r   ú"Too many seeks, most likely a bug.r   ó   
ó    ó   /Néÿÿÿÿ)Ú_requires_lockÚ_read_header_if_neededrO   r;   rM   r™   rT   r4   r5   r6   rª   Ú_fields_per_entryrZ   r£   r^   Ú_get_fields_to_entryÚpopr   r   Ú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Úfieldsrl   Úentrys#                                      r   Ú_bisectzDirState._bisectX  sí  € ð 	×ÒÑÔÐà×#Ò#Ñ%Ô%Ð%ð Ô¥8Ô#9Ò9Ð9Ý Ð!8Ø!%Ô!5ñ"6ñ 7ô 7ð 7ð Ô%ˆ
Ý”H˜Z×.Ò.Ñ0Ô0Ñ1Ô1Ô9ˆ	ð !×2Ò2Ñ4Ô4°qÑ8ÐàÔ!ˆØ˜1‰}ˆàˆð �˜U™œ‘Oˆ	Øˆð ˜˜uÐ%Ð&ˆàÔ*ˆ	à×3Ò3Ñ5Ô5ˆàñ F	6Ø#*§;¢;¡=¤=Ñ ˆC��yàð   t¢ àà�Q‰JˆEØ�yÒ Ð Ý”oÐ&JÑKÔKÐKå�c˜C $™J¨Ñ2°qÑ8Ñ9Ô9ˆCà�OŠO˜CÑ Ô Ð õ ˜I¨¨s©
°aÑ'7Ñ8Ô8ˆIØ—O’O IÑ.Ô.ˆEàˆEØ—k’k %Ñ(Ô(ˆGå�7‰|Œ|˜aÒÐð
 ˜Q‘�	Ø—’  T¨9Ð5Ñ6Ô6Ð6Øð  ˆOØ" 1œ:×+Ò+¨EÑ2Ô2ˆLÝ�<Ñ Ô Ð#4Ò4Ð4ð �˜W QœZ™œ¨1Ñ,Ñ,�Ø& qœz×/Ò/°Ñ6Ô6�Ø"#�å�<Ñ Ô  AÒ%Ð%ð ˜Q‘�	Ø—’  T¨9Ð5Ñ6Ô6Ð6Ùð �Ø ”?ð 1Ø!-¨a¤°4Ñ!7¸,Àq¼/Ñ!I�J�Jà!-¨a¤�JÝ-¨i¸ÑDÔD�	ð   
  
Ô+�ð !   Ô,�àñ ;E�˜LÑ)Ô)Ð->Ò>Ñ>õ "% W¡¤°Ñ!1�Ø% nÔ5×;Ò;¸EÑBÔB�Ý�{Ñ#Ô#Ð&7Ò7Ð7ð  ¥# e¡*¤*Ñ,­s°7¸2´;Ñ/?Ô/?Ñ?�EØ" aÑ'�NØ")¨.Ô"9×"?Ò"?ÀÑ"FÔ"F�K�Kà¥# e¡*¤*Ñ,�Eà˜q”>ð /Ø +¨A¤°Ñ 5¸ÀA¼Ñ F�I�Ià +¨A¤�IÝ-¨d°IÑ>Ô>�à# I X Iœ�Ø˜H˜I˜I”�àñ #Eð $ A”¨*Ò4Ð4àŸ
š
 :Ñ.Ô.Ð.Ø# BÔ'¨9Ò4Ð4ØŸš A yÑ1Ô1Ð1ð (¨,¨Ð8�Eð &¨Ò8Ð8Ø×(Ò(¨°BÑ7Ô7×>Ò>¸{ÑKÔKÐKÝ$ _°qÑ%8¸.ÑIÔIð 	Bð 	B˜ð ")¨¤×!3Ò!3°EÑ!:Ô!:˜Ø! !œ9ð -Ø#)¨!¤9¨tÑ#3°f¸Q´iÑ#?˜D˜Dà#)¨!¤9˜DØ×(Ò(¨¨rÑ2Ô2×9Ò9¸&ÑAÔAÐAÐAà ,ð Eð E˜Ø&+§i¢i°°bÑ&9Ô&9ð Eð E˜Fð %4 O°F¸1¸2¸2´JÑ$?Ô$?˜EØ!×,Ò,¨T°2Ñ6Ô6×=Ò=¸eÑDÔDÐDÐDðEð ð 4Ø—’  t¨TÐ2Ñ3Ô3Ð3Øð 6Ø—’  U¨Q¡Y°Ð4Ñ5Ô5Ð5ðM ñ F	6ðV ˆr   c                 óÊ	  — |                       ¦   «          |                      ¦   «          | j        t          j        k    rt          d| j        z  ¦  «        ‚| j        }t          j        | 	                    ¦   «         ¦  «        j
        }|                      ¦   «         dz   }| j        }|dz
  }i }dt          |¦  «        z  }d}	|||fg}
| j        }|                      ¦   «         }|
�rÿ|
                     ¦   «         \  }}}|r||k    rŒ$|	dz  }	|	|k    rt#          j        d¦  «        ‚t'          |||z   |z
  dz  ¦  «        }|                     |¦  «         t+          |||z
  dz   ¦  «        }|                     |¦  «        }|}|                     d¦  «        }t          |¦  «        dk     r|dz  }|
                     |||f¦  «         Œäd}|d                              d¦  «        }t          |¦  «        |k     r8|t          |d         ¦  «        dz   z  }|d                              d¦  «        }d}t          |¦  «        dk    r|dz  }|
                     |||f¦  «         �Œ~|}|d         }t3          j        ||¦  «        }|d	|…         }||d	…         }|�rt          |¦  «        |k    �r t          |¦  «        dz
  }||                              d¦  «        }t          |¦  «        |k     rI|t          |¦  «        z   t          |d
         ¦  «        z
  }|dz  }||                              d¦  «        }n|t          |¦  «        z   }|d         }t3          j        ||¦  «        }|d	|…         }||d	…         }|�r1|d         |k    r|                     |¦  «         |d
         |k    r|                     d|¦  «         ||gi}||k    r)|                     |g ¦  «                             |¦  «         t=          |dz   |¦  «        D ]L} ||                               d¦  «        }!|                     |!d         g ¦  «                             |!¦  «         ŒM|D ]W}"|                     |"g ¦  «        D ]>}! ||!dd	…         ¦  «        }#|                     |"g ¦  «                             |#¦  «         Œ?ŒX|r|
                     |||f¦  «         |r|
                     ||dz
  |f¦  «         |
�°ÿ|S )a]  Bisect 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Ï   r   rÐ   r   rÑ   rÒ   NrÔ   ) rÕ   rÖ   rO   r;   rM   r™   rT   r4   r5   r6   rª   r×   rZ   r£   r^   rØ   rÙ   r   r   rÚ   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_dirrù   rú   rû   rü   rý   Úlast_dirrÿ   r   rä   r  r  Úcur_dirr  s$                                       r   Ú_bisect_dirblockszDirState._bisect_dirblocks  s€  € ð 	×ÒÑÔÐà×#Ò#Ñ%Ô%Ð%ð Ô¥8Ô#9Ò9Ð9Ý Ð!8Ø!%Ô!5ñ"6ñ 7ô 7ð 7ð
 Ô%ˆ
Ý”H˜Z×.Ò.Ñ0Ô0Ñ1Ô1Ô9ˆ	ð !×2Ò2Ñ4Ô4°qÑ8ÐàÔ!ˆØ˜1‰}ˆàˆð �˜X™œÑ&ˆ	Øˆð ˜˜xÐ(Ð)ˆàÔ*ˆ	à×3Ò3Ñ5Ô5ˆàñ |	6Ø")§+¢+¡-¤-ÑˆC��xàð ˜s dš{˜{àà�Q‰JˆEØ�yÒ Ð Ý”oÐ&JÑKÔKÐKå�c˜C $™J¨Ñ2°qÑ8Ñ9Ô9ˆCà�OŠO˜CÑ Ô Ð õ ˜I¨¨s©
°aÑ'7Ñ8Ô8ˆIØ—O’O IÑ.Ô.ˆEàˆEØ—k’k %Ñ(Ô(ˆGå�7‰|Œ|˜aÒÐð
 ˜Q‘�	Ø—’  T¨8Ð4Ñ5Ô5Ð5Øð  ˆOØ" 1œ:×+Ò+¨EÑ2Ô2ˆLÝ�<Ñ Ô Ð#4Ò4Ð4ð �˜W QœZ™œ¨1Ñ,Ñ,�Ø& qœz×/Ò/°Ñ6Ô6�Ø"#�å�<Ñ Ô  AÒ%Ð%ð ˜Q‘�	Ø—’  T¨8Ð4Ñ5Ô5Ð5Ùð �Ø(¨œO�	Ý"Ô.¨x¸ÑCÔC�	ð ˜z 	˜zÔ*�ð   	 
 
Ô+�àñ 4H�˜LÑ)Ô)Ð->Ò>Ñ>õ "% W¡¤°Ñ!1�Ø% nÔ5×;Ò;¸EÑBÔB�Ý�{Ñ#Ô#Ð&7Ò7Ð7ð  ¥# e¡*¤*Ñ,­s°7¸2´;Ñ/?Ô/?Ñ?�EØ" aÑ'�NØ")¨.Ô"9×"?Ò"?ÀÑ"FÔ"F�K�Kà¥# e¡*¤*Ñ,�Eà& qœ>�Ý!Ô.¨t°XÑ>Ô>�à# I X Iœ�Ø˜H˜I˜I”�àñ Hð $ A”¨)Ò3Ð3àŸ
š
 9Ñ-Ô-Ð-Ø# BÔ'¨8Ò3Ð3ØŸš A xÑ0Ô0Ð0ð '¨¨Ð7�Eð &¨Ò8Ð8Ø×(Ò(¨°2Ñ6Ô6×=Ò=¸kÑJÔJÐJÝ$ _°qÑ%8¸.ÑIÔIð Gð G˜ð ")¨¤×!3Ò!3°EÑ!:Ô!:˜Ø×(Ò(¨°¬°BÑ7Ô7×>Ò>¸vÑFÔFÐFÐFà#/ð Hð H˜Ø&+§i¢i°¸Ñ&<Ô&<ð Hð H˜Fð %4 O°F¸1¸2¸2´JÑ$?Ô$?˜EØ!×,Ò,¨W°bÑ9Ô9×@Ò@ÀÑGÔGÐGÐGðHð ð 4Ø—’  t¨TÐ2Ñ3Ô3Ð3Øð 6Ø—’  U¨Q¡Y°Ð4Ñ5Ô5Ð5ðy ñ |	6ð| ˆr   c                 ó<  — i }t          ¦   «         }t          ¦   «         }|                      |¦  «        }|�ret          ¦   «         }t          ¦   «         }|                     ¦   «         D ]Å}|D ]À\  }	}
|
||	<   |                     |	dd…         ¦  «         d}|
D ]”}|d         }|dk    r:|rŒ|	\  }}}t	          j        ||¦  «        }d}||vr|                     |¦  «         ŒJ|dk    rDt	          j        |d         ¦  «        }|d         |v rŒu||vr|                     |d         ¦  «         Œ•ŒÁŒÆ|                      t          |¦  «        ¦  «        }|                     |  	                    t          |¦  «        ¦  «        ¦  «         |                     |¦  «         |�°e|S )	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]
        Nr   Fr   r>   Tr?   r   )
re   r  ÚvaluesrÌ   r   rž   r’   Úsortedr{   r  )r   rä   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°   rl   Údir_names                      r   Ú_bisect_recursivezDirState._bisect_recursiveÊ  sé  € ð ˆå™%œ%ˆõ ™œˆà—l’l 5Ñ)Ô)ˆàñ %	0å™5œ5ˆLÝ!™eœeˆOØ)×0Ò0Ñ2Ô2ð Bð B�
Ø/9ð Bð BÑ+�K Ø)3�E˜+Ñ&Ø#×'Ò'¨°B°Q°B¬Ñ8Ô8Ð8Ø"�FØ%/ð Bð B˜	Ø#,¨Q¤<˜Ø# tÒ+Ð+Ø%ð )ð !)Ø4?Ñ1˜F D¨'Ý#*Ô#3°F¸DÑ#AÔ#A˜DØ%)˜FØ#¨>Ð9Ð9Ø ,× 0Ò 0°Ñ 6Ô 6Ð 6øØ%¨Ò-Ð-õ (/¤}°Y¸q´\Ñ'BÔ'B˜HØ'¨œ{¨lÐ:Ð:à (Ø'¨Ð>Ð>Ø /× 3Ò 3°I¸a´LÑ AÔ AÐ Aøð)Bð	Bð< Ÿ,š,¥v¨oÑ'>Ô'>Ñ?Ô?ˆKØ×Ò˜t×5Ò5µf¸\Ñ6JÔ6JÑKÔKÑLÔLÐLØ×!Ò! ,Ñ/Ô/Ð/ðK ñ %	0ðL ˆr   c                 óÎ  ‡ ‡— ‰                       ¦   «          ‰                      ¦   «         }t          |¦  «        dk     rdS ‰                      ¦   «          h d£Šˆˆ fd„}|d         ‰                      ¦   «         v r(t
          j        g} |¦   «         D ]}||d         dd…<   Œn |¦   «         D ]}|d         dd…= Œg ‰ _        |d         g‰ _        ‰  	                    d¬¦  «         dS )	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>   ©r<   r<   ©r?   r?   r�   ©r?   r<   c               3   ó~  •K  — ‰j         D ]±} g }t          | d         ¦  «        D ]H\  }}|V — |d         d         d         |d         d         d         f‰v r|                     |¦  «         ŒI|rMt          |¦  «        t          | d         ¦  «        k    r| d         d d …= Œ–t	          |¦  «        D ]}| d         |= ŒŒ²d S )Nr   r   )rQ   Ú	enumeraterÞ   r£   Úreversed)r¾   Údeleted_positionsÚposr  Údead_patternsr   s       €€r   Úiter_entries_removablez?DirState._discard_merge_parents.<locals>.iter_entries_removable  sê   øè è € Øœð .ð .�Ø$&Ð!Ý"+¨E°!¬HÑ"5Ô"5ð 6ð 6‘J�C˜Ø�K�K�KØ˜aœ œ Aœ¨¨a¬°¬°A¬Ð7¸=ÐHÐHØ)×0Ò0°Ñ5Ô5Ð5øØ$ð .ÝÐ,Ñ-Ô-µ°U¸1´X±´Ò>Ð>Ø! !œH Q Q Q˜K˜Kå#+Ð,=Ñ#>Ô#>ð .ð .˜CØ % a¤¨  øð.ð .r   r   r   T©r€   )
rÖ   Úget_parent_idsr£   Ú_read_dirblocks_if_neededÚ
get_ghostsr;   ÚNULL_PARENT_DETAILSrR   rS   r�   )r   Úparentsr*  Úempty_parentr  r)  s   `    @r   Ú_discard_merge_parentszDirState._discard_merge_parents  s2  øø€ ð 	×#Ò#Ñ%Ô%Ð%Ø×%Ò%Ñ'Ô'ˆÝˆw‰<Œ<˜!ÒÐØˆFà×&Ò&Ñ(Ô(Ð(ð5ð 5ð 5ˆð	.ð 	.ð 	.ð 	.ð 	.ð 	.ð �1Œ:˜ŸšÑ*Ô*Ð*Ð*Ý$Ô8Ð9ˆLØ/Ð/Ñ1Ô1ð ,ð ,�Ø+��a”˜˜˜‘�ð,ð 0Ð/Ñ1Ô1ð !ð !�Ø˜!”H˜Q˜R˜R�L�LàˆŒØ  œ˜ˆŒØ×Ò¨DÐÑ1Ô1Ð1Ð1Ð1r   c                 óp   — t           j        gt          | j        ¦  «        t          | j        ¦  «        z
  z  S r   )r;   r/  r£   rS   rR   rt   s    r   r¬   zDirState._empty_parent_info2  s6   € ÝÔ,Ð-µ°T´]Ñ1CÔ1CÝ14°T´\Ñ1BÔ1Bñ2Cñ Dð 	Dr   c                 óZ  — |dk    r|dk    r|dk    rdS |dk    r|dk    r|dk    sJ|                      | j        |         d         |         d         d         ¦  «        st          d|z  ¦  «        ‚|                      |ddf¦  «        \  }}|s| j                             ||g f¦  «         |S )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.
        r   r   r   rÔ   zbad dirname %r)ÚendswithrQ   r™   r¡   r®   )r   Úparent_block_indexÚparent_row_indexr³   r¼   r½   s         r   r¨   zDirState._ensure_block6  sè   € ð( �cŠ>ˆ>Ð.°!Ò3Ð3Ð8JÈaÒ8OÐ8Oð �1à" bÒ(Ð(Ø" bÒ(Ð(¨W¸ª^¨^Ø×#Ò#Ø”OÐ$6Ô7¸Ô:Ð;KÔLÈQÔOÐPQÔRñTô Tð Aå$Ð%5¸Ñ%?Ñ@Ô@Ð@Ø#×>Ò>Ø�c˜3Ðñ !ô  !Ñˆ�Wàð 	?ð ŒO×"Ò" ;°¸"°Ñ>Ô>Ð>ØÐr   c                 ó¾  — |d         d         dd…         dk    r.t          d                     |d         d         ¦  «        ¦  «        ‚dg fdg fg| _        | j        d         d         }d}d}|j        }|D ]R}|d         d         |k    r3g }|d         d         }| j                             ||f¦  «         |j        } ||¦  «         ŒS|                      ¦   «          dS )a‘  Load 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.
        r   r   ©r   r   zMissing root row {!r}r   r   N)r™   rš   rQ   rÞ   Ú"_split_root_dirblock_into_contents)r   Únew_entriesÚcurrent_blockÚcurrent_dirnameÚroot_keyÚappend_entryr  s          r   Ú_entries_to_current_statez"DirState._entries_to_current_state\  s  € ð �qŒ>˜!Ô˜Q˜q˜SÔ! ZÒ/Ð/Ý Ø'×.Ò.¨{¸1¬~¸aÔ/@ÑAÔAñCô Cð Cð   ˜9 s¨B iÐ0ˆŒØœ¨Ô*¨1Ô-ˆØˆØˆØ$Ô+ˆØ ð 	 ð 	 ˆEØ�QŒx˜Œ{˜oÒ-Ð-à "�Ø"'¨¤(¨1¤+�Ø”×&Ò&¨¸Ð'GÑHÔHÐHØ,Ô3�àˆL˜ÑÔÐÐØ×/Ò/Ñ1Ô1Ð1Ð1Ð1r   c                 ó\  — | j         d         dg fk    r-t          d                     | j         d         ¦  «        ¦  «        ‚g }g }| j         d         d         D ];}|d         d         s|                     |¦  «         Œ&|                     |¦  «         Œ<d|f| j         d<   d|f| j         d<   dS )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   r   zbad dirblock start {!r}r   N)rQ   Ú
ValueErrorrš   rÞ   )r   Ú
root_blockÚcontents_of_root_blockr  s       r   r:  z+DirState._split_root_dirblock_into_contents{  sË   € ð Œ?˜1Ô # r Ò*Ð*ÝÐ6×=Ò=¸d¼oÈaÔ>PÑQÔQÑRÔRÐRØˆ
Ø!#ÐØ”_ QÔ'¨Ô*ð 	5ð 	5ˆEØ˜”8˜A”;ð 5Ø×!Ò! %Ñ(Ô(Ð(Ð(à&×-Ò-¨eÑ4Ô4Ð4Ð4Ø! :Ð.ˆŒ˜ÑØ!Ð#9Ð:ˆŒ˜ÑÐÐr   c                 óü  — t           j                             |¦  «        \  }}||df}|                      |¦  «        \  }}|sg S g }| j        |         d         }|                      ||¦  «        \  }	}
|	t          |¦  «        k     rw||	         d         dd…         |dd…         k    rU|                     ||	         ¦  «         |	dz  }	|	t          |¦  «        k     r"||	         d         dd…         |dd…         k    °U|S )z?Return a list with all the entries that match path for all ids.r   r   r   r   )r4   rl   r’   r¡   rQ   r¢   r£   rÞ   )r   rl   r³   r´   Úkeyr¼   r½   Úresultr¾   r¿   rÀ   s              r   Ú_entries_for_pathzDirState._entries_for_path�  s  € åœGŸMšM¨$Ñ/Ô/Ñˆ�Ø˜ #Ð&ˆØ#×>Ò>¸sÑCÔCÑˆ�WØð 	àˆIØˆØ” Ô,¨QÔ/ˆØ×/Ò/°°UÑ;Ô;‰ˆ�Qà�S ™ZœZÒ'Ð'Ø�[Ô! !Ô$ Q q SÔ)¨S°°1°¬XÒ5Ð5Ø�MŠM˜% Ô,Ñ-Ô-Ð-Ø˜1ÑˆKð �S ™ZœZÒ'Ð'Ø�[Ô! !Ô$ Q q SÔ)¨S°°1°¬XÒ5Ð5ð ˆr   c                 ó@  — t          |d         ¦  «        }t          |d         ¦  «        D ]_\  }}|                     |¦  «         d|dz  z   }|d         ||dz   <   d|d         z  ||dz   <   t          j        |d                  ||dz   <   Œ`d                     |¦  «        S )z˜Serialize entry to a NULL delimited line ready for _get_output_lines.

        :param entry: An entry_tuple as defined in the module docstring.
        r   r   r   é   ó   %dr   rÒ   )Úlistr%  Úextendr;   Ú	_to_yesnoÚjoin)r   r  Úentire_entryÚtree_numberÚ	tree_dataÚtree_offsets         r   Ú_entry_to_linezDirState._entry_to_line¢  s¯   € õ
 ˜E !œH‘~”~ˆÝ&/°°a´Ñ&9Ô&9ð 
	Mð 
	MÑ"ˆK˜à×Ò 	Ñ*Ô*Ð*à˜k¨A™oÑ-ˆKà,5°a¬LˆL˜ q™Ñ)à,1°I¸a´LÑ,@ˆL˜ q™Ñ)å,4Ô,>¸yÈ¼|Ô,LˆL˜ q™Ñ)Ð)Ø�zŠz˜,Ñ'Ô'Ð'r   c                 óF   — d|                       ¦   «         z   }dd|z  z   dz   S )a1  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   r   rJ  )Ú_num_present_parents)r   Ú
tree_counts     r   r×   zDirState._fields_per_entryµ  s.   € ð ˜×2Ò2Ñ4Ô4Ñ4ˆ
Ø�1�z‘>Ñ! AÑ%Ð%r   c                 ób  — |                       |¦  «        \  }}|s‰|sdt          j        |d         ¦  «        \  }}|                      ||d¦  «        d         s*t	          j        |dd…         t          | ¦  «        ¦  «        ‚| j                             ||d         g f¦  «         | j        |         S )z…Return the block that key should be present in.

        :param key: A dirstate entry key.
        :return: The block tuple.
        r   r   r   )	r¡   r   r’   r¥   r   r¦   r§   rQ   r®   )r   rF  Úadd_if_missingr¼   r½   rÂ   Úparent_names          r   Ú_find_blockzDirState._find_blockÃ  s¸   € ð  $×>Ò>¸sÑCÔCÑˆ�WØð 	>Ø!ð 
Hõ ,3¬=¸¸Q¼Ñ+@Ô+@Ñ(�˜[Ø×2Ò2°;ÀÈQÑOÔOÐPQÔRð Hõ !Ô2°3°q¸°s´8½SÀ¹Y¼YÑGÔGÐGØŒO×"Ò" ;°°Q´¸°Ñ=Ô=Ð=ØŒ˜{Ô+Ð+r   c                 ó~  — |dd…         dk    rdS 	 | j         �+| j        | j                  d         |d         k    r	| j         dfS n# t          $ r Y nw xY wt          | j        |d         d| j        ¬¦  «        }|t          | j        ¦  «        k     o| j        |         d         |d         k    }|| _         d	| _        ||fS )
zxFind the dirblock index for a key.

        :return: The block index, True if the block for the key is present.
        r   r   r9  ©r   TNTr   )ÚcacherÔ   )rc   rQ   Ú
IndexErrorÚbisect_dirblockr\   r£   rd   )r   rF  r¼   r½   s       r   r¡   z#DirState._find_block_index_from_keyÙ  sñ   € ð
 ˆq�ˆsŒ8�zÒ!Ð!Ø�7ð	ØÔ&Ð2Ø”O DÔ$:Ô;¸AÔ>À#ÀaÄ&ÒHÐHØÔ-¨tÐ3Ð3øøÝð 	ð 	ð 	ØˆDð	øøøå% d¤o°s¸1´v¸qØ,0Ô,BðDñ Dô Dˆð ¥ T¤_Ñ!5Ô!5Ò5ð =Ø”? ;Ô/°Ô2°c¸!´fÒ<ð 	à!,ˆÔà!#ˆÔØ˜GÐ#Ð#s   ’1A Á
AÁAc                 ón  — t          |¦  «        }	 | j        �T| j        dz   }|dk    rD||dz
           d         |k     r/|||         d         k    r|| _        ||         d         |k    }||fS n# t          $ r Y nw xY wt          j        ||g f¦  «        }||k     o||         d         |k    }|| _        ||fS )z€Find the entry index for a key in a block.

        :return: The entry index, True if the entry for the key is present.
        Nr   r   )r£   rd   r_  r  r  )r   rF  r¾   Ú	len_blockr¿   r½   s         r   r¢   zDirState._find_entry_indexõ  s÷   € õ
 ˜‘J”Jˆ	ð	ØÔ%Ð1à"Ô4°qÑ8�ð ! 1’_�_¨¨{¸Q©Ô)?ÀÔ)BÀSÒ)HÐ)HØ˜u [Ô1°!Ô4Ò4Ð4Ø-8�DÔ*Ø$ [Ô1°!Ô4¸Ò;�GØ&¨Ð/Ð/øøÝð 	ð 	ð 	ØˆDð	øøøåÔ(¨°°b°	Ñ:Ô:ˆØ Ò*ð 0Ø˜Ô% aÔ(¨CÒ/ð 	à!,ˆÔØ˜GÐ#Ð#s   ‘AA- Á-
A:Á9A:c                 óˆ  — t                                ||¬¦  «        }	 t          j        ¦   «         5 }|                     |                      ¦   «         ¦  «         |                      ¦   «         }t          |¦  «        }g }|D ]_}| j        j	         
                    |¦  «        }	|                     ||	f¦  «         |                     |	                     ¦   «         ¦  «         Œ`|                     |g ¦  «         |                     | j        ¦  «         ddd¦  «         n# 1 swxY w Y   n#  |                     ¦   «          ‚ xY w|S )aŽ  Create 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)
        )rm   N)r;   Ú
initializeÚ
contextlibÚ	ExitStackÚenter_contextÚ	lock_readr,  r£   ÚbranchÚ
repositoryÚrevision_treerÞ   Úset_parent_treesÚset_state_from_inventoryÚroot_inventoryÚunlock)
ÚtreeÚdir_state_filenamerm   rG  Ú
exit_stackÚ
parent_idsÚnum_parentsÚparent_treesÚ	parent_idÚparent_trees
             r   Ú	from_treezDirState.from_tree  s“  € õ ×$Ò$Ð%7Ø3@ð %ñ Bô Bˆð	ÝÔ%Ñ'Ô'ð E¨:Ø×(Ò(¨¯ªÑ)9Ô)9Ñ:Ô:Ð:Ø!×0Ò0Ñ2Ô2�
Ý! *™oœo�Ø!�Ø!+ð Fð F�IØ"&¤+Ô"8×"FÒ"FØ!ñ##ô ##�Kà ×'Ò'¨°KÐ(@ÑAÔAÐAØ×,Ò,¨[×-BÒ-BÑ-DÔ-DÑEÔEÐEÐEØ×'Ò'¨°bÑ9Ô9Ð9Ø×/Ò/°Ô0CÑDÔDÐDðEð Eð Eñ Eô Eð Eð Eð Eð Eð Eð Eøøøð Eð Eð Eð Eøøð	ð �MŠM‰OŒOˆOØøøøØˆs/   žD( ±CDÄD( ÄD Ä D( Ä#D Ä$D( Ä(D?c                 ó0  — t          t          j        t          j        t          j        t          j        t          j        t          j        |¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        }d„ }|                     |d¬¦  «         |S )Nc                 ó,   — | \  }}}}|€d}|€d}||||fS )NÚ r!   )ÚdÚold_pathÚnew_pathr°   Ú	new_entrys        r   Ú	delta_keyz1DirState._check_delta_is_valid.<locals>.delta_key7  s5   € Ø78Ñ4ˆX�x ¨)ØÐØ�ØÐØ�Ø˜h¨°Ð;Ð;r   T)rF  Úreverse)	rL  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_validzDirState._check_delta_is_valid/  s§   € Ý•YÔ6ÝÔ<Ý"Ô@Ý&ÔCÝ!*Ô!EÝ%.Ô%WÐX]Ñ%^Ô%^ñ"`ô "`ñaô añbô bñcô cñdô dñ eô eˆð	<ð 	<ð 	<ð 	�
Š
�y¨$ˆ
Ñ/Ô/Ð/Øˆr   c                 ó  — |                       ¦   «          t          j        }i }i }t          ¦   «         }t          ¦   «         }|                      |¦  «        }|D �]X\  }}}	}
t          |	t          ¦  «        s/t          d                     t          |	¦  «        ¦  «        ¦  «        ‚|	|v s|	|v r|  
                    |p||	d¦  «         |�|                     d¦  «        }|||	<   n|                     |	¦  «         |� |
€|  
                    ||	d¦  «         |                     d¦  «        }t          j        |¦  «        \  }}|r|                     ||
j        f¦  «         |||	f}t          j        |
j                 }|dk    r
|
j        pd}nd}|||
j        ||f||	<   d||fv�r|                      d|¦  «        D ]ù}|d         d	         |v s|d         d	         |v rŒ#|d         d         }|d         d
         }|d
         d         d         }|d
         d         d         }|d
         d         d         }t          j        ||¦  «        }|||d         d	         <   |t-          |¦  «        d…         }||z   }|||d         d	         f}t          j        ||¦  «        }|||||f||d         d	         <   Œú�ŒZ|                      ||d¦  «         	 |                      |                     ¦   «         ¦  «         |                      |                     ¦   «         ¦  «         |                      |d¦  «         dS # t:          j        $ rF}d| _        dtA          |¦  «        vr‚ t;          j!        |d                     |¦  «        ¦  «        ‚d}~ww xY w)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ˆ   zrepeated file_idNúutf-8únew_path with no entryrA   r   r   r   r   é   r   Túintegrity errorúerror from _get_entry. {})"r-  r   r—   re   rŠ  Ú
isinstancer˜   r™   rš   r›   Ú_raise_invalidrÌ   r   r’   rv  r;   r­   r±   Úreference_revisionÚ
executableÚ_iter_child_entriesrž   r£   Ú_check_delta_ids_absentÚ_apply_removalsÚitemsÚ_apply_insertionsr  Ú_after_delta_check_parentsr   r   rP   r§   ÚInconsistentDeltaDelta)r   r‰  r—   Ú
insertionsÚremovalsr0  Únew_idsr}  r~  r°   Ú	inv_entryÚdirname_utf8r´   rF  rÉ   rŽ   ÚchildÚchild_dirnameÚchild_basenamer”  Úold_child_pathÚchild_suffixÚnew_child_dirnameÚnew_child_pathry   s                            r   Úupdate_by_deltazDirState.update_by_deltaA  s  € ð 	×&Ò&Ñ(Ô(Ð(ÝÔ"ˆØˆ
Øˆõ
 ‘%”%ˆõ ‘%”%ˆð ×*Ò*¨5Ñ1Ô1ˆØ6;ð /	Lñ /	LÑ2ˆH�h ¨Ý˜g¥uÑ-Ô-ð KÝ$Ø3×:Ò:½4À¹=¼=ÑIÔIñKô Kð Kà˜:Ð%Ð%¨7°hÐ+>Ð+>Ø×#Ò# HÐ$8°¸'Ø$6ñ8ô 8ð 8àÐ#Ø#Ÿ?š?¨7Ñ3Ô3�Ø$,�˜Ñ!Ð!à—’˜GÑ$Ô$Ð$ØÐ#ØÐ$Ø×'Ò'¨°'Ø(@ñBô Bð Bà#Ÿ?š?¨7Ñ3Ô3�Ý)0¬°xÑ)@Ô)@Ñ&�˜hØð EØ—K’K ¨yÔ/BÐ CÑDÔDÐDØ# X¨wÐ7�Ý#Ô5°i´nÔE�Ø˜tÒ#Ð#Ø"+Ô">Ð"EÀ#�K�Kà"%�KØ'*¨H°iÔ6JØ'2°Hð'>�
˜7Ñ#ð ˜H hÐ/Ð/Ñ/Ø!×5Ò5°a¸ÑBÔBð Lð L�EØ˜Q”x ”{ jÐ0Ð0°E¸!´H¸Q´KÀ8Ð4KÐ4KØ Ø$)¨!¤H¨Q¤K�MØ%*¨1¤X¨a¤[�NØ$ Qœx¨œ{¨1œ~�HØ"'¨¤(¨1¤+¨a¤.�KØ!& q¤¨!¤¨Q¤�JÝ%,Ô%5°mØ6Dñ&Fô &F�Nà,:�H˜U 1œX aœ[Ñ)Ø#0µ°X±´°°Ô#@�LØ)1°LÑ)@Ð%Ø,¨n¸eÀA¼hÀq¼kÐJ�CÝ%,Ô%5Ð6GØ6Dñ&Fô &F�Nà/2°H¸jØ/:¸Nð/L�J˜u Qœx¨œ{Ñ+Ð+ùà×$Ò$ W¨e°QÑ7Ô7Ð7ð	WØ× Ò  §¢Ñ!1Ô!1Ñ2Ô2Ð2Ø×"Ò" :×#4Ò#4Ñ#6Ô#6Ñ7Ô7Ð7à×+Ò+¨G°QÑ7Ô7Ð7Ð7Ð7øÝŒð 	Wð 	Wð 	WØ$(ˆDÔ!Ø ­¨A©¬Ð.Ð.Øõ Ô/°Ø0K×0RÒ0RÐSTÑ0UÔ0UñWô Wð Wøøøøð	Wøøøs   Ë
A$L0 Ì0NÌ?AN Î Nc                 ó  — t          |dt          j        d¦  «        ¬¦  «        D �]d\  }}t          j        |¦  «        \  }}|                      ||d¦  «        \  }}}}		 | j        |         d         |         }
n'# t          $ r |                      ||d¦  «         Y nw xY w|	r|
d         d         d         dv r|                      ||d¦  «         ||
d         d         k    r&|                      ||d|
d         d         z  ¦  «         |  	                    |
¦  «         |                      |d	d¦  «        \  }}}}	|rO| j        |         d         D ];}|d         d         d         d
vr#|                      ||
d         d         d¦  «         Œ<�Œfd S )NTr   )r�  rF  r   zWrong path for old path.r�   r   z/Attempt to remove path has wrong id - found %r.r   r#  ú:The file id was deleted but its children were not deleted.)
r  ÚoperatorÚ
itemgetterr   r’   r¥   rQ   r_  r’  Ú_make_absent)r   r�  r°   rl   r³   r´   Úblock_iÚentry_iÚ	d_presentÚ	f_presentr  Úchild_entrys               r   r—  zDirState._apply_removals™  s  € Ý# H°dÝ(0Ô(;¸AÑ(>Ô(>ð@ñ @ô @ð  	<ñ  	<‰MˆG�Tå '¤¨dÑ 3Ô 3ÑˆG�Xà×+Ò+¨G°X¸qÑAÔAñ 3ˆG�W˜i¨ð@Øœ¨Ô0°Ô3°GÔ<��øÝð @ð @ð @Ø×#Ò# D¨'Ø$>ñ@ô @ð @ð @ð @ð@øøøð ð @  a¤¨¤¨A¤°,Ð >Ð >Ø×#Ò# D¨'Ø$>ñ@ô @ð @à˜% œ( 1œ+Ò%Ð%Ø×#Ò# D¨'Ø$UØ&+¨A¤h¨q¤kñ%2ñ3ô 3ð 3ð ×Ò˜eÑ$Ô$Ð$ð ×+Ò+¨D°#°qÑ9Ô9ñ 3ˆG�W˜i¨àð <ð $(¤?°7Ô#;¸AÔ#>ð <ð <�KØ" 1”~ aÔ(¨Ô+°<Ð?Ð?Ø×+Ò+¨D°%¸´(¸1´+ð-;ñ<ô <ð <øùð= 	<ð  	<s   ÁA9Á9!BÂBc                 óø   — 	 t          |¦  «        D ]"\  }}}}}|                      |||||¬¦  «         Œ#d S # t          j        $ r4 |                      |                     d¦  «        |d         d¦  «         Y d S w xY w)N©rŒ   r‡   r   zMissing parent)r  r�   r   r¦   r’  Údecode)r   ÚaddsrF  rÉ   r”  rŽ   rŒ   s          r   r™  zDirState._apply_insertions¼  s¾   € ð	2ÝEKÈDÁ\Ä\ð 9ð 9ÑA��X˜z¨;¸	Ø×#Ò# C¨°:¸{Ø.7ð $ñ 9ô 9ð 9ð 9ð9ð 9øõ Ô'ð 	2ð 	2ð 	2Ø×Ò 	× 0Ò 0°Ñ 8Ô 8¸#¸a¼&Ø 0ñ2ô 2ð 2ð 2ð 2ð 2ð	2øøøs   ‚26 ¶?A9Á8A9c           	      ó:	  — |                       ¦   «          |                      ¦   «          | j        g k    rt          | j        ¦  «        ‚t          | j        ¦  «        dk    rXt          j        }|  	                    ¦   «         D ]}|d          
                    |¦  «         Œ| j         
                    |¦  «         || j        d<   |                      |¦  «        }g }g }g }t          j        }| j        }	d}
t          ¦   «         }t          ¦   «         }|D �]¦\  }}}}|j        t"          ur/t%          d                     t)          |¦  «        ¦  «        ¦  «        ‚|�%||j        k    r|                      ||d|z  ¦  «         |€d}nY|€|                      ||d¦  «          ||¦  «        }t/          j        |¦  «        \  }}|r|                     ||j        f¦  «         |€d}n ||¦  «        }|€:| 
                    d|| |	|¦  «        df¦  «         |                     |¦  «         �Œ|€| 
                    |d|ddf¦  «         �Œ4||f|
k    r$| 
                    ||| |	|¦  «        f¦  «         �Œ`|                      |¦  «         g }| 
                    ||| |	|¦  «        d	f¦  «         t9          t;          |                      d|¦  «        ¦  «        ¦  «        }|D ]¿}|d         \  }}}|r	|d
z   |z   }n|}|r||t          |¦  «        d…         z   }n/|dk    rt%          d¦  «        ‚|t          |¦  «        dz   d…         }| 
                    d||d         d         |d         d         d	f¦  «         | 
                    |||d         d         dd	f¦  «         ŒÀ| 
                    |||dd	f¦  «         �Œ¨|                      ||d¦  «         	 |                      |¦  «         |                       |¦  «         |  !                    |¦  «         |  "                    |d¦  «         nX# tF          j$        $ rF}d| _%        dtM          |¦  «        vr‚ tG          j'        |d                     |¦  «        ¦  «        ‚d}~ww xY w|  (                    d¬¦  «         d| _)        dS )a§  Update 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.
        r   r   )r{  r{  rˆ   Nzmismatched entry file_id %rr�  TFrÓ   r   z!cannot rename directory to itselfr   r�  r�  r+  )*r-  r2  rR   r%   Úupdate_basis_by_deltar£   rS   r;   r/  Ú_iter_entriesrÞ   rŠ  r   r—   Ú_inv_entry_to_detailsre   rs   r˜   r™   rš   r›   r°   r’  r   r’   rÌ   rv  Ú_update_basis_apply_deletesr&  rL  r•  r–  Ú_update_basis_apply_addsÚ_update_basis_apply_changesrš  r   r   rP   r§   r›  r�   rX   )r   r‰  Ú	new_revidr1  r  r¶  ÚchangesÚdeletesr—   Úinv_to_entryÚ	root_onlyr0  rž  r}  r~  r°   rŸ  Únew_path_utf8r   Úbasename_utf8rÊ   Únew_deletesr¢  r£  Úchild_file_idÚsource_pathÚtarget_pathry   s                               r   r¸  zDirState.update_basis_by_deltaÅ  sµ  € ð 	×&Ò&Ñ(Ô(Ð(Ø×#Ò#Ñ%Ô%Ð%ØŒ<˜2ÒÐÝ% dÔ&@ÑAÔAÐAÝˆtŒ}ÑÔ Ò"Ð"å#Ô7ˆLØ×+Ò+Ñ-Ô-ð .ð .�Ø�a”—’ Ñ-Ô-Ð-Ð-ØŒM× Ò  Ñ+Ô+Ð+à$ˆŒ�aÑà×*Ò*¨5Ñ1Ô1ˆØˆØˆØˆõ Ô"ˆØÔ1ˆð ˆ	õ
 ‘%”%ˆõ ‘%”%ˆØ6;ð R	Jñ R	JÑ2ˆH�h ¨ØÔ ­Ð-Ð-Ý$Ø3×:Ò:½4À¹=¼=ÑIÔIñKô Kð KàÐ$¨°IÔ4EÒ)EÐ)EØ×#Ò# H¨gØ$AÀIÑ$MñOô Oð OàÐØ $��àÐ$Ø×'Ò'¨°'Ø(@ñBô Bð Bà &  xÑ 0Ô 0�å.5¬m¸MÑ.JÔ.JÑ+�˜mØ ð EØ—K’K ¨yÔ/BÐ CÑDÔDÐDØÐØ $��à &  xÑ 0Ô 0�ØÐØ—’˜T =°'Ø)˜\¨)Ñ4Ô4°dð<ñ =ô =ð =à—’˜GÑ$Ô$Ð$Ñ$ØÐ!Ø—’ ¨t°W¸dÀDÐIÑJÔJÐJÑJØ˜HÐ%¨Ò2Ð2ð —’ ¨}¸gØ , ¨YÑ 7Ô 7ð 9ñ :ô :ð :ñ :ð ×0Ò0°Ñ9Ô9Ð9Ø�à—’˜]¨M¸7Ø)˜\¨)Ñ4Ô4°eð=ñ >ô >ð >õ '¥tØ×,Ò,¨Q°Ñ>Ô>ñ(@ô (@ñ Aô A�ð )ð Nð N�EØCHÈÄ8Ñ@�M >°=Ø$ð 5Ø&3°dÑ&:¸^Ñ&K˜˜à&4˜Ø$ð Kà)¨K½¸MÑ8JÔ8JÐ8KÐ8KÔ,LÑLð $˜ð )¨CÒ/Ð/Ý"0ð 2;ñ #<ô #<ð <à&1µ#°mÑ2DÔ2DÀqÑ2HÐ2IÐ2IÔ&J˜Ø—K’KØ˜{¨E°!¬H°Q¬K¸¸q¼À!¼ÀeÐLñNô Nð Nà—N’NØ$ k°5¸´8¸A´;ÀÀeÐLñNô Nð Nð Nà—’Ø" M°7¸DÀ%ÐHñJô Jð Jñ Jð 	×$Ò$ W¨e°QÑ7Ô7Ð7ð	Wà×,Ò,¨WÑ5Ô5Ð5à×)Ò)¨$Ñ/Ô/Ð/à×,Ò,¨WÑ5Ô5Ð5à×+Ò+¨G°QÑ7Ô7Ð7Ð7øÝŒð 	Wð 	Wð 	WØ$(ˆDÔ!Ø ­¨A©¬Ð.Ð.Øõ Ô/°Ø0K×0RÒ0RÐSTÑ0UÔ0UñWô Wð Wøøøøð	Wøøøð 	×Ò¨DÐÑ1Ô1Ð1ØˆŒØˆs   ÏAP& Ð&Q;Ð5AQ6Ñ6Q;c                 óŠ  — |sdS |                       ¦   «         }|D ]§}|                     |d¦  «        D ]Ž}|                      |d         |d         |¦  «        \  }}}	}
|
sŒ-| j        |         d         |         }|d         d         |k    rŒY|                      d|dd…         z                       d¦  «        |d¦  «         Œ�Œ¨dS )	zACheck that none of the file_ids in new_ids are present in a tree.Nr!   r   r   r   r�   r‡   zBThis file_id is new in the delta but already present in the target)Ú_get_id_indexrã   r¥   rQ   r’  rµ  )r   rž  r‰  Ú
tree_indexÚid_indexr°   rF  r®  r¯  r°  r±  r  s               r   r–  z DirState._check_delta_ids_absentf  sý   € àð 	ØˆFØ×%Ò%Ñ'Ô'ˆØð 	2ð 	2ˆGØ—|’| G¨RÑ0Ô0ð 2ð 2�à×/Ò/°°A´¸¸A¼À
ÑKÔKñ 7�˜ )¨Yà ð àØœ¨Ô0°Ô3°GÔ<�Ø˜”8˜A”; 'Ò)Ð)àØ×#Ò# X°°A°a°C´Ñ%8×$@Ò$@ÀÑ$HÔ$HÈ'ð%1ñ2ô 2ð 2ð 2ð2ð	2ð 	2r   c                 ó<   — d| _         t          j        |||¦  «        ‚)NT)rP   r   ÚInconsistentDelta)r   rl   r°   Úreasons       r   r’  zDirState._raise_invalidz  s   € Ø $ˆÔÝÔ& t¨W°fÑ=Ô=Ð=r   c           	      ó^  — |                      d„ ¬¦  «         t          j        }|D �]…\  }}}}}t          j        |¦  «        \  }}	 |||	|¦  «        }
|                      |
¦  «        \  }}|sct          j        |¦  «        \  }}|                      ||d¦  «        \  }}}}|s|                      ||d¦  «         |                      |||¦  «         | j	        |         d         }|  
                    |
|¦  «        \  }}|r|�|                      ||d|›�¦  «         |r[||         }|d         d         d         }|dk    r||d         d<   �n|d	k    rt          ¦   «         ‚|                      ||d
¦  «         nÚt          |dz
  |dz   ¦  «        D ]�}|dk     s|t          |¦  «        k    rŒ||         }|d         dd…         ||	fk    rŒ;|d         d         |k    rt          d|
›�¦  «        ‚|d         d         d         }|dvr&|                      ||d|d         d         ›�¦  «         Œž|
t          j        |gf}|                     ||¦  «         |d         d         d         }|dk    �r|                      ¦   «         }|                     |d¦  «        }|D ]Ø}|                      |d         |d         d¦  «        \  }}}} | sŒ-| j	        |         d         |         }!|!d         d         |k    rŒY|!d         d         d         }"|"dv r|                      ||d¦  «         |!d         dd…         \  }#}$|#r	|#dz   |$z   }%n|$}% |d	|ddd¦  «        |!d         d<    |d	|%ddd¦  «        |d         d<   ŒÙn|d	k    rt          ¦   «         ‚|d         }&|&dk    r|                      |||¦  «         �Œ‡dS )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                 ó   — | d         S )Nr   r!   )Úxs    r   ú<lambda>z3DirState._update_basis_apply_adds.<locals>.<lambda>Ž  s
   €   !¤€ r   ©rF  r   z;Unable to find block for this record. Was the parent added?Nz0considered a real add but still had old_path at r   r<   r?   zEAn entry was marked as a new add but the basis target already existedr   zG_find_entry_index didnt find a key match but walking the data did, for r�   zUwe 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Ó   Fr   r>   )rˆ  r   ÚStaticTupler   r’   r¡   r¥   r’  r¨   rQ   r¢   r%   râ   r£   r™   r;   r/  r®   rÊ  rã   )'r   r¶  Ústr}  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Ì  ÚkeysrF  r®  r¯  r°  r±  Úactive_entryÚreal_active_kindÚ
active_dirÚactive_nameÚactive_pathÚnew_kinds'                                          r   r¼  z!DirState._update_basis_apply_adds~  så  € ð  	�	Š	�n�nˆ	Ñ%Ô%Ð%õ Ô%ˆØBFð j	Gñ j	GÑ>ˆH�h ¨°hÝ '¤¨hÑ 7Ô 7ÑˆG�XØ˜˜7 H¨gÑ6Ô6ˆIØ#'×#BÒ#BÀ9Ñ#MÔ#MÑ ˆK˜Øð Põ +2¬-¸Ñ*@Ô*@Ñ'�
˜Kà×/Ò/°
¸KÈÑKÔKñ FÐ Ð"2°A°~à%ð BØ×'Ò'¨°'ð)AñBô Bð Bð ×"Ò"Ð#3Ð5EÀwÑOÔOÐOà”O KÔ0°Ô3ˆEØ#'×#9Ò#9¸)ÀUÑ#KÔ#KÑ ˆK˜Øð 7ØÐ'Ø×'Ò'¨°'°'à+3¨8ð)6ñ7ô 7ð 7ð ð %1Ø˜kÔ*�Ø" 1œX aœ[¨œ^�
Ø Ò%Ð%Ø"-�E˜!”H˜Q‘K‘KØ 4Ò'Ð'Ý-Ñ/Ô/Ð/à×'Ò'¨°'ð)PñQô Qð Qð Qõ $)¨°q©¸+È¹/Ñ#JÔ#Jð Dð D�KØ" Q’�¨+½¸U¹¼Ò*CÐ*CØ Ø"'¨Ô"4�KØ" 1”~ b q bÔ)¨g°xÐ-@Ò@Ð@à Ø" 1”~ aÔ(¨GÒ3Ð3Ý,˜nð  )˜yð+ñ,ô ,ð ,ð "-¨Q¤°Ô!2°1Ô!5�JØ!¨Ð5Ð5Ø×+Ò+¨H°g°gð 0;¸1¬~¸aÔ/@Ð/@ð-CñDô Dð Døð
 #¥XÔ%AØ%0ð%2ð 3�à—’˜[¨%Ñ0Ô0Ð0à œ( 1œ+ aœ.ˆKØ˜dÒ"Ñ"ð  ×-Ò-Ñ/Ô/�ð
  —|’| G¨RÑ0Ô0�Øð Gð G�Cà×3Ò3°C¸´F¸CÀ¼FÀAÑFÔFñ ;�G˜W i°à$ð !Ø Ø#'¤?°7Ô#;¸AÔ#>¸wÔ#G�LØ$ Qœ¨Ô*¨gÒ5Ð5ð !Ø'3°A¤°qÔ'9¸!Ô'<Ð$Ø'¨<Ð7Ð7ð ×+Ò+¨H°gØ,[ñ]ô ]ð ]ð
 /;¸1¬o¸b¸q¸bÔ.AÑ+�J Ø!ð 2Ø&0°4Ñ&7¸+Ñ&E˜˜à&1˜Ø)+¨¨D°(¸A¸uÀcÑ)JÔ)J�L ”O AÑ&Ø"$ " T¨;¸¸5À#Ñ"FÔ"F�E˜!”H˜Q‘K�Kð5Gð6  Ò$Ð$Ý)Ñ+Ô+Ð+à" 1”~ˆHØ˜4ÒÐØ×"Ò" ;°¸XÑFÔFÐFùðUj	Gð j	Gr   c                 óÈ   — |D ]^\  }}}}|                       d||¦  «        }|d         �|d         d         d         dv r|                      ||d¦  «         ||d         d<   Œ_dS )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   r   Nr�   z$changed entry considered not present)rœ   r’  )r   r¿  r}  r~  r°   r×  r  s          r   r½  z$DirState._update_basis_apply_changesþ  s�   € ð 9@ð 	&ð 	&Ñ4ˆH�h ¨à—O’O A w°Ñ9Ô9ˆEØ�QŒxÐ 5¨¤8¨A¤;¨q¤>°\Ð#AÐ#AØ×#Ò# H¨gØ$JñLô Lð Là%ˆE�!ŒH�Q‰KˆKð	&ð 	&r   c                 óª  — t           j        }|D �]B\  }}}}}||du k    r|                      ||d¦  «         t          j        |¦  «        \  }}	|                      ||	d¦  «        \  }
}}}|s|                      ||d¦  «         | j        |
         d         |         }|d         d         d         }|d         d         |k    r|                      ||d¦  «         d}|d         d         d         }|d	v rî|d
k    r“|d         d         d         }|                      d||¦  «        }|d         d         d         d
k    r|                      ||d¦  «         n-|d         d         d         d	v r|                      ||d¦  «         ||d         d<   | j        |
         d         |= |dk    r:|                      |ddf¦  «        \  }}|r| j        |         d         }|s| j        |= n<||d         d<   |                      |dd¦  «        \  }}}}|r| j        |         d         }|D ]1}|d         d         d         }|d	vr|                      ||d¦  «         Œ2�ŒDdS )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.
        Nzbad delete deltar   z)basis tree does not contain removed entryr   r   zmismatched file_id in tree 1r!   s   arr?   z-Dirstate did not have matching rename entriesz3Dirstate had a rename pointing at an inactive tree0r>   r   rª  )	r;   r/  r’  r   r’   r¥   rQ   rœ   r¡   )r   rÀ  Ú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                               r   r»  z$DirState._update_basis_apply_deletes  s  € õ Ô+ˆØ;Bð >	8ñ >	8Ñ7ˆH�h ¨¨KØ˜x¨4Ð/Ò0Ð0Ø×#Ò# H¨gÐ7IÑJÔJÐJå '¤¨hÑ 7Ô 7ÑˆG�Xà×+Ò+¨G°X¸qÑAÔAñ @ˆK˜ k°<àð QØ×#Ò# H¨gØ$OñQô Qð Qà”O KÔ0°Ô3°KÔ@ˆEà œ( 1œ+ aœ.ˆKØ�QŒx˜Œ{˜gÒ%Ð%Ø×#Ò# H¨gØ$BñDô Dð DàˆIØ˜Q”x ”{ 1”~ˆHØ˜eÐ#Ð#ð  $Ò&Ð&Ø"'¨¤(¨1¤+¨a¤.�KØ#'§?¢?°1°g¸{Ñ#KÔ#K�LØ# A” qÔ)¨!Ô,°Ò4Ð4Ø×+Ò+¨H°gØ,[ñ]ô ]ð ]ð ]à% aœ¨Ô+¨AÔ.°%Ð7Ð7Ø×+Ò+¨H°gð-5ñ6ô 6ð 6ð *.�L ”O AÑ&Ø”O KÔ0°Ô3°KÐ@Ø˜tÒ#Ð#ð
 !%× ?Ò ?Ø! 3¨Ð,ñ!.ô !.ñ�_Øàð AØ$(¤O°OÔ$DÀQÔ$G˜	Ø(ð Aà $¤°Ð @øð #��a”˜‘à×/Ò/°¸#¸qÑAÔAñ 7�˜ )¨Yàð <Ø $¤°Ô 8¸Ô ;�IØ(ð 8ð 8�Ø#.¨q¤>°!Ô#4°QÔ#7Ð Ø#¨5Ð0Ð0Ø×'Ò'¨°'ð)7ñ8ô 8ð 8øñ8ðs>	8ð >	8r   c                 ó,  — |D ]�\  }}|                       |||¦  «        }|d         €*|                      |                     d¦  «        |d¦  «         |d         |         d         dk    r*|                      |                     d¦  «        |d¦  «         Œ‘dS )aI  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‡   zThis parent is not present.r   r>   zThis parent is not a directory.)rœ   r’  rµ  )r   r0  Úindexr   r°   r  s         r   rš  z#DirState._after_delta_check_parentsY  sÄ   € ð &-ð 
	Pð 
	PÑ!ˆL˜'ð —O’O E¨7°LÑAÔAˆEØ�QŒxÐØ×#Ò# L×$7Ò$7¸Ñ$?Ô$?Ø$+Ð-JñLô Lð Lð �QŒx˜Œ˜qÔ! TÒ)Ð)Ø×#Ò# L×$7Ò$7¸Ñ$?Ô$?Ø$+Ð-NñPô Pð Pøð
	Pð 
	Pr   c                 ón  — 	 ||j         dz           }n# t          $ r Y dS w xY w|dk    r‡| j        €|                      ¦   «          |j        | j        k     r^|j        | j        k     rPd||j        |d         d         d         t          |¦  «        f|d         d<   |                      |g¦  «         dS dS dS dS )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.
        é ð  Nr=   r   r   r   )	Úst_modeÚKeyErrorr[   Ú_sha_cutoff_timeÚst_mtimeÚst_ctimerª   r«   r�   )r   r  r&   Ú
stat_valueÚ_stat_to_minikindrÉ   s         r   Ú_observed_sha1zDirState._observed_sha1m  së   € ð	Ø(¨Ô);¸hÑ)FÔGˆHˆHøÝð 	ð 	ð 	à�4�4ð	øøøð �tÒÐØÔ Ð(Ø×%Ò%Ñ'Ô'Ð'ØÔ# dÔ&7Ò7Ð7Ø"Ô+¨dÔ.?Ò?Ð?Ø# T¨:Ô+=¸uÀQ¼xÈ¼{È1¼~Ý(¨Ñ4Ô4ð6��a”˜‘à×#Ò# U GÑ,Ô,Ð,Ð,Ð,ð Ðð 8Ð7Ø?Ð?ó   ‚ “
! !c                 ó`   — t          t          j        ¦   «         ¦  «        dz
  | _        | j        S )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Útimer[   rt   s    r   rô  zDirState._sha_cutoff_timeƒ  s(   € õ  ¥¤	¡¤Ñ,Ô,¨qÑ0ˆÔØÔ Ð r   c                 ó*   — t          j        |¦  «        S )z(Return the os.lstat value for this path.)r4   Úlstat)r   r(   r  s      r   Ú_lstatzDirState._lstat�  s   € åŒx˜Ñ Ô Ð r   c                 ód   — t          j        d|z   ¦  «         | j                             |¦  «        S )Nzdirstate sha1 )r   Úmutterr_   r&   r'   s     r   ra   zDirState._sha1_file_and_mutter”  s1   € õ 	ŒÐ%¨Ñ/Ñ0Ô0Ð0ØÔ"×'Ò'¨Ñ0Ô0Ð0r   c                 óB   — | j         rt          t          |z  ¦  «        S |S )zIs this file executable?)rk   Úboolr   )r   ÚmodeÚold_executables      r   Ú_is_executablezDirState._is_executableš  s%   € àÔ(ð 	"Ý� $™Ñ'Ô'Ð'à!Ð!r   c                 óø   — t          |t          ¦  «        rt          j        |¦  «        }t          j        |¦  «        }t          j        ¦   «         dvr't          j        |¦  «                             d¦  «        }|S )zRead the target of a symlink)rŒ  ÚasciizUTF-8)	r‘  r§   r4   ÚfsencodeÚreadlinkÚsysÚgetfilesystemencodingÚfsdecoder—   )r   r(   Úold_linkÚtargets       r   Ú
_read_linkzDirState._read_link¡  sm   € õ �g�sÑ#Ô#ð 	+õ
 ”k 'Ñ*Ô*ˆGÝ”˜WÑ%Ô%ˆÝÔ$Ñ&Ô&Ð.@Ð@Ð@å”[ Ñ(Ô(×/Ò/°Ñ8Ô8ˆFØˆr   c                 ó8   — |                       ¦   «          | j        S )z>Return a list of the parent tree revision ids that are ghosts.)rÖ   rR   rt   s    r   r.  zDirState.get_ghosts³  s   € à×#Ò#Ñ%Ô%Ð%ØŒ|Ðr   c                 ó  — | j         t          j        k    rH| j        t          j        k    r3| j                             d¦  «         | j                             ¦   «         S g }|                     |                      |  	                    ¦   «         ¦  «        ¦  «         |                     |  
                    | j        ¦  «        ¦  «         |                     |                      ¦   «         ¦  «         |                      |¦  «        S )z5Serialise the entire dirstate to a sequence of lines.r   )rN   r;   r|   rO   rT   rÛ   Ú	readlinesrÞ   Ú_get_parents_liner,  Ú_get_ghosts_linerR   rM  Ú_iter_entry_linesÚ_get_output_lines)r   Úliness     r   Ú	get_lineszDirState.get_lines¸  sÕ   € àÔ¥(Ô"?Ò?Ð?ØÔ$­Ô(EÒEÐEàÔ×!Ò! !Ñ$Ô$Ð$ØÔ#×-Ò-Ñ/Ô/Ð/ØˆØ�Š�T×+Ò+¨D×,?Ò,?Ñ,AÔ,AÑBÔBÑCÔCÐCØ�Š�T×*Ò*¨4¬<Ñ8Ô8Ñ9Ô9Ð9Ø�Š�T×+Ò+Ñ-Ô-Ñ.Ô.Ð.Ø×%Ò% eÑ,Ô,Ð,r   c                 óT   — d                      dt          |¦  «        z  g|z   ¦  «        S )z7Create a line for the state file for ghost information.rÒ   rK  ©rO  r£   )r   Ú	ghost_idss     r   r  zDirState._get_ghosts_lineÅ  s'   € à�zŠz˜5¥3 y¡>¤>Ñ1Ð2°YÑ>Ñ?Ô?Ð?r   c                 óT   — d                      dt          |¦  «        z  g|z   ¦  «        S )z9Create a line for the state file for parents information.rÒ   rK  r  )r   rs  s     r   r  zDirState._get_parents_lineÉ  s'   € à�zŠz˜5¥3 z¡?¤?Ñ2Ð3°jÑ@ÑAÔAÐAr   c                 óP   — t          | j        |                      ¦   «         ¦  «        S )zCreate lines for entries.)ÚmaprT  r¹  rt   s    r   r  zDirState._iter_entry_linesÍ  s!   € å�4Ô&¨×(:Ò(:Ñ(<Ô(<Ñ=Ô=Ð=r   c                 ó®   — |                       ¦   «         }|dk    rt          fd„}|S |dk    rt          fd„}|S |dk    rt          fd„}|S t          fd„}|S )a  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.
        r   c                 óš   — | d         | d         | d         f}|| d         | d          || d         ¦  «        | d         dk    | d	         fgfS )
Nr   r   r   r   rŽ  rJ  é   rH   é   r!   ©r  Ú_intÚpath_name_file_id_keys      r   Úfields_to_entry_0_parentsz@DirState._get_fields_to_entry.<locals>.fields_to_entry_0_parentsÜ  sb   € Ø)/°¬°F¸1´I¸vÀa¼yÐ(IÐ%Ø-à˜qœ	Ø˜qœ	Ø˜˜V AœY™œØ˜qœ	 TÒ)Ø˜qœ	ðð0ð ð r   r   c                 óü   — | d         | d         | d         f}|| d         | d          || d         ¦  «        | d         dk    | d	         f| d
         | d          || d         ¦  «        | d         dk    | d         fgfS )Nr   r   r   r   rŽ  rJ  r#  rH   r$  é   é	   é
   é   é   r!   r%  s      r   Úfields_to_entry_1_parentz?DirState._get_fields_to_entry.<locals>.fields_to_entry_1_parentè  s›   € Ø)/°¬°F¸1´I¸vÀa¼yÐ(IÐ%Ø-à˜qœ	Ø˜qœ	Ø˜˜V AœY™œØ˜qœ	 TÒ)Ø˜qœ	ðð ˜qœ	Ø˜qœ	Ø˜˜V BœZÑ(Ô(Ø˜rœ
 dÒ*Ø˜rœ
ðð0ð ð r   r   c           	      ó^  — | d         | d         | d         f}|| d         | d          || d         ¦  «        | d         dk    | d	         f| d
         | d          || d         ¦  «        | d         dk    | d         f| d         | d          || d         ¦  «        | d         dk    | d         fgfS )Nr   r   r   r   rŽ  rJ  r#  rH   r$  r*  r+  r,  r-  r.  é   é   é   é   é   r!   r%  s      r   Úfields_to_entry_2_parentsz@DirState._get_fields_to_entry.<locals>.fields_to_entry_2_parentsü  sÔ   € Ø)/°¬°F¸1´I¸vÀa¼yÐ(IÐ%Ø-à˜qœ	Ø˜qœ	Ø˜˜V AœY™œØ˜qœ	 TÒ)Ø˜qœ	ðð ˜qœ	Ø˜qœ	Ø˜˜V BœZÑ(Ô(Ø˜rœ
 dÒ*Ø˜rœ
ðð ˜rœ
Ø˜rœ
Ø˜˜V BœZÑ(Ô(Ø˜rœ
 dÒ*Ø˜rœ
ðð0ð ð r   c                 ó˜   ‡ ‡— ‰ d         ‰ d         ‰ d         f}ˆˆ fd„t          dt          ‰ ¦  «        dz
  d¦  «        D ¦   «         }||fS )Nr   r   r   c           	      óŒ   •— g | ]@}‰|         ‰|d z             ‰‰|dz            ¦  «        ‰|dz            dk    ‰|dz            f‘ŒAS )r   r   r   rH   rŽ  r!   )rx   Úcurr&  r  s     €€r   rz   zTDirState._get_fields_to_entry.<locals>.fields_to_entry_n_parents.<locals>.<listcomp>  su   ø€ ð Eð Eð Eð
 !$ð ! œ+Ø   q¡œ/Ø˜$˜v c¨A¡gœÑ/Ô/Ø   q¡œ/¨TÒ1Ø   q¡œ/ð	ð Eð Eð Er   r   rJ  )râ   r£   )r  r&  r'  Útreess   ``  r   Úfields_to_entry_n_parentsz@DirState._get_fields_to_entry.<locals>.fields_to_entry_n_parents  sw   øø€ Ø)/°¬°F¸1´I¸vÀa¼yÐ(IÐ%ðEð Eð Eð Eð Eõ
 (-¨Qµ°F±´¸a±ÀÑ'CÔ'CðEñ Eô E�ð -¨eÐ3Ð3r   )rV  rü  )r   Únum_present_parentsr(  r/  r6  r;  s         r   rØ   zDirState._get_fields_to_entryÑ  s³   € ð #×7Ò7Ñ9Ô9ÐØ !Ò#Ð#Ý7:ð 	ð 	ð 	ð 	ð -Ð,Ø  AÒ%Ð%Ý69ð ð ð ð ð$ ,Ð+Ø  AÒ%Ð%Ý7:ð ð ð ð ð2 -Ð,å7:ð 4ð 4ð 4ð 4ð -Ð,r   c                 óR   — |                       ¦   «          t          | j        ¦  «        S )z=Return a list of the parent tree ids for the directory state.)rÖ   rL  rS   rt   s    r   r,  zDirState.get_parent_ids"  s$   € à×#Ò#Ñ%Ô%Ð%Ý�D”MÑ"Ô"Ð"r   c                 óÒ  — |                       ¦   «          ||df}|                      |¦  «        \  }}|s|dddfS | j        |         d         }|                      ||¦  «        \  }}|t	          |¦  «        k     rj||         d         d         |k    rR||         d         |         d         dvr||ddfS |dz  }|t	          |¦  «        k     r||         d         d         |k    °R||ddfS )aw  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.
        r   r   Fr   r�   T)r-  r¡   rQ   r¢   r£   )	r   r³   r´   rË  rF  r¼   r½   r¾   r¿   s	            r   r¥   zDirState._get_block_entry_index'  s  € ð( 	×&Ò&Ñ(Ô(Ð(Ø�x Ð$ˆØ#×>Ò>¸sÑCÔCÑˆ�WØð 	0à  5¨%Ð/Ð/Ø” Ô,¨QÔ/ˆØ#×5Ò5°c¸5ÑAÔAÑˆ�Wð �C ™JœJÒ&Ð&¨5°Ô+=¸aÔ+@ÀÔ+CÀxÒ+OÐ+OØ�[Ô! !Ô$ ZÔ0°Ô3¸<ÐGÐGà" K°°tÐ;Ð;Ø˜1ÑˆKð	 �C ™JœJÒ&Ð&¨5°Ô+=¸aÔ+@ÀÔ+CÀxÒ+OÐ+Oð
 ˜K¨¨uÐ4Ð4r   c           	      ó’  — |                       ¦   «          |�ðt          |t          ¦  «        s't          j        dt          |¦  «        ›d|›�¦  «        ‚t          j        |¦  «        \  }}|                      |||¦  «        \  }}}	}
|
sdS | j	        |         d         |         }|d         d         r|d         |         d         dvst          d	¦  «        ‚|r-|d         d         |k    rd
| _        t          j        d¦  «        ‚|S |                      ¦   «                              |d¦  «        }|sdS |D �]}|                      |¦  «        \  }}|sŒ| j	        |         d         }|                      ||¦  «        \  }}|rÄ| j	        |         d         |         }|d         |         d         dv r|c S |d         |         d         dk    r	|r|c S  dS |d         |         d         dk    r*t          d|›d|d         |         d         ›d|›�¦  «        ‚|d         |         d         }|                      |||¬¦  «        c S �ŒdS )a«  Get 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)
        Nzpath_utf8 is not bytes: r‘   r‹   r   r   r   r�   zunversioned entry?Tz<integrity error ? : mismatching tree_index, file_id and pathr!   ¾   r>   r=   r@   rA   r<   r?   úentry z has invalid minikind z
 for tree )r‰   rŒ   )r-  r‘  r˜   r   r   r›   r   r’   r¥   rQ   r™   rP   rÊ  rã   r¡   r¢   rœ   )r   rË  r‰   rŒ   rŠ   r³   r´   r¼   r¿   rè  ré  r  Úpossible_keysrF  r½   r¾   Ú	real_paths                    r   rœ   zDirState._get_entryL  sê  € ð( 	×&Ò&Ñ(Ô(Ð(ØÐ Ý˜i­Ñ/Ô/ð FÝ”o�oÝ)-¨i©¬¨¨¸)¸)ð'Eñ Fô Fð Fõ !(¤¨iÑ 8Ô 8ÑˆG�Xà×+Ò+¨G°X¸zÑJÔJñ @ˆK˜ k°<àð "Ø!�zØ”O KÔ0°Ô3°KÔ@ˆEØ˜!”H˜Q”Kð ; E¨!¤H¨ZÔ$8¸Ô$;À<Ð$OÐ$OÝ$Ð%9Ñ:Ô:Ð:Øð KØ˜”8˜A”; +Ò-Ð-Ø,0�DÔ)Ý œ/ð +Jñ Kô Kð KàˆLà ×.Ò.Ñ0Ô0×4Ò4°[À"ÑEÔEˆMØ ð "Ø!�zØ$ð "@ñ "@�à×3Ò3°CÑ8Ô8ñ %�˜Wð ð Øð œ¨Ô4°QÔ7�Ø'+×'=Ò'=¸cÀ5Ñ'IÔ'IÑ$�˜WØð @Ø œO¨KÔ8¸Ô;¸KÔH�Eð ˜Q”x 
Ô+¨AÔ.Ð2JÐJÐJð  %˜˜˜Ø˜Q”x 
Ô+¨AÔ.°$Ò6Ð6à*ð )Ø#(˜L˜L˜LØ)˜z˜zØ˜Q”x 
Ô+¨AÔ.°$Ò6Ð6Ý,˜nà$˜u˜uØ$ Qœx¨
Ô3°AÔ6Ð6Ð6Ø)˜zð+ñ,ô ,ð ,ð
 !& a¤¨Ô 4°QÔ 7�IØŸ?š?¨:À;Ø5>ð +ñ @ô @ð @ð @ð @ñ+@ð. �:r   c                 ó‚  — |€t          ¦   «         } | ||¦  «        }dg fdg fg}|d         d                              ddt          j        fddddt          j        fgf¦  «         |                     ¦   «          	 |                     g |¦  «         |                     ¦   «          n#  | 	                    ¦   «          ‚ xY w|S )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.
        Nr   r   r   r>   F)
r.   rÞ   r   ÚROOT_IDr;   r©   Ú
lock_writeÚ	_set_dataÚsavero  )Úclsrl   rm   rG  Úempty_tree_dirblockss        r   rd  zDirState.initialize�  sà   € ð" Ð Ý/Ñ1Ô1ˆMØ��T˜=Ñ)Ô)ˆà!$ b 	¨C°¨9Ð5Ðà˜QÔ Ô"×)Ò)Ø�3�	Ô)Ð*Ø�s˜A˜u¥hÔ&7Ð8ð-ð ñ	ô 	ð 	ð 	×ÒÑÔÐð	Ø×Ò˜RÐ!5Ñ6Ô6Ð6Ø�KŠK‰MŒMˆMˆMøð	Ø�MŠM‰OŒOˆOØøøøØˆs   Á:*B% Â%B<c                 óv  — | j         }t          j        |         }| j        }|dk    rd}d}d}nu|dk    r)| j        €d}n| j                             d¦  «        }d}d}nF|dk    r| j        pd}| j        pd}| j        }n&|d	k    r| j	        pd}d}d}nt          d
| z  ¦  «        ‚t          j        |||||¦  «        S )a1  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.
        rD   r   r   FrF   Nr‡   rC   rG   zcan't pack %s)r±   r;   r­   ÚrevisionÚsymlink_targetr—   Ú	text_sha1Ú	text_sizer”  r“  r¤   r   rÕ  )rŸ  r±   rÉ   rR  rŽ   rÇ   r”  s          r   rº  zDirState._inv_entry_to_detailsÁ  sþ   € ð Œ~ˆÝÔ-¨dÔ3ˆØÔ&ˆ	Ø�;ÒÐØˆKØˆDØˆJˆJØ�YÒÐØÔ'Ð/Ø!��à'Ô6×=Ò=¸fÑEÔE�ØˆDØˆJˆJØ�VŠ^ˆ^Ø#Ô-Ð4°ˆKØÔ&Ð+¨!ˆDØ"Ô-ˆJˆJØÐ%Ò%Ð%Ø#Ô6Ð=¸#ˆKØˆDØˆJˆJå˜O¨iÑ7Ñ8Ô8Ð8ÝÔ'¨°+¸tØ(2°Iñ?ô ?ð 	?r   c              #   óÐ  K  — g }|g}d}|rÚ|}g }|D ]Ï}|                       |ddf¦  «        \  }}|dk    rd}t          | j        ¦  «        dk    r dS |sŒC| j        |         }	|	d         D ]v}
|
d         |         d         }||vr|
V — |dk    rR|
d         d         r!|
d         d         dz   |
d         d         z   }n|
d         d         }|                     |¦  «         ŒwŒÐ|°ØdS dS )a«  Iterate 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�   r   r   r   Nr>   rÓ   )r¡   r£   rQ   rÞ   )r   rË  rŒ   r  Únext_pending_dirsrB   rl   r¼   r½   r¾   r  r±   s               r   r•  zDirState._iter_child_entrieså  s^  è è € ð ˆØ&˜KÐØˆØð 	7Ø,ˆLØ "ÐØ$ð 7ð 7�Ø'+×'FÒ'FØ˜3 Ð$ñ(&ô (&Ñ$�˜Wà !Ò#Ð#Ø"#�KÝ˜4œ?Ñ+Ô+¨qÒ0Ð0ð ˜˜Øð àØœ¨Ô4�Ø" 1œXð 	7ð 	7�EØ  œ8 JÔ/°Ô2�DØ 6Ð)Ð)Ø#˜˜˜Ø˜t’|�|Ø  œ8 Aœ;ð /Ø#(¨¤8¨A¤;°Ñ#5¸¸a¼À¼Ñ#C˜D˜Dà#(¨¤8¨A¤;˜DØ)×0Ò0°Ñ6Ô6Ð6øð	7ð!  ð 	7ð 	7ð 	7ð 	7ð 	7r   c              #   ób   K  — |                       ¦   «          | j        D ]}|d         E d{V —† ŒdS )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)r-  rQ   )r   rD   s     r   r¹  zDirState._iter_entries	  sT   è è € ð 	×&Ò&Ñ(Ô(Ð(Øœð 	$ð 	$ˆIØ  ”|Ð#Ð#Ð#Ð#Ð#Ð#Ð#Ð#ð	$ð 	$r   c                 ó�   — | j         €9i }|                      ¦   «         D ]\  }}|                      ||¦  «         Œ|| _         | j         S )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.
        )rX   r¹  r¯   )r   rÌ  rF  Útree_detailss       r   rÊ  zDirState._get_id_index	  sY   € ð Œ>Ð!ØˆHØ%)×%7Ò%7Ñ%9Ô%9ð 5ð 5Ñ!��\Ø×%Ò% h°Ñ4Ô4Ð4Ð4Ø%ˆDŒNØŒ~Ðr   c                 ó¼   — |d         }t           j                             |¦  «        }||vrt          j        |¦  «        ||<   dS ||         }||vr||fz   ||<   dS dS )z(Add this entry to the _id_index mapping.r   N)r   rÕ  Úfrom_sequence©r   rÌ  rÆ   r°   Ú
entry_keyss        r   r¯   zDirState._add_to_id_index%	  s}   € ð ˜A”,ˆÝ Ô,×:Ò:¸9ÑEÔEˆ	Ø˜(Ð"Ð"Ý ,Ô 8¸Ñ DÔ DˆH�WÑÐÐà! 'Ô*ˆJØ 
Ð*Ð*Ø$.°)°Ñ$=�˜Ñ!Ð!Ð!ð +Ð*r   c                 ó®   — |d         }t          ||         ¦  «        }|                     |¦  «         t          j                             |¦  «        ||<   dS )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.
        r   N)rL  Úremover   rÕ  rV  rW  s        r   Ú_remove_from_id_indexzDirState._remove_from_id_index7	  sT   € ð ˜A”,ˆÝ˜( 7Ô+Ñ,Ô,ˆ
Ø×Ò˜)Ñ$Ô$Ð$Ý(Ô4×BÒBÀ:ÑNÔNˆ�ÑÐÐr   c                 óJ  — t           j        g}|                     d¦  «         d                     |¦  «        }|                     dt	          j        |¦  «        fz  ¦  «         t          |¦  «        dz
  }|                     d|fz  ¦  «         |                     |¦  «         |S )zŽFormat lines for final output.

        :param lines: A sequence of lines containing the parents list and the
            path lines.
        r   s    
 s
   crc32: %d
r   s   num_entries: %d
)r;   ÚHEADER_FORMAT_3rÞ   rO  ÚzlibÚcrc32r£   )r   r  Úoutput_linesÚinventory_textÚnum_entriess        r   r  zDirState._get_output_linesB	  s�   € õ !Ô0Ð1ˆØ�Š�SÑÔÐØ"Ÿš¨Ñ.Ô.ˆØ×Ò˜N­d¬j¸Ñ.HÔ.HÐ-JÑJÑKÔKÐKå˜%‘j”j 1‘nˆØ×ÒÐ0°K°>ÑAÑBÔBÐBØ×Ò˜NÑ+Ô+Ð+ØÐr   c                 ó,   — ddd|dt           j        df|fS )z%Return a deleted row for fileid_utf8.rÓ   s   RECYCLED.BINs   filer   r   )r;   r©   )r   r‰   r0  s      r   Ú_make_deleted_rowzDirState._make_deleted_rowR	  s'   € à�o w°¸QÅÔ@QØðØðð 	r   c                 óT   — t          | j        ¦  «        t          | j        ¦  «        z
  S )z0The number of parent entries in each record row.)r£   rS   rR   rt   s    r   rV  zDirState._num_present_parentsW	  s!   € å�4”=Ñ!Ô!¥C¨¬Ñ$5Ô$5Ñ5Ð5r   c                 óD   — |€t          ¦   «         } | ||||¬¦  «        }|S )a¢  Construct 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.
        N)rn   ro   )r.   )rI  rl   rm   rn   ro   rG  s         r   Úon_filezDirState.on_file[	  s?   € ð Ð Ý/Ñ1Ô1ˆMØ��T˜=Ø(:Ø-DðFñ Fô Fˆð ˆr   c                 óz   — |                       ¦   «          | j        t          j        k    rt	          | ¦  «         dS dS )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Ö   rO   r;   rM   Ú_read_dirblocksrt   s    r   r-  z"DirState._read_dirblocks_if_neededq	  sC   € ð 	×#Ò#Ñ%Ô%Ð%ØÔ¥8Ô#9Ò9Ð9Ý˜DÑ!Ô!Ð!Ð!Ð!ð :Ð9r   c                 óÔ  — |                       ¦   «          | j                             ¦   «         }|                     d¦  «        }t	          |d         ¦  «        }|dd…         | _        | j                             ¦   «         }|                     d¦  «        }t	          |d         ¦  «        }|dd…         | _        t          j        | _	        | j         
                    ¦   «         | _        dS )a  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Ò   r   r   rÔ   r   N)Ú_read_preluderT   Úreadliner’   rü  rS   rR   r;   r|   rN   ÚtellrZ   )r   Úparent_linerº   rt  Ú
ghost_lineÚ
num_ghostss         r   Ú_read_headerzDirState._read_header|	  sÈ   € ð 	×ÒÑÔÐØÔ&×/Ò/Ñ1Ô1ˆØ× Ò  Ñ'Ô'ˆÝ˜$˜qœ'‘l”lˆØ˜Q˜r˜Tœ
ˆŒØÔ%×.Ò.Ñ0Ô0ˆ
Ø×Ò Ñ&Ô&ˆÝ˜˜aœ‘\”\ˆ
Ø˜A˜b˜D”zˆŒÝ%Ô:ˆÔØ"Ô.×3Ò3Ñ5Ô5ˆÔÐÐr   c                 ó’   — | j         st          j        | ¦  «        ‚| j        t          j        k    r|                      ¦   «          dS dS )z/Read the header of the dirstate file if needed.N)rV   r   ÚObjectNotLockedrN   r;   rM   rq  rt   s    r   rÖ   zDirState._read_header_if_needed�	  sQ   € ð Ôð 	/ÝÔ(¨Ñ.Ô.Ð.ØÔ¥Ô!7Ò7Ð7Ø×ÒÑÔÐÐÐð 8Ð7r   c                 óX  — | j                              ¦   «         }|t          j        k    r't	          j        d                     |¦  «        ¦  «        ‚| j                              ¦   «         }|                     d¦  «        st	          j        d|z  ¦  «        ‚t          |t          d¦  «        d…         ¦  «        | _
        | j                              ¦   «         }|                     d¦  «        st	          j        d¦  «        ‚t          |t          d¦  «        d…         ¦  «        | _        dS )ar  Read 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.
        zinvalid header line: {!r}s   crc32: zmissing crc32 checksum: %rrÔ   s   num_entries: zmissing num_entries lineN)rT   rl  r;   r]  r   r   rš   Ú
startswithrü  r£   Úcrc_expectedÚ_num_entries)r   ÚheaderÚcrc_lineÚnum_entries_lines       r   rk  zDirState._read_prelude˜	  s  € ð Ô!×*Ò*Ñ,Ô,ˆØ•XÔ-Ò-Ð-Ý”/Ø+×2Ò2°6Ñ:Ô:ñ<ô <ð <àÔ#×,Ò,Ñ.Ô.ˆØ×"Ò" :Ñ.Ô.ð 	KÝ”/Ð">ÀÑ"IÑJÔJÐJÝ ­¨Z©¬¸Ð);Ô <Ñ=Ô=ˆÔØÔ+×4Ò4Ñ6Ô6ÐØ×*Ò*Ð+;Ñ<Ô<ð 	>Ý”/Ð"<Ñ=Ô=Ð=ÝÐ 0µÐ5EÑ1FÔ1FÀrÐ1IÔ JÑKÔKˆÔÐÐr   c                 ól   — |                       ¦   «                              t          |¦  «        d¦  «        S )z Find a sha1 given a stat lookup.N)Ú_get_packed_stat_indexrã   r«   )r   rl   Ústat_results      r   Úsha1_from_statzDirState.sha1_from_stat®	  s,   € à×*Ò*Ñ,Ô,×0Ò0µ¸;Ñ1GÔ1GÈÑNÔNÐNr   c                 óÂ   — | j         €Ri }|                      ¦   «         D ]4\  }}|d         d         dk    r|d         d         ||d         d         <   Œ5|| _         | j         S )z+Get a packed_stat index of self._dirblocks.Nr   r=   r   rŽ  )rY   r¹  )r   rï  rF  rT  s       r   r|  zDirState._get_packed_stat_index²	  st   € àÔ"Ð*ØˆEØ%)×%7Ò%7Ñ%9Ô%9ð Cð CÑ!��\Ø ”? 1Ô%¨Ò-Ð-Ø0<¸Q´ÀÔ0B�E˜, qœ/¨!Ô,Ñ-øØ&+ˆDÔ#ØÔ&Ð&r   c                 ó  — | j         rt          j        d¦  «         dS |                      ¦   «         sdS d}| j        dk    r3| j                             ¦   «         \  }}|| _        |j        | _        |sdS 	 |  	                    ¦   «         }| j         
                    d¦  «         | j                             |¦  «         | j                             ¦   «          | j                             ¦   «          |                      ¦   «          |                      ¦   «          |r1| j                             ¦   «         | _        | j        j        | _        dS dS # |r/| j                             ¦   «         | _        | j        j        | _        w xY w)a¿  Save 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   )rP   r   r  Ú_worth_savingrW   rV   Útemporary_write_lockÚfrT   r  rÛ   Ú
writelinesÚtruncateÚflushÚ_maybe_fdatasyncrƒ   Úrestore_read_lock)r   Úgrabbed_write_lockÚnew_lockr  s       r   rH  zDirState.save¼	  s   € ð Ô ð 	õ ŒLð 4ñ 5ô 5ð 5àˆFð
 ×!Ò!Ñ#Ô#ð 	ØˆFà"ÐØÔ˜sÒ"Ð"Ø+/Ô+;×+PÒ+PÑ+RÔ+RÑ(Ð ð
  (ˆDÔØ'œzˆDÔØ%ð à�ð	6Ø—N’NÑ$Ô$ˆEØÔ×!Ò! !Ñ$Ô$Ð$ØÔ×'Ò'¨Ñ.Ô.Ð.ØÔ×%Ò%Ñ'Ô'Ð'ØÔ×"Ò"Ñ$Ô$Ð$Ø×!Ò!Ñ#Ô#Ð#Ø×!Ò!Ñ#Ô#Ð#à!ð 6Ø#'Ô#3×#EÒ#EÑ#GÔ#G�Ô Ø#'Ô#3Ô#5�Ô Ð Ð ð6ð 6øÐ!ð 6Ø#'Ô#3×#EÒ#EÑ#GÔ#G�Ô Ø#'Ô#3Ô#5�Ô Ð5Ð5Ð5Ð5s   Á5B"E Å3E?c                 ó”   — | j                              d¦  «        r-t          j        | j                             ¦   «         ¦  «         dS dS )z4Flush to disk if possible and if not configured off.zdirstate.fdatasyncN)rj   rã   r   Ú	fdatasyncrT   r6   rt   s    r   rˆ  zDirState._maybe_fdatasyncó	  sL   € àÔ×!Ò!Ð"6Ñ7Ô7ð 	9ÝÔ˜dÔ.×5Ò5Ñ7Ô7Ñ8Ô8Ð8Ð8Ð8ð	9ð 	9r   c                 óà   — | j         t          j        k    s| j        t          j        k    rdS | j        t          j        k    r,| j        dk    rdS t          | j        ¦  «        | j        k    rdS dS )z'Is it worth saving the dirstate or not?TrÔ   F)rN   r;   r~   rO   r}   rg   r£   rf   rt   s    r   r‚  zDirState._worth_savingø	  sr   € àÔ¥(Ô"=Ò=Ð=ØÔ'­8Ô+FÒFÐFØ�4ØÔ¥8Ô#CÒCÐCØÔ'¨2Ò-Ð-à�uõ �4Ô+Ñ,Ô,°Ô0HÒHÐHØ�tØˆur   c                 ó„   — || _         |                      d¬¦  «         t          |¦  «        | _        d| _        d| _        dS )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.
        Tr+  N)rQ   r�   rL  rS   rX   rY   )r   rs  Ú	dirblockss      r   rG  zDirState._set_data
  sF   € ð $ˆŒØ×Ò¨DÐÑ1Ô1Ð1Ý˜ZÑ(Ô(ˆŒØˆŒØ"&ˆÔÐÐr   c                 óö  — |                       ¦   «          t          |¦  «        rt          | j        ¦  «        ‚|                      d|¬¦  «        }|d         d         |k    rdS |j        t          k    r/t          d                     t          |¦  «        ¦  «        ¦  «        ‚|  
                    |¦  «         |                      dd|fdd|d         d         d	         ¬
¦  «         |                      ¦   «          dS )a;  Change 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).
        r   r´  r   Nrˆ   r   r>   r   rŽ  )rŒ   r�   )r-  r£   r%   Úset_path_idrœ   rs   r˜   r™   rš   r›   r­  r�   r�   )r   rl   Únew_idr  s       r   r’  zDirState.set_path_id
  s  € ð 	×&Ò&Ñ(Ô(Ð(Ýˆt‰9Œ9ð 	8å% dÔ&6Ñ7Ô7Ð7à—’ ¨T�Ñ2Ô2ˆØ�Œ8�AŒ;˜&Ò Ð àˆFØÔ�uÒ$Ð$Ý Ø/×6Ò6µt¸F±|´|ÑDÔDñFô Fð Fð 	×Ò˜%Ñ Ô Ð Ø×Ò˜S # vÐ.°Ø&)°u¸Q´xÀ´{À1´~ð 	ñ 	Gô 	Gð 	Gà×ÒÑÔÐÐÐr   c                 óÖ  ‡— |                       ¦   «          i }i }ˆfd„|D ¦   «         }t          |¦  «        }t          j        }|                      ¦   «         D ]^}|d         d         d         dv rŒ|d         d         gt
          j        g|z  z   ||d         <   |                      ||d         ¦  «         Œ_t          |¦  «        D �]$\  }	}
|	dz   }	t
          j        g||	z
  z  }d}|
 	                    ¦   «         D �]î\  }}|j
        }|                     d¦  «        }t          j        |¦  «        \  }}||k    r|}n|} ||||¦  «        }|                     |d¦  «        }|D ] }||k    r |d|dd	d
¦  «        ||         |	<   Œ!||v r|                      |¦  «        ||         |	<   Œ­g }t!          |	¦  «        D ]×}t          |¦  «        s |                     t
          j        ¦  «         Œ1t%          t'          |¦  «        ¦  «        }||         |         d         dv r"|                     ||         |         ¦  «         Œ…d                     |dd…         ¦  «                             d¦  «        }|                      |d|dd	d
¦  «        ¦  «         ŒØ|                     |                      |¦  «        ¦  «         |                     |¦  «         |||<   |                      ||¦  «         �Œð�Œ&|                      |                     ¦   «         ¦  «        }|                      |¦  «         d„ |D ¦   «         | _        t7          ‰¦  «        | _        |                      d¬¦  «         || _        dS )aL  Set 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.
        c                 ó"   •— g | ]\  }}|‰v¯	|‘ŒS r!   r!   )rx   Úrev_idrp  Úghostss      €r   rz   z-DirState.set_parent_trees.<locals>.<listcomp>f
  s'   ø€ ÐOÐOÐO¡ ¨¸&ÈÐ:NÐ:N˜Ð:NÐ:NÐ:Nr   r   r   r�   Nr‡   r!   r?   Fr   r#  rÓ   r   c                 ó   — g | ]\  }}|‘ŒS r!   r!   )rx   r–  rp  s      r   rz   z-DirState.set_parent_trees.<locals>.<listcomp>Ì
  s   € Ð:Ð:Ð:¡L F¨D˜Ð:Ð:Ð:r   Tr+  )r-  r£   r   rÕ  r¹  r;   r/  r¯   r%  Úiter_entries_by_dirr°   r—   r   r’   rã   rº  râ   rÞ   ÚnextÚiterrO  r–   rM  Ú_sort_entriesr˜  r@  rS   rL  rR   r�   rX   )r   r:  r—  Úby_pathrÌ  ru  Úparent_countrÖ  r  rË  rp  Únew_location_suffixÚlast_dirnamerl   r°   rŒ   r³   r´   Únew_entry_keyrX  rÆ   r×  Úlookup_indexÚa_keyrC  r;  s     `                       r   rl  zDirState.set_parent_trees8
  s  ø€ ð 	×&Ò&Ñ(Ô(Ð(ð& ˆØˆð PÐOÐOÐO°ÐOÑOÔOˆå˜<Ñ(Ô(ˆÝÔ%ˆð ×'Ò'Ñ)Ô)ð 	6ð 	6ˆEà�QŒx˜Œ{˜1Œ~ Ð-Ð-ØØ!& q¤¨!¤ ÝÔ-Ð.°Ñ=ñ!>ˆG�E˜!”HÑð ×!Ò! (¨E°!¬HÑ5Ô5Ð5Ð5õ !*¨,Ñ 7Ô 7ð O	Cñ O	CÑˆJ˜à# a™ˆJõ Ô,ð#.Ø1=À
Ñ1Jñ#LÐð  ˆLØ#×7Ò7Ñ9Ô9ð DCñ DC‘��eð  œ-�Ø ŸKšK¨Ñ/Ô/�	Ý$+¤M°)Ñ$<Ô$<Ñ!�˜Ø˜lÒ*Ð*à*�G�Gà#*�LØ "  7¨H°gÑ >Ô >�ð &Ÿ\š\¨'°2Ñ6Ô6�
Ø!+ð 
Hð 
H�Ið ! MÒ1Ð1ð
 :<¸¸DÀ)ÈQØ<AÀ3ñ:Hô :H˜ 	Ô*¨:Ñ6øð
 ! JÐ.Ð.ð ×2Ò2°5Ñ9Ô9ð ˜MÔ*¨:Ñ6Ð6ð #%�KÝ(-¨jÑ(9Ô(9ð <ð <˜õ  # :™œð <Ø'×.Ò.­xÔ/KÑLÔLÐLÐLõ %)­¨jÑ)9Ô)9Ñ$:Ô$:˜EØ& uœ~¨lÔ;¸AÔ>À,ÐNÐNð !,× 2Ò 2Ø$+¨E¤N°<Ô$@ñ!Bô !Bð !Bð !Bð .2¯YªY°u¸Q¸q¸S´zÑ-BÔ-B×,IÒ,IÈ$Ñ,OÔ,O 	Ø +× 2Ò 2°2°2°d¸IÀqÈ%Ø69ñ4;ô 4;ñ !<ô !<ð !<ð !<à×&Ò& t×'AÒ'AÀ%Ñ'HÔ'HÑIÔIÐIØ×&Ò&Ð':Ñ;Ô;Ð;Ø-8�G˜MÑ*Ø×)Ò)¨(°MÑBÔBÐBÑBñIDCðP ×(Ò(¨¯ª©¬Ñ9Ô9ˆØ×&Ò& {Ñ3Ô3Ð3Ø:Ð:°EÐ:Ñ:Ô:ˆŒÝ˜F‘|”|ˆŒØ×Ò¨DÐÑ1Ô1Ð1Ø!ˆŒˆˆr   c                 óH   — i }|t           j        fd„}t          ||¬¦  «        S )a	  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                 óÂ   — | d         \  }}}	 ||         }n=# t           $ r0 |                     |                     d¦  «        ¦  «        }|||<   Y nw xY w ||||¦  «        S )Nr   rÓ   )ró  rV  r’   )r  Ú_split_dirsÚ_stÚdirpathÚfnamer°   r’   s          r   Ú_keyz$DirState._sort_entries.<locals>._keyÞ
  sƒ   € à&+¨A¤hÑ#ˆG�U˜Gð-Ø# GÔ,��øÝð -ð -ð -Ø×)Ò)¨'¯-ª-¸Ñ*=Ô*=Ñ>Ô>�Ø',�˜GÑ$Ð$Ð$ð-øøøð �3�u˜e WÑ-Ô-Ð-s   Ž —7AÁArÔ  )r   rÕ  r  )r   r  Ú
split_dirsrª  s       r   rœ  zDirState._sort_entriesÑ
  s:   € ð ˆ
à$.µLÔ4Lð 	.ð 	.ð 	.ð 	.õ �j dÐ+Ñ+Ô+Ð+r   c                 ó´  — dt           j        v rt          j        dd¦  «         dt           j        v }|rt          j        d¦  «         |                      ¦   «          |                     ¦   «         }t          t          |  	                    ¦   «         ¦  «        ¦  «        }t          |¦  «        }t          |¦  «        }d„ }|s|�rZ|r"|d         d         d         dv r ||¦  «        }Œ)|rz|d                              d	¦  «        }t          j        |¦  «        \  }	}
|d         j        }|	|
|f}t          j        |d         j                 }|d
k    r|d         j        pd}nd}n
dx}x}	x}
x}}|s]|r(t          j        d|                     d	¦  «        ¦  «         |                      |||d         j        ||d¬¦  «          ||¦  «        }�nK|sx|rTt          j        d|d         d                              d	¦  «        |d         d                              d	¦  «        ¦  «         |                      |¦  «          ||¦  «        }�nÑ||d         k    r©|d         d         d         |d         j        k    s|d         d         d         |k    rV|r(t          j        d|                     d	¦  «        ¦  «         |                      |d         ||d         j        ||d¬¦  «          ||¦  «        } ||¦  «        }�nt/          |	|d         d         ¦  «        s.|	|d         d         k    rx|dd…         |d         dd…         k     r\|r(t          j        d|                     d	¦  «        ¦  «         |                      |||d         j        ||d¬¦  «          ||¦  «        }nv|rTt          j        d|d         d                              d	¦  «        |d         d                              d	¦  «        ¦  «         |                      |¦  «          ||¦  «        }|�°W|�°Z|                      ¦   «          d| _        d| _        |rt          j        d¦  «         dS dS )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Údirstatezset_state_from_inventory trace:c                 óD   — 	 t          | ¦  «        S # t          $ r Y d S w xY wr   )rš  ÚStopIteration)Úiterators    r   Úadvancez2DirState.set_state_from_inventory.<locals>.advance  s5   € ðÝ˜H‘~”~Ð%øÝ ð ð ð Ø�t�tðøøøs   ‚ ‘
žr   r�   r‡   rA   r   NzAppending from new '%s'.T)r”  rŒ   rŽ   ÚfullscanzTruncating from old '%s/%s'.r   zUpdating in-place change '%s'.zInserting from new '%s'.zDeleting from old '%s/%s'.z"set_state_from_inventory complete.)r
   r`   r   Úmutter_callsiter  r-  r™  r›  rL  r¹  rš  r—   r   r’   r°   r;   r­   r±   r“  rµ  r�   r”  r­  Ú
lt_by_dirsr�   rX   rY   )r   Únew_invÚtracingÚnew_iteratorÚold_iteratorÚcurrent_newÚcurrent_oldr²  rÃ  Únew_dirnameÚnew_basenamer“  r¡  Úcurrent_new_minikindrŽ   s                  r   rm  z!DirState.set_state_from_inventoryé
  s@  € ð •UÔ&Ð&Ð&ÝÔ! !Ø"cñeô eð eà¥Ô 1Ð1ˆØð 	<ÝŒLÐ:Ñ;Ô;Ð;Ø×&Ò&Ñ(Ô(Ð(ð ×2Ò2Ñ4Ô4ˆõ �D ×!3Ò!3Ñ!5Ô!5Ñ6Ô6Ñ7Ô7ˆå˜<Ñ(Ô(ˆÝ˜<Ñ(Ô(ˆð	ð 	ð 	ð
 ð W	4˜[ñ W	4àð ˜{¨1œ~¨aÔ0°Ô3°|ÐCÐCà%˜g lÑ3Ô3�ØØð )à +¨A¤× 5Ò 5°fÑ =Ô =�Ý,3¬M¸-Ñ,HÔ,HÑ)�˜\Ø$ QœÔ/�Ø!,¨l¸FÐ C�åÔ.¨{¸1¬~Ô/BÔCð %à'¨4Ò/Ð/Ø"-¨a¤.Ô"CÐ"JÀs�K�Kð #&�K�Kð %)ð)�ð ) ð )¨lð )¸VØ!ð ð ;4àð ?Ý”LÐ!;Ø!.×!5Ò!5°fÑ!=Ô!=ñ?ô ?ð ?à×#Ò# MÐ3GØ/:¸1¬~Ô/HØ.;ÈØ-1ð $ñ 3ô 3ð 3ð &˜g lÑ3Ô3�‘Ø ð 14àð CÝ”LÐ!?Ø!,¨Q¤°Ô!2×!9Ò!9¸&Ñ!AÔ!AØ!,¨Q¤°Ô!2×!9Ò!9¸&Ñ!AÔ!AñCô Cð Cð ×!Ò! +Ñ.Ô.Ð.Ø%˜g lÑ3Ô3�‘Ø +¨a¤.Ò0Ð0ð   ”N 1Ô% aÔ(¨K¸¬NÔ,EÒEÐEØ# Aœ qÔ)¨!Ô,Ð0DÒDÐDØð CÝœÐ%EØ%2×%9Ò%9¸&Ñ%AÔ%AñCô Cð Cà×'Ò'¨°A¬Ð8LØ3>¸q´>Ô3LØ2?È[Ø15ð (ñ 7ô 7ð 7ð
 &˜g lÑ3Ô3�Ø%˜g lÑ3Ô3�‘Ý˜[¨+°a¬.¸Ô*;Ñ<Ô<ð 4Ø! [°¤^°AÔ%6Ò6Ð6Ø# A B BÔ'¨+°a¬.¸¸¸Ô*<Ò<Ð<ð ð ?Ý”LÐ!;Ø!.×!5Ò!5°fÑ!=Ô!=ñ?ô ?ð ?à×#Ò# MÐ3GØ/:¸1¬~Ô/HØ.;ÈØ-1ð $ñ 3ô 3ð 3ð &˜g lÑ3Ô3��ð ð CÝ”LÐ!=Ø!,¨Q¤°Ô!2×!9Ò!9¸&Ñ!AÔ!AØ!,¨Q¤°Ô!2×!9Ò!9¸&Ñ!AÔ!AñCô Cð Cð ×!Ò! +Ñ.Ô.Ð.Ø%˜g lÑ3Ô3�ðo ñ W	4˜[ñ W	4ðp 	×ÒÑÔÐØˆŒØ"&ˆÔØð 	?ÝŒLÐ=Ñ>Ô>Ð>Ð>Ð>ð	?ð 	?r   c                 ó  — |                       ¦   «          ddt          j        fddddt          j        fgf}d|gfdg fg}|                      g |¦  «         |                      |¦  «         |                      ||¦  «         dS )z…Wipe the currently stored state and set it to something new.

        This is a hard-reset for the data we are working with.
        r   r>   r   FN)rÕ   r   rE  r;   r©   rG  rm  rl  )r   Úworking_invru  Úparent_ghostsÚ
empty_rootrJ  s         r   Úset_state_from_scratchzDirState.set_state_from_scratchp  sœ   € ð 	×ÒÑÔÐð ˜C¥Ô!2Ð3Ø˜c 1 e­XÔ->Ð?Ð@ðBˆ
à!$ z lÐ 3°c¸2°YÐ?ÐØ�Š�rÐ/Ñ0Ô0Ð0Ø×%Ò% kÑ2Ô2Ð2Ø×Ò˜l¨MÑ:Ô:Ð:Ð:Ð:r   c           	      ó°  — t          ¦   «         }|d         dd…         D ]~}|d         dvr|                     |d         ¦  «         Œ(|d         dk    rJ|                     t          t          j        |d         ¦  «        ¦  «        |d         d         fz   ¦  «         Œ|d         |v}|r§|                      |d         ¦  «        }|                      |d         |d         ¦  «        \  }}|s"t          d                     |¦  «        ¦  «        ‚|d          	                    |¦  «         | j
        �!|                      | j
        |d         ¦  «         |D ]î}|                      |¦  «        \  }	}|s"t          d                     |¦  «        ¦  «        ‚|                      || j        |	         d         ¦  «        \  }
}|s"t          d                     |¦  «        ¦  «        ‚| j        |	         d         |
         d         }|d         d         d	k    r"t          d
                     |¦  «        ¦  «        ‚t          j        |d<   Œï|                      ¦   «          |S )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   Nr   r�   r?   r   zcould not find entry for {}úcould not find block for {}r<   zbad row {!r})re   rÌ   Útupler   r’   r[  r¢   r™   rš   rÙ   rX   r[  r¡   rQ   r;   r/  r�   )r   r»  Úall_remaining_keysÚdetailsÚlast_referencer¾   r¿   r½   Ú
update_keyÚupdate_block_indexÚupdate_entry_indexÚupdate_tree_detailss               r   r­  zDirState._make_absent�  s©  € õ !™UœUÐà" 1”~ a b bÔ)ð 	Mð 	MˆGØ�qŒz Ð-Ð-Ø"×&Ò& {°1¤~Ñ6Ô6Ð6Ð6Ø˜”˜tÒ#Ð#à"×&Ò&Ý�'œ-¨°¬
Ñ3Ô3Ñ4Ô4¸ÀA¼ÀqÔ8IÐ7KÑKñMô Mð Møð % QœÐ/AÐAˆØð 	Kð ×$Ò$ [°¤^Ñ4Ô4ˆEØ#'×#9Ò#9Ø˜A”  a¤ñ$*ô $*Ñ ˆK˜àð GÝ$Ø1×8Ò8¸ÑEÔEñGô Gð Gà�!ŒH�LŠL˜Ñ%Ô%Ð%àŒ~Ð)Ø×*Ò*¨4¬>¸;Àq¼>ÑJÔJÐJð
 -ð 	Bð 	BˆJà×/Ò/°
Ñ;Ô;ñ (Ð àð FÝ$Ø1×8Ò8¸ÑDÔDñFô Fð Fð ×&Ò&Ø ¤Ð0BÔ CÀAÔ FñHô Hñ (Ð ð ð FÝ$Ø1×8Ò8¸ÑDÔDñFô Fð Fà"&¤/Ð2DÔ"EÀaÔ"HÐI[Ô"\Ð]^Ô"_Ðà" 1Ô% aÔ(¨DÒ0Ð0Ý$ ^×%:Ò%:Ð;NÑ%OÔ%OÑPÔPÐPÝ%-Ô%AÐ Ñ"Ð"Ø×ÒÑÔÐØÐr   c	                 ó€
  — |                       |¦  «        d         }	|€t          j        }|                      ||	¦  «        \  }
}|||||f}|                      ¦   «         }|�sx|sÕ|                      |dd…         dz   |	¦  «        \  }}|t          |	¦  «        k     rž|	|         }|d         dd…         |dd…         k    rf|d         d         d         dvrJ|                      d|dd…         z                       d¦  «        |d         d	|d         d         z  ¦  «         |dz  }nn|t          |	¦  «        k     °ž|                     |d         d
¦  «        }|s||g|  	                    ¦   «         z   f}�n:||gf}t          |¦  «        D ]×}|                      |¦  «        \  }}|s"t          d                     |¦  «        ¦  «        ‚| j        |         d         }|                      ||¦  «        \  }}|st          d|›�¦  «        ‚|€t          d¦  «        ‚||         }d|dddf|d         d<   |                      |||¦  «        r|                      ||	¦  «        \  }
}ŒØ|                      ¦   «         }|rt#          |¦  «        d         }t%          d|dz   ¦  «        D �]}|                      |¦  «        \  }}|s"t          d                     |¦  «        ¦  «        ‚|                      || j        |         d         ¦  «        \  }}|s"t          d                     |¦  «        ¦  «        ‚| j        |         d         |         d         |         }|d         dv r|d                              |¦  «         ŒØt)          j        |dd…         Ž }|d                              d|dddf¦  «         �Œ|	                     |
|¦  «         |                      ||¦  «         nï||	|
         d         d<   |€t          d¦  «        ‚|                     |d         d
¦  «        }||vrt          d|›d|›�¦  «        ‚|D ]•}||k    r�|                      |¦  «        \  }}|st          d|¦  «        ‚|                      || j        |         d         ¦  «        \  }
}|st          d|¦  «        ‚d|dddf| j        |         d         |
         d         d<   Œ–|d         dk    rVt)          j        |dd…         Ž ddf} |                      | ¦  «        \  }}|s#| j                             || d         g f¦  «         |                      ¦   «          dS )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   Nr   r   )r   r�   r�   r‡   z5Attempt to add item at path already occupied by id %rr!   rÅ  z/update_minimal: could not find other entry for zno pathr?   Fr   z+update_minimal: could not find entry for {}zKWe found the entry in the blocks, but the key is not in the id_index. key: z, existing_keys: znot present: %rr>   )r[  r;   r©   r¢   rÊ  r£   r’  rµ  rã   r¬   rÆ  r¡   r™   rš   rQ   Ú_maybe_remove_rowrV  rL  râ   rÞ   r   rž   r®   r¯   r�   )!r   rF  rÉ   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_entryr<  r¢  rË  rÌ  Úupdate_detailsÚpointer_pathrÆ   r¼   Ú
subdir_keys!                                    r   r�   zDirState.update_minimal»  sƒ  € ð2 × Ò  Ñ%Ô% aÔ(ˆØÐÝ"Ô+ˆKð  $×5Ò5°c¸5ÑAÔAÑˆ�WØ ¨d°JÀÐLˆØ×%Ò%Ñ'Ô'ˆØñ H	9àð Ø#×5Ò5°c¸!¸A¸#´hÀÑ6GÈÑOÔO‘�	˜1Ø¥# e¡*¤*Ò,Ð,Ø! )Ô,�EØ˜Q”x  ! ”}¨¨A¨a¨C¬Ò0Ð0Ø  œ8 Aœ; qœ>°Ð=Ð=ð !×/Ò/Ø!)¨C°°!°¬HÑ!4× <Ò <¸VÑ DÔ DÀcÈ!Äfð!(Ø*/°¬(°1¬+ñ!6ñ7ô 7ð 7ð " Q™˜	˜	àð  ¥# e¡*¤*Ò,Ð,ð %ŸLšL¨¨Q¬°Ñ4Ô4ˆMØ ð LAà + °×1HÒ1HÑ1JÔ1JÑ!JÐJ�	‘	ð
   + Ð.�	å!& }Ñ!5Ô!5ð Lð L�Ið 26×1PÒ1PØ!ñ2#ô 2#Ñ.Ð% wà"ð (Ý,Ð-J×-QÒ-QØ%ñ.'ô .'ñ (ô (ð (à"&¤/Ð2CÔ"DÀQÔ"G�KØ15×1GÒ1GØ! ;ñ20ô 20Ñ.Ð% wà"ð ,Ý,˜nà(˜yð+ñ,ô ,ð ,ð !Ð(Ý,¨YÑ7Ô7Ð7ð #.Ð.?Ô"@�KØ)-¨y¸!¸UÀCÐ(H�K ”N 1Ñ%Ø×-Ò-¨kÐ;LØ.6ñ8ô 8ð Lð *.×)?Ò)?ÀÀUÑ)KÔ)K™˜ Qøð '+×&?Ò&?Ñ&AÔ&AÐ#Ø&ð 7õ !% ]Ñ 3Ô 3°AÔ 6�IÝ$)¨!Ð-@À1Ñ-DÑ$EÔ$Eð Añ A�Lð ×7Ò7¸	ÑBÔBñ 0Ð&¨à"ð MÝ,Ø9×@Ò@ÀÑKÔKñMô Mð Mð ×.Ò.Ø% t¤Ð7IÔ'JÈ1Ô'MñOô Oñ 0Ð&¨ð #ð ]Ý,ØI×PÒPÐQZÑ[Ô[ñ]ô ]ð ]à%)¤_Ð5GÔ%HÈÔ%KÐL^Ô%_Ð`aÔ%bÐcoÔ%p�NØ% aÔ(¨LÐ8Ð8ð " !œ×+Ò+¨NÑ;Ô;Ð;Ð;õ (/Ô'7¸À1ÀQÀ3¼Ð'H˜Ø! !œ×+Ò+Ø! <°°E¸3Ð?ñAô Að Añ Aà�LŠL˜ iÑ0Ô0Ð0Ø×!Ò! (¨CÑ0Ô0Ð0Ð0ð (3ˆE�+Ô˜qÔ! !Ñ$ð Ð Ý$ YÑ/Ô/Ð/Ø$ŸLšL¨¨Q¬°Ñ4Ô4ˆMØ˜-Ð'Ð'Ý$�nàFIÀcÀcÈ=È=ð&Zñ [ô [ð [ð +ð 9ð 9�	ð  Ò#Ð#ð
 ,0×+JÒ+JØ!ñ,#ô ,#Ñ(�K à"ð KÝ,Ð->À	ÑJÔJÐJØ+/×+AÒ+AØ! 4¤?°;Ô#?ÀÔ#Bñ,Dô ,DÑ(�K à"ð KÝ,Ð->À	ÑJÔJÐJà˜y¨!¨U°CÐ8ð ”O KÔ0°Ô3°KÔ@ÀÔCÀAÑFøð �qŒ>˜TÒ!Ð!å!Ô*¨C°°!°¬HÐ5°s¸CÐ@ˆJØ#'×#BÒ#BÀ:Ñ#NÔ#NÑ ˆK˜Øð IØ”×&Ò& {°ZÀ´]ÀBÐ4GÑHÔHÐHà×ÒÑÔÐÐÐr   c                 ó¶   — d}||         }|d         D ]}|d         dvrd} nŒ|s3|                      |¦  «         |                      ||d         ¦  «         dS dS )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   r   r�   T)rÙ   r[  )r   r¾   rï  rÌ  Úpresent_in_rowr  Úcolumns          r   rÏ  zDirState._maybe_remove_rowp  sƒ   € ð ˆØ�e”ˆØ˜A”hð 	ð 	ˆFØ�aŒy Ð,Ð,Ø!%�Ø�ð -ð ð 	Ø�IŠI�eÑÔÐØ×&Ò& x°°q´Ñ:Ô:Ð:Ø�4Øˆur   c           
      ó	  ‡ ‡‡‡— ddl m} ‰                      ¦   «          t          ‰ j        ¦  «        dk    r7‰ j        d         d         dk    s t          d |‰ j        ¦  «        z   ¦  «        ‚t          ‰ j        ¦  «        dk    r7‰ j        d         d         dk    s t          d |‰ j        ¦  «        z   ¦  «        ‚d„ ‰ j        dd…         D ¦   «         }|t          |¦  «        k    r/t          d	 |‰ j        ¦  «        z   d
z    ||¦  «        z   ¦  «        ‚‰ j        D ]†}|d         D ]8Š|d         ‰d         d         k    rt          d‰›d ||¦  «        ›�¦  «        ‚Œ9|d         t          |d         ¦  «        k    r$t          d|d         ›d ||¦  «        ›�¦  «        ‚Œ‡ˆˆ ˆˆfd„}‰                      ¦   «         dz   }d„ t          |¦  «        D ¦   «         }‰  	                    ¦   «         D �]žŠ‰d         d         }t          j        ‰d         d         ‰d         d         ¦  «        Št          ‰d         ¦  «        |k    rt          d |‰¦  «        |fz  ¦  «        ‚d}t          ‰d         ¦  «        D ]ê\  Š}	|‰         }
|	d         }|dv r|dz  }||
v r•|
|         \  }}|dk    r.|�+t          d|                     d¦  «        ›d‰›d|›�¦  «        ‚Œa|dk    r'|	d         }||k    rt          d|›d‰›d|›�¦  «        ‚ŒŽ|‰k    rt          d‰›d|›d|›�¦  «        ‚ |¦   «          Œ·|dk    rd‰f|
|<   ŒÅ|dk    r|	d         ‰f|
|<   ŒÙ‰‰f|
|<    |¦   «          Œë||k    r"t          d                     ‰¦  «        ¦  «        ‚�Œ ‰ j        �ê‰ j                             ¦   «         D ]Ò\  }}|D ]‰}|d         |k    rt          d |›d!|›�¦  «        ‚‰                      |¦  «        \  }}|st          d"|¦  «        ‚‰                      |‰ j        |         d         ¦  «        \  }}|st          d#|¦  «        ‚ŒŠt          |¦  «        t          t'          |¦  «        ¦  «        k    rt          d$|›�¦  «        ‚ŒÑdS dS )%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   )Úpformatr   z'dirblocks don't start with root block:
r   z"dirblocks missing root directory:
c                 óD   — g | ]}|d                                d¦  «        ‘ŒS )r   rÓ   )r’   )rx   r|  s     r   rz   z&DirState._validate.<locals>.<listcomp>¢  s8   € ð 3ð 3ð 3Øð �q”T—Z’Z Ñ%Ô%ð 3ð 3ð 3r   Nz#dir names are not in sorted order:
z
keys:
zentry key for z doesn't match directory name in
zdirblock for z is not sorted:
c                  ó
  •— ‰d         dd…         dk    rdS ‰                      ‰‰d         d         ¬¦  «        } | dk    rt          d‰›d‰›�¦  «        ‚| d	         ‰         d         d
k    rt          d‰›d| ›�¦  «        ‚dS )a   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.)
            r   r   r9  Nr´  r‹   zno parent entry for: z	 in tree r   r>   zParent entry for z% is not marked as a valid directory. )rœ   r™   )Úparent_entryr  r   Ú	this_pathrË  s    €€€€r   Úcheck_valid_parentz.DirState._validate.<locals>.check_valid_parent¸  s¸   ø€ ð �QŒx˜˜!˜Œ} 
Ò*Ð*à�ØŸ?š?¨:ÀÀqÄÈ!Ä˜?ÑMÔMˆLØ˜|Ò+Ð+Ý$�nà �y�y * *ð.ñ/ô /ð /ð ˜AŒ˜zÔ*¨1Ô-°Ò5Ð5Ý$�nà(1¨	¨	°<°<ðBñCô Cð Cð 6Ð5r   c                 ó   — g | ]}i ‘ŒS r!   r!   )rx   rÀ   s     r   rz   z&DirState._validate.<locals>.<listcomp>Ö  s   € Ð6Ð6Ð6˜q˜Ð6Ð6Ð6r   r   z5wrong number of entry details for row
%s,
expected %dr�   r<   zfile rŒ  z is absent in row z but also present at r?   z relocation in row z but also at rA  z! inconsistent with previous path z	 seen at z$entry {!r} has no data for any tree.zfile_id z did not match entry key zmissing block for entry key: %rzmissing entry for key: %rz'id_index contained non-unique data for )ÚpprintrÞ  r-  r£   rQ   r™   r  rV  râ   r¹  r   rž   r%  rµ  rš   rX   r˜  r¡   r¢   re   )r   rÞ  Ú	dir_namesÚdirblockrã  rW  Úid_path_mapsr°   Úabsent_positionsÚ
tree_stateÚthis_tree_maprÉ   Úprevious_pathÚprevious_locÚtarget_locationrX  rÆ   r¼   r½   r¿   r  râ  rË  s   `                   @@@r   Ú	_validatezDirState._validate‚  sm  øøøø€ ð& 	#Ð"Ð"Ð"Ð"Ð"Ø×&Ò&Ñ(Ô(Ð(ÝˆtŒÑÔ !Ò#Ð#Ø”? 1Ô% aÔ(¨CÒ/Ð/Ý$Ø>Ø�g˜dœoÑ.Ô.ñ/ñ0ô 0ð 0õ ˆtŒÑÔ !Ò#Ð#Ø”? 1Ô% aÔ(¨CÒ/Ð/Ý$Ø9Ø�g˜dœoÑ.Ô.ñ/ñ0ô 0ð 0ð3ð 3Ø"œo¨a¨b¨bÔ1ð3ñ 3ô 3ˆ	à�˜yÑ)Ô)Ò)Ð)Ý Ø6Ø�˜œÑ(Ô(ñ)àñð �˜	Ñ"Ô"ñ#ñ$ô $ð $ð
 œð 	6ð 	6ˆHð " !œð 4ð 4�Ø˜A”; %¨¤(¨1¤+Ò-Ð-Ý(˜.ð ˜˜  ¨Ñ 1Ô 1Ð 1ð3ñ4ô 4ð 4ð .ð
 ˜Œ{�f X¨a¤[Ñ1Ô1Ò1Ð1Ý$�nà˜a”[�[�[ ' '¨(Ñ"3Ô"3Ð"3ð5ñ6ô 6ð 6ð 2ð
	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cð: ×.Ò.Ñ0Ô0°1Ñ4ˆ
Ø6Ð6¥E¨*Ñ$5Ô$5Ð6Ñ6Ô6ˆà×'Ò'Ñ)Ô)ð 4	Jñ 4	JˆEØ˜A”h˜q”kˆGÝÔ(¨¨q¬°!¬°e¸A´h¸q´kÑBÔBˆIÝ�5˜”8‰}Œ} 
Ò*Ð*Ý$ð%à�W˜U‘^”^ ZÐ0ñ1ñ2ô 2ð 2ð  !ÐÝ*3°E¸!´HÑ*=Ô*=ð (-ð (-Ñ&�
˜JØ ,¨ZÔ 8�Ø% aœ=�Ø˜|Ð+Ð+Ø$¨Ñ)Ð$à˜mÐ+Ð+Ø2?ÀÔ2HÑ/�M <ð   4Ò'Ð'Ø(Ð4Ý"0 .ð ")§¢°Ñ!8Ô!8Ð!8Ð!8¸%¸%¸%ÀÀð!Pñ#Qô #Qð Qð 5ð
 " TÒ)Ð)Ø*4°Q¬-˜Ø(¨OÒ;Ð;Ý"0 .à#* 7 7¨E¨E¨E°=°=ð!Bñ#Cô #Cð Cð <ð )¨IÒ5Ð5Ý"0 .ð "'  ¨¨¨°|°|ð!Eñ#Fô #Fð Fð +Ð*Ñ,Ô,Ð,Ð,à 4Ò'Ð'à15°y°˜ gÑ.Ð.Ø! TÒ)Ð)à1;¸A´À	Ð1I˜ gÑ.Ð.à1:¸IÐ1E˜ gÑ.Ø*Ð*Ñ,Ô,Ð,Ð,Ø :Ò-Ð-Ý$Ø:×AÒAÀ%ÑHÔHñJô Jð Jñ .ð Œ>Ð%Ø'+¤~×';Ò';Ñ'=Ô'=ð )ð )Ñ#�˜Ø!+ð Dð D�Ið ! ”| wÒ.Ð.Ý,˜nà&˜w˜w¨	¨	ð3ñ4ô 4ð 4ð
 ,0×+JÒ+JØ!ñ,#ô ,#Ñ(�K à"ð JÝ,Ø=¸yñJô Jð Jà+/×+AÒ+AØ! 4¤?°;Ô#?ÀÔ#Bñ,Dô ,DÑ(�K à"ð DÝ,Ø7¸ñDô Dð DðDõ �z‘?”?¥c­#¨j©/¬/Ñ&:Ô&:Ò:Ð:Ý(˜.à%˜:ð(ñ)ô )ð )ð ;ð+ &Ð%ð)ð )r   c                 óÈ   — t           j        | _        t           j        | _        d| _        g | _        g | _        g | _        d| _        d| _	        d| _
        d| _        i | _        dS )z0Forget all state information about the dirstate.FN)r;   rM   rN   rO   rP   rS   rR   rQ   rX   rY   rZ   r[   r\   rt   s    r   Ú_wipe_statezDirState._wipe_state'  sb   € å%Ô3ˆÔÝ'Ô5ˆÔØ %ˆÔØˆŒØˆŒØˆŒØˆŒØ"&ˆÔØ"ˆÔØ ˆÔØ!#ˆÔÐÐr   c                 ó  — | j         �t          j        | j         ¦  «        ‚t          j        | j        ¦  «        | _         d| _        | j         j        | _        |  	                    ¦   «          t          j
        | j        ¦  «        S )z$Acquire a read lock on the dirstate.NÚr)rV   r   ÚLockContentionr   ÚReadLockrU   rW   r„  rT   rñ  ÚLogicalLockResultro  rt   s    r   rh  zDirState.lock_read5  sp   € àÔÐ'ÝÔ'¨Ô(8Ñ9Ô9Ð9õ
  œ=¨¬Ñ8Ô8ˆÔØˆÔØÔ+Ô-ˆÔØ×ÒÑÔÐÝÔ% d¤kÑ2Ô2Ð2r   c                 ó  — | j         �t          j        | j         ¦  «        ‚t          j        | j        ¦  «        | _         d| _        | j         j        | _        |  	                    ¦   «          t          j
        | j        | j         ¦  «        S )z%Acquire a write lock on the dirstate.Nr�  )rV   r   rô  r   Ú	WriteLockrU   rW   r„  rT   rñ  rö  ro  rt   s    r   rF  zDirState.lock_writeC  su   € àÔÐ'ÝÔ'¨Ô(8Ñ9Ô9Ð9õ
  œ>¨$¬.Ñ9Ô9ˆÔØˆÔØÔ+Ô-ˆÔØ×ÒÑÔÐÝÔ% d¤k°4Ô3CÑDÔDÐDr   c                 ó¦   — | j         €t          j        | ¦  «        ‚d| _        d| _        | j                              ¦   «          d| _         i | _        dS )z$Drop any locks held on the dirstate.N)rV   r   ÚLockNotHeldrT   rW   ro  r\   rt   s    r   ro  zDirState.unlockQ  sY   € àÔÐ#ÝÔ$ TÑ*Ô*Ð*ð
  ˆÔØˆÔØÔ×ÒÑ!Ô!Ð!ØˆÔØ!#ˆÔÐÐr   c                 ó<   — | j         st          j        | ¦  «        ‚dS )z?Check that a lock is currently held by someone on the dirstate.N)rV   r   rs  rt   s    r   rÕ   zDirState._requires_lock_  s(   € àÔð 	/ÝÔ(¨Ñ.Ô.Ð.ð	/ð 	/r   r]  ©NF)Fr   )NNF)Nr   T)Fr   Nr   NF)jr   r   r   r,   r­   rŸ   r²   ÚS_IFDIRÚS_IFREGÚS_IFLNKrø  rN  r]   rM   r|   r~   r}   r©   r   rÕ  r/  ÚHEADER_FORMAT_2r]  r   ru   r�   rƒ   rÌ   r  r  r  r2  r¬   r¨   r@  r:  rH  rT  r×   r[  r¡   r¢   Ústaticmethodrx  rŠ  r¨  r—  r™  r¸  r–  r’  r¼  r½  r»  rš  rù  rô  r   ra   r  r  r.  r  r  r  r  rØ   r,  r¥   rœ   Úclassmethodrd  rº  r•  r¹  rÊ  r¯   r[  r  rd  rV  rg  r-  rq  rÖ   rk  r~  r|  rH  rˆ  r‚  rG  r’  rl  rœ  rm  rÃ  r­  r�   rÏ  rï  rñ  rh  rF  ro  rÕ   r!   r   r   r;   r;   1  s~  € € € € € ðð ð  ØØØØØð
ð 
Ðð ØØØØØð
ð 
Ðð 	Œ�dØŒ�dØŒ�dðÐð
  DÐ)Ð)€Ið Ðà€MØÐØÐØÐð €HØ2˜,Ô2°4¸¸aÀÈÑLÔLÐà9€OØ9€Oà?@Ø)-ð<@ð <@ð <@ð <@ð|6ð 6ð 6ð=ð =ð =ð =ð4)ð )ð )ðH=ð H=ð H=ðT|ð |ð |ð|rð rð rðh;ð ;ð ;ðz)2ð )2ð )2ðVDð Dð Dð$ð $ð $ðL2ð 2ð 2ð>;ð ;ð ;ð*ð ð ð$(ð (ð (ð&&ð &ð &ð,ð ,ð ,ð ,ð,$ð $ð $ð8$ð $ð $ð2 ðð ð ñ „\ðð@ð ð ð$VWð VWð VWðp!<ð !<ð !<ðF2ð 2ð 2ð_ð _ð _ðB2ð 2ð 2ð(>ð >ð >ð~Gð ~Gð ~Gð@&ð &ð &ðK8ð K8ð K8ðZPð Pð Pð* *;ð-ð -ð -ð -ð,!ð !ð !ð!ð !ð !ð1ð 1ð 1ð"ð "ð "ðð ð ð$ð ð ð
-ð -ð -ð@ð @ð @ðBð Bð Bð>ð >ð >ðO-ð O-ð O-ðb#ð #ð #ð
#5ð #5ð #5ðJ BFØ#(ðOð Oð Oð Oðb ð!ð !ð !ñ „[ð!ðF ð!?ð !?ñ „\ð!?ðF'7ð '7ð '7ðR$ð $ð $ðð ð ð>ð >ð >ð$	Oð 	Oð 	Oðð ð ð ð ð ð
6ð 6ð 6ð ØBCØ(,ðð ð ñ „[ðð*	"ð 	"ð 	"ð6ð 6ð 6ð( ð  ð  ðLð Lð Lð,Oð Oð Oð'ð 'ð 'ð26ð 26ð 26ðn9ð 9ð 9ð
ð ð ð('ð 'ð 'ð$ð ð ð4W"ð W"ð W"ðr,ð ,ð ,ð0E?ð E?ð E?ðN;ð ;ð ;ð"8ð 8ð 8ðt KNØJOðsð sð sð sðjð ð ð$c)ð c)ð c)ðJ$ð $ð $ð3ð 3ð 3ðEð Eð Eð$ð $ð $ð/ð /ð /ð /ð /r   r;   c           	      ó€  — 	 ||j         dz           }n# t          $ r Y dS w xY wt          |¦  «        }|d         d         \  }}}	}
}t          |t          ¦  «        st          |¦  «        ‚|dk    r|dk    rd}||k    r||k    r|dk    rdS |	|j        k    r|S d}d}|dk    rÖ|                      |j         |
¦  «        }| j        €|  	                    ¦   «          |j
        | j        k     rm|j        | j        k     r]t          |d         ¦  «        dk    rD|d         d         d         d	k    r,|                      |¦  «        }d||j        ||f|d         d<   �nOdd
|j        |t          j        f|d         d<   d}�n,|dk    r’d}dd
dd|f|d         d<   |dk    rw|                      |d         d         |d         d         d¦  «        \  }}}}|                      ||t%          j        |d         d         |d         d         ¦  «        ¦  «         n—d}n”|dk    rŽ|dk    rd}|                      ||¦  «        }| j        €|  	                    ¦   «          |j
        | j        k     r&|j        | j        k     rd||j        d|f|d         d<   ndd
|j        dt          j        f|d         d<   |r|                      |g¦  «         |S )a@  Update 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.
    rñ  Nr   r   r>   rA   Tr=   r<   r   Fr@   )rò  ró  r«   r‘  r˜   Ú	TypeErrorrª   r  r[   rô  rõ  rö  r£   rb   r;   r©   r¥   r¨   r   rž   r  r�   )r   r  r(   r÷  rø  rÉ   r�   Úsaved_minikindÚsaved_link_or_sha1Úsaved_file_sizeÚsaved_executableÚsaved_packed_statÚlink_or_sha1Úworth_savingr”  r¼   r¿   rè  ré  s                      r   Úpy_update_entryr  e  si  € ðØ$ ZÔ%7¸(Ñ%BÔCˆˆøÝð ð ð àˆtˆtðøøøõ ˜JÑ'Ô'€Kà,1°!¬H°Q¬Kñ*€^Ð'¨ØÐ(Ý�n¥eÑ,Ô,ð (Ý˜Ñ'Ô'Ð'à�4ÒÐ˜N¨dÒ2Ð2ØˆØ�NÒ"Ð"ØÐ0Ò0Ð0ð �tÒÐØ�4ð ˜jÔ0Ò0Ð0Ø%Ð%ð €LØ€LØ�4ÒÐØ×)Ò)¨*Ô*<Ø*:ñ<ô <ˆ
àÔÐ%Ø×"Ò"Ñ$Ô$Ð$ØÔ %Ô"4Ò4Ð4ØÔ# eÔ&8Ò8Ð8Ý�E˜!”H‘” Ò!Ð!Ø˜!”H˜Q”K ”N dÒ*Ð*ð !×+Ò+¨GÑ4Ô4ˆLØ ¨zÔ/AØ% {ð4ˆE�!ŒH�Q‰K‰Kð    jÔ&8Ø%¥xÔ'8ð:ˆE�!ŒH�Q‰Kà ˆL‰LØ	�TÒ	Ð	ØˆØ˜S ! U¨KÐ8ˆˆaŒ�‰Ø˜TÒ!Ð!ð
 ×,Ò,¨U°1¬X°a¬[¸%À¼(À1¼+ÀqÑIÔIñ @ˆK˜ k°<à×Ò ¨[Ý 'Ô 0°°q´¸!´¸eÀA¼hÀq¼kÑ JÔ JñLô Lð Lð Lð !ˆLˆLØ	�TÒ	Ð	Ø˜TÒ!Ð!Ø ˆLØ×'Ò'¨Ð1CÑDÔDˆØÔÐ%Ø×"Ò"Ñ$Ô$Ð$ØÔ %Ô"4Ò4Ð4ØÔ'¨%Ô*<Ò<Ð<Ø ¨zÔ/AØ  +ð/ˆE�!ŒH�Q‰KˆKð    jÔ&8Ø ¥(Ô"3ð5ˆE�!ŒH�Q‰Kàð &Ø×Ò˜e˜WÑ%Ô%Ð%ØÐrú  c                   óN   — e Zd Zg d¢Zd„ Zej        fd„Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd	S )
ÚProcessEntryPython)Úold_dirname_to_file_idÚnew_dirname_to_file_idÚlast_source_parentÚlast_target_parentÚinclude_unchangedÚpartialro   Úutf8_decodeÚsearched_specific_filesÚsearch_specific_filesÚsearched_exact_pathsÚsearch_specific_file_parentsÚseen_idsr   Úsource_indexÚtarget_indexÚwant_unversionedrp  c	                 ó¼  — i | _         i | _        |dhk    | _        d d g| _        d d g| _        || _        || _        t          j        | _	        t          ¦   «         | _        t          ¦   «         | _        || _        t          ¦   «         | _        t          ¦   «         | _        || _        || _        || _        |dk    rt'          j        d¦  «        ‚|| _        || _        d S )Nr{  r   zunsupported target index)r  r  r  r  r  r  ro   ÚcodecsÚutf_8_decoder  re   r  r  r  r  r  r   r  r  r   r   r  rp  )	r   r  ro   r  r   r  r  r  rp  s	            r   r   zProcessEntryPython.__init__Î  sÚ   € ð ')ˆÔ#Ø&(ˆÔ#à,°°Ò4ˆŒð $(¨ ,ˆÔØ#'¨ ,ˆÔØ!2ˆÔØ'>ˆÔ$Ý!Ô.ˆÔõ
 (+¡u¤uˆÔ$õ %(¡E¤EˆÔ!Ø%:ˆÔ"õ -0©E¬EˆÔ)å™œˆŒØˆŒ
Ø(ˆÔØ(ˆÔØ˜1ÒÐå”/Ð"<Ñ=Ô=Ð=Ø 0ˆÔØˆŒ	ˆ	ˆ	r   c                 óî  — | j         €t          j        }n|d         | j                  }h d£}h d£}d}|d         | j                 }|d         }	|�]|	|v rY| j        dk    st	          ¦   «         ‚t          | j        ||d         |d         ¬	¦  «        }
|d         | j                 }|d         }	nd}
|d         d
         }|d         }||v �r|	|v �r|dk    �rt          j        | j	        |d         ¦  «        s | j
                             |d         ¦  «         |d         }t          j                             |¦  «        \  }} ||d         d         |d         d         ¦  «        }| j                             | j         |¬¦  «        }|dk    r>t!          | j        j        d|d         d         ›d|d         d         ›d|›d|›�¦  «        ‚|d         | j                  }|d         }n |d         d         }|d         d         }dx}}|€d}d}d}�n*|d
         }|dk    r(|€ |||¦  «        x}}|| j        |<   |dk    rd}nd}d}nô|dk    r“|dk    rd}nR|
€D| j        j                             |d         ¦  «        \  }}
| j                             ||
|¦  «         |
|d         k    }| j        r(t/          t0          j        |d         j        z  ¦  «        }nd|d         }n[|dk    r|dk    rd}n|
|d         k    }d}n=|dk    r|dk    rd}nd}d}n)|€ |||¦  «        }t7          j        ||d
         ¦  «        ‚|dk    r|€ |||¦  «        x}}|| j        |<   |r|| j        d         k    r| j        d         }nw	 | j        |         }n?# t>          $ r2 | j                             | j         |¬¦  «        }|d         d
         }Y nw xY w||d         d
         k    rd}n|| j        d<   || j        d<   |d         d         }|d         d         r|| j         d         k    r| j         d         }n’	 | j        |         }nZ# t>          $ rM | j                             | j        |¬¦  «        }|dk    rt	          d|›d|›�¦  «        ‚|d         d
         }Y nw xY w||d         d
         k    rd}n|| j         d<   || j         d<   |d         }|p||k    p||d         d         k    p||k    }|s	| j!        sdS |€- |||¦  «        x}}|  "                    |d¦  «        d         }|}nA|  "                    |d¦  «        d         }||k    r|}n|  "                    |d¦  «        d         }t          j#        |         }tI          |d         d
         ||f|d ||f|  "                    |d¦  «        d         |  "                    |d         d         d¦  «        d         f||f||f¦  «        |fS |d!v �r¬|	|v �r§ ||d         d         |d         d         ¦  «        }| j                             | j        |d         d         ¬¦  «        d         d
         } | |d         d
         k    rd} |�Ê| j        rGt/          t1          j%        |d         j        ¦  «        ot0          j        |d         j        z  ¦  «        }n|d         }tI          |d         d
         d|  "                    |d¦  «        d         fdd"d| fd|  "                    |d         d         d¦  «        d         fd|d
         fd|f¦  «        dfS tI          |d         d
         d|  "                    |d¦  «        d         fdd"d| fd|  "                    |d         d         d¦  «        d         fdd¦  «        dfS ||v rù|	d!v rõ ||d         d         |d         d         ¦  «        }| j                             | j         |d         d         ¬¦  «        d         d
         } | |d         d
         k    rd} tI          |d         d
         |  "                    |d¦  «        d         dfdd#| df|  "                    |d         d         d¦  «        d         dft          j#        |         df|d         df¦  «        dfS ||v rE|	dv rAt          j        | j	        |d         ¦  «        s | j
                             |d         ¦  «         n||v r|	|v rnt	          d$|›d%|	›�¦  «        ‚dS )&a³  Compare 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   >   r>   r=   r@   r?   rA   r@  r#  r   rŽ  r   )r(   r÷  r   r?   r´  r‹   zentry 'r†   z' is considered renamed from z" but source does not exist
entry: TFrD   r>   rC   r=   rF   r@   rG   rA   z$Could not find target parent in wt: z
parent of: rü  Úsurrogateescape)TTr<   )FTrJ   z*don't know how to compare source_minikind=z, target_minikind=)&r  r;   r/  r  r™   Úupdate_entryr   r   Úis_inside_anyr  r  rÌ   r4   rl   r’   rœ   r   rU   r  r_   r*   rù  ro   r  r²   r   rò  r   ÚBadFileKindErrorr  r  ró  r  r  r  rŸ   r   ÚS_ISREG)!r   r  Ú	path_inforž   Úsource_detailsÚ_fdltrÚ_fdltÚ_raÚtarget_detailsÚtarget_minikindr
  r°   Úsource_minikindr}  Úold_dirnameÚold_basenamerl   Ú	old_entryÚcontent_changeÚtarget_kindÚtarget_execr9   Úsource_parent_idÚsource_parent_entryr¼  Útarget_parent_idÚtarget_parent_entryÚsource_execÚchangedÚ
old_path_uÚpath_uÚsource_kindrv  s!                                    r   Ú_process_entryz!ProcessEntryPython._process_entryó  sŠ  € ð" ÔÐ$Ý%Ô9ˆNˆNà" 1œX dÔ&7Ô8ˆNà/Ð/Ð/ˆØ(Ð(Ð(ˆØˆØ˜qœ $Ô"3Ô4ˆØ(¨Ô+ˆØÐ  _¸Ð%=Ð%=ØÔ%¨Ò*Ð*Ý$Ñ&Ô&Ð&Ý'¨¬
°EØ09¸!´ÈÐSTÌðWñ Wô WˆLð # 1œX dÔ&7Ô8ˆNØ,¨QÔ/ˆOˆOàˆLØ˜”(˜1”+ˆØ(¨Ô+ˆØ˜fÐ$Ñ$¨¸EÐ)AÑ)Að  $Ò&Ñ&õ Ô,¨TÔ-IØ-;¸AÔ->ñ@ô @ð FàÔ.×2Ò2°>À!Ô3DÑEÔEÐEð *¨!Ô,�Ý,.¬G¯MªM¸(Ñ,CÔ,CÑ)�˜\Ø�x  a¤¨¤¨U°1¬X°a¬[Ñ9Ô9�Ø œJ×1Ò1°$Ô2CØ<Dð 2ñ Fô F�	ð  Ò,Ð,Ý)¨$¬*Ô*>Ð*>ð :?¸q¼À!¼¸¸ÀeÈAÄhÈqÄkÀkÀkÐS[ÐS[ÐS[Ð]bÐ]bð+dñeô eð eð "+¨1¤¨dÔ.?Ô!@�Ø"0°Ô"3��à# Aœh qœk�Ø$ Qœx¨œ{�Ø"&Ð&�˜4ØÐ à!%�Ø"�Ø#�‘ð (¨œl�Ø +Ò-Ð-Ø�|Ø*2¨(°;ÀÑ*MÔ*MÐM˜ 4Ø8?�DÔ/°Ñ5Ø&¨$Ò.Ð.Ø)-˜˜ð */˜Ø"'�K�KØ  FÒ*Ð*Ø&¨$Ò.Ð.Ø)-˜˜ð
 (Ð/ð !%¤
Ô 9× GÒ GØ$-¨a¤Lñ!2ô !2ñ 4˜I |ð !œJ×5Ò5°e¸\Ø6?ñAô Að Aà*6¸.ÈÔ:KÒ*K˜àÔ3ð 8õ '+­4¬<¸)ÀA¼,Ô:NÑ+NÑ&OÔ&O˜˜à&4°QÔ&7˜˜Ø  IÒ-Ð-Ø&¨$Ò.Ð.Ø)-˜˜à*6¸.ÈÔ:KÒ*K˜Ø"'�K�KØ Ð$4Ò4Ð4Ø&¨$Ò.Ð.Ø)-˜˜à).˜Ø"'�K�Kà�|Ø'˜x¨°\ÑBÔB˜Ý Ô1°$¸	À!¼ÑEÔEÐEØ $Ò&Ð&Ø�<Ø&. h¨{¸LÑ&IÔ&IÐI�H˜tØ8?�Ô+¨HÑ5àð B ¨tÔ/FÀqÔ/IÒ IÐ IØ#'Ô#:¸1Ô#=Ð Ð ðAØ'+Ô'BÀ;Ô'OÐ$Ð$øÝð Að Að AØ*.¬*×*?Ò*?ÀÔ@QØJUð +@ñ +Wô +WÐ'à':¸1Ô'=¸aÔ'@Ð$Ð$Ð$ðAøøøð $ u¨Q¤x°¤{Ò2Ð2à'+Ð$Ð$à1<�DÔ+¨AÑ.Ø1A�DÔ+¨AÑ.Ø œ( 1œ+ˆKØ�QŒx˜Œ{ð B˜{¨dÔ.EÀaÔ.HÒHÐHØ#'Ô#:¸1Ô#=Ð Ð ðAØ'+Ô'BÀ;Ô'OÐ$Ð$øÝð 	Að 	Að 	Að +/¬*×*?Ò*?ÀÔ@QØJUð +@ñ +Wô +WÐ'à*¨lÒ:Ð:Ý,˜nà*˜{˜{¨E¨Eð3ñ4ô 4ð 4ð (;¸1Ô'=¸aÔ'@Ð$Ð$Ð$ð	Aøøøð $ u¨Q¤x°¤{Ò2Ð2à'+Ð$Ð$à1<�DÔ+¨AÑ.Ø1A�DÔ+¨AÑ.à(¨Ô+ˆKØ%ð 5Ø*Ð.>Ò>ð5à&¨%°¬(°1¬+Ò5ð5ð &¨Ò4ð ð
 ð 9 4Ô#9ð 9Ø"�{àÐ#Ø&. h¨{¸LÑ&IÔ&IÐI�H˜tØ!%×!1Ò!1°(Ð<MÑ!NÔ!NÈqÔ!Q�JØ'�F�Fà!%×!1Ò!1°(Ð<MÑ!NÔ!NÈqÔ!Q�JØ 4Ò'Ð'Ø!+˜˜à!%×!1Ò!1°$Ð8IÑ!JÔ!JÈ1Ô!M˜Ý&Ô8¸ÔI�Ý*Ø˜!”H˜Q”KØ Ð(Ø"Ø Ø%Ð'7Ð8Ø×%Ò% lÐ4EÑFÔFØôØ×)Ò)¨%°¬(°1¬+Ð7HÑIÔIÈ!ÔLðNà  +Ð.Ø  +Ð.ñ	0ô 	0ð 29ð	9ð 	9ð  Ð$Ñ$¨¸EÐ)AÑ)Aà�8˜E !œH QœK¨¨q¬°!¬Ñ5Ô5ˆDð œ
×-Ò-¨dÔ.?Ø8=¸a¼À¼ð .ñ Eô EØEFôHØHIôKˆIà˜E !œH QœKÒ'Ð'Ø �	ØÐ$àÔ/ð 4õ #'Ýœ Y¨q¤\Ô%9Ñ:Ô:ð @Ý œL¨9°Q¬<Ô+?Ñ?ñ#Aô #A�K�Kð #1°Ô"3�KÝ*Ø˜!”H˜Q”KØ˜4×+Ò+¨DÐ2CÑDÔDÀQÔGÐHØØ!Ø˜9Ð%Ø˜4×+Ò+¨E°!¬H°Q¬KÐ9JÑKÔKÈAÔNÐOØ˜9 Qœ<Ð(Ø˜;Ð'ñ)ô )ð +/ð/ð /õ +Ø˜!”H˜Q”KØ˜4×+Ò+¨DÐ2CÑDÔDÀQÔGÐHØØ!Ø˜9Ð%Ø˜4×+Ò+¨E°!¬H°Q¬KÐ9JÑKÔKÈAÔNÐOØ Ø!ñ#ô #ð %)ð)ð )ð  Ð%Ð%¨/¸TÐ*AÐ*Að
  �x  a¤¨¤¨U°1¬X°a¬[Ñ9Ô9ˆHàœ
×-Ò-ØÔ!¨U°1¬X°a¬[ð .ñ :ô :Ø:;ô=Ø=>ô@ˆIà˜E !œH QœKÒ'Ð'Ø �	Ý&Ø�a”˜”Ø×!Ò! (Ð,=Ñ>Ô>¸qÔAÀ4ÐHØØØ˜DÐ!Ø×!Ò! %¨¤(¨1¤+Ð/@ÑAÔAÀ!ÔDÀdÐKÝÔ+¨OÔ<¸dÐCØ Ô" DÐ)ñ+ô +ð -1ð1ð 1ð  Ð%Ð%¨/¸TÐ*AÐ*Aõ
 Ô(¨Ô)EØ)7¸Ô):ñ<ô <ð BàÔ*×.Ò.¨~¸aÔ/@ÑAÔAÐAøØ Ð#Ð#¨¸3Ð(>Ð(>ð å �.à$3 O O°_°_ð"Fñ Gô Gð Gð ˆzs%   Í:N Î9OÏOÐ,P: Ð:ARÒRc                 ó   — | S r   r!   rt   s    r   Ú__iter__zProcessEntryPython.__iter__	  s   € Øˆr   c                 ó&  — | j         r|j        sdS | j                             |j        ¦  «         |j        d         }|rR| j                             d„ t          j        |¦  «        D ¦   «         ¦  «         | j                             d¦  «         dS dS )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   c              3   óB   K  — | ]}|                      d d¦  «        V — ŒdS )r‡   r"  N)r—   )rx   Úps     r   ú	<genexpr>zDProcessEntryPython._gather_result_for_consistency.<locals>.<genexpr>  sJ   è è € ð 5cð 5cØ89�—’˜Ð!2Ñ3Ô3ð5cð 5cð 5cð 5cð 5cð 5cr   r   )	r  r°   r  rÌ   rl   r  r{   r   Úparent_directories)r   rG  r~  s      r   Ú_gather_result_for_consistencyz1ProcessEntryPython._gather_result_for_consistency  s»   € ð Œ|ð 	 6¤>ð 	ØˆFØŒ×Ò˜&œ.Ñ)Ô)Ð)Ø”;˜q”>ˆØð 	7àÔ-×4Ò4ð 5cð 5cÝ=DÔ=WÐX`Ñ=aÔ=að5cñ 5cô 5cñ cô cð cð Ô-×1Ò1°#Ñ6Ô6Ð6Ð6Ð6ð	7ð 	7r   c              #   ól  K  — t           j        }t          }| j        }| j        }| j        }t          j        }|�	rß|                     ¦   «         }| 	                    d¦  «        }| 
                    |¦  «         | j                             |¦  «        }	| j                             |¦  «        }
	 t          j        |
¦  «        }d|t          j        |j        ¦  «        ||
f}|d         dk    rE| j                             | 	                    d¦  «        ¦  «        r|dd…         dz   |dd…         z   }n0# t(          $ r#}|j        t*          j        k    rd}n‚ Y d}~nd}~ww xY w|	s|s�Œ0d}|	D ]9} |||¦  «        \  }}|�&d	}|r|                      |¦  «         |s| j        r|V — Œ:| j        r|s}|r{t5          t7          j        |d         j        ¦  «        ot6          j        |d         j        z  ¦  «        }t=          dd|fd	d
dd ||¦  «        d         fd|d         fd|f¦  «        V — |ddf}| j                             |¦  «        \  }}|dk    r|dz  }|r|d         dk    rd}�nt          j         |
|¬¦  «        }	 tC          |¦  «        }|d         d         dk    rJtE          j#        |d         d¦  «        }|d         |         d         dk    rtI          ¦   «         ‚|d         |= n„# t(          $ rw}tK          |dd¦  «        }tL          tN          f}|j        t*          j        t*          j(        t*          j)        fv rd}n!tT          j+        dk    r|j        |v s||v rd}n‚ Y d}~nd}~ww xY w|tY          | j        j-        ¦  «        k     r>t          j.        || j        j-        |         d         ¦  «        r| j        j-        |         }nd}|€|��C|�rY|�rV|d         d         |d         k    �r= ||d         d         |d         ¦  «        �rzd}|tY          |d         ¦  «        k     �r;|d         |         }| j        rï|d         dk    rK| j                             |d          	                    d¦  «        ¦  «        r|dd…         dz   |dd…         z   }t5          t7          j        |d         j        ¦  «        ot6          j        |d         j        z  ¦  «        }t=          dd ||d         d¦  «        d         fd	d
dd ||d         d¦  «        d         fd|d         fd|f¦  «        V — |d         dv r|d         |= |dz  }|dz  }|tY          |d         ¦  «        k     �°;	 tC          |¦  «        }n´# t^          $ r d}Y n¦w xY w|d         D ]7} ||d¦  «        \  }}|�$|r|                      |¦  «         |s| j        r|V — Œ8|dz  }|tY          | j        j-        ¦  «        k     r>t          j.        || j        j-        |         d         ¦  «        r| j        j-        |         }nd}�Œad}|r(|tY          |d         ¦  «        k     r|d         |         }nd}d	} d}|r|tY          |d         ¦  «        k     rf|d         |         }|d         dk    rK| j                             |d          	                    d¦  «        ¦  «        r|dd…         dz   |dd…         z   }nd}d	}!d}|€|��š|€nõ|€6 |||¦  «        \  }}|�$|r|                      |¦  «         |s| j        r|V — n½|d         d         |d         k    s|d         | j0                 d         dv rS|d         |d         d         k     rd} no ||d¦  «        \  }}|�$|r|                      |¦  «         |s| j        r|V — d}!n7 |||¦  «        \  }}|�&d	}|r|                      |¦  «         |s| j        r|V — | r2|�0|dz  }|tY          |d         ¦  «        k     r|d         |         }nd}nd	} |!�ra|��^|s¹| j        ršt5          t7          j        |d         j        ¦  «        ot6          j        |d         j        z  ¦  «        } ||d         d¦  «        d         }"t=          dd|"fd	d
dd ||d         d¦  «        d         fd|d         fd|f¦  «        V — |d         dv r|d         |= |dz  }|d         dk    r|d         |= |dz  }|dz  }|tY          |d         ¦  «        k     rf|d         |         }|d         dk    rK| j                             |d          	                    d¦  «        ¦  «        r|dd…         dz   |dd…         z   }nd}d}nd	}!|�­—|�­š|�b|dz  }|tY          | j        j-        ¦  «        k     r>t          j.        || j        j-        |         d         ¦  «        r| j        j-        |         }nd}|�#	 tC          |¦  «        }n# t^          $ r d}Y nw xY w|�­@|�­C|�	°ß|  1                    ¦   «         D ]}|V — ŒdS )zIterate over the changes.r‡   r   r   rD   N©rG   r   FT)FFr‹   rÔ   r   r   rG   )Úprefix)ó   .bzrrJ  ÚwinerrorÚwin32r"  )rD   rG   r�   )2r  r   rµ  r>  r  r  r   Ú	splitpathrÙ   rµ  rÌ   r   rH  rp  r(   r4   rÿ  Úfile_kind_from_stat_moderò  Ú_directory_is_tree_referenceÚOSErrorÚerrnoÚENOENTrF  r  r  r  r²   r&  r   r   r¡   Ú_walkdirs_utf8rš  r  r  r™   ÚgetattrÚERROR_DIRECTORYÚERROR_PATH_NOT_FOUNDÚENOTDIRÚEINVALr  Úplatformr£   rQ   Ú	is_insider°  r  Ú_iter_specific_file_parents)#r   r  Ú_lt_by_dirsr>  r  r  rM  Úcurrent_rootÚcurrent_root_unicodeÚroot_entriesÚroot_abspathÚ	root_statÚroot_dir_infory   Úpath_handledr  rG  r:  Únew_executableÚinitial_keyr¼   rÀ   Úcurrent_dir_infoÚdir_iteratorÚ	bzr_indexÚ
e_winerrorÚ
win_errorsr<  Ú
path_indexÚcurrent_path_infoÚcurrent_entryr¿   Úadvance_entryÚadvance_pathÚrelpath_unicodes#                                      r   Úiter_changeszProcessEntryPython.iter_changes  sÆ  è è € åÔ)ˆÝ ˆØÔ,ˆØ $Ô :ÐØ"&Ô">ÐÝÔ%ˆ	ðN $ñ r	0ð 1×4Ò4Ñ6Ô6ˆLØ#/×#6Ò#6°vÑ#>Ô#>Ð Ø#×'Ò'¨Ñ5Ô5Ð5ð  œ:×7Ò7¸ÑEÔEˆLØœ9×,Ò,Ð-AÑBÔBˆLðDÝœH \Ñ2Ô2�	ð "% lÝ!(Ô!AØ%.Ô%6ñ"8ô "8Ø9BØ!-ð!/�ð ! Ô# {Ò2Ð2Ø”y×=Ò=Ø(×/Ò/°Ñ7Ô7ñ9ô 9ð Dà(5°b°q°bÔ(9Ø/ñ)0Ø2?ÀÀÀÔ2Cñ)D˜øøõ ð ð ð Ø”7�eœlÒ*Ð*à$(�M�Mð ð "�M�M�M�Møøøøðøøøð$  ð ¨ð áØ ˆLØ%ð %ð %�Ø"0 .°¸Ñ"FÔ"F‘�˜ØÐ&Ø#'�LØð DØ×;Ò;¸FÑCÔCÐCØð % $Ô"8ð %Ø$˜˜˜øØÔ$ð ¨\ð ¸mð Ý!%Ý”L ¨qÔ!1Ô!9Ñ:Ô:ð @Ýœ }°QÔ'7Ô'?Ñ?ñ"Aô "A�õ *ØØÐ/Ð0ØØ"Ø Ø˜9˜9Ð%9Ñ:Ô:¸2Ô>Ð?Ø˜=¨Ô+Ð,Ø˜>Ð*ñ	ô 	ð 	ð 	ð 	ð (¨¨cÐ2ˆKØ!œZ×BÒBÀ;ÑOÔO‰NˆK˜Ø˜aÒÐð ˜qÑ �Øð ; ¨qÔ!1Ð5EÒ!EÐ!EØ#'Ð Ñ å&Ô5Ø ¨ð 7ñ  7ô  7�ð;Ý'+¨LÑ'9Ô'9Ð$ð& (¨Ô*¨1Ô-°Ò4Ð4å$*Ô$6Ø,¨QÔ/°ñ%=ô %=˜	à+¨AÔ.¨yÔ9¸!Ô<ÀÒGÐGÝ"0Ñ"2Ô"2Ð2Ø,¨QÔ/°	Ð:øøõ1 ð ð ð õ ")¨¨J¸Ñ!=Ô!=�JÝ"1Õ3GÐ!H�Jð ”w¥5¤<µ´ÅÄÐ"MÐMÐMØ+/Ð(Ð(Ýœ,¨'Ò1Ð1Ø œw¨*Ð4Ð4Ø)¨ZÐ7Ð7Ø+/Ð(Ð(àøøøøøøøøøð!øøøð6 �c $¤*Ô"7Ñ8Ô8Ò8Ð8ÝÔ! ,Ø"&¤*Ô"7¸Ô"DÀQÔ"GñIô Ið 9ð !%¤
Ô 5°kÔ B��à $�Ø#Ð/Ø Ñ,Ø$ñ H¨ñ HØ,¨QÔ/°Ô2°mÀAÔ6FÒFÑFØ"�{Ð#3°AÔ#6°qÔ#9¸=ÈÔ;KÑLÔLñ E1ð &'˜
Ø(­3Ð/?ÀÔ/BÑ+CÔ+CÒCÑCØ0@ÀÔ0CÀJÔ0OÐ-Ø#Ô4ð <Ø#4°QÔ#7¸;Ò#FÐ#FØ'+¤y×'MÒ'MØ,=¸aÔ,@×,GÒ,GÈÑ,OÔ,Oñ(Qô (Qð %Bà<MÈbÈqÈbÔ<QØ,?ñ=@à,=¸a¸b¸bÔ,Añ=BÐ(9õ 26Ý$(¤LÐ1BÀ1Ô1EÔ1MÑ$NÔ$Nð %TÝ(,¬Ð7HÈÔ7KÔ7SÑ(Sñ2Uô 2U õ ':Ø$(Ø%)¨;¨;Ð7HÈÔ7KÐM^Ñ+_Ô+_Ð`aÔ+bÐ$cØ$(Ø$2Ø$0Ø%)¨;¨;Ð7HÈÔ7KÐM^Ñ+_Ô+_Ð`aÔ+bÐ$cØ%)Ð+<¸QÔ+?Ð$@Ø%)¨>Ð$:ñ'<ô '<ð !<ð !<ð !<ð  1°Ô3ð 8Jð  Jð  Jà$4°QÔ$7¸
Ð$CØ *¨a¡ 
Ø&¨!™O˜Jð7 )­3Ð/?ÀÔ/BÑ+CÔ+CÒCÑCð<4Ý/3°LÑ/AÔ/AÐ,Ð,øÝ,ð 4ð 4ð 4Ø/3Ð,Ð,Ð,ð4øøøð .;¸1Ô-=ð 	1ð 	1˜Mð /=¨nØ -¨tñ/5ô /5™O˜F Gà&Ð2Ø#*ð !PØ$(×$GÒ$GÈÑ$OÔ$OÐ$OØ#*ð !1¨dÔ.Dð !1Ø*0 L L LøØ# qÑ(˜Ø'­#¨d¬jÔ.CÑ*DÔ*DÒDÐDÝ#Ô-¨lØ.2¬jÔ.CÀKÔ.PÐQRÔ.SñUô Uð Eð -1¬JÔ,AÀ+Ô,N˜M˜Mà,0˜MÙØ�Ø ð ) [µ3°}ÀQÔ7GÑ3HÔ3HÒ%HÐ%HØ$1°!Ô$4°[Ô$A�M�Mà$(�MØ $�Ø�
Ø#ð -¨
µSÐ9IÈ!Ô9LÑ5MÔ5MÒ(MÐ(MØ(8¸Ô(;¸JÔ(GÐ%Ø(¨Ô+¨{Ò:Ð:Øœ9×AÒAØ 1°!Ô 4× ;Ò ;¸FÑ CÔ CñEô Eð Là0AÀ"À1À"Ô0EØ 3ñ14Ø6GÈÈÈÔ6Kñ1LÐ-øð )-Ð%Ø#�Ø$�Ø$Ð0Ø(Ñ4Ø$Ð,ð Ø*Ð2à*8¨.Ø)Ð+<ñ+>ô +>™˜ à"Ð.Ø&ð LØ $× CÒ CÀFÑ KÔ KÐ KØ&ð -¨$Ô*@ð -Ø&,   øØ'¨Ô*¨1Ô-Ð1BÀ1Ô1EÒEÐEØ*¨1Ô-¨dÔ.?Ô@ÀÔCÀ|ÐSÐSð -¨QÔ/°-ÀÔ2BÀ1Ô2EÒEÐEð -2˜M˜Mð /=¨nØ -¨tñ/5ô /5™O˜F Gà&Ð2Ø#*ð !PØ$(×$GÒ$GÈÑ$OÔ$OÐ$OØ#*ð !1¨dÔ.Dð !1Ø*0 L L LØ+0˜L˜Là*8¨.Ø)Ð+<ñ+>ô +>™˜ à"Ð.Ø+/˜LØ&ð LØ $× CÒ CÀFÑ KÔ KÐ KØ&ð -¨$Ô*@ð -Ø&,   Ø$ð -¨Ð)BØ# qÑ(˜Ø&­¨]¸1Ô-=Ñ)>Ô)>Ò>Ð>Ø,9¸!Ô,<¸[Ô,I˜M˜Mà,0˜M˜Mà(,˜Ø#ñ ),Ð(9Ñ(EØ+ð 0à#Ô4ð <Ý15Ý$(¤LÐ1BÀ1Ô1EÔ1MÑ$NÔ$Nð %TÝ(,¬Ð7HÈÔ7KÔ7SÑ(Sñ2Uô 2U ð 3>°+Ø$5°aÔ$8Ð:Kñ3Mô 3MØMNô3P å&9Ø$(Ø%)¨?Ð$;Ø$(Ø$2Ø$0Ø%)¨;¨;Ð7HÈÔ7KÐM^Ñ+_Ô+_Ð`aÔ+bÐ$cØ%)Ð+<¸QÔ+?Ð$@Ø%)¨>Ð$:ñ'<ô '<ð !<ð !<ð !<ð  1°Ô3¸ÐDÐDØ$4°QÔ$7¸
Ð$CØ *¨a¡ 
ð -¨QÔ/Ð3CÒCÐCØ 0°Ô 3°JÐ ?Ø&¨!™O˜JØ" a™˜
Ø%­Ð,<¸QÔ,?Ñ(@Ô(@Ò@Ð@Ø0@ÀÔ0CÀJÔ0OÐ-Ø0°Ô3°{ÒBÐBØ#'¤9×#IÒ#IØ(9¸!Ô(<×(CÒ(CÀFÑ(KÔ(Kñ$Mô $Mð !>à8IÈ"È1È"Ô8MØ(;ñ9<à(9¸!¸"¸"Ô(=ñ9>Ð$5øð 15Ð-Ø',˜˜à'+˜ðE %Ñ0Ø(Ñ4ðD !Ð,Ø 1Ñ$�KØ#¥c¨$¬*Ô*?Ñ&@Ô&@Ò@Ð@ÝÔ)¨,Ø*.¬*Ô*?ÀÔ*LÈQÔ*OñQô Qð Að )-¬
Ô(=¸kÔ(J˜˜à(,˜Ø#Ð/ð0Ý+/°Ñ+=Ô+=Ð(Ð(øÝ(ð 0ð 0ð 0Ø+/Ð(Ð(Ð(ð0øøøðW $Ñ/Ø Ñ,ðO $ñ r	0ðf	 ×6Ò6Ñ8Ô8ð 	ð 	ˆFØˆLˆLˆLˆLð	ð 	sU   Â-D1 Ä1
EÄ;EÅEÊK- Ë-
M.Ë7A-M)Í)M.Õ)U9 Õ9VÖVç.g> ç>hèhc           
   #   óŒ  K  — | j         �r9| j                              ¦   «         }t          j        | j        |¦  «        rŒ<|| j        v rŒF| j                             |¦  «        }g }d}|D ]½}|d         | j                 d         dvrd}| 	                    |¦  «         Œ5| j
        ��|d         | j
                 d         dvrfd}|d         | j                 d         dk    r| 	                    |¦  «         ŒŒ| j                              |d         | j                 d         ¦  «         Œ¾|s#t          d                     ||¦  «        ¦  «        ‚|                      ||                     d	¦  «        ¦  «        }|D �]§}|d         d
         | j        v rŒ|                      ||¦  «        \  }}	|	€t          d|›d|›d|›d�¦  «        ‚|	�rJ|                      |¦  «         |j        d         dk    �r#|j        d         dk    �r|d         | j
                 d         dk    r|d         | j
                 d         }
n|}
|
ddf}| j                             |¦  «        \  }}|dk    r|dz  }d}|t+          | j        j        ¦  «        k     r/| j        j        |         }t          j        |
|d         ¦  «        sd}|�[|d         D ]R}|d         | j
                 d         dv rŒ| j                              t          j        |d         dd
…         Ž ¦  «         ŒS|	s| j        r|V — �Œ©| j                             |¦  «         | j         �°7dS dS )z$Iter over the specific file parents.Fr   r   r�   TNr<   z1Missing entry for specific path parent {!r}, {!r}r‡   r   z,Got entry<->path mismatch for specific path z entry z path_info r‘   rD   r?   r   )r  rÙ   r   r$  r  r  r   rH  r  rÞ   r  rÌ   r™   rš   Ú
_path_inforµ  r  r>  rF  r±   r¡   r£   rQ   rZ  rž   r  )r   rŒ   Úpath_entriesÚselected_entriesÚ
found_itemÚcandidate_entryr'  r  rG  r:  Úentry_path_utf8re  r¼   rÀ   r<  s                  r   r[  z.ProcessEntryPython._iter_specific_file_parentsƒ  s   è è € àÔ/ñ W	5ð Ô9×=Ò=Ñ?Ô?ˆIÝÔ$ TÔ%AÀ9ÑMÔMð àØ˜DÔ5Ð5Ð5àØœ:×7Ò7¸	ÑBÔBˆLð
  "ÐØˆJØ#/ð Fð F�à" 1Ô% dÔ&7Ô8¸Ô;À<ÐOÐOØ!%�JØ$×+Ò+¨OÑ<Ô<Ð<Ð<àÔ'Ð3Ø% aÔ(¨Ô):Ô;¸AÔ>ÀlÐRÐRØ!%�JØ& qÔ)¨$Ô*;Ô<¸QÔ?À4ÒGÐGà(×/Ò/°Ñ@Ô@Ð@Ð@ð Ô9×=Ò=Ø+¨AÔ.¨tÔ/@ÔAÀ!ÔDñFô Fð Føàð 2Ý$ØG×NÒNØ! <ñ1ô 1ñ2ô 2ð 2ð Ÿš¨	°9×3CÒ3CÀFÑ3KÔ3KÑLÔLˆIØ)ð .!ñ .!�Ø˜”8˜A”; $¤-Ð/Ð/ØØ"&×"5Ò"5°e¸YÑ"GÔ"G‘�˜Ø�?Ý(˜.ð &˜I˜I u u u¨i¨i¨ið9ñ:ô :ð :ð ñ !EØ×7Ò7¸Ñ?Ô?Ð?Øœ Aœ¨+Ò5Ñ5Ø"œK¨œN¨kÒ9Ñ9ð ! œ8 DÔ$5Ô6°qÔ9¸TÒAÐAà.3°A¬h°tÔ7HÔ.IÈ!Ô.L˜O˜Oà.7˜OØ'6¸¸SÐ&A˜Ø)-¬×)NÒ)NØ'ñ*)ô *)™˜ Qà&¨!Ò+Ð+à'¨1Ñ,˜KØ(,˜Ø&­¨T¬ZÔ-BÑ)CÔ)CÒCÐCØ,0¬JÔ,AÀ+Ô,N˜MÝ#*Ô#4Ø$3°]À1Ô5Eñ$Gô $Gð 5ð 15 Ø(Ð4Ø)6°qÔ)9ð Eð E Ø#(¨¤8¨DÔ,=Ô#>¸qÔ#AÀ\Ð#QÐ#Qð %-ð !%Ô A× EÒ EÝ$+Ô$4°e¸A´h¸rÀ¸r´lÐ$Cñ!Eô !Eð !Eð !Eàð !˜dÔ4ð !Ø �L�L�LùØÔ%×)Ò)¨)Ñ4Ô4Ð4ðo Ô/ñ W	5ð W	5ð W	5ð W	5ð W	5r   c                 óÐ  — | j                              |¦  «        }	 t          j        |¦  «        }n.# t          $ r!}|j        t
          j        k    rY d}~dS ‚ d}~ww xY w|                     dd¦  «        d         }||t          j	        |j
        ¦  «        ||f}|d         dk    rA| j                              |¦  «        r'| j        dd…         dz   | j        dd…         z   | _        |S )	zzGenerate path_info for unicode_path.

        :return: None if unicode_path does not exist, or a path_info tuple.
        NrÓ   r   rÔ   r   rD   rH  r   )rp  r(   r4   rÿ  rP  rQ  rR  Úrsplitr   rN  rò  rO  rb  )r   Ú	utf8_pathÚunicode_pathr(   r²   ry   Úutf8_basenameÚdir_infos           r   rs  zProcessEntryPython._path_infoÞ  s  € ð
 ”)×#Ò# LÑ1Ô1ˆð	Ý”8˜GÑ$Ô$ˆDˆDøÝð 	ð 	ð 	ØŒw�%œ,Ò&Ð&à�t�t�t�t�tàøøøøð	øøøð "×(Ò(¨¨qÑ1Ô1°"Ô5ˆØ˜}ÝÔ4°T´\ÑBÔBÀDØðˆð �AŒ;˜+Ò%Ð%ØŒy×5Ò5Ø ñ"ô "ð Aà%)Ô%7¸¸¸Ô%;Ø'ñ&(Ø*.Ô*<¸Q¸R¸RÔ*@ñ&A�Ô"àˆs   œ1 ±
A»AÁAÁAN)r   r   r   Ú	__slots__r   r   rž   r>  r@  rF  rq  r[  rs  r!   r   r   r  r  Å  s­   € € € € € ðVð Vð V€Ið#ð #ð #ðJ 9@Ô8Hð Tð Tð Tð Tðlð ð ð7ð 7ð 7ð&bð bð bðHY5ð Y5ð Y5ðvð ð ð ð r   r  )ri  r`  rß   rà   rµ  r«   ÚProcessEntryCr#  )ri  r`  rß   rà   rµ  r«   )1r,   r  r  re  rQ  r«  r4   r²   r   r  rý  r^  r{  r   r   r   r	   r
   r   r   r   r   r   Úinventorytreer   rV  rU  r   r   r#   r.   r;   rø  r  r  Ú_dirstate_helpers_pyxri  r`  rß   rà   rµ  r«   r€  r>  r#  ÚImportErrorry   Úfailed_to_load_extensionÚ_dirstate_helpers_pyr!   r   r   ú<module>r†     sA  ðð"Jð JðX €€€Ø €€€Ø Ð Ð Ð Ø €€€Ø €€€Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø €€€Ø 
€
€
€
Ø €€€Ø €€€ðð ð ð ð ð ð ð ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð /Ð .Ð .Ð .Ð .Ð .ð Ð Ø€ðð ð ð ð �f”oñ ô ð ð6ð 6ð 6ð 6ð 6ñ 6ô 6ð 6ð.ð ð ð ð ˜,ñ ô ð ðq0/ð q0/ð q0/ð q0/ð q0/ñ q0/ô q0/ð q0/ðja '/Ô&@ð]ð ]ð ]ð ]ð@pð pð pð pð pñ pô pð pðh(ð	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
øð ð (ð (ð (Ø$€GÔ$ QÑ'Ô'Ð'ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð #€LØ'€N€N€N€N€N€N€Nøøøøð(øøøs   Â*C  Ã C4Ã$C/Ã/C4