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

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


�t�c@s�ddlZddlmZejjdddg�ddlmZddlmZddlm	Z	m
Z
mZy0dd	lm
Z
mZmZdd
lmZWnek
r�nXdZd
efd��YZdS(i�N(tdemandimportsbzrlib.transactionssbzrlib.urlutilstElementPath(t_(tutil(tNoRepotcommittconverter_source(tbzrdirtrevisionterrors(tRevisionSpectfiletsymlinkt
bzr_sourcecBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(s>Reads Bazaar repositories by using the Bazaar Python librariescCs�tt|�j||d|�tjjtjj|d��sYttd�|��nyt	Wn#t
k
r�ttd���nXtjj|�}|j|�yt	j
j|�j�|_Wn*tjk
r�ttd�|��nXi|_dS(Ntrevs.bzrs)%s does not look like a Bazaar repositorys"Bazaar modules could not be loaded(tsuperR
t__init__tostpathtexiststjoinRRRt	NameErrortabspatht_checkrepotypetBzrDirtopentopen_repositoryt
sourcerepoR	tNoRepositoryPresentt
_parentids(tselftuiRR((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyR$s !


cCs�y�ddlm}|jj|�d}y|jdt�}|j}Wn/tjtj	fk
ryd}|j�}nX|dk	r�|jjj
|jjj
kr�|jjtd��nWn'tk
r�|jjtd��nXdS(Ni�(Ritrecommend_upgradesawarning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
s(bzr source type could not be determined
(tbzrlibRRtopen_containingtopen_workingtreetFalsetbranchR	t
NoWorkingTreetNotLocalUrltNonetopen_branchtroot_transporttbaseRtwarnRt	Exceptiontnote(RRRtdirttreeR%((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyR:s

cCs|jj�dS(sBefore the conversion begins, acquire a read lock
        for all the operations that might need it. Fortunately
        read locks don't block other reads or writes to the
        repository, so this shouldn't have any impact on the usage of
        the source repository.

        The alternative would be locking on every operation that
        needs locks (there are currently two: getting the file and
        getting the parent map) and releasing immediately after,
        but this approach can take even 40% longer.N(Rt	lock_read(R((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytbeforeNscCs|jj�dS(N(Rtunlock(R((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytafter[scCs|jjdt�S(Ntusing(Rt
find_branchestTrue(R((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyt_bzrbranches^scCs�|js7tg|j�D]}|j�^q�}n�d}xY|j�D]K}y%tj|j�}|j|�}Wntj	k
r�nX|j
}qJW|dkr�tjt
d�|j��n|g}g|D]}|dkr�|^q�}|S(Ns%s is not a valid revisionsnull:(RtsortedR8t
last_revisionR(R
tfrom_stringt
in_historyR	tBzrErrortrev_idRtAbortR(RtbtheadstrevidR%trtinfoth((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytgetheadsas	.
	%c	Cs|jj|�}|j|j|jp*d��}d}|dk	rW|j|�}n|tkr�tt	d�||f��n|j
||f}|dkr�j|�}|dkr�tj
t	d�||f��n||fS|j|�}|j�|fSdS(Nsutf-8s!%s is not available in %s anymoreRs%s.%s symlink has no target(Rt
revision_treetpath2idtdecodetencodingR(tkindtsupportedkindstIOErrorRt
_modecachetget_symlink_targetRR?tget_filetread(	RtnameRtrevtreetfileidRKtmodettargettsio((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytgetfileus"!
cCsYi|_|jj|�|_|jj|�}|jj|d�}|j|j|�S(Ni(RNRRGt_revtreeRtpopt_gettreechanges(Rtversiont	parentidstprevtree((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyt
getchanges�s
	c
Cs�|jj|�}|js7g}tjf|j|<n|j|j�}||j|<|j|jj	dd��}|dkr�d}nt
d|dd|j|jfd|j|j
�d	|j|j�d
|d|�S(Nsbranch-nickudefaultttrunktdefaulttparentstdates%d %dtauthortdescR%R(Rtget_revisiont
parent_idsRt
NULL_REVISIONRt
_filterghoststrecodet
propertiestgetRt	timestampttimezonet	committertmessage(RR\RRbR%((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyt	getcommit�s	
	cCspi}xc|j�D]U}|j�s)iS|jj�}x-|j�D]\}}|||j|�<qEWqW|S(N(R8t
supports_tagsttagstget_tag_dictt	iteritemsRj(RtbytetagsR%ttagdictRRR((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytgettags�scCs�i|_|jj|�}|dk	r;|j||}n	tj}|jj|�}g|j||�dD]}|d^qm}|S(Ni(RNRRGR(RRRhR[(RRtitcurtreetparentidR^tetchanges((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pytgetchangedfiles�s		-cCsX|j}g}i}t�}t|j|�dd�dt�}x	|D]\}}	}
}}}
}}|	ddksI|	ddkr�qIn|ddkr%|ddkr�|j|j|	d�|f�n|ddkrId|	krI|	d|	dk}|jj	|	d�}x|jj
|�D]�}
}|jdkrJq)n|j|	dd|
�}||krwq)n|j|�|s�q)n|j|	dd|
�}|j||f�|j||f�|j
r�	p�jd
kr�p�}||j||f<|||<q)WqIqIn|	\}}|dk	rO|j|�}n|dk	rm|j|�}n|j|p||�|dkr�|j||f�qIn|r�||kr�|||<|j||f�ng||fD]}|d^q�}}|rd	p!|d
krd
p!d}||j||f<|j||f�qIW||fS(NtkeycSs|ddp|ddS(Nii((tc((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyt<lambda>�streverseiuit	directoryt/txRtsttl(Ns	directory(t_revision_idtsetR9titer_changesR7R(tappendRjt	inventoryRHtiter_entriesRKtaddt
executableRN(RtcurrenttoriginRBR}trenamestseent
curchangesRTtpathstchanged_contentt	versionedtparentRRRKR�trenamingtsubdirtentrytfrompathttopathRURR|((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyR[�sj				" #

)cCsA|jj|�}tg|D]}||kr|^q�}|S(sqFilters out ghost revisions which hg does not support, see
        <http://bazaar-vcs.org/GhostRevision>
        (Rtget_parent_mapttuple(Rtidst	parentmapR�Rb((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyRis+N(t__name__t
__module__t__doc__R(RRR2R4R8RFRXR_RqRxR~R[Ri(((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyR
!s		
					
		
	
	X(sfilessymlink(Rt	mercurialRtignoretextendtmercurial.i18nRRtcommonRRRR!RRR	tbzrlib.revisionspecR
tImportErrorRLR
(((s5/sys/lib/python2.7/site-packages/hgext/convert/bzr.pyt<module>s	



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].