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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/metadata.cpython-39.pyc
a

�+�bM��@s�ddlmZmZddlZddlZddlmZddlmZm	Z	ddl
mZm
ZGdd�de�Zd	d
�Zdd�ZdAd
d�Zdd�Zdd�Zdd�Zdd�Zdd�ZdBdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Z e!d)d*�Z"e!d+d*�Z#e!d,d*�Z$e!d-d*�Z%e!d.d*�Z&e!d/d*�Z'e!d0d*�Z(e!d1d*�Z)e!d0d*�Z*e�+d2�Z,e�+d3�Z-d4d5�Z.d6d7�Z/d8d9�Z0d:d;�Z1d<d=�Z2d>Z3d?d@�Z4dS)C�)�absolute_import�print_functionN�)�nullrev)�error�util)�flagutil�sidedatac@seZdZdZd3dd�Zdd�Zedd��Zej	d	d
��Z
dd�Zd
d�Zej	dd��Z
dd�Zdd�Zej	dd��Zdd�Zdd�Zej	dd��Zdd�Zdd �Zej	d!d"��Zd#d$�Zd%d&�Zej	d'd(��Zd)d*�Zd+d,�Zej	d-d.��Zd/d0�Zd1d2�ZdS)4�
ChangingFilesazA class recording the changes made to files by a changeset

    Actions performed on files are gathered into 3 sets:

    - added:   files actively added in the changeset.
    - merged:  files whose history got merged
    - removed: files removed in the revision
    - salvaged: files that might have been deleted by a merge but were not
    - touched: files affected by the merge

    and copies information is held by 2 mappings

    - copied_from_p1: {"<new-name>": "<source-name-in-p1>"} mapping for copies
    - copied_from_p2: {"<new-name>": "<source-name-in-p2>"} mapping for copies

    See their inline help for details.
    NcCs�t|durdn|�|_t|dur$dn|�|_t|dur:dn|�|_t|durPdn|�|_t|durfdn|�|_|j�|j�|j�|j�|j�|j�t|dur�dn|�|_t|dur�dn|�|_	dS)N�)
�set�_added�_merged�_removed�_touched�	_salvaged�update�dict�
_p1_copies�
_p2_copies)�self�touched�added�removed�merged�salvagedZ	p1_copiesZ	p2_copiesrr�8/usr/lib64/python3.9/site-packages/mercurial/metadata.py�__init__-s
zChangingFiles.__init__cCsT|j|jkoR|j|jkoR|j|jkoR|j|jkoR|j|jkoR|j|jkoR|j|jkS�N)rrrrr�copied_from_p1�copied_from_p2)r�otherrrr�__eq__Bs
�
�
�
�
�
�zChangingFiles.__eq__cCs"t|jp|jp|jp|jp|j�Sr)�boolrrrrr �rrrr�has_copies_infoMs����zChangingFiles.has_copies_infocCs
t|j�S)aKfiles actively added in the changeset

        Any file present in that revision that was absent in all the changeset's
        parents.

        In case of merge, this means a file absent in one of the parents but
        existing in the other will *not* be contained in this set. (They were
        added by an ancestor)
        )�	frozensetr
r$rrrrWszChangingFiles.addedcCs*dt|�vr|`|j�|�|�|�dS)Nr)�varsrr
�add�mark_touched�r�filenamerrr�
mark_addeddszChangingFiles.mark_addedcCs|D]}|�|�qdSr)r,�r�	filenames�frrr�update_addedjszChangingFiles.update_addedcCs
t|j�S)z�files actively merged during a merge

        Any modified files which had modification on both size that needed merging.

        In this case a new filenode was created and it has two parents.
        )r&rr$rrrrnszChangingFiles.mergedcCs*dt|�vr|`|j�|�|�|�dS)Nr)r'rrr(r)r*rrr�mark_mergedxszChangingFiles.mark_mergedcCs|D]}|�|�qdSr)r1r-rrr�
update_merged~szChangingFiles.update_mergedcCs
t|j�S)afiles actively removed by the changeset

        In case of merge this will only contain the set of files removing "new"
        content. For any file absent in the current changeset:

        a) If the file exists in both parents, it is clearly "actively" removed
        by this changeset.

        b) If a file exists in only one parent and in none of the common
        ancestors, then the file was newly added in one of the merged branches
        and then got "actively" removed.

        c) If a file exists in only one parent and at least one of the common
        ancestors using the same filenode, then the file was unchanged on one
        side and deleted on the other side. The merge "passively" propagated
        that deletion, but didn't "actively" remove the file. In this case the
        file is *not* included in the `removed` set.

        d) If a file exists in only one parent and at least one of the common
        ancestors using a different filenode, then the file was changed on one
        side and removed on the other side. The merge process "actively"
        decided to drop the new change and delete the file. Unlike in the
        previous case, (c), the file included in the `removed` set.

        Summary table for merge:

        case | exists in parents | exists in gca || removed
         (a) |       both        |     *         ||   yes
         (b) |       one         |     none      ||   yes
         (c) |       one         | same filenode ||   no
         (d) |       one         |  new filenode ||   yes
        )r&rr$rrrr�s"zChangingFiles.removedcCs*dt|�vr|`|j�|�|�|�dS)Nr)r'rrr(r)r*rrr�mark_removed�szChangingFiles.mark_removedcCs|D]}|�|�qdSr)r3r-rrr�update_removed�szChangingFiles.update_removedcCs
t|j�S)a.files that might have been deleted by a merge, but still exists.

        During a merge, the manifest merging might select some files for
        removal, or for a removed/changed conflict. If at commit time the file
        still exists, its removal was "reverted" and the file is "salvaged"
        )r&rr$rrrr�szChangingFiles.salvagedcCs*dt|�vr|`|j�|�|�|�dS)Nr)r'rrr(r)r*rrr�
mark_salvaged�szChangingFiles.mark_salvagedcCs|D]}|�|�qdSr)r5r-rrr�update_salvaged�szChangingFiles.update_salvagedcCs
t|j�S)z0files either actively modified, added or removed)r&rr$rrrr�szChangingFiles.touchedcCs dt|�vr|`|j�|�dS)Nr)r'rrr(r*rrrr)�szChangingFiles.mark_touchedcCs|D]}|�|�qdSr)r)r-rrr�update_touched�szChangingFiles.update_touchedcCs
|j��Sr)r�copyr$rrrr�szChangingFiles.copied_from_p1cCsdt|�vr|`||j|<dS)Nr)r'rr�r�source�destrrr�mark_copied_from_p1�sz!ChangingFiles.mark_copied_from_p1cCs"|��D]\}}|�||�qdSr)�itemsr<�r�copiesr;r:rrr�update_copies_from_p1�sz#ChangingFiles.update_copies_from_p1cCs
|j��Sr)rr8r$rrrr �szChangingFiles.copied_from_p2cCsdt|�vr|`||j|<dS)Nr )r'r rr9rrr�mark_copied_from_p2�sz!ChangingFiles.mark_copied_from_p2cCs"|��D]\}}|�||�qdSr)r=rAr>rrr�update_copies_from_p2�sz#ChangingFiles.update_copies_from_p2)NNNNNNN)�__name__�
__module__�__qualname__�__doc__rr"�propertyr%rZ
propertycacherr,r0rr1r2rr3r4rr5r6rr)r7rr<r@r rArBrrrrr
sP�

	

	
#
	


r
cCs�|��}|��}|��tkr0|��tkr0t|�S|��tkrR|��tkrRt||�S|��tkrx|��tkrxt||dd�S|��|��kr�t||�St|||�SdS)z'compute the files changed by a revision�)�parentN)�p1�p2�revr�
_process_root�_process_linear�_process_merge��ctxrJrKrrr�compute_all_files_changes�s

rRcCs&t�}|��}|D]}|�|�q|S)zEcompute the appropriate changed files for a changeset with no parents)r
�manifestr,)rQ�mdrSr+rrrrM�s
rMc
Cs�t�}|��}|��}g}|�|���D]T\}}|dddurL|�|�q(|�|�|dddurr|�|�q(|�|�q(|dkr�|j}	n |dkr�|j	}	nds�Jd|��|D]&}||�
�}
|
r�|
\}}|	||�q�|S)zJcompute the appropriate changed files for a changeset with a single parentrrNrHFzbad parent value %d)r
rS�diffr=r3�appendr,r)r<rA�renamed)
Z
parent_ctxZchildren_ctxrIrTZparent_manifestZchildren_manifestZcopies_candidater+�d�copied�	copy_infor:�srcnoderrrrN	s,
rNcs~���}t�}���}|��}|��}|�|�}|�|�}	���j�|��|���}
|
s^tg}
�fdd�|
D�}g}|��D�]`\�}
|	�	�d�}|dur�t
||�|
�q||
dddur�|dddur�|���|���q||
dddu�r|dddu�r|�
��q||
dddu�r�|dddu�r�|
dddu�sX|dddu�r�t�fdd�|D���r||���n
|���n>|j�|
ddd�}|����tk�r�|���n
|���|���q|d	s|Jd
��q||	��D]\�}t
||�|��q�|D]r�����}|�r|\}}||v�rN||��|k�rN|�|��n(||v�r||��|k�r|�|���q|S)u�compute the appropriate changed files for a changeset with two parents

    This is a more advance case. The information we need to record is summarise
    in the following table:

    ┌──────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
    │ diff ╲  diff │       ø      │ (Some, None) │ (None, Some) │ (Some, Some) │
    │  p2   ╲  p1  │              │              │              │              │
    ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
    │              │              │🄱  No Changes │🄳  No Changes │              │
    │  ø           │🄰  No Changes │      OR      │     OR       │🄵  No Changes │
    │              │              │🄲  Deleted[1] │🄴  Salvaged[2]│     [3]      │
    ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
    │              │🄶  No Changes │              │              │              │
    │ (Some, None) │      OR      │🄻  Deleted    │       ø      │      ø       │
    │              │🄷  Deleted[1] │              │              │              │
    ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
    │              │🄸  No Changes │              │              │   🄽 Touched  │
    │ (None, Some) │     OR       │      ø       │🄼   Added     │OR 🅀 Salvaged │
    │              │🄹  Salvaged[2]│              │   (copied?)  │   (copied?)  │
    ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
    │              │              │              │   🄾 Touched  │   🄿 Merged   │
    │ (Some, Some) │🄺  No Changes │      ø       │OR 🅁 Salvaged │OR 🅂 Touched  │
    │              │     [3]      │              │   (copied?)  │   (copied?)  │
    └──────────────┴──────────────┴──────────────┴──────────────┴──────────────┘

    Special case [1]:

      The situation is:
        - parent-A:     file exists,
        - parent-B:     no file,
        - working-copy: no file.

      Detecting a "deletion" will depend on the presence of actual change on
      the "parent-A" branch:

      Subcase 🄱 or 🄶 : if the state of the file in "parent-A" is unchanged
      compared to the merge ancestors, then parent-A branch left the file
      untouched while parent-B deleted it. We simply apply the change from
      "parent-B" branch the file was automatically dropped.
      The result is:
          - file is not recorded as touched by the merge.

      Subcase 🄲 or 🄷 : otherwise, the change from parent-A branch were explicitly dropped and
      the file was "deleted again". From a user perspective, the message
      about "locally changed" while "remotely deleted" (or the other way
      around) was issued and the user chose to deleted the file.
      The result:
          - file is recorded as touched by the merge.


    Special case [2]:

      The situation is:
        - parent-A:     no file,
        - parent-B:     file,
        - working-copy: file (same content as parent-B).

      There are three subcases depending on the ancestors contents:

      - A) the file is missing in all ancestors,
      - B) at least one ancestor has the file with filenode ≠ from parent-B,
      - C) all ancestors use the same filenode as parent-B,

      Subcase (A) is the simpler, nothing happend on parent-A side while
      parent-B added it.

        The result:
            - the file is not marked as touched by the merge.

      Subcase (B) is the counter part of "Special case [1]", the file was
        modified on parent-B side, while parent-A side deleted it. However this
        time, the conflict was solved by keeping the file (and its
        modification). We consider the file as "salvaged".

        The result:
            - the file is marked as "salvaged" by the merge.

      Subcase (C) is subtle variation of the case above. In this case, the
        file in unchanged on the parent-B side and actively removed on the
        parent-A side. So the merge machinery correctly decide it should be
        removed. However, the file was explicitly restored to its parent-B
        content before the merge was commited. The file is be marked
        as salvaged too. From the merge result perspective, this is similar to
        Subcase (B), however from the merge resolution perspective they differ
        since in (C), there was some conflict not obvious solution to the
        merge (That got reversed)

    Special case [3]:

      The situation is:
        - parent-A:     file,
        - parent-B:     file (different filenode as parent-A),
        - working-copy: file (same filenode as parent-B).

      This case is in theory much simple, for this to happens, this mean the
      filenode in parent-A is purely replacing the one in parent-B (either a
      descendant, or a full new file history, see changeset). So the merge
      introduce no changes, and the file is not affected by the merge...

      However, in the wild it is possible to find commit with the above is not
      True. For example repository have some commit where the *new* node is an
      ancestor of the node in parent-A, or where parent-A and parent-B are two
      branches of the same file history, yet not merge-filenode were created
      (while the "merge" should have led to a "modification").

      Detecting such cases (and not recording the file as modified) would be a
      nice bonus. However do not any of this yet.
    csg|]}���|���qSr��reporS��.0�r�rQrr�
<listcomp>��z"_process_merge.<locals>.<listcomp>Nrrc3s|]}t|��duVqdSr��_find�r_Zma�r+rr�	<genexpr>�rcz!_process_merge.<locals>.<genexpr>)ZfileidF�unreachable)r]r
rSrU�	changelog�commonancestorsheads�noderr=�pop�_process_other_unchangedr,rVr3�anyr5r)ZfilectxrKrLr1rW�filenoder<rA)Zp1_ctxZp2_ctxrQr]rT�mZp1mZp2mZdiff_p1Zdiff_p2�cahs�masZcopy_candidatesZd1Zd2�fctxrZr:r[r)rQr+rrO.sZo


� 
$$$
rOcCs||vrdS|�|�dS)z%return the associate filenode or NoneNr��find)rSr+rrrre�srecs�|dd�|dd}�durL|durLt��fdd�|D��r�|���nP�dur~|dur~t�fdd�|D��r�|���n�dur�|dur�nds�Jd��dS)Nrrc3s|]}t|���kVqdSrrdrf�r+Zsource_noderrrh�rcz+_process_other_unchanged.<locals>.<genexpr>c3s|]}t|��duVqdSrrdrfrgrrrh�rcFri)ror3r5)rTrsr+rUZtarget_noderrwrrn�srncst�fdd�|D��S)Nc3s|]}t|��duVqdSrrdrfrgrrrhrcz._missing_from_all_ancestors.<locals>.<genexpr>��all)rsr+rrgr�_missing_from_all_ancestorssrzcs:g}|��D](�t�fdd�|��D��s|���q|S)z-return the list of files added in a changesetc3s|]}�|vVqdSrr)r_�p�r/rrrhrcz-computechangesetfilesadded.<locals>.<genexpr>)�filesro�parentsrV)rQrrr|r�computechangesetfilesaddeds
rcs`|dur|\����n ����������������tj���fdd������fdd�}|S)a<return a function to detect files "wrongly" detected as `removed`

    When a file is removed relative to p1 in a merge, this
    function determines whether the absence is due to a
    deletion from a parent, or whether the merge commit
    itself deletes the file. We decide this by doing a
    simplified three way merge of the manifest entry for
    the file. There are two ways we decide the merge
    itself didn't delete a file:
    - neither parent (nor the merge) contain the file
    - exactly one parent contains the file, and that
      parent has the same filelog entry as the merge
      ancestor (or all of them if there two). In other
      words, that parent left the file unchanged while the
      other one deleted it.
    One way to think about this is that deleting a file is
    similar to emptying it, so the list of changed files
    should be similar either way. The computation
    described above is not done directly in _filecommit
    when creating the list of changed files, however
    it does something very similar by comparing filelog
    nodes.
    Ncs>���}���}���j�||�}|s,tg}�fdd�|D�S)Ncsg|]}���|���qSrr\r^rarrrbCrcz3get_removal_filter.<locals>.mas.<locals>.<listcomp>)rlr]rjrkr)Zp1nZp2nrrrPrrrs<szget_removal_filter.<locals>.mascsT��vr*��vo(t��fdd���D��S��vrLt��fdd���D��SdSdS)Nc3s*|]"}�|vo |�������kVqdSrrurf)r/�m1rrrhGszAget_removal_filter.<locals>.deletionfromparent.<locals>.<genexpr>c3s*|]"}�|vo |�������kVqdSrrurf)r/�m2rrrhKrcTrxr|)r�r�rsr|r�deletionfromparentEs�z.get_removal_filter.<locals>.deletionfromparent)rJrKrSrZ	cachefunc)rQ�xr�r)rQr�r�rsrJrKr�get_removal_filters
r�csFg}|��D]}||vr|�|�q|rBt|���fdd�|D�}|S)z/return the list of files removed in a changesetcsg|]}�|�s|�qSrrr^�ZrfrrrbZrcz0computechangesetfilesremoved.<locals>.<listcomp>)r}rVr�)rQrr/rr�r�computechangesetfilesremovedRsr�cCsdg}t|���dkr|S|��D]>}||vr ||}|j�|j�}|d|��jkr |�|�q |S)z.return the list of files merged in a changesetrHr)�lenr~r}Z_filelogZ	_filenoder]ZnullidrV)rQrr/rtr~rrr�computechangesetfilesmerged^sr�c
Cs�i}i}|��}|��}|j��}|��D]r}||�r*||vr@q*||��}|sRq*|\}}	||vr|||��|	kr||||<q*||vr*||��|	kr*|||<q*||fS)z�return the copies data for a changeset

    The copies data are returned as a pair of dictionnary (p1copies, p2copies).

    Each dictionnary are in the form: `{newname: oldname}`
    )rJrKZ_repo�narrowmatchr}rWrp)
rQZp1copiesZp2copiesrJrKr��dstrY�srcr[rrr�computechangesetcopiesls"


r�cCsXg}t|�D]&\}}||vr|�d|||f�qt|�t|�krNt�d��d�|�S)Ns%d%ss(some copy targets missing from file list�
)�	enumeraterVr�rZProgrammingError�join)r}r?r=�ir�rrr�encodecopies�s�r�c	CshzJi}|s|WS|�d�D]*}|�d�\}}t|�}||}|||<q|WSttfybYdS0dS)Nr��)�split�int�
ValueError�
IndexError)r}�datar?�l�strindexr�r�r�rrr�decodecopies�s
r�cCs>t|�}g}t|�D]\}}||vr|�d|�qd�|�S)Ns%dr�)rr�rVr�)r}�subset�indicesr�r/rrr�encodefileindices�sr�c	CstzVg}|s|WS|�d�D]6}t|�}|dks:|t|�krBWdS|�||�q|WSttfynYdS0dS)Nr�r)r�r�r�rVr�r�)r}r�r�r�r�rrr�decodefileindices�sr�Z11100rHZ00100Z01000Z01100Z10000Z10100Z11Z10z>Lz>bLLc
Cs\t|j�}|�|j���|�|j���t|�}dd�t|�D�}d|d<t�	t
|��g}d}|D]�}t
|�}||7}d}||jvr�|tO}nN||j
vr�|tO}n:||jvr�|tO}n&||jvr�|tO}n||jvr�|tO}d}||jv�r|tO}|j�|�}n ||jv�r$|j�|�}|tO}||}	|�t�	|||	��qd|�|�tjd�|�iS)NcSsi|]\}}||�qSrr)r_r�r/rrr�
<dictcomp>�rcz)encode_files_sidedata.<locals>.<dictcomp>rrc)rrrr�valuesr �sortedr��INDEX_HEADER�packr�r�
ADDED_FLAGr�MERGED_FLAGr�REMOVED_FLAGr�
SALVAGED_FLAG�TOUCHED_FLAG�COPIED_FROM_P1_FLAG�get�COPIED_FROM_P2_FLAGrV�INDEX_ENTRY�extend�sidedatamod�SD_FILESr�)
r}�	all_filesZfile_idx�chunksZfilename_lengthr/Z
filename_size�flagr8�copy_idxrrr�encode_files_sidedata�sB










r�cCs�t�}|�tj�}|dur|Sg}g}t|�tjks8J�t�|d�d}tj}|tj|}|}t|�|kspJ�t	|�D�]}	t�||�\}
}}||7}|||�}
||}t|
�|ks�J�|tj7}|}|�
|
�|
t@tkr�|�
|
�nf|
t@tk�r|�|
�nL|
t@tk�r |�|
�n2|
t@tk�r:|�|
�n|
t@tk�rR|�|
�d}|
t@tk�rl|j}n|
t@tk�r�|j}|durx|�
||
|f�qx|D]\}}
}||||
��q�|S�Nr)r
r�r�r�r�r��size�unpack_fromr��rangerV�ACTION_MASKr�r,r�r1r�r3r�r5r�r)�COPIED_MASKr�r<r�rA)r	rT�rawr?r�Ztotal_files�offsetZfile_offset_baseZfile_offset_last�idxr�Zfile_endr�r+ZfilesizerYrrr�decode_files_sidedata�sR


r�cCs||}t|�}t|�|jfSr)rRr�r%)�srcreporLrQr}rrr�_getsidedata-sr�cCs(t||�\}}|rtjnd}||dffSr�)r��sidedataflag�REVIDX_HASCOPIESINFO)r]�revlogrLZexisting_sidedatar	r%Zflags_to_addrrr�copies_sidedata_computer3sr�cCsN|��|��}|durBt||�}|�||f�|��|��}q|��dS)a�The function used by worker precomputing sidedata

    It read an input queue containing revision numbers
    It write in an output queue containing (rev, <sidedata-map>)

    The `None` input value is used as a stop signal.

    The `tokens` semaphore is user to avoid having too many unprocessed
    entries. The workers needs to acquire one token before fetching a task.
    They will be released by the consumer of the produced data.
    N)�acquirer�r��put�release)r�Z
revs_queueZsidedata_queue�tokensrLr�rrr�_sidedata_worker9s

r��2cs�ddlm}|�|j�}t�|t��t��}t���|jdusDJ�|j	�
�D]}|�|�qNt|�D]}|�d�qfg}t|�D]0}||��f}tj
t|d�}	|�|	�|	��q�i����fdd�}
|
S)z�The parallel version of the sidedata computation

    This code spawn a pool of worker that precompute a buffer of sidedata
    before we actually need themr)�workerN)�target�argsc	sh��|d�}|dur>���\}}||kr>|�|<���\}}q ���|\}}d}|r\tj}||dffSr�)rmr�r�r�r�)	r]r�rLZold_sidedatar�r`r	r%Znew_flag�Z	sidedataqZstagingr�rr�sidedata_companion{sz6_get_worker_sidedata_adder.<locals>.sidedata_companion)�r�Z_numworkersZui�multiprocessing�BoundedSemaphore�BUFF_PER_WORKERZQueueZ
filternamerjZrevsr�r�ZProcessr�rV�start)r�Zdestrepor�Z	nbworkersZrevsqr`r�Z
allworkersr��wr�rr�r�_get_worker_sidedata_adderSs&

r�)r)N)5Z
__future__rrr��structrlrr�rrZrevlogutilsrr�r	r��objectr
rRrMrNrOrernrzrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��Structr�r�r�r�r�r�r�r�r�rrrr�<module>	sTT

%?	
7	










'6

Youez - 2016 - github.com/yon3zu
LinuXploit