�ܬQc@sddlZddlmZddlmZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddlZddl
Z
ejZejZdZdefd��YZdefd��YZd efd
��YZdS(i�N(tnullid(t_i�t repocachecBseZdZd�ZRS(sfilecache for files in .hg/cCs|jj|�S(N(t_openertjoin(tselftobjtfname((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRs(t__name__t
__module__t__doc__R(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRst rootcachecBseZdZd�ZRS(s*filecache for files in the repository rootcCs
|j|�S(N(t_join(RRR((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRs(RR R
R(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRstdirstatecBs$eZd�Zed��Zed��Zed��Zed�d��Zed��Z ed��Z
d�Zed �d
��Z
ed��Zed��Zed
��Zed��Zd�Zd�Zd�Zd3d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d&�Z+d'�Z,d(�Z-d)�Z.d*�Z/e0d3d+�Z1e0e0d,�Z2d-�Z3d3d.�Z4d/�Z5d0�Z6d1�Z7d2�Z8RS(4cCsd||_||_||_tjj|d�|_t|_t|_ d|_
||_i|_dS(s�Create a new dirstate object.
opener is an open()-like callable that can be used to open the
dirstate file; root is the root of the directory tracked by
the dirstate.
tiN(
Rt _validatet_roottostpathRt_rootdirtFalset_dirtyt_dirtyplt_lastnormaltimet_uit
_filecache(Rtopenertuitroottvalidate((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt__init__s cCs|j�|jS(sYReturn the dirstate contents as a map from filename to
(state, mode, size, time).(t_readt_map(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR /s
cCs|j�|jS(N(Rt_copymap(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR!6s
cCs�i}xC|jj�D]2\}}|ddkr||tj|�<qqWx$|jD]}||tj|�<qVWd|d<|S(Nitrt.(R t iteritemstutiltnormcaset_dirs(Rtftnamets((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_foldmap;s
tbranchcCsSy |jjd�j�pdSWn,tk
rN}|jtjkrJ�ndSXdS(NR,tdefault(RtreadtstriptIOErrorterrnotENOENT(Rtinst((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_branchFs cCs�y�|jd�}|jd�}|j�t|�}|dkrX|d |dd!fS|dkr�|dkr�tjtd���nWn+tk
r�}|jtj kr��q�nXt
t
gS(NR
i(iis(working directory state appears damaged!(RR.tclosetlenR%tAbortRR0R1R2R(Rtfptsttlterr((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_plOs
cCstj|jd�S(NR"(tscmutiltdirsR (R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR'_scCs|jS(N(R'(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR>css .hgignorecCs�|jd�g}xT|jjd�D]@\}}|dksL|jd�r%|jtj|��q%q%Wtj|j||jj �S(Ns .hgignoreRtignoresignore.(
RRtconfigitemst
startswithtappendR%t
expandpathR?Rtwarn(RtfilesR)R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_ignorefs
cCs"|jjdd�o!tjdkS(NRtslasht/(Rt
configboolRtsep(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_slashnscCstj|j�S(N(R%t checklinkR(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
_checklinkrscCstj|j�S(N(R%t checkexecR(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
_checkexecvscCstj|jd��S(Ns.hg(R%t checkcaseR(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
_checkcasezscCs|j|S(N(R(RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR~scst�jr%�jr%�fd�}|S|���jrM��fd�}|S�jrl��fd�}|S�SdS(NcsZyBtj�j|��}tj|�r.dStj|�rAdSWntk
rUnXdS(NR:txR(RtlstatRR%t
statislinkt
statisexectOSError(RRR9(R(s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR(�s
cs9tjj�j|��rdSd�|�kr5dSdS(NR:RRR(RRtislinkR(RR(tfallbackR(s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR(�s
cs6d�|�krdStj�j|��r2dSdS(NR:RRR(R%tisexecR(RR(RXR(s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR(�s
(RMRO(Rt
buildfallbackR(((RXRs6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytflagfunc�s
cCsltj�}||jkrdS|j}tj|�sG|tj7}n|j|�rd|t|�S|SdS(NR(RtgetcwdRR%tendswithsepRJRAR6(Rtcwdtrootsep((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR\�s cCsM|dkr|j�}ntj|j||�}|jrItj|�S|S(N(tNoneR\R%tpathtoRRKtpconvert(RR(R^R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRa�s
cCs|jj|d�dS(s�Return the current state of key (a filename) in the dirstate.
States are:
n normal
m needs merging
r marked for removal
a marked for addition
? not tracked
t?i(Rc(R tget(Rtkey((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt__getitem__�s
cCs
||jkS(N(R (RRe((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt__contains__�sccs#xt|j�D]}|VqWdS(N(tsortedR (RRR((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt__iter__�scCs
|jj�S(N(R R$(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR$�scCs#g|jD]}|j|�^q
S(N(R<R(Rtp((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytparents�scCs|j|jd�S(Ni(RR<(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytp1�scCs|j|jd�S(Ni(RR<(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytp2�scCstj|j�S(N(tencodingttolocalR4(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR,�scCs�t|_|_|jd}||f|_i}|tkr�|tkr�xc|jj�D]O\}}|ddkrZ||jkr�|j|||<n|j|�qZqZWn|S(s�Set dirstate parents to p1 and p2.
When moving from two parents to one, 'm' merged entries a
adjusted to normal and previous copy records discarded and
returned by the call.
See localrepo.setparents()
iitm( tTrueRRR<RR R$R!tnormallookup(RRlRmtoldp2tcopiesR(R*((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
setparents�s
cCs�tj|�|_|jdddt�}yB|j|jd�|j�|jd}|rk|j�nWn|j ��nXdS(NR,twt
atomictemps
R4(
Rnt fromlocalR4RRqtwriteR5Rtrefreshtdiscard(RR,R(tce((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt setbranch�s
cCs�i|_i|_y|jjd�}Wn,tk
rV}|jtjkrR�ndSX|sadStj�}tj �zt
j|j|j|�}Wd|r�tj�nX|j
s�||_ndS(NR
(R R!RR.R0R1R2tgct isenabledtdisabletparserstparse_dirstatetenableRR<(RR9R;t gcenabledRj((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRs$
cCsFx-d D]%}||jkrt||�qqWd|_t|_dS(
NR R!R+R4R<R'RFi(s_maps_copymaps_foldmaps_branchs_pls_dirss_ignore(t__dict__tdelattrRRR(Rta((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
invalidate#s
cCsU||krdSt|_|dk r5||j|<n||jkrQ|j|=ndS(s=Mark dest as a copy of source. Unmark dest if source is None.N(RqRR`R!(Rtsourcetdest((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytcopy+s cCs|jj|d�S(N(R!RdR`(Rtfile((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytcopied5scCs|jS(N(R!(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRt8scCs6||dkr2d|jkr2|jj|�ndS(Ns?rR'(R�R'tdelpath(RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt _droppath;scCs||}|dks"|dkr�tj|�||jkrZtjtd�|��nxntj|�D]Z}||jkr�Pn||jkrj||dkrjtjtd�||f��qjqjWn|dkr�|jkr�jj |�nt
|_||||f|j|<dS(NR�R"s directory %r already in dirstates#file %r in dirstate clashes with %rs?rR'(R=t
checkfilenameR'R%R7RtfinddirsR R�taddpathRqR(RR(tstatetmodetsizetmtimetoldstatetd((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt_addpath?s
# cCs�tj|j|��}t|j�}|j|d|j|jt@|t@�||j krj|j |=n||j
kr�||_
ndS(sMark a file normal and clean.tnN(RRSRtinttst_mtimeR�tst_modetst_sizet
_rangemaskR!R(RR(R*R�((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytnormalQs
c
Cs.|jdtkr�|jkr�j|}|ddkr�|dd
kr�|jj|�}|ddkr�|j|�n |ddkr�|j|�n|r�|j||�ndS|ddks�dd kr�ddkr�Sn|j|d ddd�||jkr*|j|=ndS(s'Mark a file normal, but possibly dirty.iiR"ii�i�NRpR�(i�i�( R<RR R!RdtmergetotherparentR�R�(RR(tentryR�((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRr_s "
0cCsh|jdtkr/tjtd�|��n|j|dddd�||jkrd|j|=ndS(s3Mark as coming from the other parent, always dirty.is1setting %r to other parent only allowed in mergesR�ii�i�N(R<RR%R7RR�R!(RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR�us
cCs9|j|dddd�||jkr5|j|=ndS(sMark a file added.R�ii�N(R�R!(RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytadd~scCs�t|_|j|�d}|jdtkr�||jkr�|j|}|ddkrdd}q�|ddkr�|ddkr�d}q�ndd|df|j|<|dkr�||jkr�|j|=nd S(
sMark a file removed.iiRpi�R�ii�R"N(RqRR�R<RR R!(RR(R�R�((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytremove�s
"
cCs�|jdtkr |j|�Stj|j|��}|j|d|j|jt @t
|j�t @�||jkr�|j|=ndS(sMark a file merged.iRpN(
R<RRrRRSRR�R�R�R�R�R�R!(RR(R*((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR��s
cCs6||jkr2t|_|j|�|j|=ndS(sDrop a file from the dirstateN(R RqRR�(RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytdrop�s
c
Cshtj|�}|jj|d�}|dkrd|r?|}qd|dkrrtjjtjj|j |��}n|s�|r�d|kr�|j
dd�\}}|j|||d�}|d|}qa|}qdd|kr?|j
dd�\}}|j|||t�}|j d|} |dtj
|| �}ntj
||j �}||j|<n|S(NRHi(R%R&R+RdR`RRtlexistsRRtrsplitt
_normalizeRqtfspath(
RRtisknownt
ignoremissingtexiststnormedtfoldedR�R(R"((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR��s* ' cCs |jr|j|||�S|S(sL
normalize the case of a pathname when on a casefolding filesystem
isknown specifies whether the filename came from walking the
disk, to avoid extra filesystem access.
If ignoremissing is True, missing path are returned
unchanged. Otherwise, we try harder to normalize possibly
existing path components.
The normalized case is determined based on the following precedence:
- version of name already stored in the dirstate
- version of name stored on disk
- version provided via command arguments
(RQR�(RRR�R�((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt normalize�s cCsVi|_d|jkr(t|d�ni|_ttg|_d|_t|_dS(NR'i( R R�R�R!RR<RRqR(R((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytclear�s cCs�|p |}|j}|j�x`|D]X}||krL|||j|<q&d|j|�krqd|j|<q&d|j|<q&W|tf|_t|_dS( NRRR�i�i�ii�(R�i�i�i(R�i�i�i(R R�tflagsRR<RqR(RtparenttallfilestchangedfilestoldmapR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytrebuild�s
csr�js
dS�jdddt����fd�}tj��j}|tj�j�j �j
|��dS(NR
RvRwcs4�j|��j�d�_t�_�_dS(Ni(RyR5RRRR(R*(RR9(s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytfinish�s
(RRRqR%tfstatR�R�t
pack_dirstateR R!R<(RR�tnow((RR9s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyRy�s cCsT|dkrtS|j|�r#tSx*tj|�D]}|j|�r3tSq3WtS(NR#(RRFRqR=R�(RR(Rj((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt
_dirignoresc-
s[�fd�}d�}�j}�j}|rEtj}tj}n|s`tj}tj}n|j} |j�}
|j}�j}tj}
t j
}tj}t
j}t
j}t
j}t
j}�j}g}|j}t}}| |jkr t}tj}n"|j�r+|j�r+t}n|rM�jrM�j}t}nd}t|j��}|j�d\}}x�|t|�kr|t|�kr||d}|||kr�|d7}q~nx0|t|�kr||j|�r||=q�W|d7}q~W|s$d|kr0dg}nt j!|�}d|d<x�|D]�}|rw||
|�tt�} n|
|�} | |kr�qPny�||| ��}!||!j"�}"|"|kr
t}| |kr�|| <n|j#| �|| �s^|| �q^nQ|"|ks%|"|kr2|!|| <n,||||"��| |kr^d|| <nWqPt$k
r�}#| |kr�d|| <q�| d}$xH|D],}%|%j|$�r�|j#| �t}Pq�q�W|||#j%�qPXqPWx|r�j&�}&d}'|&dkrd}&nd}'y"|||&�d td
|'�}(WnGt$k
r�}#|#j't'j(t'j)fkr~||&|#j%�q��nXxo|(D]g\})}"}!|r�||&r�|&d|)p�|)tt�} n|&r�|&d|)p�)} | |kr�|"|krP|| �s"|j#| �|| �n| |kr�s@| | �r�|| <q�|"|ksh|"|kr�| |kr�|
s�| | �r�|!|| <q�q�s�| | �r�| �r�|| <q�| |kr�s� | �r�|| <q�q�Wq�x|D]
}*||*=qW|d=|rW|rW|rD|
rD|j*�}+n1g|D]$})|)|krK| |)�rK|)^qK}+|+j�|rt+j,�j-�},x�t.|+�D]Z} |,j/| �r�||| ��|| <Wq�$k
r�d|| <q��d|| <q�WqWt.|+�j0} x@tj1g|+D]}||�^q$�D]}!|!|| �<q=Wn|S(
s�
Walk recursively through the directory tree, finding all files
matched by match.
Return a dict mapping filename to stat-like object (either
mercurial.osutil.stat instance or return value of os.stat()).
cs'�jjd�j|�|f�tS(Ns%s: %s
(RRDRaR(R(tmsg(R(s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytfwarns#cSs�td�}tj|�r*td�}nxtj|�rHtd�}nZtj|�rftd�}n<tj|�r�td�}ntj|�r�td�}ntd�|S(Ntunknownscharacter devicesblock devicetfifotsockett directorys"unsupported file type (type is %s)(RtstattS_ISCHRtS_ISBLKtS_ISFIFOtS_ISSOCKtS_ISDIR(R�tkind((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytbadtypesiRHiR#Rs.hgR�tskipN(ii(2RFR�R%tnevertalwaystmatchfntbadR tnormpathtosutiltlistdirRRSR�tS_IFMTtS_IFDIRtS_IFREGtS_IFLNKRRBRtexactRqREtanypatsRQR�R`RhtsortR6RAtdicttfromkeysR�tdirRVtstrerrortpopR1tEACCESR2tkeysR=tpathauditorRtitertchecktnextt statfiles(-RtmatchtsubreposR�tignoredR�R�R?t dirignoreR�tmatchalwaystbadfntdmapR�R�RStgetkindtdirkindtregkindtlnkkindRtworktwaddR�t skipstep3R�REtitjtsubpathtresultstfftnfR9R�R3tprefixtfntndR�tentriesR(R*tvisitt
audit_path((Rs6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytwalk
s
'
(
")
1
/c%Cs
|||}}}gggggf\} }
}}}ggg}}
}|j}| j}|
j}|j}|j}|j}|j}|
j}|j}|j}|j}|j}|j}|j}|j}tj }x|j
||||�j�D]�}}||kr`|s%||�rG||�rG|rZ||�qZq�r�|�q�n||\} }!}"}#|r�| dkr�||�q�dkr�t|j
�}$|"dkr|"|jkr�|"|jt@ks�|jAd@r|r|!|@|ks$|s$|"dks$||kr1||�q�#|$krp|#|$t@krp|!|@|ksc|rp||�q�$|kr�||�q�r�|�q��dkr�||�q�dkr�||�q�dkr�|�q�W| |
|||
|||fS( s;Determine the status of the working copy relative to the
dirstate and return a tuple of lists (unsure, modified, added,
removed, deleted, unknown, ignored, clean), where:
unsure:
files that might have been modified since the dirstate was
written, but need to be read to be sure (size is the same
but mtime differs)
modified:
files that have definitely been modified since the dirstate
was written (different size or mode)
added:
files that have been explicitly added with hg add
removed:
files that have been explicitly removed with hg remove
deleted:
files that have been deleted through other means ("missing")
unknown:
files not in the dirstate that are not ignored
ignored:
files not in the dirstate that are ignored
(by _dirignore())
clean:
files that have definitely not been modified since the
dirstate was written
tnmaR�ii@i�RpR�R"(R RBR�R�RORMR!RR�R�RR$R�R�R�R�R�(%RR�R�R�tcleanR�tlistignoredt listcleantlistunknowntlookuptmodifiedtaddedtremovedtdeletedR�tladdtmaddtaaddtuaddtiaddtraddtdaddtcaddtmexactR�RNRLtcopymaptlastnormaltimeR�R�R9R�R�R�ttimeR�((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pytstatus�sn$
"
N(9RR Rt
propertycacheR R!R+RR4R<R'R>RRFRKRMRORQRR[R\R`RaRfRgRiR$RkRlRmR,RRuR}RR�R�R�RtR�R�R�RrR�R�R�R�R�RR�R�R�R�RyR�RR(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyR
sb "
�R1tnodeRti18nRR=R%R?R�R�RnRR�R~Rt filecacheR�RRtobjectR
(((s6/sys/lib/python2.7/site-packages/mercurial/dirstate.pyt<module>sH0
|