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__/mergestate.cpython-39.opt-1.pyc
a

�+�b}}�@sddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZmZmZmZddlmZejZejZdd	�Zd
d�ZdZd
ZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-Gd d!�d!e.�Z/e/dd"e,d#�Z0e/dd"e,d#�Z1e/d$d"e+d#�Z2e/d%d"e-d#�Z3e/d&�Z4e/d'�Z5e/d(d"e+d#�Z6e/d)d"e+d#�Z7e/d*�Z8e/d+�Z9e/d�Z:e/d,�Z;e/d-�Z<e/d.d"d/�Z=e/d0d"d/�Z>e/d1d"d/�Z?e/d2d"e-d#�Z@e/d3d"e+d#�ZAe:e<e9e8fZBGd4d5�d5e.�ZCGd6d7�d7eC�ZDGd8d9�d9eC�ZEd:d;�ZFdS)<�)�absolute_importN�)�_)�bin�hex�nullrev)�error�	filemerge�pycompat�util)�hashutilcCs,|�d�}|dd�|dd�}d�|�S)N�������)�split�join)�data�bits�r�:/usr/lib64/python3.9/site-packages/mercurial/mergestate.py�
_droponodes
rcCs(||��jjkrt�||�S||SdS�N)�repo�
nodeconstants�nullhexr	Z
absentfilectx)Zhexnode�ctx�frrr�_filectxorabsent"sr�L�O�l�f�F�C�P�u�rspuspr�o�t�R�d�m�Dsaddedsremovedsmodifiedc@sReZdZdZe��Ze��Zddd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�MergeActiona#represent an "action" merge need to take for a given file

    Attributes:

    _short: internal representation used to identify each action

    no_op:  True if the action does affect the file content or tracking status

    narrow_safe:
        True if the action can be safely used for a file outside of the narrow
        set

    changes:
        The types of changes that this actions involves. This is a work in
        progress and not all actions have one yet. In addition, some requires
        user changes and cannot be fully decided. The value currently available
        are:

        - ADDED: the files is new in both parents
        - REMOVED: the files existed in one parent and is getting removed
        - MODIFIED: the files existed in at least one parent and is getting changed
    FNcCs:||_|j�|�||_|jr*|j�|�||_||_dSr)�_short�ALL_ACTIONS�add�no_op�
NO_OP_ACTIONS�narrow_safe�changes)�selfZshortr1r3r4rrr�__init__�szMergeAction.__init__cCs
t|j�Sr)�hashr.�r5rrr�__hash__�szMergeAction.__hash__cCsd|j�d�S)NzMergeAction<%s>�ascii)r.�decoder8rrr�__repr__�szMergeAction.__repr__cCs|jSr�r.r8rrr�	__bytes__�szMergeAction.__bytes__cCs|durdS|j|jkS�NFr=�r5�otherrrr�__eq__�szMergeAction.__eq__cCs|j|jkSrr=r@rrr�__lt__�szMergeAction.__lt__)FFN)�__name__�
__module__�__qualname__�__doc__�weakref�WeakSetr/r2r6r9r<r>rBrCrrrrr-js
	r-T)r3r4�a�g�pZprsam�csdcscdsdgsdm�k)r1skaskn�escmc@seZdZdZdd�Zdd�Zd9dd�Zejd	d
��Z	ejdd��Z
ejd
d��Zejdd��Zdd�Z
dd�Zedd��Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!dS):�_mergestate_basea�track 3-way merge state of individual files

    The merge state is stored on disk when needed. Two files are used: one with
    an old format (version 1), and one with a new format (version 2). Version 2
    stores a superset of the data in version 1, including new kinds of records
    in the future. For more about the new format, see the documentation for
    `_readrecordsv2`.

    Each record can contain arbitrary content, and has an associated type. This
    `type` should be a letter. If `type` is uppercase, the record is mandatory:
    versions of Mercurial that don't support it should abort. If `type` is
    lowercase, the record can be safely ignored.

    Currently known records:

    L: the node of the "local" part of the merge (hexified version)
    O: the node of the "other" part of the merge (hexified version)
    F: a file to be merged entry
    C: a change/delete or delete/change conflict
    P: a path conflict (file vs directory)
    f: a (filename, dictionary) tuple of optional values for a given file
    l: the labels for the parts of the merge.

    Merge record states (stored in self._state, indexed by filename):
    u: unresolved conflict
    r: resolved conflict
    pu: unresolved path conflict (file conflicts with directory)
    pr: resolved path conflict
    o: file was merged in favor of other parent of merge (DEPRECATED)

    The resolve command transitions between 'u' and 'r' for conflicts and
    'pu' and 'pr' for path conflicts.
    cCs:||_i|_t�t�|_d|_d|_d|_i|_	d|_
dS)z^Initialize the merge state.

        Do not use this directly! Instead call read() or clean().NF)�_repo�_state�collections�defaultdict�dict�_stateextras�_local�_other�_labels�_results�_dirty�r5rrrrr6�sz_mergestate_base.__init__cCsdSrrr8rrr�reset�sz_mergestate_base.resetNcCs||_||_||_dSr)rWrXrY)r5�noderA�labelsrrr�startsz_mergestate_base.startcCs|jdurd}t�|��|jS)Ns(local accessed but self._local isn't set)rWr�ProgrammingError�r5�msgrrr�locals

z_mergestate_base.localcCs|j|jSr)rQrdr8rrr�localctxsz_mergestate_base.localctxcCs|jdurd}t�|��|jS)Ns(other accessed but self._other isn't set)rXrrarbrrrrAs

z_mergestate_base.othercCs|j|jSr)rQrAr8rrr�otherctxsz_mergestate_base.otherctxcCst|j�pt|j�S)z�Whether mergestate is active.

        Returns True if there appears to be mergestate. This is a rough proxy
        for "is a merge in progress."
        )�boolrWrRr8rrr�activesz_mergestate_base.activecCsdS)z*Write current state on disk (if necessary)Nrr8rrr�commit#sz_mergestate_base.commitcCstt�|����S)zUhash the path of a local file context for storage in the .hg/merge
        directory.)rrZsha1�digest)�pathrrr�getlocalkey&sz_mergestate_base.getlocalkeycCs
t��dSr��NotImplementedError�r5�fctx�localkeyrrr�_make_backup-sz_mergestate_base._make_backupcCs
t��dSrrm�r5rprq�flagsrrr�_restore_backup0sz _mergestate_base._restore_backupc	Cs�|��r|jjj}nt�|���}|�||�t||��|��t	|�
��|��t	|�
��|��g|j|<t	|�
��|j|d<d|_dS)a/add a new (potentially?) conflicting file the merge state
        fcl: file context for local,
        fco: file context for remote,
        fca: file context for ancestors,
        fd:  file path of the resulting merge.

        note: also write the local version to the `.hg/merge` directory.
        �ancestorlinknodeTN)�isabsentrQrr�
mergestaterlrkrr�MERGE_RECORD_UNRESOLVEDrZfilenodertrRr^rVr[)r5Zfcl�fco�fca�fdrqrrrr03s	

�

z_mergestate_base.addcCst||g|j|<d|_dS)z�add a new conflicting path to the merge state
        path:    the path that conflicts
        frename: the filename the conflicting file was renamed to
        forigin: origin of the file ('l' or 'r' for local/remote)
        TN)�MERGE_RECORD_UNRESOLVED_PATHrRr[)r5rkZfrenameZforiginrrr�addpathconflictNsz _mergestate_base.addpathconflictcCs|j|�|�d|_dS)zHstores information which is required at commit
        into _stateextrasTN)rV�updater[)r5rkrrrr�
addcommitinfoWsz_mergestate_base.addcommitinfocCs
||jvSr�rR�r5�dfilerrr�__contains__]sz_mergestate_base.__contains__cCs|j|dS)Nrr�r�rrr�__getitem__`sz_mergestate_base.__getitem__cCstt|j��Sr)�iter�sortedrRr8rrr�__iter__csz_mergestate_base.__iter__cCs
|j��Sr)rR�keysr8rrr�filesfsz_mergestate_base.filescCs||j|d<d|_dS)NrT)rRr[)r5r��staterrr�markisz_mergestate_base.markccs0t�|j�D]\}}|dttfvr|VqdS)z%Obtain the paths of unresolved files.rN)r
�	iteritemsrRryr})r5r�entryrrr�
unresolvedms�z_mergestate_base.unresolvedcCs|jS)z8return all extras information stored with the mergestate�rVr8rrr�	allextraswsz_mergestate_base.allextrascCs
|j|S)z?return extras stored with the mergestate for the given filenamer�)r5�filenamerrr�extras{sz_mergestate_base.extrasc
Cs�||ttfvrdS|j|}|\}}}}}}	}
}|j|j}|�|�}
|
�d�}|rb|j|}nd}t|||�}t|
||	�}|jj|||d�}|�	�}|�	�}d|||vr�d|||vr�|�
�tkr�||kr�|jj�
td�|�n||kr�|}||jjjk�r|�||||�n||jdd	�|�|��sT|j|=d
|j|<d|_dStj|j||j|||||jd�\}}|�s�|�|t�d}|�r�|���r�t}nt}n0|���r�t}n |���r�||jv�r�t}nt }||f|j|<|S)zHrun merge process for dfile

        Returns the exit code of the merge.rrvN)ZfileidZ	changectx�xr sQwarning: cannot merge flags for %s without common ancestor - keeping local flags
T)Z
ignoremissing)NN)r_)!�MERGE_RECORD_RESOLVED�LEGACY_RECORD_DRIVER_RESOLVEDrRrQrXr��getrZfilectxrtZrevrZui�warnrrrru�remove�cmprZr[r	rWrYr�rw�
ACTION_FORGET�
ACTION_REMOVE�
ACTION_GETre�ACTION_ADD_MODIFIED�
ACTION_ADD)r5r�ZwctxZ
stateentryr�rqZlfileZafileZanodeZofileZonodertZoctxr�Z
anccommitnodeZactxZfcdrzr{ZfloZflaZ	merge_retZdeleted�actionrrr�resolves|�


 ���
�



z_mergestate_base.resolvecCs^d\}}}t�|j�D]<\}}|dur0|d7}q|dkr|tkrJ|d7}q|d7}q|||fS)zKreturn counts for updated, merged and removed files in this
        session)rrrNrr)r
Z
itervaluesrZr�)r5�updatedZmergedZremoved�rr�rrr�counts�s



z_mergestate_base.countscCstt|����S)z0get unresolved count for this merge (persistent))�len�listr�r8rrr�unresolvedcount�sz _mergestate_base.unresolvedcountc
CsRtgtgtgtgtgi}t�|j�D](\}\}}|dur$||�|ddf�q$|S)z2return lists of actions to perform on the dirstateNsmerge result)	r�r�r�r�r�r
r�rZ�append)r5�actionsrr�r�rrrr��s�z_mergestate_base.actions)N)"rDrErFrGr6r]r`rZ
propertycacherdrerArfrhri�staticmethodrlrrrur0r~r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrP�sB"





	
UrPc@s�eZdZdZdZedd��Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)"rxsmerge/statesmerge/state2cCst|�}|��|S)zPInitialize a brand new merge state, removing any existing state on
        disk.)rxr]�r�msrrr�clean�szmergestate.cleancCst|�}|��|S)z1Initialize the merge state, reading it from disk.)rx�_readr�rrr�readszmergestate.readcCsTt�}|��}|D�]*\}}|tkr0t|�|_q|tkrDt|�|_q|tkrNq|tt	t
ttfvr�|�
d�}|dtkr�d|j|dd<n|dd�|j|d<q|tk�r|�
dd�\}}|�
d�}i}	d}
|
t|�kr�||
d|	||
<|
d7}
q�|	|j|<q|tk�r,|�
dd�}dd	�|D�|_q|��s|�|�q|�rPt�|��dS)
z�Analyse each record content to restore a serialized state from disk

        This function process "record" entry produced by the de-serialization
        of on disk file.
        r
rsotherrsfilenode-sourceN�cSsg|]}t|�dkr|�qS)r)r�)�.0�lrrr�
<listcomp>3�z$mergestate._read.<locals>.<listcomp>)�set�_readrecords�RECORD_LOCALrrW�RECORD_OTHERrX�LEGACY_MERGE_DRIVER_STATE�
RECORD_MERGED�RECORD_CHANGEDELETE_CONFLICT�RECORD_PATH_CONFLICT�LEGACY_MERGE_DRIVER_MERGE�LEGACY_RECORD_RESOLVED_OTHERr�MERGE_RECORD_MERGED_OTHERrVrR�RECORD_FILE_VALUESr��
RECORD_LABELSrY�islowerr0rZUnsupportedMergeRecords)r5Zunsupported�records�rtype�recordrr��	rawextrasZ
extrapartsr��ir_rrrr�	sH�




zmergestate._readcCs�|��}|��}|�||�r |S|jd��d}|�t|��f�t|�D]D\}}|dt	krL|d�
d�}|�dd�|dd�|�f||<qL|SdS)a�Read merge state from disk and return a list of record (TYPE, data)

        We read data from both v1 and v2 files and decide which one to use.

        V1 has been used by version prior to 2.9.1 and contains less data than
        v2. We read both versions and check if no data in v2 contradicts
        v1. If there is not contradiction we can safely assume that both v1
        and v2 were written at the same time and use the extract data in v2. If
        there is contradiction we ignore v2 content as we assume an old version
        of Mercurial has overwritten the mergestate file and left an old v2
        file around.

        returns list of record [(TYPE, data), ...]Nrrrr
rr�)
�_readrecordsv1�_readrecordsv2�
_v1v2matchrQ�parentsr�r�r�	enumerater�r�insertr)r5�	v1records�	v2recordsZmctx�idxr�rrrrr�:szmergestate._readrecordscCsft�}|D]>}|dtkr&|�|�q
|dtkr
|�tt|d�f�q
|D]}||vrNdSqNdS)NrrFT)r�r�r0r�r)r5r�r�Zoldv2Zrecrrrr�\szmergestate._v1v2matchc
Cs�g}zb|j�|j�}t|�D]>\}}|dkrD|�t|dd�f�q|�t|dd�f�q|��Wn2ty�}z|j	t	j
kr��WYd}~n
d}~00|S)z�read on disk merge state for version 1 file

        returns list of record [(TYPE, data), ...]

        Note: the "F" data from this file are one entry short
              (no "other file node" entry)
        rNr)rQ�vfs�statepathv1r�r�r�r��close�IOError�errno�ENOENT)r5r�rr�r��errrrrr�jszmergestate._readrecordsv1c

Cs�g}z�|j�|j�}|��}d}t|�}||kr�|||d�}|d7}td|||d��d}|d7}||||�}||7}|tkr�|dd�|dd�}}|�||f�q(|��Wn2t	y�}	z|	j
t
jkr܂WYd}	~	n
d}	~	00|S)aread on disk merge state for version 2 file

        This format is a list of arbitrary records of the form:

          [type][length][content]

        `type` is a single character, `length` is a 4 byte integer, and
        `content` is an arbitrary byte sequence of length `length`.

        Mercurial versions prior to 3.7 have a bug where if there are
        unsupported mandatory merge records, attempting to clear out the merge
        state with hg update --clean or similar aborts. The 't' record type
        works around that by writing out what those versions treat as an
        advisory record, but later versions interpret as special: the first
        character is the 'real' record type and everything onwards is the data.

        Returns list of records [(TYPE, data), ...].rrs>I�N)rQr��statepathv2r�r��_unpack�RECORD_OVERRIDEr�r�r�r�r�)
r5r�rrZoff�endr��lengthr�r�rrrr��s*zmergestate._readrecordsv2cCs"|jr|��}|�|�d|_dSr?)r[�_makerecords�
_writerecords�r5r�rrrri�s
zmergestate.commitcCs<g}|�tt|j�f�|�tt|j�f�t�|j�D]�\}}|dt	t
fvrl|�td�|g|�f�q8|d|j
jjks�|d|j
jjkr�|�td�|g|�f�q8|�td�|g|�f�q8tt�|j��D]8\}}d�dd�t�|�D��}|�td||ff�q�|jdu�r8d�|j�}|�t|f�|S)Nrr
r�css|]\}}d||fVqdS)�%s%sNr)r��k�vrrr�	<genexpr>�sz*mergestate._makerecords.<locals>.<genexpr>r�)r�r�rrWr�rXr
r�rRr}�MERGE_RECORD_RESOLVED_PATHr�rrQrrr�r�r�rVr�rYr�)r5r�r�r�r�r�r_rrrr��s<�����
��zmergestate._makerecordscCs|�|�|�|�dS)z,Write current state on disk (both v1 and v2)N)�_writerecordsv1�_writerecordsv2r�rrrr��s
zmergestate._writerecordscCsh|j�|jd�}t|�}t|�}|�t|j�d�|D]"\}}|tkr8|�dt	|��q8|�
�dS)z/Write current state on disk in a version 1 file�wb�
s%s
N)rQr�r�r��next�writerrWr�rr�)r5r�rZirecordsZlrecordsr�rrrrr��szmergestate._writerecordsv1cCsrtttf}|j�|jd�}|D]F\}}||vr@td||f}}dt|�}|�t	||t|�|��q|�
�dS)zqWrite current state on disk in a version 2 file

        See the docstring for _readrecordsv2 for why we use 't'.r�s%s%ss>sI%isN)r�r�r�rQr�r�r�r�r��_packr�)r5r�Z	allowlistr�keyr�formatrrrr��s
zmergestate._writerecordsv2cCs|jj�d||���dS�Nsmerge/)rQr�r�rrorrrrr�szmergestate._make_backupcCsD|j�d|�� }|�|��|�Wd�n1s60YdSr�)rQr�r�r�)r5rprqrtrrrrru�szmergestate._restore_backupcCst�|jj�d�d�dS)NsmergeT)�shutil�rmtreerQr�rr8rrrr]szmergestate.resetN)rDrErFr�r�r�r�r�r�r�r�r�r�rir�r�r�r�rrrur]rrrrrx�s&

1"(-rxcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�
memmergestatecstt|��|�i|_dSr)�superr�r6�_backupsr\��	__class__rrr6szmemmergestate.__init__cCs|��|j|<dSr)rr�rorrrrrszmemmergestate._make_backupcCs|�|j||�dSr)r�r�rsrrrruszmemmergestate._restore_backup)rDrErFr6rrru�
__classcell__rrr�rr�sr�cCs�|�tg�D]4\}}}|r.|jj|ddd�q|jj|ddd�q|�tg�D]\}}}|jj|ddd�qN|�tg�D]`\}}}|\}}|jj|ddd�|j�||�||kr�|jj|ddd�qx|jj|ddd�qx|�tg�D]\}}}|jj|ddd�q�|�tg�D]:\}}}|�r6|jj|dddd�n|jj|ddd��q|�t	g�D] \}}}|jj|dddd��qX|�t
g�D]\}}}�q�|�tg�D]\}}}�q�|�tg�D]\}}}�q�|�t
g�D]j\}}}|�r|j�|�}	|	j�o�|	j}
|jj||
ddd�n&|�r$||nd}|jj|dd|d��q�|�tg�D]�\}}}|\}}
}}}|�r�||k}
|jj||
ddd�||
k�r|�r�|jj|ddd�||k�r�|j�||�n|j�|
|�n6|
|k�r�|jj|dddd�|�rL|jj|ddd��qL|�tg�D]r\}}}|\}}|�rd|jj|ddd�|jj|ddd�|j�||�n$|jj|ddd�|jj|ddd��q|�tg�D]N\}}}|\}}|�r�|jj|ddd�|j�||�n|jj|ddd��q�dS)z$record merge actions to the dirstateTF)�
p1_tracked�
wc_tracked)r�r�Zpossibly_dirty)r�r�Zp2_infoN)r�r��parentfiledata)r�r�ZdirstateZupdate_filer��ACTION_PATH_CONFLICT_RESOLVE�copyr�r��ACTION_EXEC�ACTION_KEEP�ACTION_KEEP_ABSENT�ACTION_KEEP_NEWr�Z	get_entryZany_trackedZadded�ACTION_MERGE�ACTION_DIR_RENAME_MOVE_LOCAL�ACTION_LOCAL_DIR_RENAME_GET)rr�ZbranchmergeZgetfiledatar�argsrcZf0Zorigf0Z	old_entryr�r��f1�f2�fa�moveZanc�flagrrr�
recordupdatess���
��
�
�

��
r)GZ
__future__rrSr�r��structrHZi18nrr^rrr�rr	r
rZutilsr�packr��unpackr�rrr�r�r�r�r�r�r�ryr�r}r�r�r�r�r�r�r�ZCHANGE_ADDEDZCHANGE_REMOVEDZCHANGE_MODIFIED�objectr-r�r�r�r�ZACTION_PATH_CONFLICTr�r�ZACTION_CREATEDZACTION_DELETED_CHANGEDZACTION_CHANGED_DELETEDrrrr�rrr�ZACTION_CREATED_MERGEZCONVERT_MERGE_ACTIONSrPrxr�rrrrr�<module>s�
7���/

Youez - 2016 - github.com/yon3zu
LinuXploit