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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/__pycache__/absorb.cpython-39.opt-1.pyc
a

�+�bܣ�
@s�dZddlmZddlZddlmZddlmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZddlmZdZiZe�e�ZiZe�e�Zed	d
dd�ed	d
dd�ed	ddd�dddd�Z ej!Z!Gdd�de"�Z#Gdd�de"�Z$dd�Z%d<dd�Z&d=dd�Z'Gdd�dej(�Z)d>d d!�Z*Gd"d#�d#e"�Z+Gd$d%�d%e"�Z,d&d'�Z-d(d)�Z.d?d*d+�Z/ed	d,d-ded.�fd/d0ded1�fd2d3ded4�fd5d6ded7�fgej0ej1ej2ed8�ej3dd9�d:d;��Z4dS)@a?apply working directory changes to changesets (EXPERIMENTAL)

The absorb extension provides a command to use annotate information to
amend modified chunks into the corresponding non-public changesets.

::

    [absorb]
    # only check 50 recent non-public changesets at most
    max-stack-size = 50
    # whether to add noise to new commits to avoid obsolescence cycle
    add-noise = 1
    # make `amend --correlated` a shortcut to the main command
    amend-flag = correlated

    [color]
    absorb.description = yellow
    absorb.node = blue bold
    absorb.path = bold
�)�absolute_importN)�_)�hex�short)�cmdutil�commands�context�crecord�error�linelog�mdiff�obsolete�patch�phases�pycompat�	registrar�rewriteutil�scmutil�util)�
stringutilsships-with-hg-core�absorb�	add-noiseT��defaults
amend-flag�max-stack-size�2syellows	blue boldsbold)�absorb.description�absorb.node�absorb.pathc@s$eZdZdZdZdZdZdd�ZdS)�nulluizblank ui object doing nothingFTcCsdd�}|S)Nc_sdS�N�)�args�kwdsr!r!�2/usr/lib64/python3.9/site-packages/hgext/absorb.py�nullfunc_sz$nullui.__getitem__.<locals>.nullfuncr!)�namer%r!r!r$�__getitem__^sznullui.__getitem__N)�__name__�
__module__�__qualname__�__doc__�	debugflag�verbose�quietr'r!r!r!r$rWs
rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�emptyfilecontextz.minimal filecontext representing an empty filecCs
||_dSr )�_repo)�self�repor!r!r$�__init__hszemptyfilecontext.__init__cCsdS)N�r!�r1r!r!r$�datakszemptyfilecontext.datacCs|jjSr )r0�nullidr5r!r!r$�nodenszemptyfilecontext.nodeN)r(r)r*r+r3r6r8r!r!r!r$r/esr/cCs4t�}g}|D] }||vr|�|�|�|�q|S)z@list -> list. remove duplicated items without changing the order)�set�add�append)Zlst�seen�result�xr!r!r$�uniqrs
r?cCs^|}g}|��tjkrR|r(t|�|kr(qR|��}t|�dkr>qR|�|�|d}q|��|S)a)(ctx, int?) -> [ctx]. get a linear stack of non-public changesets.

    changesets are sorted in topo order, oldest first.
    return at most limit items, if limit is a positive number.

    merges are considered as non-draft as well. i.e. every commit
    returned has and only has 1 parent.
    �r)ZphaserZpublic�len�parentsr;�reverse)�headctx�limit�ctxr=rBr!r!r$�
getdraftstack}s	

rGc	Cs�|durt�}||dvr"gifSg}i}|d��}t|�D]b}||vrR|}q�||}|�|�||vrtd}q�|||<|��}|r>|}||vr>|��}q�q>|dur�||vr�|�||�n|�t|����|��t|�|fS)aP([ctx], str, set) -> [fctx], {ctx: fctx}

    stack is a list of contexts, from old to new. usually they are what
    "getdraftstack" returns.

    follows renames, but not copies.

    seenfctxs is a set of filecontexts that will be considered "immutable".
    they are usually what this function returned in earlier calls, useful
    to avoid issues that a file was "moved" to multiple places and was then
    modified differently, like: "a" was copied to "b", "a" was also copied to
    "c" and then "a" was deleted, then both "b" and "c" were "moved" from "a"
    and we enforce only one of them to be able to affect "a"'s content.

    return an empty list and an empty dict, if the specified path does not
    exist in stack[-1] (the top of the stack).

    otherwise, return a list of de-duplicated filecontexts, and the map to
    convert ctx in the stack to fctx, for possible mutable fctxs. the first item
    of the list would be outside the stack and should be considered immutable.
    the remaining items are within the stack.

    for example, given the following changelog and corresponding filelog
    revisions:

      changelog: 3----4----5----6----7
      filelog:   x    0----1----1----2 (x: no such file yet)

    - if stack = [5, 6, 7], returns ([0, 1, 2], {5: 1, 6: 1, 7: 2})
    - if stack = [3, 4, 5], returns ([e, 0, 1], {4: 0, 5: 1}), where "e" is a
      dummy empty filecontext.
    - if stack = [2], returns ([], {})
    - if stack = [7], returns ([1, 2], {7: 2})
    - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be
      removed, since 1 is immutable.
    N���r)	r9�p1�reversedr;�
copysourcer/r2rCr?)	�stack�path�	seenfctxs�fctxs�fctxmap�pctxrF�fctx�copyr!r!r$�getfilestack�s:%
rTc@s eZdZdZdd�Zdd�ZdS)�overlaystorezsread-only, hybrid store based on a dict and ctx.
    memworkingcopy: {path: content}, overrides file contents.
    cCs||_||_dSr )�basectx�memworkingcopy)r1rVrWr!r!r$r3�szoverlaystore.__init__cCsX||jvrdS|j|}||jvr.|j|}n|��}|��|��f}|��}|||fS)z-comply with mercurial.patch.filestore.getfile)NNN)rVrWr6�islinkZisexecrK)r1rMrR�content�moderSr!r!r$�getfile�s


zoverlaystore.getfileN)r(r)r*r+r3r[r!r!r!r$rU�srUc	Cs�|dur|��j�|���}|dur,|��}|dur<|��}|��}|��}t|�	���
|�}t||�}tj
|��||||||d|d�	S)zi({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx
    memworkingcopy overrides file contents.
    N)	r2rB�text�filesZ	filectxfn�user�date�branch�extra)r2Z	changelogrBr8ra�descriptionr_r^r9r]�unionrUrZmemctx)	rWrFrBra�descr_r^r]�storer!r!r$�overlaycontext�s*
�rfc@s�eZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
dd�Zdd�Zdd�Z
dd�Zd dd�Zdd�Zdd�ZdS)!�filefixupstateastate needed to apply fixups to a single file

    internally, it keeps file contents of several revisions and a linelog.

    the linelog uses odd revision numbers for original contents (fctxs passed
    to __init__), and even revision numbers for fixups, like:

        linelog rev 1: self.fctxs[0] (from an immutable "public" changeset)
        linelog rev 2: fixups made to self.fctxs[0]
        linelog rev 3: self.fctxs[1] (a child of fctxs[0])
        linelog rev 4: fixups made to self.fctxs[1]
        ...

    a typical use is like:

        1. call diffwith, to calculate self.fixups
        2. (optionally), present self.fixups to the user, or change it
        3. call apply, to apply changes
        4. read results from "finalcontents", or call getfinalcontent
    NcCs~||_||_|pt�|_|pi|_dd�|D�|_t�tj	|j�|_
|��|_|jj
rVddg|_g|_g|_g|_t�|_dS)z�([fctx], ui or None) -> None

        fctxs should be linear, and sorted by topo order - oldest first.
        fctxs[0] will be considered as "immutable" and will not be changed.
        cSsg|]}|���qSr!)r6��.0�fr!r!r$�
<listcomp>;r4z+filefixupstate.__init__.<locals>.<listcomp>rN)rOrMr�ui�opts�contentsrZmaplistr�
splitnewlines�contentlines�
_buildlinelogrr,�
chunkstats�targetlines�fixups�
finalcontentsr9�ctxaffected)r1rOrMrlrmr!r!r$r3/s


zfilefixupstate.__init__cCs�|jd}|jd}|��}t�|�}||_|j�|jj�|jj	}|rn|dd|dddf}|�
|�|�||||�D]`}	|�|	|�}
|j
dt|
�7<|j
dd7<|j|
7_|dur~|�||||	|
�q~dS)a�calculate fixups needed by examining the differences between
        self.fctxs[-1] and targetfctx, chunk by chunk.

        targetfctx is the target state we move towards. we may or may not be
        able to get there because not all modified chunks can be amended into
        a non-public fctx unambiguously.

        call this only once, before apply().

        update self.fixups, self.chunkstats, and self.targetlines.
        rHrr@N)rnrpr6rrorsr�annotateZmaxrev�annotateresultr;�_alldiffchunks�_analysediffchunkrr�boolrt�_showchanges)r1�
targetfctx�fm�a�alines�b�blines�	annotatedZdummyendline�chunk�	newfixupsr!r!r$�diffwithHs"



zfilefixupstate.diffwithc	Cs�t|j�D]x\}}}}}|j||�}|jjrnt|dd�d}|j�td�t|j	|�
��||t|�f�|j�
|||||�q
|j�dd�r�|��|_n
|��|_dS)z�apply self.fixups. update self.linelog, self.finalcontents.

        call this only once, before getfinalcontent(), after diffwith().
        r@r�s%s: chunk %d:%d -> %d lines
�
edit_linesFN)rJrtrsrlr,�max�writerrrOr8rAr�replacelinesrm�get�_checkoutlinelogwitheditsru�_checkoutlinelog)r1�rev�a1�a2�b1�b2r��idxr!r!r$�applyks��zfilefixupstate.applycCs|j�|�}|j|S)z@(fctx) -> str. get modified file content for a given filecontext)rO�indexru)r1rRr�r!r!r$�getfinalcontent�szfilefixupstate.getfinalcontentcs6|\}}}}�||�}|sD�rD|td|d�h}�fdd�|D�}tdd�|D��}	g}
t|	�dkr�|�||dd�r�|	d}|dkr�|d}|
�|||||f�n�||||ks�||k�r,t�||�D]^}
�|
\}}|dkr�||kr�d}}n||
|}|d}|d}|
�||
|
d||f�q�|�|
�S)a�analyse a different chunk and return new fixups found

        return [] if no lines from the chunk can be safely applied.

        the chunk (or lines) cannot be safely applied, if, for example:
          - the modified (deleted) lines belong to a public changeset
            (self.fctxs[0])
          - the chunk is a pure insertion and the adjacent lines (at most 2
            lines) belong to different non-public changesets, or do not belong
            to any non-public changesets.
          - the chunk is modifying lines from different changesets.
            in this case, if the number of lines deleted equals to the number
            of lines added, assume it's a simple 1:1 map (could be wrong).
            otherwise, give up.
          - the chunk is modifying lines from a single non-public changeset,
            but other revisions touch the area as well. i.e. the lines are
            not continuous as seen from the linelog.
        rr@cs$g|]}�|ddkr�|�qS�rr@r!)ri�i�r�r!r$rk�sz4filefixupstate._analysediffchunk.<locals>.<listcomp>cSsh|]\}}|�qSr!r!)ri�r�lr!r!r$�	<setcomp>�r4z3filefixupstate._analysediffchunk.<locals>.<setcomp>T)r��listrA�
_iscontinuousr;r�xrange�_optimizefixups)r1r�r�r�r�r�r�ZinvolvedZnearbylinenumsZinvolvedrevsr�r�Zfixuprevr��linenumZnb1Znb2r!r�r$rz�s2
�
z filefixupstate._analysediffchunkccs4tj||||d�}|D]\}}|dkr(q|VqdS)z5like mdiff.allblocks, but only care about differences)Zlines1Zlines2�!N)rZ	allblocks)rr�r�r�Zblocksr�Zbtyper!r!r$ry�s
zfilefixupstate._alldiffchunksc
	Cs�t��}dg}}t�t|j��D]l}|j||j|}}|dd}|�||||�}tt|��D]\}	}
}}|�	||	|
||�qd||}}q"|S)z~calculate the initial linelog based on self.content{,line}s.
        this is similar to running a partial "annotate".
        r4r�r@)
rrr�rArnrpryrJr�r�)
r1�llogrr�r�r�r�Zllrev�chunksr�r�r�r�r!r!r$rq�s
zfilefixupstate._buildlinelogcCsVg}t�t|j��D]<}|dd}|j�|�d�t|j|jj	��}|�
|�q|S)z1() -> [str]. check out file contents from linelogr@r�r4)rr�rArnrrw�join�map�_getlinerxr;)r1rnr�r�rYr!r!r$r��szfilefixupstate._checkoutlinelogc

s.|j��}td�|jd��}dd�t|j�D�}t|�D]P\}\}}|td�d|dt|�|dt|���|�	��
d	d�d
f7}q<|td�dt|�7}tdd
���|D]8\}}|j�|dd�|jj
D]����|�q�q�|D]0�|dd���fdd�|D��|���f7}q�|jj|ddd�}|�sLt�td���dgt|j�}d}	|	t|�d}
t�|�D]����d��r��qz�|
d|
d�dk�r�t�td�����|
dd�}tt��|	|
d���D],\}}|dk�r�|||d
|7<�q�qz||k�r*ddg|_|S)z&() -> [str]. prompt all lines for editsZHG: editing %s
HG: "y" means the line to the right exists in the changeset to the top
HG:
rHcSs"g|]\}}t|t�s||f�qSr!)�
isinstancer/)rir�rjr!r!r$rk�s
�z<filefixupstate._checkoutlinelogwithedits.<locals>.<listcomp>sHG: %s/%s %s %s
�|�-r@�
rsHG: %s
cSst�Sr )r9r!r!r!r$�<lambda>�r4z:filefixupstate._checkoutlinelogwithedits.<locals>.<lambda>r�s    %s : %sr4cs$g|]\}}|��vrdnd�qS)�y� r!)rir�Z_f�r�Zlinesetr!r$rk�s�r)�actionsempty editor text�sHG:s : smalformed line: %sNr�)r�getalllinesrrOrM�	enumeraterArr8rb�split�defaultdictrwrxr:r�r�rlZeditr
�
InputErrorrro�
startswithrZbytestrrr)
r1ZalllinesZ
editortextZvisiblefctxsr��jrjZ
editedtextrnZ
leftpadposZcolonposZlinecontentZchr!r�r$r��sh
����
�
���

�
 

z(filefixupstate._checkoutlinelogwitheditscCs0|\}}|d@r"|j|d|S|j|SdS)z@((rev, linenum)) -> str. convert rev+line number to line contentr@r�N)rprs)r1Zlineinfor�r�r!r!r$r�szfilefixupstate._getlineFcCsR||krdS|j}|�|�}|�|�t|�}|�||�}t|�||t|�kS)a(a1, a2 : int) -> bool

        check if these lines are continuous. i.e. no other insertions or
        deletions (from other revisions) among these lines.

        closedinterval decides whether a2 should be included or not. i.e. is
        it [a1, a2), or [a1, a2] ?
        T)rZ	getoffset�intr�rA)r1r�r�Zclosedintervalr�Zoffset1Zoffset2Zlinesinbetweenr!r!r$r�&s	
zfilefixupstate._iscontinuousc
s�g�gd�g���fdd�}t|�D]�\}}|\}}}}}	�dd}
�dd}�dd}||kr�||kr�||
kr�|�t|dd�|�r�|�dd<|	�dd<q$|�t|��d<q$|��S)zx[(rev, a1, a2, b1, b2)] -> [(rev, a1, a2, b1, b2)].
        merge adjacent fixups to make them less fragmented.
        )rHrHrHrHrHcs&�dddkr"��t�d��dS)NrrH)r;�tupler!�Z
pcurrentchunkr=r!r$�	pushchunk>sz1filefixupstate._optimizefixups.<locals>.pushchunkrr�r�r@)r�r�r�r�)
r1rtr�r�r�r�r�r�r�r�ZlastrevZlasta2Zlastb2r!r�r$r�7s,
����zfilefixupstate._optimizefixupsc	sTdd�}|\}}}	}
dg||dg|
|	}}|D]f\}
}}}}t�||�D]}t|
d�dd|||<qPt�||�D]}t|
d�dd|||	<q|q6����jddd||||	|
|	fd	d
��j�jdd���fdd
�}t�||�D]$}||||d|||�dd�q�t�|	|
�D]&}||||	d|||�dd��q(dS)NcSs|�d�r|dd�}|S)Nr�rH)�endswith)�liner!r!r$�trimWs
z)filefixupstate._showchanges.<locals>.trimrr@r�shunks        %s
s@@ -%d,%d +%d,%d @@s	diff.hunk�Zlabel�rM�linetypecs|���d}|r>�j|}�j|d�|��}�j�|����jdd|dd��jd|d|||d��j�j	|d	�dS)
Nr4)rR�node�%-7.7s rr�s	diffchar s%s%s
r�)
�	startitemrOrrrvr:Z	changectxr�r6rM)r�Zdiffcharr�r�Z	linelabelr8rF�r~r1r!r$�	writelineos 
�z.filefixupstate._showchanges.<locals>.writeliner�sdeletedsdiff.deleted�+sinserteds
diff.inserted)rr�r�r�r�r6rM)r1r~r�r�r�rtr�r�r�r�r�ZaidxsZbidxsr�Zfa1Zfa2Zfb1Zfb2r�r�r!r�r$r|VsB�

�

�zfilefixupstate._showchanges)NN)N)F)r(r)r*r+r3r�r�r�rz�staticmethodryrqr�r�r�r�r�r|r!r!r!r$rgs

#3

D
rgc@s�eZdZdZd#dd�Zd$dd�Zdd�Zed	d
��Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zed%dd��Zd&dd�Zejdd��Zdd �Zejd!d"��ZdS)'�
fixupstatea^state needed to run absorb

    internally, it keeps paths and filefixupstates.

    a typical use is like filefixupstates:

        1. call diffwith, to calculate fixups
        2. (optionally), present fixups to the user, or edit fixups
        3. call apply, to apply changes to memory
        4. call commit, to commit changes to hg database
    NcCs^|pt�|_|pi|_||_|d����|_g|_d|_i|_i|_	i|_
d|_t�|_
dS)z�([ctx], ui or None) -> None

        stack: should be linear, and sorted by topo order - oldest first.
        all commits in stack are considered mutable.
        rHN)rrlrmrLr2Z
unfiltered�paths�statusrP�fixupmap�
replacemap�	finalnoder9rv)r1rLrlrmr!r!r$r3�s
zfixupstate.__init__cCsX|jd�||�|_g|_|j�d�}|jjs@|r@|r@|��}n|jj}t�}t|�D]�}|j	�
d|�||}t|j||�\}	}
tdd�|g|	D��r�qV|�
�|	d�
�kr�|s�qV|�|	dd��|
|j|<t|	||j	|jd�}|du�r"|��|�d	�|jd
d|dd
�|j
d
d�|�||�||j|<|j�|�|j�|j�qVdS)z9diff and prepare fixups. update self.fixupmap, self.pathsrHr�scalculating fixups for %s
css.|]&}t|t�s|��p$t�|���VqdSr )r�r/rXrZbinaryr6rhr!r!r$�	<genexpr>�s
�z&fixupstate.diffwith.<locals>.<genexpr>r@N�rlrmsshowing changes for spath�%s
rr��r�)rLr�r�rmr�Zmodifiedr]r9�sortedrl�debugrT�anyr6�updaterPrgr�Zplainr�r�r�r;rv)r1�	targetctx�matchr~ZeditoptZinterestingpathsrNrMr}rO�ctx2fctxZfstater!r!r$r��s:
�



zfixupstate.diffwithcCs>t�|j�D],\}}|jjr0|j�td�|�|��qdS)z*apply fixups to individual filefixupstatessapplying fixups to %s
N)r�	iteritemsr�rlr,r�rr�)r1rM�stater!r!r$r��szfixupstate.applycCsdd�t�|j�D�S)z>-> {path: chunkstats}. collect chunkstats from filefixupstatescSsi|]\}}||j�qSr!)rr)rirMr�r!r!r$�
<dictcomp>�s�z)fixupstate.chunkstats.<locals>.<dictcomp>)rr�r�r5r!r!r$rr�s
�zfixupstate.chunkstatscCsh|j�d��F}|��|�|�|jd��|jvr<|��|��Wd�n1sX0Y|jS)z6commit changes. update self.finalnode, self.replacemapr�.N)	r2Ztransaction�_commitstack�_movebookmarksr8r��_moveworkingdirectoryparent�_cleanupoldcommitsr�)r1�trr!r!r$�commit�s
&zfixupstate.commitcs�|j}|j}|jrPt�|�D]0\}}|dr|�td�||d|df�qn:|js�|����fdd�dD�\}}|�td�||f�dS)	z+print things like '1 of 2 chunk(s) applied'rs%s: %d of %d chunk(s) applied
r@c3s$|]�t�fdd��D��VqdS)c3s|]}|�VqdSr r!�ri�s�r�r!r$r�r4z7fixupstate.printchunkstats.<locals>.<genexpr>.<genexpr>N)�sum)ri�Zstatsr�r$r�r4z-fixupstate.printchunkstats.<locals>.<genexpr>r�s%d of %d chunk(s) applied
N)	rlrrr-rr�r�rr.�values)r1rlrrrM�statZapplied�totalr!r�r$�printchunkstats�s��zfixupstate.printchunkstatscCsd}d}|jD]�}|�|�}|s*|s*|}q|��o>|�|||�}|jrb|rbd|j|��<td�}nt|j|||d�}|j	|}|}|��|j|��<|r�|r�td�}ntd�}|t
|�|�|�f}ntd�|�|�}|jj
r|r|j�td�|�|�|f�q|�o|��|_dS)z�make new commits. update self.finalnode, self.replacemap.
        it is splitted from "commit" to avoid too much indentation.
        Nsbecame empty and was dropped)rIs&%d file(s) changed, became empty as %ss%d file(s) changed, became %ss	became %ss%s: %s
)rL�_getnewfilecontentsr]�_willbecomenoop�skip_empty_successorr�r8r�
_commitsingler2rA�_ctx2strrlr-r�r�)r1Z
lastcommittedZnextp1rFrWZwillbecomenoop�msgZnodestrr!r!r$r�
s:

�



� zfixupstate._commitstackcCs8|jjrd|��|��fSd|��t|���fSdS)Ns%d:%s)rlr,r�rrr8)r1rFr!r!r$r�5szfixupstate._ctx2strcCs\i}|jD]L}|j|}||vr"q
||}|��}|j|�|�}||kr
|||��<q
|S)z�(ctx) -> {path: str}

        fetch file contents from filefixupstates.
        return the working copy overrides - files different from ctx.
        )r�rPr6r�r�rM)r1rFr=rMr�rRrYZ
newcontentr!r!r$r�;s

zfixupstate._getnewfilecontentscs��j}�fdd�t�|j�D�}g}|D]j\}}|rh|�||f��jjr��j�td�|t	|�f�q(|�|df��jjr(�j�td�|�q(|j�
|||�dS)Ncs(g|] \}}|�jvr|�j|f�qSr!)r�)rir&�hshr5r!r$rkOs
�z-fixupstate._movebookmarks.<locals>.<listcomp>smoving bookmark %s to %s
sdeleting bookmark %s
)r2rr�Z
_bookmarksr;rlr-r�rrZapplychanges)r1r�r2Z
needupdateZchangesr&r�r!r5r$r�Ms 

��zfixupstate._movebookmarkscs�|js4|j�d|j���}|j|��}|��|_n|j|j}|jj�dd�}|}t�	�d�r~�j
j���fdd�}|�j
_zJ����(��
|��|��|j�Wd�n1s�0YW|�n|�0dS)Nsmax(::. - %ln)cSsdS)Nrr!r!r!r!r$r�nr4z8fixupstate._moveworkingdirectoryparent.<locals>.<lambda>�_fsmonitorstatecs��j_dSr )r��
invalidater!�Zbak�dirstater!r$�restoressz7fixupstate._moveworkingdirectoryparent.<locals>.restore)r�r2�revsr��keys�firstr8r�rZsafehasattrr�r�ZparentchangeZrebuildZmanifestr�)r1r�rFZnoopr�r!r�r$r�bs 
8z&fixupstate._moveworkingdirectoryparentcCs�|s$|��}t|�dkrdS|d}|��|��kr8dS|���d�rJdSt|����t|��sddSt�	|�D]V\}}||vs�||vr�dS||}||}|�
�|�
�kr�dS|��|krndSqndS)z�({path: content}, ctx, ctx) -> bool. test if a commit will be noop

        if it will become an empty commit (does not change anything, after the
        memworkingcopy overrides), return True. otherwise return False.
        r@FrscloseT)rBrAr`rar�r9r]�issubsetrr��flagsr6)rWrFrQrBrMrYrRZpfctxr!r!r$r�}s*zfixupstate._willbecomenoopcCsx|o||jjf}|��}|jr8|j�dd�r8|��|d<t�|��|�	�dd�|j
��D��}t|||||d�}|�
�S)z�(ctx, {path: content}, node) -> node. make a single commit

        the commit is a clone from ctx, with a (optionally) different p1, and
        different file contents replaced by memworkingcopy.
        rrs
absorb_sourcecSsi|]\}}||g�qSr!r!)riZoldnodeZnewnoder!r!r$r��s�z,fixupstate._commitsingle.<locals>.<dictcomp>)rard)r2r7ra�_useobsoleterlZ
configboolrrZupdate_hash_refsrbr��itemsrfr�)r1rWrFrIrBrardZmctxr!r!r$r��s��
�zfixupstate._commitsinglecCst�|jtj�S)z
() -> bool)r
�	isenabledr2Zcreatemarkersoptr5r!r!r$r�szfixupstate._useobsoletecCs2dd�t�|j�D�}|r.tj|j|ddd�dS)NcSs$i|]\}}||dur|gng�qSr r!)ri�k�vr!r!r$r��s�z1fixupstate._cleanupoldcommits.<locals>.<dictcomp>rT)Z	operationZfixphase)rr�r�rZcleanupnodesr2)r1Zreplacementsr!r!r$r��s
�
�zfixupstate._cleanupoldcommitscCst�|jd�S)Nr)rr�rlr5r!r!r$r��szfixupstate.skip_empty_successor)NN)NN)N)N)r(r)r*r+r3r�r��propertyrrr�r�r�r�r�r�r�r�r�r�rZ
propertycacherr�r�r!r!r!r$r��s*

*

+


r�cCs�t|�tjtjfvrdS|j��}|jt|j	�d}g|_	|_
t��}|�
|�t�|���}||j}dd�|dd�D�}||||ffS)zA(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline])))NNr@cSs"g|]}|�d�s|dd��qS)r�r@N)r�)rir�r!r!r$rk�r4z_parsechunk.<locals>.<listcomp>N)�typer	ZuihunkrZ
recordhunk�header�filenameZfromlinerA�beforeZafterrZstringior�rro�getvalueZremoved)ZhunkrMr��bufZ
patchlinesr�r�r!r!r$�_parsechunk�s


rcCs�i}tdd��}tt|�D] \}}|r|s,q||�|�qt�|�D]^\}}||vsF|s\qF|jdd�t�||�	��}|D]\}}	}
|
|||	�<q~d�
|�||<qFt||�S)z�(ctx, [crecord.uihunk]) -> memctx

    return a memctx with some [1] patches (chunks) applied to ctx.
    [1]: modifications are handled. renames, mode changes, etc. are ignored.
    cSsgSr r!r!r!r!r$r��r4z$overlaydiffcontext.<locals>.<lambda>T)rCr4)r�r�rr;rr��sortrror6r�rf)rFr�rWZpatchmaprM�infoZpatches�linesr�r�r�r!r!r$�overlaydiffcontext�srcCsj|durf|�dd�}|d}t|���dkr:t�td���t||�}|rft|�|krf|�td�|�|sxt�td���|dur�|d}|dur�d	}|dur�i}t|||d
�}t	�
|||�}	|�d��rt�
||d��|��|	�}
t�|
�}t�|||	�d
}t|d|�}d}
|�d��s*|�d��s6|�d|�}
|�||	|
�|
du�r�|
��|
�ddt|j��|
jdd�t|�D]n}||jv�r��q~|
��|
j|d�|
jdd�|
jdd|��dd�|����d
}|
jdd|dd��q~|
��|�d��sf|�d��s4|j�r4|jddd��r4t� td ���|�!�|�"��rP|�#�n|j$�sf|�td!��|S)"z�pick fixup chunks from targetctx, apply them to stack.

    if targetctx is None, the working copy context will be used.
    if stack is None, the current draft stack will be used.
    return fixupstate.
    Nrrr�r@scannot absorb into a merges7absorb: only the recent %d changesets will be analysed
sno mutable changeset to changer!r��interactiverHrs
print_changess
apply_changesscounts
%d changesets affected
ssummaryr�)rFs	changesetr�r�rr�s
descfirstliner�r�dry_runs#apply changes (y/N)? $$ &Yes $$ &Norsabsorb cancelled
snothing applied
)%Z	configintrArBr
r�rrG�warnr�rr�r�r�diffr8Z
parsepatchrZrecordfilterr�	formatterr�r�r�rvr6rJrrrb�
splitlines�endZpromptchoiceZ
CanceledErrorr�r�r�r.)rlr2rLr��patsrmrErDr�ZmatcherrZ
origchunksr�r~rFZ
descfirstliner!r!r$�absorb�s�
���

��
����

r�as
apply-changess0apply changes without prompting for confirmation�ps
print-changess;always print which changesets are modified by which changes�irs*interactively select which chunks to apply�es
edit-linessGedit what lines belong to which changesets before commit (EXPERIMENTAL)shg absorb [OPTION] [FILE]...)ZhelpcategoryZ	helpbasicc	Os�t�|�}|����|���j|ds0t�|�t||||d�}tdd�|j�	�D��dkrxWd�Wd�dSWd�n1s�0YWd�n1s�0YdS)a�incorporate corrections into the stack of draft changesets

    absorb analyzes each change in your working directory and attempts to
    amend the changed lines into the changesets in your stack that first
    introduced those lines.

    If absorb cannot find an unambiguous changeset to amend for a change,
    that change will be left in the working directory, untouched. They can be
    observed by :hg:`status` or :hg:`diff` afterwards. In other words,
    absorb does not write to the working directory.

    Changesets outside the revset `::. and not public() and not merge()` will
    not be changed.

    Changesets that become empty after applying the changes will be deleted.

    By default, absorb will show what it plans to do and prompt for
    confirmation.  If you are confident that the changes will be absorbed
    to the correct place, run :hg:`absorb -a` to apply the changes
    immediately.

    Returns 0 on success, 1 if all chunks were ignored and nothing amended.
    r)rrmcss|]}|dVqdS)rNr!r�r!r!r$r��r4zabsorbcmd.<locals>.<genexpr>rNr@)
rZbyteskwargsZwlock�lockrZcheckunfinishedrr�rrr�)rlr2rrmr�r!r!r$�	absorbcmdGs>

r)N)N)NNN)NNNN)5r+Z
__future__r�collectionsZmercurial.i18nrZmercurial.noderrZ	mercurialrrrr	r
rrr
rrrrrrrZmercurial.utilsrZ
testedwithZcmdtableZcommandZconfigtableZ
configitemZ
colortabler��objectrr/r?rGrTZ	filestorerUrfrgr�rrrZ
dryrunoptsZtemplateoptsZwalkoptsZCATEGORY_COMMITTINGrr!r!r!r$�<module>s�D

�


R
|6 
O��������� �&

Youez - 2016 - github.com/yon3zu
LinuXploit