403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/dirstateutils/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/dirstateutils/__pycache__/v2.cpython-39.opt-1.pyc
a

�+�b8;�@s�ddlmZddlZddlmZddlmZmZe�d�Z	dZ
dZe�d�Z
e�d	�Zd
Zdd�Zd
d�Zdd�ZejGdd�de��Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)�)�absolute_importN�)�attr)�error�policy�parsers�,z>LLLLL4s20sz>LHHLHLLLLHlll� cCs,t�|�\}}}}}}	}
t|||||�dS)a;parse a full v2-dirstate from a binary data into dictionnaries:

    - map: a {path: entry} mapping that will be filled
    - copy_map: a {path: copy-source} mapping that will be filled
    - data: a binary blob contains v2 nodes data
    - tree_metadata:: a binary blob of the top level node (from the docket)
    N)�
TREE_METADATA�unpack�parse_nodes)�map�copy_map�data�
tree_metadata�root_nodes_start�root_nodes_lenZ_nodes_with_entry_countZ_nodes_with_copy_source_countZ_unreachable_bytesZ_unusedZ_ignore_patterns_hash�r�@/usr/lib64/python3.9/site-packages/mercurial/dirstateutils/v2.py�parse_dirstate?s�rcCs�t|�D]�}|t|}t||t�}t�|�\
}}	}
}}}
}}}}}}}t||||
|�tj�||||�}|j	srqt|||	�}|||<|rt|||�||<qdS)aparse <len> nodes from <data> starting at offset <start>

    This is used by parse_dirstate to recursively fill `map` and `copy_map`.

    All directory specific information is ignored and do not need any
    processing (DIRECTORY, ALL_UNKNOWN_RECORDED, ALL_IGNORED_RECORDED)
    N)
�range�	NODE_SIZE�slice_with_len�NODErrrZDirstateItemZfrom_v2_dataZany_tracked)r
rr�start�len�iZ
node_startZ
node_bytes�
path_start�path_lenZ_basename_start�copy_source_start�copy_source_lenZchildren_start�children_countZ_descendants_with_entry_countZ_tracked_descendants_count�flags�size�mtime_s�mtime_ns�item�pathrrrrSs8��rcCs||||�S�Nr)rrrrrrr|src@s`eZdZe��Ze��Zejdd�Zejdd�Zejdd�Z	ejdd�Z
ejdd�Zdd�ZdS)�NodeN)�defaultrcCs�|j}|�|�}|j}|}t|�}|�d�d}|durN|t|�}	t|�}
nd}	d}
|durp|��\}}}
}nt}d}d}
d}t�||||	|
|j	|j
|j|j|||
|�
S)N�/�r)
r'�get�entryr�rfindZv2_data�DIRSTATE_V2_DIRECTORYr�pack�children_offsetr!�descendants_with_entry�tracked_descendants)�selfr�paths_offsetr'�copyr.rrZbasename_startrr r"r#r$r%rrrr1�s@

�z	Node.pack)
�__name__�
__module__�__qualname__rZibr'r.�parentr!r2r3r4r1rrrrr)�sr)c	Cs�t�}d}d}d}d}d}d}d}	t|�dkrLt�|||||||	�}
||
fSt|��dd�d�}g}tdd�}
|�|
�t|d	�D�]\}\}}|d	7}||vr�|d	7}t	|�}t
||
|�}
|
jd	7_|jr�|
j
d	7_
|
jd	7_|�t|||
��d
}d}|t|�k�r,||d}t||�}|r�t|
|||�|r�|
jdkr�|
j}|du�ont|t	|dj��}|du�s�|�r�q�t||||�|}
�q>q�|��}
t�|
j|
j|||||	�}
||
fS)a

    Pack `map` and `copy_map` into the dirstate v2 binary format and return
    the bytearray.

    The on-disk format expects a tree-like structure where the leaves are
    written first (and sorted per-directory), going up levels until the root
    node and writing that one to the docket. See more details on the on-disk
    format in `mercurial/helptext/internals/dirstate-v2`.

    Since both `map` and `copy_map` are flat dicts we need to figure out the
    hierarchy. This algorithm does so without having to build the entire tree
    in-memory: it only keeps the minimum number of nodes around to satisfy the
    format.

    # Algorithm explanation

    This explanation does not talk about the different counters for tracked
    descendents and storing the copies, but that work is pretty simple once this
    algorithm is in place.

    ## Building a subtree

    First, sort `map`: this makes it so the leaves of the tree are contiguous
    per directory (i.e. a/b/c and a/b/d will be next to each other in the list),
    and enables us to use the ordering of folders to have a "cursor" of the
    current folder we're in without ever going twice in the same branch of the
    tree. The cursor is a node that remembers its parent and any information
    relevant to the format (see the `Node` class), building the relevant part
    of the tree lazily.
    Then, for each file in `map`, move the cursor into the tree to the
    corresponding folder of the file: for example, if the very first file
    is "a/b/c", we start from `Node[""]`, create `Node["a"]` which points to
    its parent `Node[""]`, then create `Node["a/b"]`, which points to its parent
    `Node["a"]`. These nodes are kept around in a stack.
    If the next file in `map` is in the same subtree ("a/b/d" or "a/b/e/f"), we
    add it to the stack and keep looping with the same logic of creating the
    tree nodes as needed. If however the next file in `map` is *not* in the same
    subtree ("a/other", if we're still in the "a/b" folder), then we know that
    the subtree we're in is complete.

    ## Writing the subtree

    We have the entire subtree in the stack, so we start writing it to disk
    folder by folder. The way we write a folder is to pop the stack into a list
    until the folder changes, revert this list of direct children (to satisfy
    the format requirement that children be sorted). This process repeats until
    we hit the "other" subtree.

    An example:
        a
        dir1/b
        dir1/c
        dir2/dir3/d
        dir2/dir3/e
        dir2/f

    Would have us:
        - add to the stack until "dir2/dir3/e"
        - realize that "dir2/f" is in a different subtree
        - pop "dir2/dir3/e", "dir2/dir3/d", reverse them so they're sorted and
          pack them since the next entry is "dir2/dir3"
        - go back up to "dir2"
        - add "dir2/f" to the stack
        - realize we're done with the map
        - pop "dir2/f", "dir2/dir3" from the stack, reverse and pack them
        - go up to the root node, do the same to write "a", "dir1" and "dir2" in
          that order

    ## Special case for the root node

    The root node is not serialized in the format, but its information is
    written to the docket. Again, see more details on the on-disk format in
    `mercurial/helptext/internals/dirstate-v2`.
    rsscSs|dS)Nrr)�xrrr�<lambda>�zpack_dirstate.<locals>.<lambda>)�keyr>Nr,T���)�	bytearrayrr
r1�sorted�itemsr)�append�	enumerate�
get_folder�move_to_correct_node_in_treer!Ztrackedr4r3�is_ancestor�pack_directory_childrenr'r;�popr2)r
rrrrZnodes_with_entry_countZnodes_with_copy_source_countZunreachable_bytesZunusedZignore_patterns_hashrZ
sorted_map�stack�current_node�indexr'r.Zcurrent_folderZshould_packZ	next_pathr;Zin_ancestor_of_next_pathrrr�
pack_dirstate�s~K�	

�
�
�
rNcCsd|vr|�dd�dSdS)zU
    Return the folder of the path that's given, an empty string for root paths.
    r+r,rr>)�rsplit)r'rrrrFTsrFcCsD|dkrdS||krdS|�d�}|�d�}tdd�t||�D��S)aReturns whether `maybe_ancestor` is an ancestor of `path`.

    >>> is_ancestor(b"a", b"")
    True
    >>> is_ancestor(b"a/b/c", b"a/b/c")
    False
    >>> is_ancestor(b"hgext3rd/__init__.py", b"hgext")
    False
    >>> is_ancestor(b"hgext3rd/__init__.py", b"hgext3rd")
    True
    r>TFr+css|]\}}||kVqdSr(r)�.0�c�orrr�	<genexpr>mr>zis_ancestor.<locals>.<genexpr>)�split�all�zip)r'Zmaybe_ancestorZpath_componentsZancestor_componentsrrrrH[s

rHcCs�||jkr�t||j�r�|t|j�d��d�}|�dd�d}|jrT|jd|}n|}|d}|j|krp|}q�|jd7_t|d|�}|�|�q|j}q|S)z�
    Move inside the dirstate node tree to the node corresponding to
    `target_folder`, creating the missing nodes along the way if needed.
    Nr+r,rr@)	r'rHr�lstriprTr!r)rDr;)Z
target_folderrLrK�prefixZsubfolder_nameZsubfolder_pathZ	next_noderrrrGps

rGcCs�g}|djdkr6t|dj�|jkr6|�|���q|sJt�d|j��|��t�}|D]`}|j|t	|�d�}|�
|�|�
|j�|�
|�|jd��|j|j7_|j
|j
7_
q\t	|�|_|�
|�dS)z_
    Write the binary representation of the direct sorted children of `node` to
    `data`
    r@r>sno direct children for %r)rr6N)r'rFrDrJrZProgrammingError�reverserAr1r�extendr-r4r3r2)ZnoderrrKZdirect_childrenZpacked_children�childZpackedrrrrI�s "

rI)Z
__future__r�structZ
thirdpartyr�rrZ	importmodrZTREE_METADATA_SIZEr�Structr
rr0rrr�s�objectr)rNrFrHrGrIrrrr�<module>s(


)0$

Youez - 2016 - github.com/yon3zu
LinuXploit