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

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


�t�c@s�ddlZddlZddlmZddlmZddlmZmZd�Z	d�Z
defd��YZd	efd
��YZ
dS(i�N(t_(tutil(tSKIPREVtconverter_sourceccsZt|�}x<|dkrJ|| ||dfV|jdd|�}qWd|fVdS(Ni�it/it.(tlentrfind(tnamete((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pytrpairs
s
cCs|dkrdStj|�S(s We use posixpath.normpath to support cross-platform path format.
    However, it doesn't handle None input. So we wrap it up. N(tNonet	posixpathtnormpath(tpath((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyt	normalizest
filemappercBs>eZdZdd�Zd�Zd�Zd�Zd�ZRS(s�Map and filter filenames when importing.
    A name can be mapped to itself, a new name, or None (omit from new
    repository).cCsX||_i|_i|_i|_|rT|j|�rTtjtd���qTndS(Nserrors in filemap(tuitincludetexcludetrenametparseRtAbortR(tselfRR((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyt__init__ s				cs�d}��fd�}tjt|�|t���jd7_�j�}xw|r�|dkr�t�j��}|||�jd�7}|�j|<n|dkr��j��}|||�jd�7}|||�jd�7}|�j|<n�|dkrWt�j��}t�j��}|||�jd�7}|�j|<na|dkr�|�j	t�j���7}n3�j
jtd��j
�j|f�|d	7}�j�}qQW|S(
Nics�|s3�jjtd��j�j|f�dS||kro�jjtd��j�j||f�dS|jd�s�|jd�s�d|kr��jjtd��j�j||f�dSdS(Ns%s:%d: path to %s is missing
is%s:%d: %r already in %s list
Rs//s%s:%d: superfluous / in %s %r
i(RtwarnRtinfiletlinenot
startswithtendswith(Rtmappingtlistname(tlexR(s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pytcheck+ss!@#$%^&*()-=+[]{}|;:,./<>?RRRtsources%s:%d: unknown directive %r
i(tshlextopentTruet	wordcharst	get_tokenRRRRRRRRRR(RRterrsR!tcmdRtsrctdest((R Rs9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR)s6	"
cCs_t|�}xCt|�D]5\}}y||||fSWqtk
rMqXqWd|dfS(Nt(RR
tKeyError(RRRtpretsuf((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pytlookupVs
cCs�|jr%|j||j�d}n|}|jrP|j||j�d}nd}|jrf|s~t|�t|�kr�dS|j||j�\}}}|r�dkr�|S|r�|jd�r�||S|d|S|S|S(NiR,RR(RR0RRRRR(RRtinctexctnewpreR.R/((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyt__call___s$		(cCst|jp|jp|j�S(N(tboolRRR(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pytactiveusN(	t__name__t
__module__t__doc__RRRR0R4R6(((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRs		-			tfilemap_sourcecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cCs}tt|�j|�||_t||�|_i|_i|_i|_d|_	t
|_i|_i|_
i|_dS(N(tsuperR:RtbaseRtcommitst	parentmaptwantedancestorsRtconvertedordertFalset_rebuilttorigparentstchildrentseenchildren(RRt
baseconvertertfilemap((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR�s								cCs|jj�dS(N(R<tbefore(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRH�scCs|jj�dS(N(R<tafter(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRI�sc	Cs�||_itt6}t�}g}x�|jD]�}||}||k}|rl|||<||j|<n|||j|<||j|<||}|tkr�d}n|j|||f�q0W||_|j	j
|�S(N(RBRtsettorderR>R?RtappendR@R<t	setrevmap(	Rtrevmaptseentdummysett	convertedtrevtmappedtwantedtarg((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRM�s$

	



		cCs|jr
tSt|_|jj�|jj�|jj�xt|jD]i\}}}||jkr�|j|�j	|j|<n|dk	rG|jj|d�d|j|<qGqGWx`|jD]U\}}}|j|}|r�j
||�n|j||�|j||�q�WtS(Nii(RBR%R>tclearR?RER@RCt	getcommittparentsRRDtgettmark_wantedtmark_not_wantedt_discard(RRRRTRURX((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pytrebuild�s$		


'
cCs
|jj�S(N(R<tgetheads(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR^�scCsU|jj|�}|j|<x1|jD]&}|jj|d�d|j|<q'W|S(Nii(R<RWR=RXRDRY(RRRtctp((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRW�s$cCs*||jkr|j|S|jj|�S(N(R=R<RW(RRR((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyt
_cachedcommit�scGs�x�|D]�}|dkrqn|jj|d�d|j|<|j||j|kr|j|=|j|=|j|=|jr�|j|=q�qqWdS(Nii(RRERYRDR?R>RB(Rtrevstr((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR\�s
 


	cCsjy|jj||�}Wn&tk
rAtjtd���nXx!|D]}|j|�rItSqIWtS(Ns+source repository doesn't support --filemap(	R<tgetchangedfilestNotImplementedErrorRRRRR%RA(RRRtitfilestf((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRT�s

cCs_|dkr3t|j|<ttf�|j|<dS|j||j|<|j||j|<dS(N(RRR>RJR?(RRRR`((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR[s
cCsY||j|<t�}x"|D]}|j|j|�qW|j|�||j|<dS(N(R>RJtupdateR?tadd(RRRRXtwrevR`((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRZs
	

c	s��j|j}t|�dkr/�j�ng}t�}�j|j}t}x�t|�D]�\}��j���t	ksa�|kr�qant
j���fd�|D��}|r|rt|�dkr�j��j|krt
}qn|j��||f�|j��qaW|rWg|D]}	|	ds8|	^q8}nd}
|r�td�|D��}
g|D]}	|	d^q�}n|r�d}
n|�j|<t}d�j|jkrg|D]}	�j|	�j^q�}||krt
}qnt|�dkr�|r��j||
�r�d}	|rS||
}	n�j||	��jj|t|	f��j|��j|S|�j|_�j||��jj|t
df��j|��jj|�\}
}i}xT|
D]L\}}�j|�}|r�|ks8||kr�|f||<q�Wt|j��}i}xL|D]D}�j|�}|rn�j||�}|r�|||<q�qnqnW||fS(Nic3sG|]=}�|kr��j|kr��j|kr|VqdS(N(R>R?(t.0tp2(tmp1tp1R(s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pys	<genexpr><sicss|]}|dVqdS(iN((RlR`((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pys	<genexpr>Ksitclosei(R=RXRR]RJtbranchRAt	enumerateR>RRtanyRaR%RLRjRtmaxRCtextraRTR[R@R\RZR<t
getchangesRtsortedtitems(RRRRXtmparentstknownparentsRqthasbranchparentRft
isancestorR`twptclosedt	pbranchestchangestcopiesRgRhRctnewftncopiesR_tnewct	newsource((RnRoRs9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyRv st
	
% & 	
%,



cCs|\}}|jj||�S(N(R<tgetfile(RRRRtrealnametrealrev((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR��scCs
|jj�S(N(R<tgettags(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR��scCs
|jj�S(N(R<thasnativeorder(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR��scCs|jj|�S(N(R<t	lookuprev(RRR((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR��scCs
|jj�S(N(R<tgetbookmarks(R((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR��s(R7R8RRHRIRMR]R^RWRaR\RTR[RZRvR�R�R�R�R�(((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyR:�s$													b				(RR#tmercurial.i18nRt	mercurialRtcommonRRR
RtobjectRR:(((s9/sys/lib/python2.7/site-packages/hgext/convert/filemap.pyt<module>s		k

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.