Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/merge.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c@s�ddklZlZlZlZddklZddkZddkZddk	Z	ddk
Z
ddkZddkZddk
Z
defd��YZd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�ZdS(i�(tnullidtnullrevthextbin(t_Nt
mergestatecBskeZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
RS(s+track 3-way merge state of individual filescCs||_|i�dS(N(t_repot_read(tselftrepo((s"/sys/lib/python/mercurial/merge.pyt__init__s	cCs=h|_|o
||_nti|iid�t�dS(Ntmerge(t_statet_localtshutiltrmtreeRtjointTrue(Rtnode((s"/sys/lib/python/mercurial/merge.pytresets	
c
Cs�h|_y�d}|iid�}x]t|�D]O\}}|djo|d }q1|d id�}|d|i|d<q1Wt|�|_Wn/tj
o#}|i	t	i
jo�q�nXdS(Nsmerge/stateii�ti(RtNoneRtopenert	enumeratetsplitRR
tIOErrorterrnotENOENT(Rt	localnodetftitltbitsterr((s"/sys/lib/python/mercurial/merge.pyRs	

cCst|iidd�}|it|i�d�x>|ii�D]-\}}|idi|g|�d�q?WdS(Nsmerge/statetws
R(RRtwriteRR
Rt	iteritemsR(RRtdtv((s"/sys/lib/python/mercurial/merge.pyt_write&s
cCs�ti|i��i�}|iid|d�i|i��d||i�|i�t|i	��|i�|g|i
|<|i�dS(Nsmerge/R"tu(tutiltsha1tpatht	hexdigestRRR#tdataRtfilenodeRR'(Rtfcltfcotfcatfdtflagsthash((s"/sys/lib/python/mercurial/merge.pytadd+s
&(cCs
||ijS(N(R(Rtdfile((s"/sys/lib/python/mercurial/merge.pyt__contains__1scCs|i|dS(Ni(R(RR6((s"/sys/lib/python/mercurial/merge.pyt__getitem__3sccs3|ii�}|i�x|D]}|Vq WdS(N(Rtkeystsort(RRR((s"/sys/lib/python/mercurial/merge.pyt__iter__5s

cCs||i|d<|i�dS(Ni(RR'(RR6tstate((s"/sys/lib/python/mercurial/merge.pytmark:scCs�||djodSn|i|\}}}}}}	}
|iid|�}|ii||i�|
�||}||	}
|ii|d|�}ti|i|i|||
|�}|p|i|d�n|S(Ntrismerge/tfileid(	RRRtwwritetreadtfilectxt	filemergeR
R=(RR6twctxtoctxR<R4tlfiletafiletanodetofileR3RtfcdR0R1R>((s"/sys/lib/python/mercurial/merge.pytresolve=s"

$N(t__name__t
__module__t__doc__R
RRRR'R5R7R8R;R=RK(((s"/sys/lib/python/mercurial/merge.pyR
s								cCscx\|i�D]N}||jo;||i||i��otitd�|��q
q
WdS(s<check for collisions between unknown files and files in mctxsQuntracked file in working directory differs from file in requested revision: '%s'N(tunknowntcmpR-R)tAbortR(RDtmctxR((s"/sys/lib/python/mercurial/merge.pyt
_checkunknownKs

+cCseh}xX|D]P}|i�}||jo'titd�|||f��n|||<q
WdS(s<check for case folding collisions in the destination contexts(case-folding collision between %s and %sN(tlowerR)RQR(RRtfoldedtfntfold((s"/sys/lib/python/mercurial/merge.pyt_checkcollisionRs
cCs�g}|odpd}x8|i�D]*}||jo|i||f�q'q'W|p?x<|i�D]*}||jo|i|df�qiqiWn|S(s�
    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.
    R>R(tdeletedtappendtremoved(RDRRtbranchmergetactionR<R((s"/sys/lib/python/mercurial/merge.pyt_forgetremoved\s



cs�����fd�}��fd�}gh�}|o
|}n�||jo|i�}n�|o��iiddt�om�iiddt�}	ti�||||	�\}}
x1|
i�D]\}}|dd||�q�Wn�iitd���iitd	�|t	|�f��iitd
�|||f�|i
�|i
�|i
����t|i��}
xV�i�D]H\}}|o||�oq�n|�jo�||||�}�i
|t�}|�|jp�||jo1�i|�|jo|dd||�q�q�||jo|d
d||�q�|dd||||t�q�||
joq�||joq||}|�jo*|d|d|d(|�i|��q�|d|d|||||||�t�q�|�jo�|�|jo]�iitd�|td�td�fd�o|dd|�q�|dd|�q�|ddjo|dd|�q�|ddjo|d d|�q�q�q�Wx��i�D]�\}}|o||�oq�|�jp
||
joq�||jo�||}|�jo*|d!|dd(||�i|��q�|�jo0|d"|d|||||||�t�q�|d#|d|||||||�t�q�|�jo |d$d|�i|��q�|�|jo_�iitd%�|td�td&�fd�djo |d'd|�i|��q�q�q��S()s�
    Merge p1 and p2 with ancestor ma and generate merge action list

    overwrite = whether we clobber working files
    partial = function to filter file lists
    cs�i|��i|��i|�}}}||jo|Sn|o~|ow|oo�iitd�|td�td�td�fd�}|djodSn|djod	Snd
Sn|o||jo|Sn|o||jo|Snd
S(smerge flagss6 conflicting flags for %s
(n)one, e(x)ec or sym(l)ink?s&NonesE&xecsSym&linkiitxiRt(R3tuitpromptchoiceR(Rtf2tfatatmtnR>(tmaR	tm1tm2(s"/sys/lib/python/mercurial/merge.pytfmerge�s /
		'cs8�iid|||f��i||f|�dS(Ns %s: %s -> %s
(RatdebugRZ(tmsgRfRtargs(R	R](s"/sys/lib/python/mercurial/merge.pytact�sRtfollowcopiest
followdirssdivergent renamestdrsresolving manifests
s overwrite %s partial %s
s  ancestor %s local %s remote %s
supdate permissionstesremote is newertgsversions differRfsremote renamed directory to R%slocal copied/moved to sI local changed %s which remote deleted
use (c)hanged version or (d)elete?s&Changeds&Deleteis
prompt deleteR>sprompt keepReisremote deletedRR(s
other deletedslocal renamed directory to sremote copied to sremote moved to sremote createdsOremote changed %s which local deleted
use (c)hanged version or leave (d)eleted?s&Deletedsprompt recreatingN(tp1Rat
configboolRtcopiesR$tnoteRRltbooltmanifesttsettvaluestgetRR3tFalseRRb(R	Rutp2tpat	overwritetpartialRkRotcopytdirstdivergetoftfltcopiedRRgtrflagsReRc((RiRjR	RhR]s"/sys/lib/python/mercurial/merge.pyt
manifestmergexs�


 !
&#&

"
 





#
		






#
#
 		%(cCs"|ddjodpd|fS(NiR>i�i((Re((s"/sys/lib/python/mercurial/merge.pyt	actionkey�scCs9d\}}}}t|�}|i|i�di��g}	|idt�|i}
x�D]�|d \}}
|
djo�|d\}}}}|djoqan|iit	d�||f�||}||}|i
|�p|i|dt�}|i
|||||�||jo|o|	i|�qIqaqaWx[|	D]S}ti|i|��o4|iit	d�|�ti|i|��qTqTWti|i�}xi|D]a}|d \}}
|o|dd	joq�n|
d
jo�|iit	d�|�||�|djoti||||�nyti|i|��WnOtj
oC}|itijo'|iit	d�||if�q�nX|d7}q�|
djo8|djo&ti||||i
|��q�n|d\}}}}|i|||�}|dj	o|djo|d7}n&|djo|d7}n|d7}ti |i|�d
|jd|j�||joT|oMti|i|��o4|iit	d�|�ti|i|��q%q�|
djo�|d}|iit	d�|�|i|�i!�}|i"|||�|d7}|djoti||||�q%q�|
djo�|d\}}}|ob|iit	d�||f�|i|�i!�}|i"|||�ti|i|��n|oL|iit	d�||f�|i|�i!�}|i"|||�n|d7}q�|
djoM|d}|iit	d�|�xi|D]}|iid|�q�Wq�|
djo6|d}ti |i|�d
|jd|j�q�q�W||||fS(s4apply the merge action list to the working directoryitkeyiRfs.hgsubstates preserving %s for resolve of %s
R?sremoving %s
t/R>s update failed to remove %s: %s!
iRR_Rtsgetting %s
R%smoving %s to %s
sgetting %s to %s
Rrs.warning: detected divergent renames of %s to:
s %s
Rs(iiiiN(#RRtparentsRR:R�tsubstateRaRlRtancestorRBRR5RZR)tlexiststwjointostunlinktpath_auditortrootRxtsubrepotsubmergetOSErrorRRtwarntstrerrorRKRt	set_flagsR-R@(R	R]RDRRtupdatedtmergedR[t
unresolvedtmstmovesR�ReRRfRcR2R3tmoveR/R0R1t
audit_pathtinstR>ttR�tnf((s"/sys/lib/python/mercurial/merge.pytapplyupdates�s�	

 

%






(-




  



0c
Cs�x�|D]�}|d \}}|djo/|o|ii|�q�|ii|�q|djo|p|ii|�q�q|djo|ii|�q|djo|ii|�q|djo/|o|ii|�q�|ii|�q|djo�|d\}}}}	|ow|ii|�||joV|	o|ii|�n||jo|ii||�q�|ii||�q�q�|ii|�|	o|ii|�q�q|djo�|d\}}}|o||ijoqn|o`|ii|�|o'|ii|�|ii||�n|o|ii||�q�q�|ii|�|o|ii|�q�qqWd	S(
s$record merge actions to the dirstateiR>ReRRsRtRfR%N(	tdirstatetremovetforgetR5tnormallookuptnormaldirtytnormalRR�(
R	R]R\ReRRfRcR2tflagR�((s"/sys/lib/python/mercurial/merge.pyt
recordupdatesOsZ








cCs7|i�}z|d}|djoyy|i�|i�}Wq�tj
oL|i�djo|id�}q�titd�|i���q�Xn|o|}|i	�}|d||}	}
|	i
|
�}|	i�|
i�t|	�t|
�f\}}
}}t
}|o,t|�djotitd���n|o�||
jotitd���nJ||	jo<|	i�|
i�jo
t}q�titd���n|o3|i�p
|i�otitd	���q�n�|p�||	jp
||
joq�|	i�|
i�joL|i�p
|i�otitd
���ntitd���q�|i�p
|i�otitd���q�t}ng}|pt||
�nti|i�pt|
�n|t||
|�7}|t|||
|||�7}|p"|
t|d
f\}}
}}n|p#|iddtd|d|�nt||||
�}|ptt|||�|ii||
�|o"|o|ii|
i��n|idd|d|d|d�n|SWd|i�XdS(s
    Perform a merge between the working directory and the given node

    branchmerge = whether to merge between branches
    force = whether to force branch merging or file overwriting
    partial = a function to filter file lists (dirstate not updated)
    tdefaultttipsbranch %s not foundiisoutstanding uncommitted mergesscan't merge with ancestors6nothing to merge (use 'hg update' or check 'hg heads')sAoutstanding uncommitted changes (use 'hg status' to list changes)sFcrosses branches (use 'hg merge' or 'hg update -C' to discard changes)s3crosses branches (use 'hg merge' or 'hg update -C')s>crosses named branches (use 'hg update -C' to discard changes)R`t	preupdatetthrowtparent1tparent2tupdateterroriN( twlockRt
branchtagstbranchtKeyErrortlookupR)RQRR�R�RtstrR~tlenRtfilesRYRSt	checkcaseR+RXR^R�RthookR�R�R�t
setparentst	setbranchtrelease(R	RR\tforceR�R�twcR�tplRuRR�tfp1tfp2txp1txp2tfastforwardR]tstats((s"/sys/lib/python/mercurial/merge.pyR��sr	

(6


"
"#'(RRRRRti18nRR)RCRwR�RR�RtobjectRRSRXR^R�R�R�R�R�(((s"/sys/lib/python/mercurial/merge.pys<module>s"0$>		
		s		a	=

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.