https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/hgext/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/hgext/__pycache__/absorb.cpython-310.pyc
o

�]Lbܣ�
@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!�./usr/lib/python3/dist-packages/hgext/absorb.py�nullfunc_�z$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__hs
zemptyfilecontext.__init__cC�dS)N�r!�r2r!r!r$�datakr&zemptyfilecontext.datacCs|jjSr )r1�nullidr7r!r!r$�nodenszemptyfilecontext.nodeN)r)r*r+r,r4r8r:r!r!r!r$r0es
r0cCs4t�}g}|D]}||vr|�|�|�|�q|S)z@list -> list. remove duplicated items without changing the order)�set�add�append)�lst�seen�result�xr!r!r$�uniqrs

�rBcCsj|}g}|��tjkr/|rt|�|krn|��}t|�dkrn|�|�|d}|��tjks|��|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)�phaser�public�len�parentsr=�reverse)�headctx�limit�ctxr@rGr!r!r$�
getdraftstack}s	
�rLc	Cs�|durt�}|sJ�||dvrgifSg}i}|d��}t|�D]1}||vr-|}n(||}|�|�||vr>d}n|||<|��}|rT|}||vrT|��}nq#|durn||vre|�||�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)	r;�p1�reversedr=�
copysourcer0r3rHrB)	�stack�path�	seenfctxs�fctxs�fctxmap�pctxrK�fctx�copyr!r!r$�getfilestack�s>%
�rYc@s eZdZdZdd�Zdd�ZdS)�overlaystorezsread-only, hybrid store based on a dict and ctx.
    memworkingcopy: {path: content}, overrides file contents.
    cCs||_||_dSr )�basectx�memworkingcopy)r2r[r\r!r!r$r4�s
zoverlaystore.__init__cCsX||jvrdS|j|}||jvr|j|}n|��}|��|��f}|��}|||fS)z-comply with mercurial.patch.filestore.getfile�NNN)r[r\r8�islink�isexecrP)r2rRrW�content�moderXr!r!r$�getfile�s



zoverlaystore.getfileN)r)r*r+r,r4rbr!r!r!r$rZ�srZc	Cs�|dur|��j�|���}|dur|��}|dur|��}|��}|��}t|�	���
|�}t||�}tj
|��||||||d|d�	S)zi({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx
    memworkingcopy overrides file contents.
    N)	r3rG�text�files�	filectxfn�user�date�branch�extra)r3�	changelogrGr:ri�descriptionrgrfr;rd�unionrZr�memctx)	r\rKrGri�descrgrfrd�storer!r!r$�overlaycontext�s*
�rpc@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�||_||_|p
t�|_|pi|_dd�|D�|_t�tj	|j�|_
|��|_|jj
r4|��|jks4J�ddg|_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!)r8��.0�fr!r!r$�
<listcomp>;�z+filefixupstate.__init__.<locals>.<listcomp>rN)rTrRr�ui�opts�contentsr�maplistr�
splitnewlines�contentlines�
_buildlinelogrr-�_checkoutlinelog�
chunkstats�targetlines�fixups�
finalcontentsr;�ctxaffected)r2rTrRrwrxr!r!r$r4/s


zfilefixupstate.__init__cCs�|jd}|jd}|��}t�|�}||_|j�|jj�|jj	}t
|�t
|�ks,J�|rA|dd|dddf}|�|�|�||||�D]0}	|�
|	|�}
|jdt|
�7<|jdd7<|j|
7_|dury|�||||	|
�qIdS)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.
        rMrrCN)ryr|r8rr{r�r�annotate�maxrev�annotateresultrFr=�_alldiffchunks�_analysediffchunkr�boolr��_showchanges)r2�
targetfctx�fm�a�alines�b�blines�	annotated�dummyendline�chunk�	newfixupsr!r!r$�diffwithHs(



��zfilefixupstate.diffwithc	Cs�t|j�D]<\}}}}}|j||�}|jjr7t|dd�d}|j�td�t|j	|�
��||t|�f�|j�
|||||�q|j�dd�rP|��|_dS|��|_dS)z�apply self.fixups. update self.linelog, self.finalcontents.

        call this only once, before getfinalcontent(), after diffwith().
        rCr�s%s: chunk %d:%d -> %d lines
�
edit_linesFN)rOr�r�rwr-�max�writerrrTr:rFr�replacelinesrx�get�_checkoutlinelogwitheditsr�r~)r2�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)rT�indexr�)r2rWr�r!r!r$�getfinalcontent�s
zfilefixupstate.getfinalcontentcs4|\}}}}�||�}|s"�r"|td|d�h}�fdd�|D�}tdd�|D��}	g}
t|	�dkrS|�||dd�rS|	d}|dkrR|d}|
�|||||f�nB||||ks_||kr�t�||�D]/}
�|
\}}|dkr�||krzd}}n
||
|}|d}|d}|
�||
|
d||f�qe|�|
�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.
        rrCcs$g|]}�|ddkr�|�qS�rrCr!)rs�i�r�r!r$ru�sz4filefixupstate._analysediffchunk.<locals>.<listcomp>cSsh|]\}}|�qSr!r!)rs�r�lr!r!r$�	<setcomp>�rvz3filefixupstate._analysediffchunk.<locals>.<setcomp>T)r��listrF�
_iscontinuousr=r�xrange�_optimizefixups)r2r�r�r�r�r�r��involved�nearbylinenums�involvedrevsr�r��fixuprevr��linenum�nb1�nb2r!r�r$r��s6
��
�
z filefixupstate._analysediffchunkccs6�tj||||d�}|D]\}}|dkrq|VqdS)z5like mdiff.allblocks, but only care about differences)�lines1�lines2�!N)r�	allblocks)r�r�r�r��blocksr��btyper!r!r$r��s��zfilefixupstate._alldiffchunksc
	Cs�t��}dg}}t�t|j��D]6}|j||j|}}|dd}|�||||�}tt|��D]\}	}
}}|�	||	|
||�q2||}}q|S)z~calculate the initial linelog based on self.content{,line}s.
        this is similar to running a partial "annotate".
        r6r�rC)
rrr�rFryr|r�rOr�r�)
r2�llogr�r�r�r�r��llrev�chunksr�r�r�r�r!r!r$r}�s
zfilefixupstate._buildlinelogcCsVg}t�t|j��D]}|dd}|j�|�d�t|j|jj	��}|�
|�q
|S)z1() -> [str]. check out file contents from linelogrCr�r6)rr�rFryrr��join�map�_getliner�r=)r2ryr�r�r`r!r!r$r~�szfilefixupstate._checkoutlinelogc

s"|j��}td�|jd��}dd�t|j�D�}t|�D](\}\}}|td�d|dt|�|dt|���|�	��
d	d�d
f7}q|td�dt|�7}tdd
���|D]\}}|j�|dd�|jj
D]	����|�qmq[|D]�|dd���fdd�|D��|���f7}qz|jj|ddd�}|s�t�td���dgt|j�}d}	|	t|�d}
t�|�D]H���d�r�q��|
d|
d�dkr�t�td�����|
dd�}tt��|	|
d���D]\}}|dk�r|||d
|7<q�q�||k�rddg|_|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:
rMcSs"g|]
\}}t|t�s||f�qSr!)�
isinstancer0)rsr�rtr!r!r$ru�s��z<filefixupstate._checkoutlinelogwithedits.<locals>.<listcomp>sHG: %s/%s %s %s
�|�-rC�
rsHG: %s
cSst�Sr )r;r!r!r!r$�<lambda>�sz:filefixupstate._checkoutlinelogwithedits.<locals>.<lambda>r�s    %s : %sr6cs$g|]\}}|��vrdnd�qS)�y� r!)rsr��_f�r��linesetr!r$ru����r)�actionsempty editor text�sHG:s : smalformed line: %sNr�)r�getalllinesrrTrR�	enumeraterFrr:rk�split�defaultdictr�r�r<r�r�rw�editr
�
InputErrorrr{�
startswithr�bytestrr)
r2�alllines�
editortext�visiblefctxsr��jrt�
editedtextry�
leftpadpos�colonpos�linecontent�chr!r�r$r��sn
����

����
�

�
��

z(filefixupstate._checkoutlinelogwitheditscCs,|\}}|d@r|j|d|S|j|S)z@((rev, linenum)) -> str. convert rev+line number to line contentrCr�)r|r�)r2�lineinfor�r�r!r!r$r�s
zfilefixupstate._getlineFcCsR||krdS|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)r�	getoffset�intr�rF)r2r�r��closedintervalr��offset1�offset2�linesinbetweenr!r!r$r�&s	
zfilefixupstate._iscontinuousc
s�g�gd�g���fdd�}t|�D]J\}}|\}}}}}	�dd}
�dd}�dd}||krS||krS||
krS|�t|dd�|�rS|�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.
        )rMrMrMrMrMcs*�dddkr��t�d��dSdS)NrrM)r=�tupler!��
pcurrentchunkr@r!r$�	pushchunk>s�z1filefixupstate._optimizefixups.<locals>.pushchunkrr�r�rC)r�r�r�r�)
r2r�r�r�r�r�r�r�r�r��lastrev�lasta2�lastb2r!r�r$r�7s&
�zfilefixupstate._optimizefixupsc	sRdd�}|\}}}	}
dg||dg|
|	}}|D]3\}
}}}}t�||�D]}t|
d�dd|||<q(t�||�D]}t|
d�dd|||	<q>q����jddd||||	|
|	fd	d
��j�jdd���fdd
�}t�||�D]}||||d|||�dd�q{t�|	|
�D]}||||	d|||�dd�q�dS)NcSs|�d�r|dd�}|S)Nr�rM)�endswith)�liner!r!r$�trimWs
z)filefixupstate._showchanges.<locals>.trimrrCr�shunks        %s
s@@ -%d,%d +%d,%d @@s	diff.hunk��label�rR�linetypecs|���d}|r�j|}�j|d�|��}�j�|����jdd|dd��jd|d|||d��j�j	|d	�dS)
Nr6)rW�node�%-7.7s rr�s	diffchar s%s%s
r�)
�	startitemrTrrr�r<�	changectxr�r8rR)r��diffcharr�r��	linelabelr:rK�r�r2r!r$�	writelineos 
�z.filefixupstate._showchanges.<locals>.writeliner�sdeletedsdiff.deleted�+sinserteds
diff.inserted)rr�r�r�r�r8rR)r2r�r�r�r�r�r�r�r�r�r��aidxs�bidxsr��fa1�fa2�fb1�fb2r�r�r!r�r$r�VsF��

�

��zfilefixupstate._showchanges�NNr )F)r)r*r+r,r4r�r�r�r��staticmethodr�r}r~r�r�r�r�r�r!r!r!r$rqs 

#3

D
rqc@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
    NcCsf|sJ�|pt�|_|p
i|_||_|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.
        rMN)rrwrxrQr3�
unfiltered�paths�statusrU�fixupmap�
replacemap�	finalnoder;r�)r2rQrwrxr!r!r$r4�s
zfixupstate.__init__cCsV|jd�||�|_g|_|j�d�}|jjs |r |r |��}n|jj}t�}t|�D]}}|j	�
d|�||}t|j||�\}	}
tdd�|g|	D��rOq+|�
�|	d�
�kr\|s\q+|�|	dd��|
|j|<t|	||j	|jd�}|dur�|��|�d	�|jd
d|dd
�|j
d
d�|�||�||j|<|j�|�|j�|j�q+dS)z9diff and prepare fixups. update self.fixupmap, self.pathsrMr�scalculating fixups for %s
css0�|]}t|t�s|��pt�|���VqdSr )r�r0r^r�binaryr8rrr!r!r$�	<genexpr>�s��
�z&fixupstate.diffwith.<locals>.<genexpr>rCN�rwrxsshowing changes for spath�%s
rr��r�)rQr
r	rxr��modifiedrdr;�sortedrw�debugrY�anyr8�updaterUrqr��plainr�r�rr=r�)r2�	targetctx�matchr��editopt�interestingpathsrSrRr�rT�ctx2fctx�fstater!r!r$r��s<
�


�zfixupstate.diffwithcCs>t�|j�D]\}}|jjr|j�td�|�|��qdS)z*apply fixups to individual filefixupstatessapplying fixups to %s
N)r�	iteritemsrrwr-r�rr�)r2rR�stater!r!r$r��s

�zfixupstate.applycCsdd�t�|j�D�S)z>-> {path: chunkstats}. collect chunkstats from filefixupstatescSsi|]\}}||j�qSr!)r)rsrRr r!r!r$�
<dictcomp>����z)fixupstate.chunkstats.<locals>.<dictcomp>)rrrr7r!r!r$r�s
�zfixupstate.chunkstatscCsl|j�d��%}|��|�|�|jd��|jvr|��|��Wd�|jS1s.wY|jS)z6commit changes. update self.finalnode, self.replacemapr�.N)	r3�transaction�_commitstack�_movebookmarksr:r�_moveworkingdirectoryparent�_cleanupoldcommitsr
)r2�trr!r!r$�commit�s


��zfixupstate.commitcs�|j}|j}|jr)t�|�D]\}}|dr&|�td�||d|df�qdS|jsH|����fdd�dD�\}}|�td�||f�dSdS)	z+print things like '1 of 2 chunk(s) applied'rs%s: %d of %d chunk(s) applied
rCc3s&�|]�t�fdd��D��VqdS)c3s�|]}|�VqdSr r!�rs�s�r�r!r$r��z7fixupstate.printchunkstats.<locals>.<genexpr>.<genexpr>N)�sum)rs��statsr-r$rs�$z-fixupstate.printchunkstats.<locals>.<genexpr>r�s%d of %d chunk(s) applied
N)	rwrr.rrr�rr/�values)r2rwrrR�stat�applied�totalr!r0r$�printchunkstats�s"�����zfixupstate.printchunkstatscCsd}d}|jD]y}|�|�}|s|s|}q|��o|�|||�}|jr1|r1d|j|��<td�}n:|j|||d�}|j	|}|}|��|j|��<|rb|rRtd�}ntd�}|t
|�|�|�f}n	td�|�|�}|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)rNs&%d file(s) changed, became empty as %ss%d file(s) changed, became %ss	became %ss%s: %s
)rQ�_getnewfilecontentsrd�_willbecomenoop�skip_empty_successorrr:r�
_commitsingler3rF�_ctx2strrwr.r�r
)r2�
lastcommitted�nextp1rKr\�willbecomenoop�msg�nodestrr!r!r$r%
s<

�



��zfixupstate._commitstackcCs4|jjrd|��|��fSd|��t|���fS)Ns%d:%s)rwr-r�rrr:)r2rKr!r!r$r;5szfixupstate._ctx2strcCs\i}|jD]&}|j|}||vrq||}|��}|j|�|�}||kr+|||��<q|S)z�(ctx) -> {path: str}

        fetch file contents from filefixupstates.
        return the working copy overrides - files different from ctx.
        )r	rUr8rr�rR)r2rKr@rRrrWr`�
newcontentr!r!r$r7;s

�zfixupstate._getnewfilecontentscs��j}�fdd�t�|j�D�}g}|D]5\}}|r4|�||f��jjr3�j�td�|t	|�f�q|�|df��jjrI�j�td�|�q|j�
|||�dS)Ncs(g|]\}}|�jvr|�j|f�qSr!)r)rsr'�hshr7r!r$ruOs

�z-fixupstate._movebookmarks.<locals>.<listcomp>smoving bookmark %s to %s
sdeleting bookmark %s
)r3rr�
_bookmarksr=rwr.r�rr�applychanges)r2r)r3�
needupdate�changesr'rBr!r7r$r&Ms$

����zfixupstate._movebookmarkscs�|js|j�d|j���}|j|��}|��|_n|j|j}|jj�dd�}|}t�	�d�r?�j
j���fdd�}|�j
_z,������
|��|��|j�Wd�n1s[wYW|�dSW|�dS|�w)Nsmax(::. - %ln)cSr5)Nrr!r!r!r!r$r�n�z8fixupstate._moveworkingdirectoryparent.<locals>.<lambda>�_fsmonitorstatecs��j_dSr )rH�
invalidater!��bak�dirstater!r$�restoressz7fixupstate._moveworkingdirectoryparent.<locals>.restore)r
r3�revsr�keys�firstr:rLr�safehasattrrHrI�parentchange�rebuild�manifestr	)r2rNrK�nooprMr!rJr$r'bs&
�
�z&fixupstate._moveworkingdirectoryparentcCs�|s|��}t|�dkrdS|d}|��|��krdS|���d�r%dSt|����t|��s2dSt�	|�D]+\}}||vsC||vrFdS||}||}|�
�|�
�krYdS|��|krbdSq7dS)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.
        rCFrscloseT)rGrFrhrir�r;rd�issubsetrr�flagsr8)r\rKrVrGrRr`rW�pfctxr!r!r$r8}s,�zfixupstate._willbecomenoopcCsx|o||jjf}|��}|jr|j�dd�r|��|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!)rs�oldnode�newnoder!r!r$r!�r"z,fixupstate._commitsingle.<locals>.<dictcomp>)rirn)r3r9ri�_useobsoleterw�
configboolrr�update_hash_refsrkr�itemsrpr*)r2r\rKrNrGrirn�mctxr!r!r$r:�s��
�zfixupstate._commitsinglecCst�|jtj�S)z
() -> bool)r
�	isenabledr3�createmarkersoptr7r!r!r$r[�szfixupstate._useobsoletecCs6dd�t�|j�D�}|rtj|j|ddd�dSdS)NcSs$i|]\}}||dur|gng�qSr r!)rs�k�vr!r!r$r!�r�z1fixupstate._cleanupoldcommits.<locals>.<dictcomp>rT)�	operation�fixphase)rrrr�cleanupnodesr3)r2�replacementsr!r!r$r(�s
�

��zfixupstate._cleanupoldcommitscCst�|jd�S)Nr)rr9rwr7r!r!r$r9�szfixupstate.skip_empty_successorrr )r)r*r+r,r4r�r��propertyrr*r6r%r;r7r&r'rr8r:r�
propertycacher[r(r9r!r!r!r$r�s,

*

+


rcCs�t|�tjtjfvrdS|j��}|jt|j	�d}g|_	|_
t��}|�
|�t�|���}||j}dd�|dd�D�}||||ffS)zA(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))rrCcSs"g|]
}|�d�s|dd��qS)r�rCN)r�)rsr�r!r!r$ru�s"z_parsechunk.<locals>.<listcomp>N)�typer	�uihunkr�
recordhunk�header�filename�fromlinerF�before�afterr�stringior�rr{�getvalue�removed)�hunkrRr��buf�
patchlinesr�r�r!r!r$�_parsechunk�s


rxcCs�i}tdd��}tt|�D]\}}|r|sq
||�|�q
t�|�D]/\}}||vs-|s.q#|jdd�t�||�	��}|D]\}}	}
|
|||	�<q?d�
|�||<q#t||�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��rGz$overlaydiffcontext.<locals>.<lambda>T)rHr6)r�r�rxr=rr�sortrr{r8r�rp)rKr�r\�patchmaprR�info�patches�linesr�r�r�r!r!r$�overlaydiffcontext�s
r~cCs^|dur3|�dd�}|d}t|���dkrt�td���t||�}|r3t|�|kr3|�td�|�|s<t�td���|durD|d}|durJd	}|durPi}t|||d
�}t	�
|||�}	|�d�r�t�
||d��|��|	�}
t�|
�}t�|||	�d
}t|d|�}d}
|�d�s�|�d�s�|�d|�}
|�||	|
�|
dur�|
��|
�ddt|j��|
jdd�t|�D]4}||jvr�q�|
��|
j|d�|
jdd�|
jdd|��dd�|����d
}|
jdd|dd�q�|
��|�d��s-|�d��s|j�r|jddd��rt� td ���|�!�|�"��r"|�#�|S|j$�s-|�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#rCscannot absorb into a merges7absorb: only the recent %d changesets will be analysed
sno mutable changeset to changer!r�interactiverMrs
print_changess
apply_changesscounts
%d changesets affected
ssummaryr)rKs	changesetr�r�rr�s
descfirstlinerr�dry_runs#apply changes (y/N)? $$ &Yes $$ &Norsabsorb cancelled
snothing applied
)%�	configintrFrGr
r�rrL�warnrrrr�r�diffr:�
parsepatchr�recordfilterr~�	formatterr�r�r�r�r8rOrrrk�
splitlines�end�promptchoice�
CanceledErrorr�r*r6r/)rwr3rQr�patsrxrJrIr �matcherr��
origchunksr�r�rK�
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]...)�helpcategory�	helpbasicc	Os�t�|�}|���S|���6|dst�|�t||||d�}tdd�|j�	�D��dkr=	Wd�Wd�dSWd�n1sGwYWd�dSWd�dS1s_wYdS)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�)r�rxcss�|]}|dVqdS)rNr!r+r!r!r$r�r.zabsorbcmd.<locals>.<genexpr>rNrC)
r�byteskwargs�wlock�lockr�checkunfinishedr�r/rr2)rwr3r�rxr r!r!r$�	absorbcmdGs
>
�P�r�r r])NNNN)5r,�
__future__r�collections�mercurial.i18nr�mercurial.noderr�	mercurialrrrr	r
rrr
rrrrrrr�mercurial.utilsr�
testedwith�cmdtable�command�configtable�
configitem�
colortabler��objectrr0rBrLrY�	filestorerZrprqrrxr~r��
dryrunopts�templateopts�walkopts�CATEGORY_COMMITTINGr�r!r!r!r$�<module>s�D

�

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

https://t.me/RX1948 - 2025