�
�� @sZddklZddkZddkZddkZddkZddkZeiZd�Z d�Z
d�Ze�\ZZ
d�Ze�Zdi�Zd�Zd Zd
Zd
eddZd
�Zd�ZdZdefd��YZdefd��YZdefd��YZdeifd��YZdefd��YZd�Z dS(i�(t_NcCs@|id�p|Sn|idd�idd�idd�S(s�
>>> encodedir('data/foo.i')
'data/foo.i'
>>> encodedir('data/foo.i/bla.i')
'data/foo.i.hg/bla.i'
>>> encodedir('data/foo.i.hg/bla.i')
'data/foo.i.hg.hg/bla.i'
sdata/s.hg/s.hg.hg/s.i/s.i.hg/s.d/s.d.hg/(t
startswithtreplace(tpath((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt encodedirs cCsN|id�p
d|jo|Sn|idd�idd�idd�S(s�
>>> decodedir('data/foo.i')
'data/foo.i'
>>> decodedir('data/foo.i.hg/bla.i')
'data/foo.i/bla.i'
>>> decodedir('data/foo.i.hg.hg/bla.i')
'data/foo.i.hg/bla.i'
sdata/s.hg/s.d.hg/s.d/s.i.hg/s.i/s.hg.hg/(RR(R((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt decodedir s csWd}g}dD]}|t|�q~}tg}td�D]}|t|�t|�fqA~��x9td�tdd�|D]}d|�t|�<q�WxTttd�td �d
�t|�gD]&}|t|�i��t|�<q�Wh�x$�i�D]\}}|�|<qW�fd���fd��fd
�fS(s�
>>> enc, dec = _buildencodefun()
>>> enc('nothing/special.txt')
'nothing/special.txt'
>>> dec('nothing/special.txt')
'nothing/special.txt'
>>> enc('HELLO')
'_h_e_l_l_o'
>>> dec('_h_e_l_l_o')
'HELLO'
>>> enc('hello:world?')
'hello~3aworld~3f'
>>> dec('hello~3aworld~3f')
'hello:world?'
>>> enc('thequick�hot')
'the~07quick~adshot'
>>> dec('the~07quick~adshot')
'the\x07quick\xadshot'
Rs\:*?"<>|ii i~is~%02xtAtZic 3s~d}xq|t|�jo]xVtdd�D]?}y#�||||!V||7}PWq,tj
oq,Xq,Wt�q WdS(Niii(tlentxrangetKeyError(tstitl(tdmap(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pytdecodeRs
cs2dig}t|�D]}|�|q~�S(t(tjoinR(Rt_[1]tc(tcmap(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt<lambda>^scstdit�|����S(R(RRtlist(R(R(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR_s(tordtdictR tchrtrangetlowert iteritems(teRtxtwinreservedt_[2]tktv((RRRs>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt_buildencodefun0s '?-$
cs�g}dD]}|t|�q~}tg}td�D]}|t|�t|�fq;~��x9td�tdd�|D]}d|�t|�<q�WxCttd�td�d �D]"}t|�i��t|�<q�W�fd
�S(s�
>>> f = _buildlowerencodefun()
>>> f('nothing/special.txt')
'nothing/special.txt'
>>> f('HELLO')
'hello'
>>> f('hello:world?')
'hello~3aworld~3f'
>>> f('thequick�hot')
'the~07quick~adshot'
s\:*?"<>|ii i~is~%02xRRics,dig}|D]}|�|q~�S(R(R(RRR(R(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRus(RRR RRR(RRRR ((Rs>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt_buildlowerencodefuncs'? sqcon prn aux nul
com1 com2 com3 com4 com5 com6 com7 com8 com9
lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9c Csg}x�id�D]�}|o�|id�d}|o>|tjo1dt|d�}|dd!||d}n|ddjo |d dt|d�}n|o1|ddjo dt|d�|d }q�n|i|�qWdi|�S(
s�
Encodes filenames containing names reserved by Windows or which end in
period or space. Does not touch other single reserved characters c.
Specifically, c in '\:*?"<>|' or ord(c) <= 31 are *not* encoded here.
Additionally encodes space or period at the beginning, if dotencode is
True.
path is assumed to be all lowercase.
>>> _auxencode('.foo/aux.txt/txt.aux/con/prn/nul/foo.', True)
'~2efoo/au~78.txt/txt.aux/co~6e/pr~6e/nu~6c/foo~2e'
>>> _auxencode('.com1com2/lpt9.lpt4.lpt1/conprn/foo.', False)
'.com1com2/lp~749.lpt4.lpt1/conprn/foo~2e'
>>> _auxencode('foo. ', True)
'foo.~20'
>>> _auxencode(' .foo', True)
'~20.foo'
t/t.is~%02xiii�s. i(tsplitt_winreservednamesRtappendR(Rt dotencodetrestntbasetec((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt
_auxencode|s $ixiiicCs�|id�p|Snt|�}|td�}d|t|��}t|�tjo`t|�i�}|t|��}ti i
|�\}}|id�}|d} g}
x{|d D]o}|t }|ddjo|d d}ndi
|
�d|}
t|
�tjoPn|
i|�q�Wdi
|
�}t|�djo|d7}nd|||}tt|�}|djo$| | }d||||}q�n|S(sdencodes path with a length limit
Encodes all paths that begin with 'data/', according to the following.
Default encoding (reversible):
Encodes all uppercase letters 'X' as '_x'. All reserved or illegal
characters are encoded as '~xx', where xx is the two digit hex code
of the character (see encodefilename).
Relevant path components consisting of Windows reserved filenames are
masked by encoding the third character ('aux' -> 'au~78', see auxencode).
Hashed encoding (not reversible):
If the default-encoded path is longer than _maxstorepathlen, a
non-reversible hybrid hashing of the path is done instead.
This encoding uses up to _dirprefixlen characters of all directory
levels of the lowerencoded path, but not more levels than can fit into
_maxshortdirslen.
Then follows the filler followed by the sha digest of the full path.
The filler is the beginning of the basename of the lowerencoded path
(the basename is everything after the last path separator). The filler
is as long as possible, filling in characters from the basename until
the encoded path has _maxstorepathlen characters (or all chars of the
basename have been taken).
The extension (e.g. '.i' or '.d') is preserved.
The string 'data/' at the beginning is replaced with 'dh/', if the hashed
encoding was used.
sdata/R%i�s. Risdh/(RRRtencodefilenamet_maxstorepathlent_shat hexdigesttlowerencodetosRtsplitextR't
_dirprefixlenRt_maxshortdirslenR)(Rt auxencodetndpathR+tdigesttaept_roottexttpartstbasenametsdirstptdtttdirst spacelefttfiller((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt
_hybridencode�s<
cCsYy9ti|�i}dti@d|@jo
d}nWntj
o
d}nX|S(Ni�(R5tstattst_modetutiltumasktNonetOSError(Rtmode((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt _calcmode�ssEdata 00manifest.d 00manifest.i 00changelog.d 00changelog.i phaserootst
basicstorecBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(s&base class for local repository storescCsL||_t|�|_||i�}|i|_ti|t�|_dS(N(RRPt
createmodetscmutiltfilteropenerRtopener(tselfRt
openertypetop((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt__init__�s
cCs|idt|�S(NR%(RR(RVtf((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�sc
Cs6|i}|o|d|7}nt|i�d}g}tii|�o�|g}x�|o�|i�}x�ti|dt�D]�\}} }
|d|}| ti joG|ddjo6t
i||�}|it
|�||
if�q�| tijo|o|i|�q�q�WqZWnt|�S(s!yields (unencoded, encoded, size)R%iRIi�s.ds.i(s.ds.i(RRR5tisdirtpoptosutiltlistdirtTrueRItS_IFREGRKtpconvertR)Rtst_sizetS_IFDIRtsorted(
RVtrelpathtrecurseRtstriplenR
tvisitRBRZtkindtsttfpR,((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt_walk�s$
!#cCs|idt�S(Ntdata(RlR_(RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt datafiles
sccsHx|i�D]}|Vq
Wx%t|idt��D]}|Vq5WdS(s!yields (unencoded, encoded, size)RN(RntreversedRltFalse(RVR((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pytwalks
cCsdgti�S(Ntrequires(t_dataR'(RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pytcopylistscCsdS(N((RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pytwrites(
t__name__t
__module__t__doc__RYRRlRnRqRtRu(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRQ�s tencodedstorecBs,eZd�Zd�Zd�Zd�ZRS(cCsS|d|_t|i�|_||i�}|i|_ti|t�|_dS(Ns/store(RRPRRRSRTR0RU(RVRRWRX((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRY s
ccsdx]|idt�D]I\}}}yt|�}Wntj
o
d}nX|||fVqWdS(NRm(RlR_tdecodefilenameR
RM(RVtatbtsize((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRn'scCs|idt|�S(NR%(RR0(RVRZ((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR/scCs3ddgg}ti�D]}|d|q~S(NRrs
00changelog.isstore/(RsR'(RVRRZ((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRt2s (RvRwRYRnRRt(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRys tfncachecBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(cCs||_d|_t|_dS(N(RURMtentriesRpt_dirty(RVRU((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRY9s cCs�t|_y|iddd�}Wn#tj
ot�|_dSnXttt|i�i ���|_d|ijoe|i
d�xUt|�D]C\}}|id�p't
d�|d }ti|��q�q�Wn|i�dS(
s&fill the entries from the fncache fileR~ROtrbNRis
s!invalid entry in fncache, line %si(RpR�RUtIOErrortsetRtmapRtreadt
splitlinestseekt enumeratetrstripRRKtAborttclose(RVRkR,tlineRD((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt_load>s $
cCs`|idddd|�}|o'|iditt|��d�n|i�t|_dS(NR~ROtwbt
atomictemps
(RURuRR�RR�RpR�(RVtfilesR�Rk((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt_writePs
'
cCs#|i|t�t|�|_dS(N(R�RpR�R(RVR�((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pytrewriteWscCs%|io|i|it�ndS(N(R�R�RR_(RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRu[s
cCsO|idjo|i�n||ijot|_|ii|�ndS(N(RRMR�R_R�tadd(RVtfn((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�_s
cCs+|idjo|i�n||ijS(N(RRMR�(RVR�((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt__contains__fscCs+|idjo|i�nt|i�S(N(RRMR�titer(RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt__iter__ks(
RvRwRYR�R�R�RuR�R�R�(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR~6s t_fncacheopenercBseZd�Zdd�ZRS(cCs||_||_||_dS(N(RUR~tencode(RVRXtfncR�((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRYqs trcOsP|djo$|id�o|ii|�n|i|i|�|||�S(NR�R�sdata/(R�srb(RR~R�RUR�(RVRROtargstkw((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyt__call__vs(RvRwRYR�(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�ps tfncachestorecBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsq||_|d|_t|i�|_||i�}|i|_t|�}||_t|||�|_dS(Ns/store(R�RRPRRR~R�RU(RVRRWR�RXR�((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRY|s
cCs|id|i|�S(NR%(RR�(RVRZ((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�sccs�t}g}|i}xu|iD]j}|i|�}y9ti|d|�}|||ifV|i|�Wqtj
o
t }qXqW|o|ii
|�ndS(NR%(RpRR~R�R5RIRbR)RNR_R�(RVR�texistingtspathRZtefRj((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRn�s
cCs9d}ddgg}|i�D]}|d|q ~S(NsPdata dh fncache phaseroots 00manifest.d 00manifest.i 00changelog.d 00changelog.iRrs
00changelog.isstore/(R'(RVRCRRZ((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRt�s cCs|ii�dS(N(R~Ru(RV((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyRu�s(RvRwRYRRnRtRu(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�{s
csjd�joPd�jo2�fd���fd�}t|||�Snt||�Snt||�S(NtstoreR~cst|d�j�S(R*(R/(RZ(trequirements(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�scs
t|��S((RH(RZ(R9(s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR�s(R�RyRQ(R�RRWR�((R�R9s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pyR��s
(!ti18nRR]RSRKR5RItsha1R2RRR#R0RzR$R4R'R(R/R1R7R8RHRPRstobjectRQRyR~tabstractopenerR�R�R�(((s>/sys/lib/python/lib/python2.5/site-packages/mercurial/store.pys<module>s.$ 1 " ? 2:)
|