Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/filemerge.pyc

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


��Qc@s�ddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZdd�Ze
d�Zgd�ZiZdd�Zd	�Zd
�Zd�Zd�Zed
e
�d��Zede
�d��Zede
�d��Zede
�d��Zd�Zedeed��d��Zede�d��Zd�Zd�Z ej!�Z"dS(i�(tshort(t_NtcCs|jd|d||�S(Nsmerge-toolst.(tconfig(tuittooltparttdefault((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_toolstr
scCs|jd|d||�S(Nsmerge-toolsR(t
configbool(RRRR((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_toolboolscCs|jd|d||�S(Nsmerge-toolsR(t
configlist(RRRR((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_toollistscs���fd�}|S(s;return a decorator for populating internal merge tool tablecsDd�}d||jj�|_|t|<�|_�|_|S(Ns	internal:s``%s``
(t__doc__tstript	internalsttrymerget	onfailure(tfunctfullname(tnameRR(s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	decorators

		((RRRR((RRRs7/sys/lib/python2.7/site-packages/mercurial/filemerge.pytinternaltoolscCs�|tkr|Sx|dD]t}t|||�}|s;qntj|t||d��}|rtj|t||d��}|r�|SqqWt||d|�}tjtj|��S(Ntregkeyt	regkeyalttregnamet	regappendt
executable(sregkeyR(RR	tutilt	lookupregtfindexet
expandpath(RRtkntktptexe((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_findtool#s
csW�fd�}�jdd�}|r\t�|�}|rO|tj|�fS||fSntjjd�}|r~||fSx{�jd�D]j\}	}
tj|j	d|	g�}||�r�||
|	|t
�r�t�|
�}|
tj|�fSq�Wi}x^�jd�D]M\}
}|
jd�d	}||krtt
�|d
d��||<qqW|j�}tg|j�D]\}}||f^q�}�jdd�}|r�|kr�||fS|jd	d|f�n|jd�xK|D]C\}}||d||�r��|�}|tj|�fSq�sO|rSdSdS(Ncs
|}|r|d|7}nt�|�sf|rL�jtd�|�q	�jtd�|�n�|r�t�|d�r��jtd�|�np|r�t�|d�r��jtd�|�n=tj�rt�|d�r�jtd�|�ntStS(	Ns specified for scouldn't find merge tool %s
tsymlinkstool %s can't handle symlinks
tbinarystool %s can't handle binary
tguistool %s requires a GUI
(	R%twarnRtnoteRRR(tTruetFalse(RtpatR&R'ttmsg(R(s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pytcheck3sRt
forcemergetHGMERGEsmerge-patternsRsmerge-toolsRitpriorityt0tmergethgmergesinternal:promptsinternal:merge(Nshgmerge(sinternal:promptN(sinternal:mergeN(RR%Rt
shellquotetostenvirontgettconfigitemstmatchtrootR,tsplittintR	tkeystsortedtitemstinserttNonetappend(trepoRtpathR'R&R/tforcettoolpathR5R-RtmfttoolsR"tvtttnamesR#tuimerge((Rs7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_picktool2sF

!&2

cCsDd|krdSd|kr dSd|kr0dSd|kr@dSdS(sGuess the EOL type of a filets
s
s
N(RC(tdata((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_eoltypetscCswttj|��}|rstj|�}t|�}|rs|j||�}||krptj||�qpqsndS(s/Convert EOL markers in a file to match origfileN(RRRtreadfiletreplacet	writefile(tfiletorigfilettostyleRQtstyletnewdata((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_matcheol�stpromptc	Cs�|j}|j�}|jtd�|td�td�fd�rbt|||||||�St|||||||�SdS(sXAsks the user which of the local or the other version to keep as
    the merged version.s8 no tool found to merge %s
keep (l)ocal or take (o)ther?s&Locals&OtheriN(RRFtpromptchoiceRt_iothert_ilocal(	REtmynodetorigtfcdtfcotfcattoolconfRtfd((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_iprompt�s	tlocalcCsdS(s6Uses the local version of files as the merged version.i((RER`RaRbRcRdRe((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyR_�stothercCs)|j|j�|j�|j��dS(s6Uses the other version of files as the merged version.i(twwriteRFRQtflags(RER`RaRbRcRdRe((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyR^�s%tfailcCsdS(s�
    Rather than attempting to merge files that were modified on both
    branches, it marks them as unresolved. The resolve command must be
    used to resolve these conflicts.i((RER`RaRbRcRdRe((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_ifail�scCsH|\}}}}|rdS|\}}}	}
|j}yt||d|�}Wn�tjk
r�t||d�j�}dj�}
||
kr�jg|
D]}d|d^q��}tjtd�|||f��q�X|rDt	j	||||	dt
�}|s"|jd�d	S|dkrDtj
|
|�qDndS(
Nitpremergetkeeps, t's6%s.premerge not valid ('%s' is neither boolean nor %s)tquiets premerge successful
i(RRterrortConfigErrorR	tlowerR=tjoinRtsimplemergeR+tdebugRtcopyfile(RERetfilesRRHR'R&tatbtctbackRRntvalidRKt_validtr((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	_premerge�s,	*
R4sFmerging %s incomplete! (edit conflicts, then use 'hg resolve --mark')
cCs�|\}}	}
}|rB|jjtd�|j��tdfSt|||�}|r�|\}
}}}|j}tj||
||dddg�}t|fStdfS(s�
    Uses the internal non-interactive simple merge algorithm for merging
    files. It will fail if there are any conflicts and leave markers in
    the partially merged file.s5warning: internal:merge cannot merge symlinks for %s
itlabelRhRii(RR)RRFR,R�RvR+(RER`RaRbRcRdReRyRRHR'R&R�RzR{R|R}R((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_imerge�s
	$
tdumpcCs�t|||�}|r�|\}	}
}}|j�}
tj|	|	d�|j|
d|j�|j��|j|
d|j�|j��nt|fS(su
    Creates three versions of the files to merge, containing the
    contents of local, other and base. These files can then be used to
    perform a merge manually. If the file to be merged is named
    ``a.txt``, these files will accordingly be named ``a.txt.local``,
    ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
    same directory as ``a.txt``.s.locals.others.base(R�RFRRxRjRQRkR,(RER`RaRbRcRdReRyR�RzR{R|R}Rf((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_idump�s	#&cCsvt|||�}|rl|\}	}
}}|\}
}}}d}td|j�dt|�dt|j��dt|j��dd|j�kdd|j�kd	d|j�k�}|j}t||	d
d�}d|kr�|}}
ntd
|
d|d|d|�}t	j
d||d��}t	j|
d|d|jd|d|j
�}t|fStdfS(NRtHG_FILEt
HG_MY_NODEt
HG_OTHER_NODEtHG_BASE_NODEtHG_MY_ISLINKtltHG_OTHER_ISLINKtHG_BASE_ISLINKtargss$local $base $others$outputRhtbaseRitoutputs\$cSstjtj|��S(N(RR6t	localpath(ts((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt<lambda>
st tcwdR8touti(R�tdictRFRtstrt	changectxRkRR	RtinterpolatetsystemR<tfoutR+R,(RER`RaRbRcRdReRyR�RRHR'R&RzR{R|R}R�tenvRR�RT((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt_xmerge�s.	!#
cs�fd�}|j|�s"dS�j}|j�}|j�pX|j�pX|j�}	d|j�|j�k}
t�|||	|
�\}}|jd|||	|
f�|tkr�t|}
|
j	}|
j
}nt}
t}t
d�}|||	|
f}|s)|
�||||||�S�j|�}|d|�}|d|�}|d}tj||�||j�kr�|jt
d�||j�|f�n|jt
d	�|�|jd
|||f�|
�||||||||||f�\}}|sc|r8|rE|j||�qEn
tj|�tj|�tj|�|S|r�t||d�s�dt||d
�kr�tjd|j�tj�r�d}q�nt}dt||d
�krt}|jt
d�|t
d�t
d�fd�rd}qn|r�|r�t||d�sWdt||d
�kr�tj||�r�|jt
d�|t
d�t
d�fd�r�d}q�q�nt||d�r�t||�n|r�r�j||�q�tj|�tj|�tj|�|S(sperform a 3-way merge in the working directory

    mynode = parent node before merge
    orig = original local filename before merge
    fco = other file context
    fca = ancestor file context
    fcd = local file context for current/destination file
    cs�dtjj|j��|f}tjd|�\}}�j|j�|j��}tj|d�}|j|�|j	�|S(Ns%s~%s.tprefixtwb(
R7RFtbasenamettempfiletmkstempt
wwritedataRQtfdopentwritetclose(R�tctxtpreRfRRQtf(RE(s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyttemps"

R�s/picked tool '%s' for %s (binary %s symlink %s)
smerging %s failed!
R�Ris.origsmerging %s and %s to %s
smerging %s
smy %s other %s ancestor %s
tcheckconflictst	conflictsR/s!^(<<<<<<< .*|=======|>>>>>>> .*)$iR\s"was merge of '%s' successful (yn)?s&Yess&Notcheckchangedtchangeds< output file %s appears unchanged
was merge successful (yn)?tfixeolN(tcmpRCRRFtisbinaryRkRORwRRRR�R+RtwjoinRRxtstatusR)R7tunlinkRR
tretsearchRQt	MULTILINER,R]tfilecmpR[(RER`RaRbRcRdR�RRfR'R&RRHRRRReRzR{R|R}t	needcheckR�tchecked((REs7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt	filemerges�
		$	
	
)


 


(#tnodeRti18nRRRvR;RrR7R�R�R�R	R,RR
RRCRR%RORRR[RgR_R^RmR�R+R�R�R�R�tvaluest
i18nfunctions(((s7/sys/lib/python2.7/site-packages/mercurial/filemerge.pyt<module>s.00		B						i

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.