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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

�+�bUh�@s�ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZmZmZmZmZmZmZmZmZmZmZmZmZmZej Z!ej"Z#d
d�Z$dIdd
�Z%Gdd�de&�Z'dd�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-Gdd�de&�Z.dJdd �Z/d!d"�Z0dKd#d$�Z1d%d&�Z2d'd(�Z3d)d*�Z4d+d,�Z5e
j6d-d.�Gd/d0�d0e&��Z7dLd1d2�Z8d3d4�Z9d5Z:d6Z;d7Z<d8Z=dMd9d:�Z>dNd;d<�Z?dOd=d>�Z@dPd?d@�ZAdQdAdB�ZBdRdCdD�ZCdSdEdF�ZDdTdGdH�ZEdS)U�)�absolute_importN�)�_)�nullrev)�attr)�
stringutil)�	timestamp)�copies�encoding�error�	filemerge�match�
mergestate�obsutil�pathutil�policy�pycompat�scmutil�subrepoutil�util�workercCsX|j�||�}gd�}||vrTd�dd�|D��}td�}|||||f;}t�|��|S)N)�abortsignore�warns, cSsg|]}d|d�qS)�'�)�.0�vrr�5/usr/lib64/python3.9/site-packages/mercurial/merge.py�
<listcomp>,�z*_getcheckunknownconfig.<locals>.<listcomp>s$%s.%s not valid ('%s' is none of %s))�ui�config�joinrrZConfigError)�repo�section�namer!ZvalidZvalidstr�msgrrr�_getcheckunknownconfig(s
r'cCsV|��rdS|dur|}|jj�|�oT|j�|�oT|j�|�|jvoT||�||�S)NF)�
isinmemory�wvfs�audit�check�isfileorlink�dirstate�	normalize�cmp)r#�wctx�mctx�f�f2rrr�_checkunknownfile3s
���r4c@s eZdZdZdd�Zdd�ZdS)�_unknowndirscheckeray
    Look for any unknown files or directories that may have a path conflict
    with a file.  If any path prefix of the file exists as a file or link,
    then it conflicts.  If the file itself is a directory that contains any
    file that is not tracked, then it conflicts.

    Returns the shortest path at which a conflict occurs, or None if there is
    no conflict.
    cCst�|_t�|_dS�N)�set�_unknowndircache�_missingdircache��selfrrr�__init__Qsz_unknowndirschecker.__init__c	Cs|��rdSttt�|���D]~}||jvr2dS||jvr>q|jj�	|�r|j�
|�rr|j�|�|jvrr|S|j�
|�s�|j�|�dS|j�|�q|jj�	|��r|j�|��r|j�|�D]N\}}}|D]>}t�|j�||��}|jj|dd�}||jvr�|Sq�q�dS)NFT)Zisknown)r(�reversed�listr�finddirsr9r8r)r*r+r,r-r.�lexists�add�isdir�walkrZpconvertZreljoin)	r;r#r0r2�p�dirs�files�fnZrelfrrr�__call__\s2


��
z_unknowndirschecker.__call__N)�__name__�
__module__�__qualname__�__doc__r<rHrrrrr5Fs
r5c
s.t�}t��t��t��t�dd�}t�dd�}�j�dd�}	|�s$��fdd�}
t�}|�tjtjf�D]H}t	�|||�r�|�
|�qj|	rj||vrj|�||�}
|
durj��
|
�qj|�tjg�D](\}}}t	�||||d	�r�|�
|�q�|�B}�fd
d�|D�}||}|
||�|
||�n�t
|�tjg��D]�\}}}|\}}t	�|||�}�j�|��rj|}n|}|�s�|�|tj|dfd
�nn|�s�|dk�r�|�|tj||dd|fd�n@|dk�rЈ�
|�n*|dk�r��
|�|�|tj|dfd
��q6t��D]Z}�jj}|�v�rN�j�|��r<|td�|�n|td�|�n|td�|��q��rvt�td���t��D]>}�j�|��r��j�td�|�n�j�td�|��q~t
|�tjg��D]X\}}}||v�p|�v�pt�fdd�t�|�D��}|\}|�|tj||f|��q�dS)z�
    Considers any actions that care about the presence of conflicting unknown
    files. For some actions, the result is to abort; for others, it is to
    choose a different action.
    �mergescheckunknownscheckignored�experimental�merge.checkpathconflictscs*|dkr��|�n|dkr&��|�dS)Nrr)�update)�	conflictsr!)�abortconflicts�
warnconflictsrr�collectconflicts�sz,_checkunknownfiles.<locals>.collectconflictsNrcsh|]}�j�|�r|�qSr)r-�_ignore)r�c�r#rr�	<setcomp>�rz%_checkunknownfiles.<locals>.<setcomp>F�remote createdrs#remote differs from untracked localrTs,%s: untracked file conflicts with directory
s,%s: untracked directory conflicts with file
s%s: untracked file differs
sLuntracked files in working directory differ from files in requested revisions%s: replacing untracked file
s+%s: replacing untracked files in directory
c3s|]}|�vVqdSr6r)rrD)�
pathconflictsrr�	<genexpr>�rz%_checkunknownfiles.<locals>.<genexpr>)r7r'r �
configboolr5rF�
mergestatemod�ACTION_CREATED�ACTION_DELETED_CHANGEDr4rA�
getactions�ACTION_LOCAL_DIR_RENAME_GETr>�ACTION_CREATED_MERGEr-rU�addfile�
ACTION_GET�ACTION_MERGE�sorted�warnr)r,rr�
StateError�anyrr?)r#r0r1�force�mresult�
mergeforceZ
fileconflictsZ
unknownconfigZ
ignoredconfigZ
pathconfigrTZcheckunknowndirsr2�path�argsr&ZallconflictsZignoredconflictsZunknownconflicts�fl2�ancZ	differentr!rg�backup�flagsr)rRrZr#rSr�_checkunknownfiles~s�����
���


�
���
��rscCsftj}|rtj}|��D]}||vr|�||dd�q|sb|��D]}||vrB|�|tjdd�qBdS)a�
    Forget removed files

    If we're jumping between revisions (as opposed to merging), and if
    neither the working directory nor the target rev has the file,
    then we need to remove it from the dirstate, to prevent the
    dirstate from listing the file when it is no longer in the
    manifest.

    If we're merging, and the other revision has removed a file
    that is not present in the working directory, we need to mark it
    as removed.
    Nsforget deletedsforget removed)r]�
ACTION_FORGET�
ACTION_REMOVE�deletedrc�removed)r0r1�branchmergerk�mr2rrr�_forgetremoveds�rzcCs�|��}|��sHt|�|��}|rPt|���D]}||�s.|�|�q.nt|�}|�r>|�tjtj	tj
tjtjtj
f�D]}|�|�qx|�tjf�D]}|�|�q�|�tjg�D]&\}}}|\}}	|�|�|�|�q�|�tjf�D]}|�|�q�|�tjg�D]4\}}}|\}
}}}}
|�r0|�|
�|�|��qi}|D]D}t�|�}||v�r�td�}||||f;}t�|��|||<�qFd}}}t|���D]T\}}|�|��r�|�|��s�td�}|||f;}t�|��|d}|d}|}�q�dS)z,
    Check for case-folding collisions.
    s(case-folding collision between %s and %srs5case-folding collision between %s and directory of %s�/N)�narrowmatch�alwaysr7rCr>rF�
removefiler]�
ACTION_ADD�ACTION_ADD_MODIFIEDrtrd�ACTION_CHANGED_DELETEDr_rAru�discardr`�ACTION_DIR_RENAME_MOVE_LOCALrarer�normcaserrrhrf�items�
startswith)r#Zwmfrkr|Zpmmfr2rnr&r3rr�f1�fa�moverpZfoldmapZfoldZ
foldprefixZunfoldprefixZlastfullrrr�_checkcollision"sf��
�





r�ccs4|D]*}t�|�D]}||vr||fVqqqdS)z�
    Generator that yields pairs of all the files in the manifest that are found
    inside the directories listed in dirs, and which directory they are found
    in.
    N)rr?)r#�manifestrEr2rDrrr�_filesindirsfs

r�c	Cs�|��}t�}t�}t�}t�}t�}	|�tjtjtjtjf�D](}
|�t	�
|
��|�|
�r@|�|
�q@|�tj
f�D]}
|	�|
�qx|�tjf�D]&\}
}}|\}
}}}}|r�|	�|
�q�|�tjf�D]\}
}}|\}}|	�|�q�|D]b}||v�r||v�r|�|�n
|�|�|�|�}|r�|dtjtjtjtjfvr�|�|�q�|D]t}||	v�rVt|��d�}t�|||t|����}||���p�|}|�|tj||fd�|�|tj|dfd��qV|�r�t|��d�}t|||�D]�\}
}|
|	v�r�|�|�\}}}t�|||t|����}|tjtjfv�rJ|�||||�n|d}|�|tj||fd�|�|tj|dfd�|�|��q��q�|�r�|D]}|j�td�|��q�t� td	���d
S)z�
    Check if any actions introduce path conflicts in the repository, updating
    actions to record or handle the path conflict accordingly.
    r�+slocal path conflict�ls
path conflictsremote path conflict�rs#%s: is both a file and a directory
s,destination manifest contains path conflictsN)!r�r7rFr]r^r_rerbrPrr?ZhasdirrArur`r��getfile�bytes�rstriprZsafenameZ
copysourcerc�ACTION_PATH_CONFLICT_RESOLVE�ACTION_PATH_CONFLICTr�ra�remover rgrrrh)r#r0r1rkZmfZlocalconflictsZremoteconflictsZinvalidconflictsZcreatedfiledirsZdeletedfilesr2rnr&r�r3r�r�rprrrD�pdZctxnameZpnewZporigry�flrrr�checkpathconflictsss���	
�




�	
��
���

�r�cCs�|��D]�\}}||�rq|s*|�|�q|djr@|�|�q|djr�|�d�st|�|�|�|d|dj�q�td�}td�}tj	|||d��qtd�}t�
||��qdS)	z�
    Filters out actions that can ignored because the repo is narrowed.

    Raise an exception if the merge cannot be completed because the repo is
    narrowed.
    rr{soutside-narrow-merge-actionsBmerge affects file '%s' outside narrow, which is not yet supporteds'merging in the other direction may work��hints-conflict in file '%s' is outside narrow cloneN)�filemapr~�no_opZnarrow_safe�endswith�
addcommitinfoZchangesrr�Abortrh)r|rxrkr2�actionr&r�rrr�_filternarrowactions�s(	



��r�c@s�eZdZdZdd�Zdd�Zdd�Zd$d	d
�Zd%dd�Zd
d�Z	d&dd�Z
d'dd�Zd(dd�Zdd�Z
edd��Zedd��Zedd��Zedd��Zd d!�Zd"d#�ZdS))�mergeresultz�An object representing result of merging manifests.

    It has information about what actions need to be performed on dirstate
    mapping of divergent renames and other such cases.cCs.i|_i|_i|_t�t�|_t�t�|_dS)aY
        filemapping: dict of filename as keys and action related info as values
        diverge: mapping of source name -> list of dest name for
                 divergent renames
        renamedelete: mapping of source name -> list of destinations for files
                      deleted on one side and renamed on other.
        commitinfo: dict containing data which should be used on commit
                    contains a filename -> info mapping
        actionmapping: dict of action names as keys and values are dict of
                       filename as key and related data as values
        N)�_filemapping�_diverge�
_renamedelete�collections�defaultdict�dict�_commitinfo�_actionmappingr:rrrr<#s
zmergeresult.__init__cCs||_||_dSr6)r�r�)r;�diverge�renamedeleterrr�updatevalues5szmergeresult.updatevaluescCsL||jvr&|j|\}}}|j||=|||f|j|<||f|j||<dS)aadds a new file to the mergeresult object

        filename: file which we are adding
        action: one of mergestatemod.ACTION_*
        data: a tuple of information like fctx and ctx related to this merge
        message: a message about the merge
        N�r�r�)r;�filenamer��data�message�a�dryrrrrc9s


zmergeresult.addfileNcCs||jvr|j|S|S)zfreturns (action, args, msg) about this file

        returns default_return if the file is not present)r�)r;r�Zdefault_returnrrrr�Js

zmergeresult.getfileccs@|dur|jD]
}|Vqn |D]}|j|D]
}|Vq.q dS)zvreturns files on which provided action needs to perfromed

        If actions is None, all files are returned
        Nr�)r;�actionsr2r�rrrrFRs

zmergeresult.filescCs(|j|\}}}|j|=|j||=dS)zXremoves a file from the mergeresult object as the file might
        not merging anymoreNr�)r;r�r�r�r�rrrr~bszmergeresult.removefileFccsp|D]f}|r@t|j|�D]"}|j||\}}|||fVqqt�|j|�D]\}\}}|||fVqPqdS)z�get list of files which are marked with these actions
        if sort is true, files for each action is sorted and then added

        Returns a list of tuple of form (filename, data, message)
        N)rfr�r�	iteritems)r;r��sortr�r2rnr&rrrr`is�zmergeresult.getactionscs(|durt�j�St�fdd�|D��S)z�returns number of files which needs actions

        if actions is passed, total of number of files in that action
        only is returnedNc3s|]}t�j|�VqdSr6)�lenr��rr�r:rrr[�rz"mergeresult.len.<locals>.<genexpr>)r�r��sum)r;r�rr:rr�zs
zmergeresult.lenccsNtr*tt�|j��D]\}}||fVqn t�|j�D]\}}||fVq6dSr6)rfrr�r�)r;r��key�valrrrr��s
zmergeresult.filemapcCs||j||<dS)zdadds key-value information about filename which will be required
        while committing this mergeN�r�)r;r�r��valuerrrr��szmergeresult.addcommitinfocCs|jSr6)r�r:rrrr��szmergeresult.divergecCs|jSr6)r�r:rrrr��szmergeresult.renamedeletecCs|jSr6r�r:rrr�
commitinfo�szmergeresult.commitinfocCsPt�t�}t�|j�D]4\}}t�|�D] \}\}}||�|||f�q(q|S)z}returns a dictionary of actions to be perfomed with action as key
        and a list of files and related arguments as values)r�r�r>rr�r��append)r;�resr�r�r2rnr&rrr�actionsdict�s

zmergeresult.actionsdictcCsD||_t�t�|_t�|j�D] \}\}}}||f|j||<qdSr6)r�r�r�r�r�rr�)r;r�r2Zactr�r&rrr�
setactions�szmergeresult.setactionscCsB|j��D]2}|tjtjtjtjfvr
|j|r
|js
dSq
dS)z^tells whether this merge resulted in some actions which can
        result in conflicts or notTF)r��keysr]rd�ACTION_EXECrur�r�)r;r�rrr�hasconflicts�s����	�zmergeresult.hasconflicts)N)N)F)N)F)rIrJrKrLr<r�rcr�rFr~r`r�r�r��propertyr�r�r�r�r�r�rrrrr�s*








	r�Fc
,s�t�}
|dur|��rd}dd�t���||gtjd�D�t��}t��}i}
|rlt�|�||�\}}}
t	�
t|��}t	�
t|��}t	�
t|��}|j�
td��|j�d|||f�|j�d|�|f����|��|��}}}t|j���}|�|j���t|j���}|�|j���d|v�rh���du�rht�fd	d
��jD���rh|jj|d<|�|g���v�r|	�s|j�dd��s|jd
k�st|�|����}t	�|j�D]\}}||v�r�|� |��q�|jD]}|� |��q�t�!||�}t"�#||�}|j||d�}t	�|�D�]\}\\}}\}} |�rv|�rv||v�r�|j�$|d��pn|j�$|d�}!d\}"}#|!du�r�|||!d|�%�f}"d|!}#n||dd|�%�f}"d}#|
�&|t'j(|"|#��q2||jv�r|j|}!|
�&|t'j(||!|!d|�%�fd|!��q2||jv�rF|j|}!|
�&|t'j(|!||!d|�%�fd|!��q2||}$|�)|�}%d|| |%v}&||$k�r�| |%k�r�|
�&|t'j*dd�n�||$k�r�||%k�r�||k�r�|
�&|t'j+| fd�n*|
�&|t'j,| dfd�|�rr|
�-|dd�n�|&�r||$k�r|
�&|t'j+| fd�n\|&�rR||$k�rR|
�&|t'j,|dfd�|�rr|
�-|dd�n |
�&|t'j(|||d|�%�fd��q&|�r�||v�r��q2||jv�r�|j|}'|'|v�r�|
�&|'t'j(||'dd|�%�fd�n|
�&|'t'j.||fd|��q2||jv�r&|j|}'|
�&|t'j(||'|'d|�%�fd |'�n�||v�r�|||k�r�|�rX|
�&|t'j/dd!�n4|
�&|t'j0|d|d|�%�fd"�|�r�|
�-|d#d$�nH||jj1k�r�|
�&|t'j2dd%�n&|
�&|t'j/dd&�|�r�|
�-|d#d$�n|
�&|t'j3dd'��q&|�r&||v�r�q&||jv�rb|j|}'|'|v�rD|
�&|'t'j(|'|dd|�%�fd(�n|
�&|'t'j4|| fd)|��q&||jv�r�|j|}'d\}#}"|'|v�r�|'||'d|�%�f}"d*|'}#n|'||'d|�%�f}"d+|'}#|
�&|t'j(|"|#��q&||v�r4|�s�|
�&|t'j5| fd,�n6|�s|
�&|t'j5| fd,�n|
�&|t'j6| |�%�fd-�n�|||k�rd}(|j7D]2})|�8|)��rL|j7|)|t9|)�d�}(�q��qL|(du�r�|(|v�r�|
�&|(t'j(|(||d|�%�fd.|�nP|�r�|
�&|t'j5| fd/�n4|
�&|t'j:d||d|�%�fd0�|�r2|
�-|d#d$�n&|
�&|t'j;dd1�|�r&|
�-|d#d$��q&|j�dd2��rTt<|�||
�|�=�}*|*���srt>|*||
�|j?}+|+�|j?�|
�@|
|+�|
S)3a
    Merge wctx and p2 with ancestor pa and generate merge action list

    branchmerge and force are as passed in to update
    matcher = matcher to filter file lists
    acceptremote = accept the incoming changes without prompting

    Returns an object of mergeresult class
    NcSsg|]}|���qSr)r�)r�xrrrr�s�z!manifestmerge.<locals>.<listcomp>)r�sresolving manifests
s) branchmerge: %s, force: %s, partial: %s
s% ancestor: %s, local: %s, remote: %s
�.hgsubstatec3s|]}��|���VqdSr6)�sub�dirty)r�s�r0rrr[�rz manifestmerge.<locals>.<genexpr>rNsmerge-track-salvagedschangeset-sidedata)r
�NNFsboth renamed from %ssboth createdslocal replaced from %ssother replaced from %sr�rsremote unchangedsupdate permissionssremote is newersfilenode-sourcesothersversions differTs%remote directory rename, both createds&remote directory rename - move from %sslocal copied/moved from %ss
remote deletesprompt changed/deletedsmerge-removal-candidate�yessremote deleteds
other deleteds ancestor missing, remote missings$local directory rename, both createds$local directory rename - get from %ssremote copied from %ssremote moved from %srYsremote created, get or merges-local directory rename - respect move from %ssremote recreatingsprompt deleted/changeds#local not present, remote unchangedrO)Ar�r}rf�parentsrZintrevr	Z
branch_copiesZmergecopiesr�bytestr�boolr �noter�debugr�r7�copy�valuesrPZmovewithdir�revri�substateZ
nodeconstantsZmodifiednodeidr\Zfilecopiesmode�diffr�r�rA�
matchfiles�matchmodZintersectmatchers�get�nodercr]rerr�ACTION_KEEPr�rdr�r�rur�Zaddednodeidrt�ACTION_KEEP_NEWrar^rbZdirmover�r�r_�ACTION_KEEP_ABSENTr�r|r�r�r�),r#r0�p2�parxrj�matcher�acceptremote�followcopies�
forcefulldiffrkZbranch_copies1Zbranch_copies2r�ZboolbmZboolfZboolmZm1Zm2ZmaZcopied1Zcopied2Z
relevantfilesZcopykeyZ	copyvalueZ
movedirkeyZfilesmatcherr�r2Zn1Zfl1Zn2ror�rnr&r�ZflaZnolr3Zdfr�r|r�rr�r�
manifestmerge�sJ��
�	����

 
��


�
�
�
������
�

��
�
�������


��



��
�

������
r�cCs�t|�tjf��D]0}||vr||�||�s|�|tjdd�qt|�tjf��D](}||vrV||�||�sV|�|�qVdS)zXResolves false conflicts where the nodeid changed but the content
    remained the same.Nsprompt same)	r>rFr]r�r/rcrur_r~)r#r0r1�ancestorrkr2rrr�_resolvetrivialCs
�r�c

szddlm}
d}t|�dkrNt||||d|||||�	}t||||||	��n�|j�td�||td��dd�|D��f�i}t	�}d	\}
}|D�]}|j�td
�|�t|||||||||dd�
}t||||||	�|
dus�t|j
�t|
�kr�|j
}
|du�st|�t|j�k�r|j}|j�
|j�|jdd
�D]t\}}|\}}}|j�d|||��f�||v�r�||}||v�r�||�|�n
|g||<n||gi||<�q8q�|j�td�t|��t|���D�]@\}}|jj�r:|j�d|�t|���D]4\}��D]$\}}}|j�d||��f��q�qt|�dk�r�t|���d\}�t�fdd��dd�D���r�|j�td�||��f�|j|g�d�R��q�tj|v�r�|j�td�|�|j|g|tjd�R��q�tj|v�r2|j�td�|�|j|g|tjd�R��q�tj|v�r~tj|v�r~|j�td�|�|j|g|tjd�R��q�tj|v�r�|j�td�|�|j|g|tjd�R��q�tj|v�r
tj|v�r
|j�td�|�|j|g|tjd�R��q�tj|v�rt|tjd�t�fdd�|tjdd�D���rt|j�td�|�|j|g��R��q�|j�td�|�t|���D]4\}��D]$\}}}|j�d||��f��q��q�t|���d\}�|j�td�||��f�|j|g�d�R��qԐq�|j�td��|� |
|�|�!�du�rPt"||||�|
�#|||||�t$||||d|�|S)a�
    Calculate the actions needed to merge mctx into wctx using ancestors

    Uses manifestmerge() to merge manifest and get list of actions required to
    perform for merging two manifests. If there are multiple ancestors, uses bid
    merge if enabled.

    Also filters out actions which are unrequired if repository is sparse.

    Returns mergeresult object same as manifestmerge().
    r��sparseNrs5note: merging %s and %s using bids from ancestors %s
s and css|]}t�|�VqdSr6)rr��rrprrrr[�rz#calculateupdates.<locals>.<genexpr>r�s"
calculating bids for ancestor %s
T)r��r�� %s: %s -> %s
s/
auction for merging merge bids (%d ancestors)
s list of bids for %s:
s   %s -> %s
c3s|]}|�dkVqdS)rNrr�)�lrrr[�rs %s: consensus for %s
s %s: picking 'keep' action
s" %s: picking 'keep absent' action
s& %s: picking 'changed/deleted' action
s %s: picking 'keep new' action
s% %s: picking 'delete/changed' action
c3s|]}|�kVqdSr6rr�)�ga0rrr[�rs %s: picking 'get' action
s% %s: multiple bids for merge action:
s  %s -> %s
s( %s: ambiguous merge - picked %s action
send of auction

)%�r�r�r�rsr r�rr"r�r�r�r�rPr�r��	__bytes__r�rfr�Z	debugflagr>�allrcr]r�r�r�r�r_rdrgr�r�rzZfilterupdatesactionsr�)r#r0r1Z	ancestorsrxrjr�r�r�rlr�rkZfbidsr�r�r�Zmresult1r2r�ryrnr&r�ZbidsZ_fr)r�r�r�calculateupdatesUs����
��


��
  ���������& 
��r�c
CsPz
t��WStyJ}z(|jtjkr4WYd}~dS�WYd}~n
d}~00dSr6)r
�getcwd�OSError�errno�ENOENT)�errrrr�_getcwds
r�c
cs|jj}t�}d}|D]�\}}}|j�d||f�|rL|j�td�|�||��z||jdd�WnDty�}	z,|j�	td�|t
�|	j�f�WYd}	~	n
d}	~	00|dkr�||fVd}|d	7}q|dkr�||fV|�rt��s|j�	td
�|j
�dS)zSapply removes to the working directory

    yields tuples for progress updates
    rs
 %s: %s -> r
�removing %s
T)Z
ignoremissings update failed to remove %s: %s!
N�drsCcurrent directory was removed
(consider changing to repo root: %s)
)r �verboser�r�r�rr*r�r�rgrZforcebytestr�strerror�root)
r#r0r�r��cwd�ir2rnr&�instrrr�batchremove&s<��


���rccs�i}|jj}|j}|j}d}	|jj|t|�d���<|D�]$\}
\}}}
|j�d|
|
f�|rt|j�td�|
�|r�|
}|j�	|
�s�t
�|
�D]}|j�|�r�|}q�q�|j�	|�r�t
�|||�}t�|�|�|�||
}|��|�dd�}|j||
���|d|d�}|�r:|��}|j}t�|�}|||f||
<|	d	k�rVd
|	|
ffVd}	|	d7}	q8Wd�n1�sv0Y|	dk�r�d
|	|
ffVd|fVdS)
ajapply gets to the working directory

    mctx is the context to get from

    Yields arbitrarily many (False, tuple) for progress updates, followed by
    exactly one (True, filedata). When wantfiledata is false, filedata is an
    empty dict. When wantfiledata is true, filedata[f] is a triple (mode, size,
    mtime) of the file f written for each action.
    r)Z
expectedcounts
 %s: %s -> g
sgetting %s
rNsupdate.atomic-fileT)Zbackgroundclose�
atomictempr�FrN)r r��filectxr)Zbackgroundclosingr�r�r�rr@rr?r,rZ
backuppathr�renameZwjoinZclearunknownr\�writer��lstat�st_moderZmtime_of)r#r1r0�wantfiledatar�Zfiledatar�Zfctxr rr2rrrqr&ZconflictingrDZorigZwfctxr�sizer��mode�mtimerrr�batchgetMsR

�

*
r
cCsD|�tjtjtjtjg�}tj}tj}|||�	�|||�fg�dS)z�Invoke ``scmutil.prefetchfiles()`` for the files relevant to the dict
    of merge actions.  ``ctx`` is the context being merged in.N)
rFr]rdr_rarerZ
prefetchfilesr�r�)r#�ctxrkrFZprefetchr�rrr�_prefetchfiles�s ��	���rT)�frozenc@s4eZdZe��Ze��Ze��Ze��Zdd�Z	dS)�updateresultcCs|jp|jp|jp|jSr6)�updatedcount�mergedcount�removedcount�unresolvedcountr:rrr�isempty�s���zupdateresult.isemptyN)
rIrJrKrZibrrrrrrrrrr�s
rc0Cs�t|||�d\}}}	|jdd�}
|
�|����|��|�t�|j�D]\}}|
�||�qH|�	t
jj�}
|�	�|
}|j
jtd�td�|d�}d|jt
jvr�t�||||||�|jt
jgdd�D]�\}}}|\}}|j
j}|td	�|�|d
k�r|td�|�n|td�|�|td
�|�|
�|||�|j|d�q�|���rXdnd}t�|j
|t||ft|jt
jgdd���}|D]\}}|j||d��q�|�	t
jf�}	|jt
jgdd�D]�\}}}|j
�d||f�|\}}||���rL|j
� td�||f�||�!�||�"|�#|��$�|�#|��%��||�&�|j|d��q�|j
�'dd�}tj|j
|t(||||ft|jt
j)gdd��|dd�}i}|D],\}}|�r�|}n|\}}|j||d��q�d|jt
j)v�r�t�||||||�|jt
j*fdd�D],\}}}|j
�d||f�|j|d��q|jt
j+fdd�D],\}}}|j
�d||f�|j|d��qL|jt
j,fdd�D],\}}}|j
�d||f�|j|d��q�t
jjD]>}|j|fdd�D]&\}}}|j
�d|||�-�f��q֐q�|jt
j.fdd�D]~\}}}|j
�d||f�|j|d�|\}} |j
� td�||f�||�!�||�"|�#|��$�| �||�&��q|jt
j/fdd�D]f\}}}|j
�d||f�|j|d�|\}} |j
� td�||f�||�"|�#|��$�| ��q�|jt
j0fdd�D]V\}}}|j
�d||f�|j|d�|\} ||�!�||�1d
| vd| v��q g}!t|jt
j2t
j3t
j4gdd��}"|"D]�\}}}|\}}#}$}%}&|dk�rĐq�|d u�r�t5�6||$�}'n|j
�d!||f�||}'|#d u�rt5�6||$�}(n||#}(||&})|$|)v�r4|)|$}*n|j#|t7d"�}*|
�8|'|(|*|�||k�r�|%�r�|!�9|��q�|!D]<}||���rt|j
�d#|�||�!�||�&��qt|�	t
j)t
j0t
j/t
j.f�}z�z�|"D]|\}}}|j
�d$||f�|
�|d%d&i�|j|d�|dk�r6t�||||�:|�||��q�||�!�|
�;||��q�Wnt<j=�yjYn0W|
�>�n
|
�>�0|
�?�}+|
�@�\},}-}.||,7}||-7}|	|.7}	|
�A�}/|�B�tC|||	|+�||/fS)'a�apply the merge action list to the working directory

    mresult is a mergeresult object representing result of the merge
    wctx is the working copy context
    mctx is the context to be merged into the working copy

    Return a tuple of (counts, filedata), where counts is a tuple
    (updated, merged, removed, unresolved) that describes how many
    files were affected by the update, and filedata is as described in
    batchget.
    )rrrT)Zcleansupdatingsfiles)Zunit�totalr�r�sD%s: path conflict - a file or link has the same name as a directory
r�s&the local file has been renamed to %s
s'the remote file has been renamed to %s
s1resolve manually then use 'hg resolve --mark %s'
)�itemrg����MbP?)�steprs %s: %s -> pr
smoving %s to %s
rNsworker.wdir-get-thread-safe)�
threadsafeZ	hasretvals
 %s: %s -> f
s
 %s: %s -> a
s %s: %s -> am
r�s %s: %s -> dm
s %s: %s -> dg
sgetting %s to %s
s
 %s: %s -> e
�xNs! preserving %s for resolve of %s
)Zfileidr�s
 %s: %s -> m
smergedr�)Drr�start�p1r�rr�r�r�r�r]ZMergeActionZ
NO_OP_ACTIONSr Zmakeprogressrr�rurZsubmerger`r��statusZaddpathconflictZ	incrementr(rrr>r�r�r@r�r*rrr�rrr�r\r
rdrtrr�r�r�rar�Zsetflagsr�r_rerZ
absentfilectxrrAr�r��resolverZInterventionRequiredZcommitrZcountsr�Zcompleter)0r#rkr0r1�	overwriter	�labels�updatedZmergedrw�msr2�opZ	num_no_opZ
numupdatesZprogressrnr&r��for�Zcost�progrrZf0Zorigf0r�getfiledata�finalr�r�rrZmovesZmergeactionsr3r�r�rpZfclZfcoZactxZfcaZ
unresolvedZ	msupdatedZmsmergedZ	msremoved�extraactionsrrr�applyupdates�sn
�����
��$�
�	���"������





��	
��r*cCs�|j�dd�}|j�dd�}t�d�}|dur<|j�dd�}z,ddlm}|�d�|j�dd�d	k}Wnt	y~d
}Yn0|r�|s�||j
kr�||kr�tj�
d�r�|j�td��dS)
Ns	fsmonitorswarn_when_unusedswarn_update_file_countr-swarn_update_file_count_rustr)�
extensionssmodesoffF)slinuxsdarwins�(warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
)r r\Z	configintrZ
importrustr�r+�findr!�KeyError�nullidrZsysplatformr�rgr)r#Znum_getsZp1nodeZfsmonitorwarningZfsmonitorthresholdZdirstate_rustmodr+Zfsmonitorenabledrrr�_advertisefsmonitor�s>�
�

����
���r/rsnoneslinears
noconflictc:
s`ddlm}|dusJ�|sV|sV|
dur,t}
tttf}
|
|
vrVd}||
|
f;}t|��|durp|��rpt��}n��	�}|���|dur��d}|�
�}|d}�|}|dur��|g}n^�j�dd�dgk�r
�j
�|��|���}�fd	d
�t|��p�jgD�}n|j||d�g}|��|��t|�t|�f\}}}}|�oH|}|�s�t|�dk�rlt�td���|��}|���r�td
�}td�}tj||d��|�rhtd�}||gk�r�t�|��nB||gk�r|�s|��|��k�rtd�}td�}tj||d��|�s<|���s|���r<td�}td�}tj||d��|���s,t|j�D]}|�|�� ��qPn�|�s,||k�r��j!dd|dd��j!d|ddd�t"dddd�Wd�S|
tk�r,||g|gfv�r,|j#dd�}|�r,t$�%�|��g�}�|��|v�rntd�}td�}tj&||d��n|�r:|g}n|�sF|g}�j�'dd�} |�r`d} n|d�snd} |�s�|j#dd��s�d} t(�||||||| ||d�
}!|
tk�r�|!�)��r�td �}td�}tj||d��|!�*d!�}"|"�r�d!}#|"\}$}%}t+�,|�}&|#|&d"<|$t-j.k�rn�j�/td#�|&d��r<|!�0|#t-j1dd$�n0|#|v�rZ|!�0|#t-j2dd%�n|!�0|#t-j3dd%�nd|$t-j4k�r�|%\}'}(})}*}+||(�5�},�j�/td&�|&d�dk�r�|!�0|#t-j6|,dfd'�n
|!�7|#�t�8�j9��s|�s|�s�|j#ddd(��st:�|�;�d�nt:�|�;�|!�tt<�=|!j>��D]>\}#}-�j�?td)�|#�t|-�D]}.�j�?d*|.��qR�q.tt<�=|!j@��D]>\}#}-�j�?td+�|#�t|-�D]}.�j�?d*|.��q��q~|�s�|�j|df\}}}}|du�p�|�A�}/|	�o|/�o|��}	|	�r,�j!dd||d��jB�Cd,|�D��tE�|!�t-j6f�|���|	�oP|}0tF�|!||||0|d-�\}1}2}3|	�r"|3�r�t<�=|3�D]`\}4}5|5D]&}6|!j0|6d|4g|6dd��R��q�|4t-j6k�r�|0�r�|5D]}6d|2|6d<�qΐq�t|2�|0�r|!�t-j6f�ndk�sJ��jG�H���|2�r�i}7tI�J�jB�}8|8du�r>d}2nn|8d}9t<�=|2�D]<\}#}$|$du�rP|$d.d|9k�rP|$d|$ddf|7|#<�qPt<�=|7�D]\}#}$|$|2|#<�q���K||�t-�L�|!jM||2�t�N�jB�Od,��|�s�jG�P|���|�s|�Q��Wd�n1�s0YWd�n1�s80Y|	�r\�j!d|||1jd�|1S)/a�	
    Perform a merge between the working directory and the given node

    node = the node to update to
    branchmerge = whether to merge between branches
    force = whether to force branch merging or file overwriting
    matcher = a matcher to filter file lists (dirstate not updated)
    mergeancestor = whether it is merging with an ancestor. If true,
      we should accept the incoming changes for any prompts that occur.
      If false, merging with an ancestor (fast-forward) is only allowed
      between different named branches. This flag is used by rebase extension
      as a temporary fix and should be avoided in general.
    labels = labels to use for local, other, and base
    mergeforce = whether the merge was run with 'merge --force' (deprecated): if
      this is True, then 'force' should be True as well.

    The table below shows all the behaviors of the update command given the
    -c/--check and -C/--clean or no options, whether the working directory is
    dirty, whether a revision is specified, and the relationship of the parent
    rev to the target rev (linear or not). Match from top first. The -n
    option doesn't exist on the command line, but represents the
    experimental.updatecheck=noconflict option.

    This logic is tested by test-update-branches.t.

    -c  -C  -n  -m  dirty  rev  linear  |  result
     y   y   *   *    *     *     *     |    (1)
     y   *   y   *    *     *     *     |    (1)
     y   *   *   y    *     *     *     |    (1)
     *   y   y   *    *     *     *     |    (1)
     *   y   *   y    *     *     *     |    (1)
     *   *   y   y    *     *     *     |    (1)
     *   *   *   *    *     n     n     |     x
     *   *   *   *    n     *     *     |    ok
     n   n   n   n    y     *     y     |   merge
     n   n   n   n    y     y     n     |    (2)
     n   n   n   y    y     *     *     |   merge
     n   n   y   n    y     *     *     |  merge if no conflict
     n   y   n   n    y     *     *     |  discard
     y   n   n   n    y     *     *     |    (3)

    x = can't happen
    * = don't-care
    1 = incompatible options (checked in commands.py)
    2 = abort: uncommitted changes (commit or update --clean to discard changes)
    3 = abort: uncommitted changes (checked in commands.py)

    The merge is performed inside ``wc``, a workingctx-like objects. It defaults
    to repo[None] if None is passed.

    Return the same tuple as applyupdates().
    rr�Nz&Invalid updatecheck %r (can accept %r)rrMspreferancestor�*csg|]}�|�qSrrr�rWrrrurz_update.<locals>.<listcomp>)rgsoutstanding uncommitted mergesoutstanding merge conflictssuse 'hg resolve' to resolver�s7merging with a working directory ancestor has no effectsnothing to merges#use 'hg update' or check 'hg heads'suncommitted changessuse 'hg status' to list changess	preupdateTr)�throw�parent1�parent2supdate)r2r3r)�missings+commit or update --clean to discard changessfollowcopiesF)r�rlsconflicting changesr��fsjlocal%(l)s changed %(f)s which other%(o)s deleted
use (c)hanged version or (d)elete?$$ &Changed $$ &Deletes
prompt deletesprompt keepsrother%(o)s changed %(f)s which local%(l)s deleted
use (c)hanged version or leave (d)eleted?$$ &Changed $$ &Deletedsprompt recreating)r4�branchs<note: possible conflict - %s was renamed multiple times to:
s %s
s9note: possible conflict - %s was deleted and renamed to:
supdatestate)r!�)Rr�r��UPDATECHECK_LINEAR�UPDATECHECK_NONE�UPDATECHECK_NO_CONFLICT�
ValueErrorr(rZnullcontextmanagerZwlockr�r Z
configlist�	changelogZcommonancestorsheadsr�rfr.r�r�r�rrhrrrr�r6rFrvr�r�Z
bailifchanged�hookrr�r�
foregroundZUpdateAbortr\r�r�r�rZ
partextrasr]r��promptchoicercrur�rr_rrrdr~Zfscasesensitivermr�r�rr�r�rgr�r}Zvfsr�hexr/r*r-�parentchangerZ
get_fs_now�
setparentsZ
recordupdatesr��unlinkr"Z	setbranchZprunetemporaryincludes):r#r�rxrjr��
mergeancestorr!r�rl�updatedirstate�updatecheck�wcr�Zokayr&Zmaybe_wlock�plrr�ZpasZcahs�fp1�fp2Zxp1Zxp2r r#r�Zm_ar�r�r>r�rkZvalsr2ryrnZpromptsr�r3r�r�rprrr�Znfr}r	�statsr'r)�kZactsr�Zambiguous_mtimeZnowZnow_secrrWr�_updates�C

"$


�
�




���	�
�����	���
����������
$�
2

�J
�rMc	Cst|��|��|d|||d�S)z�Merge another topological branch into the working copy.

    force = whether the merge was run with 'merge --force' (deprecated)
    T)r!rxrjrlrG�rMr#r�)rr!rjrGrrr�merge�s�rOc	Cs"t|��|��ddgd�||d�S)a�Do a regular update to the given commit, aborting if there are conflicts.

    The 'updatecheck' argument can be used to control what to do in case of
    conflicts.

    Note: This is a new, higher-level update() than the one that used to exist
    in this module. That function is now called _update(). You can hopefully
    replace your callers to use this new update(), or clean_update(), merge(),
    revert_to(), or graft().
    F)sworking copysdestinationsworking copy parent)rxrjr!rFrGrN)rrFrGrrrrP�s�rPcCst|��|��dd|d�S)z�Do a clean update to the given commit.

    This involves updating to the commit and discarding any changes in the
    working copy.
    FT)rxrjrGrN)rrGrrr�clean_update�srPc	Cst|��|��ddd||d�S)z�Revert the working copy to the given commit.

    The working copy will keep its current parent(s) but its content will
    be the same as in the given commit.
    FT)rxrjrEr�rGrN)rr�rGrrr�	revert_to�s�rQc
CsN|p
|d}|��}|p|��}|j�|��|���pD|��|��k}t||��dd|��|||d�}	|rz|	jrz|��}
n<|j}
|��}|r�t	|�dkr�||vr�|�
|�|d��}
|
|��kr�|j}
|��r�|�|��|
�t
�|||�nZ|j���>|�|��|
�|j�|���t
�|||�Wd�n1�s@0Y|	S)aIDo a graft-like merge.

    This is a merge where the merge ancestor is chosen such that one
    or more changesets are grafted onto the current changeset. In
    addition to the merge, this fixes up the dirstate to include only
    a single parent (if keepparent is False) and tries to duplicate any
    renames/copies appropriately.

    ctx - changeset to rebase
    base - merge base, or ctx.p1() if not specified
    labels - merge labels eg ['local', 'graft']
    keepparent - keep second parent if any
    keepconflictparent - if unresolved, keep parent used for the merge

    NT)rDr!rGr7r)rr<Z
isancestorr�r�rMrr.r�r�r�r(rBr	Zgraftcopiesr-rArZcurrenttransaction)r#r�baser!Z
keepparentZkeepconflictparentr0ZpctxrDrKZpotherr�rrr�graft�sB ��


.rScCsF|dur*|��dur"d}t�|��|��}t|��|dd|��dd�S)Ns/must specify parent of merge commit to back outTF)rxrjr�rD)r�rZProgrammingErrorrrMr#r�)r�parentrGr&rrr�back_outA	s
�rUc	s���fdd�}	|j}
g}�z�|r,g}|j|_�j|||d�}
|�r&d}t|
j�}t|
j�}|rx|rxtd�}|||f;}nn|r�td�}||;}nX|r�td�}||;}nB|r�d}|D] }||�r��j�|�s�|d	7}q�|r�td
�}||;}|dur�|W|
|_S|d7}�j	j
|d	d�d	k�r&t�td
���|�rvt
|
j|
j�D]8}|�sh�j	�td�|�|	�jj|�|�|��q<|�r�t
|dd�D]P}||��r��j�|��s�|�s̈j	�td�|�|	�jj|�|�|��q�|W|
|_S|
|_0dS)aPurge the working directory of untracked files.

    ``matcher`` is a matcher configured to scan the working directory -
    potentially a subset.

    ``unknown`` controls whether unknown files should be purged.

    ``ignored`` controls whether ignored files should be purged.

    ``removeemptydirs`` controls whether empty directories should be removed.

    ``removefiles`` controls whether files are removed.

    ``abortonerror`` causes an exception to be raised if an error occurs
    deleting a file or directory.

    ``noop`` controls whether to actually remove files. If not defined, actions
    will be taken.

    ``confirm`` ask confirmation before actually removing anything.

    Returns an iterable of relative paths in the working directory that were
    or would be removed.
    csTz||�WnBtyNtd�|}�r6t�|��n�j�td�|�Yn0dS)Ns%s cannot be removedswarning: %s
)r�rrr�r rg)Zremovefnrmry��abortonerrorr#rrr�u	szpurge.<locals>.remove)r
�ignored�unknownNs3permanently delete %d unknown and %d ignored files?s$permanently delete %d unknown files?s$permanently delete %d ignored files?rrs1permanently delete at least %d empty directories?s (yN)$$ &Yes $$ &No)�defaultsremoval cancelledsremoving file %s
T)�reversesremoving directory %s
)Ztraversedirr�rr�rXrYrr)�listdirr r?rZ
CanceledErrorrfr�rC�rmdir)r#r�rYrXZremoveemptydirsZremovefilesrWZnoopZconfirmr�Zoldtraversedirr�Zdirectoriesrr&Z
nb_ignoredZ
nb_unknownZ	dir_countr2rrVr�purgeQ	sn$




���r^)N)F)NF)N)NFNNFTNN)NFN)NN)N)NN)NNFFN)NN)TFTTFFF)FZ
__future__rr�r��structZi18nrr�rZ
thirdpartyrZutilsrZ
dirstateutilsrr�r	r
rrr
r�rr]rrrrrrrr�packZ_pack�unpackZ_unpackr'r4�objectr5rsrzr�r�r�r�r�r�r�r�r�rr
rr�rr*r/ZUPDATECHECK_ABORTr9r8r:rMrOrPrPrQrSrUr^rrrr�<module>s�@
8!D
#0�
�
I	'V
�

5�
#


	
�
L
�

Youez - 2016 - github.com/yon3zu
LinuXploit