��c@s�dZddlZddlZddlmZmZmZmZm Z m
Z
ddlmZddl
mZddlmZddlZddlZddlZd�ZdS(s,setup for largefiles repositories: reposetupi�N(tcontextterrortmanifesttmatchtutilt discovery(tnode(t_(t localrepocs��j�r tj���Snd�jf���fd��Y���_d�}�jdd|��jdd|�dS(Nt
lfilesrepoc
s�eZeZ�fd�Z�fd�Zejdd d eeee��fd��Z �fd�Z
dd d d eei��fd�Zed e���fd�Zd�Z
RS(
cst�|�j||�S(N(tsupertstatus(tselftargstkwargs(R (s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytstatus_nolfilesscsrt�|�j|�}|jrndtjf�fd��Y�d|jf��fd��Y��|_n|S(NtlfilesmanifestdictcseZ�fd�ZRS(cs;t�|�j|�rtSt�|�jtj|��S(N(R
t__contains__tTruetlfutiltstandin(Rtfilename(R(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR*s
(t__name__t
__module__R((R(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR)st lfilesctxcs>eZ�fd�Z��fd�Zdd�fd�ZRS(cs;t�|�j�}g|D]}tj|�p4|^qS(N(R
tfilesRtsplitstandin(Rt filenamestf(R(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR1scs"t�|�j�}�|_|S(N(R
Rt __class__(Rtman1(RR(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR4s cs�yL|dk r0t�|�j|||�}nt�|�j||�}Wn�tjk
r�|dk r�t�|�jtj|�||�}n$t�|�jtj|�|�}|j��fd�|_nX|S(Ncs��dS(Nt(((tolddata(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt<lambda>Js(tNoneR
tfilectxRtLookupErrorRRtdata(Rtpathtfileidtfilelogtresult(R(R s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR#8s N(RRRRR"R#((RR(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR0s(R
t__getitem__tlfstatusRtmanifestdictR(Rtchangeidtctx(R (RRs>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR*&s "t.c)
s|||}} }
�jsEt���j||||| |
|�St�_t|tj�ri|}n
�|}t|tj�r�|}n
�|}|j�dk��o�|�dk}
d�}|dkr�j
�j�j��}nd}z�y�j
t�}Wntjk
r%nXtj���}|j�r�|j�r�xI|D]}||�rXPqXqXWt���j||||| |
|�Sn��fd�}tj|�}||j�|_t���j|||||||�}�r^�fd�}g|jD]}||�r|^q|_|j|gt| t�}|\}}}}}}}}|
rxD|D]�}tj|�}||kr�|j|�q�||j�j�tj�j|��kr�j|�q�|j|�|j|�q�Wn�||||} ggg}}}x�| D]}tj|�}|||�r�||j�j�tj�j|��kr�|j|�q�|j|�q=|j|�q=Wxf|j�D]X}tj|�s��ntj|�}||�s q�n||kr�|j|�q�q�Wt |�}g|D]}|�j!kr<|^q<}g|dD]}||krh|^qh|d<t"|j#�}!t"|d�j$|!�|d<t"|d�j$|!�|d<g|D].}"g|"D]}#tj|#�s�#^q�q�}$||||gg|f}!gt%|$|!�D]\}%}&t&|%|&�^q9}n;d�}'g|D]%}(g|(D]}|'|�^q{^qn}|r�|j'�nWd|r�|j(�nX|
s�g|d<n|s�|d<n| s�|d <nt)�_|SdS(
NR/cSsKy2|j�dkr%||j�kS||tSWntk
rFtSXdS(N(trevR"RRtKeyErrortFalse(tfileR.((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytinctxjs
cs��s
|Sg}�j}xn|D]f}tj|�}||krQ|j|�q ||j�kry|j||f�q |j|�q W|S(N(tdirstateRRtappendtdirstextend(RtnewfilesR5Rtsf(Rtworking(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt
tostandins�s
cs4tj|�}�j}||kp3||j�kS(N(RRR5R7(RR:R5(R(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytsfindirstate�s iiicSs tj|�rtj|�S|S(N(Rt isstandinR(R((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyttoname�s
i(*R+R
RR2t
isinstanceRt changectxR0R"tmatch_talwaystroottgetcwdtwlockRt LockErrorRtopenlfdirstateRtanypatstcopyt_filesRR6R%tstripthashfiletwjointnormalRR>RtlistR5tsett_mapt
differencetziptsortedtwritetreleaseR()Rtnode1tnode2Rtignoredtcleantunknowntlistsubrepostlistignoredt listcleantlistunknowntctx1tctx2t
parentworkingR4RFt
lfdirstateRR<tmR)R=tstunsuretmodifiedtaddedtremovedtmissingt_unknownt_ignoredtlfileRttochecktlfilestfilelisttfntnormalstlist1tlist2R?titems(R tui(RR;s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyRUs�
8 2 /
cs/t�|�j||�}tj||�|S(N(R
t commitctxRtcopyalltostore(RR
RR(R (s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyRxstcs�t�|�j}|j�} zt|dt�sEt|dt�r�tj|j|dddt�|d|d|d|d|d |d
|d|�}
|
S|dks�|j �r�|j
�r�tj�|�}t
j|j|j��}|j|gttt�}
|
\}}}}}}}}||||}tj|��x��D]�}||krOtjj|jtj|���r�tjj|j|��r�tj|tj|��|j|�q�q�qOqOW|d|d|d|d|d |d
|d|�}
|
dk r�xq|D]f}||krtjj|jtj|���sltjj|j|��r|j|�qqqWn|j�|
Stj|��|j|j
���|_tj||�}|jj |gtt���s"|d|d|d|d|d |d
|d|�Stj�|�}xZ�D]R}tj!|�}||dkr�tj||�|j|�q;|j|�q;Wt"j"|�}|j#�|jt$��7_g}xm|jD]b}tj|�}|�ks�|�krq�n|j%tj&�s#|tj&7}n|j'|�q�W||_���fd
�}||_#|d|d|d|d|d |d
|d|�}
|j�|
SWd| j(�XdS(Nt_isrebasingt_istransplantingRqtprintmessagettexttusertdateRtforceteditortextratrcs$�|�r|�kS|�kSdS(N((R(Rptorigmatchfntstandins(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytmatchfn�s
()R
tcommitRFtgetattrR2t
lfcommandstupdatelfilesRwR"RIRRRHRBRCRDRERt
listlfilestosR&texistsRNRt
updatestandinROtdropRVt
_subdirlfsRKtcomposestandinmatcherR5twalkRRJR�RUtendswithtsepR6RW(RR~RR�RR�R�R�torigRFR)Rdt
dirtymatchRfRgRhRiRjt_missingRlRmt_cleant
modifiedfilesRntsmatcherRtactualfilesRtfstandinR�(R Rw(RpR�R�s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR�s�
cs8tj�|j�d|�}|jrt�}|jj|j|�d}x�|D]�}g|jj|�D]} | tj krl| ^ql}
||}t|j
��}t|
�dkr�|j�}
|j�dj�}|j�dj�}x*|D]"}||
kr�j
|�q�Wx*|D]"}||
kr'|j
|�q'q'WxY|
D]N}|
||j|d�ks�|
||j|d�krT|j
|�qTqTWn|jtg|D]7}tj|�r�||kr�||j�j�^q���}qSWtj�|||�nt�|�j||||�S(NR�iii(RtfindcommonoutgoingtpeerRkRQt changelogtnodesbetweentparentstnode_tnullidRtlenRtaddtgetR"tunionRR>R%RLR�tuploadlfilesR
tpush(RtremoteR�trevst newbranchtoutgoingttouploadtotntpR�R.Rtmctmp1tmp2R(R trepoRw(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR��s>
,
AcSs�g}g}g}x{|D]s}tj|d�rTtjtd�|dd��ntjj|j|��r|j |�q|j |�qWx�D]�t
}|jj|�d}x@|D]8} |jj| �j
|�r�|j |�t}Pq�q�W|sfxa|D]V}
|jj|
�j
|�r |j |
�|s_|j tj|��t}q_q q Wn|s�|j |�q�q�W||7}|S(s�
Adjust matched file list
If we pass a directory to commit whose only commitable files
are largefiles, the core commit code aborts before finding
the largefiles.
So we do the following:
For directories that only have largefiles as matches,
we explicitly add the largefiles to the match list and remove
the directory.
In other cases, we leave the match list unmodified.
t/s file "%s" is a largefile standinthints#commit the largefile itself instead(RR>RtAbortRR�R&tisdirRNR6R2R5t normalizet
startswithRR(RRRpR�R7tregularsRt
matcheddirtdtmftlf((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR��s<
N(RRR2R+RR*RtunfilteredmethodR"RRxR�R�R�((R R�Rw(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR s/��"c[sRd|jkrNtjd�|jj�D��rN|jjd�|j�ndS(Nt
largefilescss&|]}tjd|dkVqdS(R�iN(Rt shortname(t.0R((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pys <genexpr>�s(trequirementsRtanytstoret datafilesR�t_writerequirements(RwR�R((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytcheckrequireslfiles�sthooksschangegroup.lfiless
commit.lfiles(tlocaltprotot
wirereposetupRt setconfig(RwR�R�((R R�Rws>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt reposetups
%� (t__doc__RJR�t mercurialRRRRRBRRRR�tmercurial.i18nRRR�R�RR�(((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt<module> s.
|