ó œçƒQc@s­dZddlZddlZddlmZmZmZmZm Z m Z ddlm Z ddl 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†Z ed e‡‡‡fd†Z d„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(R tfilename(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 tfilesRt splitstandin(R t filenamestf(R(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR1scs"tˆ|ƒjƒ}ˆ|_|S(N(R Rt __class__(R tman1(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.pytJs(tNoneR tfilectxRt LookupErrorRRtdata(R tpathtfileidtfilelogtresult(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__tlfstatusRt manifestdictR(R tchangeidtctx(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ót j ˆj ˆj ƒƒ}nd}z´yˆj tƒ}Wntjk r%nXtjˆˆƒ}|jƒr|jƒ rxI|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èqÍntj|ƒ}||ƒs qÍn||krÍ|j|ƒqÍqÍWt |ƒ}g|D]}|ˆj!kr<|^q<}g|dD]}||krh|^qh|d/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(R tworking(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt tostandinss   cs4tj|ƒ}ˆj}||kp3||jƒkS(N(RRR5R7(RR:R5(R (s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt sfindirstate§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 R R2t isinstanceRt changectxR0R"tmatch_talwaystroottgetcwdtwlockRt LockErrorRtopenlfdirstateRtanypatstcopyt_filesRR6R%tstripthashfiletwjointnormalRR>RtlistR5tsett_mapt differencetziptsortedtwritetreleaseR()R tnode1tnode2Rtignoredtcleantunknownt listsubrepost listignoredt listcleant listunknowntctx1tctx2t parentworkingR4RFt lfdirstateRR<tmR)R=tstunsuretmodifiedtaddedtremovedtmissingt_unknownt_ignoredtlfileRttochecktlfilestfilelisttfntnormalstlist1tlist2R?titems(R tui(R R;s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR UsÆ                    8 2 /    cs/tˆ|ƒj||Ž}tj||ƒ|S(N(R t commitctxRtcopyalltostore(R R 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”t j ˆ|ƒ} t j|j|jƒƒ} | j| gtttƒ} | \}}}}}}}}||||}t j|ƒ‰xˆˆD]€}||krOtjj|jt j|ƒƒƒrÏtjj|j|ƒƒrÌt j|t j|ƒƒ| j|ƒqÌqÏqOqOW|d|d|d|d|d |d |d |ƒ} | dk r†xq| D]f}||krtjj|jt j|ƒƒƒ sltjj|j|ƒƒ r| j|ƒqqqWn| jƒ| St j|ƒ‰|j|j ƒˆƒ|_t j||ƒ}|jj |gttƒ‰ˆs"|d|d|d|d|d |d |d |ƒSt j ˆ|ƒ} xZˆD]R}t j!|ƒ}| |d kr€t j||ƒ| j|ƒq;| j|ƒq;Wt"j"|ƒ}|j#‰|jt$ˆƒ7_g}xm|jD]b}t j|ƒ}|ˆ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_istransplantingRqt printmessagettexttusertdateRtforceteditortextratrcs$ˆ|ƒr|ˆkS|ˆkSdS(N((R(Rpt origmatchfntstandins(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pytmatchfns  ()R tcommitRFtgetattrR2t lfcommandst updatelfilesRwR"RIRRRHRBRCRDRER t listlfilestosR&texistsRNRt updatestandinROtdropRVt _subdirlfsRKtcomposestandinmatcherR5twalkRRJR‡RUtendswithtsepR6RW(R R~RR€RRR‚RƒtorigRFR)Rdt dirtymatchRfRgRhRiRjt_missingRlRmt_cleant modifiedfilesRntsmatcherRt actualfilesRtfstandinR‡(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ú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(NRiii(RtfindcommonoutgoingtpeerRkRQt changelogt nodesbetweentparentstnode_tnullidRtlenRtaddtgetR"tunionRR>R%RLRŠt uploadlfilesR tpush(R tremoteRtrevst newbranchtoutgoingttouploadtotntpR¢R.Rtmctmp1tmp2R(R trepoRw(s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyRª s>           ,  Ac SsŽg}g}g}x{|D]s}tj|dƒrTtjtdƒ|ddƒ‚ntjj|j|ƒƒr|j |ƒq|j |ƒqWxí|D]å}t }|j j |ƒd}x@|D]8} |j j | ƒj |ƒrÀ|j |ƒt}PqÀqÀW|sfxa|D]V} |j j | ƒ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>RtAbortRRR&tisdirRNR6R2R5t normalizet startswithRR( R RRpRœR7tregularsRt matcheddirtdtmftlf((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyR‘Âs<         N(RRR2R+RR*RtunfilteredmethodR"R RxRˆ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 üs(t requirementsRtanytstoret 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__RJRt mercurialRRRRRBRRRR£tmercurial.i18nRRRŠRÎRRÑ(((s>/sys/lib/python2.7/site-packages/hgext/largefiles/reposetup.pyt s  .