o ]Lbd*d+Z,d?d,d-Z-d.d/Z. d@d0d1Z/e!"d2d3d4ged5fge j0ed6dAd8d9Z1e!"d:ge j0ed;drs  zlfconvert..rspatternsrsconverting revisionss revisionsstipunittotals largefilescs.eZdZfddZfddZZS)zlfconvert..lfsourcecs&t|||dd|jjtj<dS)N.)super__init__ filemapperrenamer shortname)selfuisource) __class__lfsourcer r$r+sz$lfconvert..lfsource.__init__cs~|\}}t|||}|tjr|ddur|S|d}t|}|dur6tt d||ft ||dfS)Nrs missing largefile for '%s' in %sr) r*getfile startswithrshortnameslashstripfindfilerAbortrrreadfile)r/namerevrealnamerealrevfhashpath)r2r3r#r r$r4s    z#lfconvert..lfsource.getfile)__name__ __module__ __qualname__r+r4 __classcell__r )r3r#r2r$r3sr3cs eZdZfddZZS)zlfconvert..convertercs&||}t||||||dSr)r*r+)r/r0r1dest revmapfileoptssrc)r2 converterr3r r$r+s   z%lfconvert..converter.__init__)rBrCrDr+rEr )rKr3rFr$rKsrKs&all largefiles must be present locallyshg) source_type dest_type)5r byteskwargsr getminsizegetr islocalrr9r repositorystatus changelog nodesbetweenheadsnullidwlockr set configlistlongnamematchmodr rootlist makeprogressr<update_lfconvert_addchangesetwvfsexistsr.rmtreekeysisfileunlink removedirsdirnameOSError requirementsaddrwritereporequirementsrfilemap_sourcerrKdownloadlfilesconvertdirstateclearreleaseshutil)r0rJrGpatsrItolfilesizerdstsuccessdstwlockdstlockctxsrevmaplfiles normalfilesmatcher lfiletohashprogressr"r?foundmissingorigr )rKr3r#r$ lfconvert3s (                 rc st} t| } g} | D]} | |vr^| |vr^t| ||} | vrQ| }|}|dur4d}|o9||v}| |O} d|vrQ|rOtt d| d} | rY| | n| | | |vrt | }| || vrш| }d|vr|}|r||vrtt d| td}|| t|}| vs| |kr|| | | d| v}t |||||| <q| | qfdd}t|| | |dS) NFls+renamed/copied largefile %s becomes symlinkslargefile %s becomes symlinkrxc st|}|dur>z|}Wn tjyYdSw|}|r't|}t||||dd| vd| v|St ||S)N rr) r splitstandinfilectxr LookupError copysourcestandinr memfilectxflags_getnormalcontext)repomemctxr?srcfnamefctxrenamedr"rr}r r$ getfilectx$s(      z+_lfconvert_addchangeset..getfilectx)_convertparents_getchangedfiles_islfilemanifestrrrrr9rrlrrappendrsha1r`datardigestwwrite writestandin_commitcontext)r#rxr"r}r~rrrwrparentsfilesdstfilesr?islfilerr renamedlfilefstandinmr@ executablerr rr$ras^                  rac Cs^t||||||||}||}t||| ||j || <dSr) rr descriptionuserdateextra commitctxrcopyalltostore setparentsrTtipnode)rxrr"rrr}mctxretr r r$rCs  rcCsRt|}|j|vr'|}|D]}||D]}||qq|Sr)rYrrrWrrdiffrl)r"rrmcpctxfnr r r$rUs   rcCsPg}|D] }|||qt|dkr&||jt|dks|S)Nr)rrrlenrrW)r"r}rpr r r$r`s   rc Csrz||}Wn tjyYdSw|}|}|dkr&t|j||}t||||d| vd| v|S)N.hgtagsrr) rrrrr _converttagsr0rrr)rr"r?r}rrrr r r$rjsrc Csg}|D]Y}z |dd\}}Wnty$|td|Yqwzt|}Wnty=|td|Yqwz|dt|||fWqt y_|td|Yqwd |S)N rs&skipping incorrectly formatted tag %s s%skipping incorrectly formatted id %s s%s %s sno mapping for id %s r) splitlinessplit ValueErrorwarnrr TypeErrorrrKeyErrorjoin)r0r}rnewdatalineidr;newidr r r$rzs*      rcCs`|dks |dks |dkrdS|r||rdSz|||ddkWStjy/YdSw)zlReturn true if file should be considered a largefile, i.e. matcher matches it or it is larger than size.rs .hgignores.hgsigsFTi)rrwrr)filer"rrwr r r$rs rc s|sdStj||dd}d}|dt|||fdd|D}|dt||jtd td t|d .}|D]"}||t ||}|sWt td || |||d 7}q?WddS1smwYdS)z&upload largefiles to the central storeNT)putrs,sending statlfile command for %d largefiles csg|]}|s|qSr r )r!hretvalr r$ z uploadlfiles..s"%d largefiles need to be uploaded suploading largefilessfilesr&s6largefile %s missing from store (needs to be uploaded)r) r openstoredebugrrcr_rr`rr8rr9r) r0r#rxrstoreatrr@r1r rr$ uploadlfiless6     "rcCs.|r|d}ndg}t|}|j||dS)a)Verify that every largefile revision in the current changeset exists in the central store. With --contents, also verify that the contents of each local largefile file revision are correct (SHA-1 hash matches the revision ID). With --all, check every changeset in this repository.sall()r))contents)revsrrverify)r0rallrrrr r r$ verifylfiless   rc Cst||}|rt|t|@}g}||}|D]5}z t|t|}Wnty?} z | jtjkr:WYd} ~ qd} ~ wwt||sM| ||fq|r\t |} | |} | SggfS)a.cachelfiles ensures that all largefiles needed by the specified revision are present in the repository's largefile cache. returns a tuple (cached, missing). cached is the list of files downloaded by this operation; missing is the list of files that were needed but could not be found.N) r listlfilesrY readasstandinrIOErrorerrnoENOENTr8rrrrP) r0rrfilelistr~togetr"lfile expectedhasherrrrr r r$ cachelfiless,      rcCs|jj}d}d}|ddtjD]}t||||\}}|t|7}|t|7}q|td||dkr@|td|||fS)Nrsfile(%s)spath:s %d additional largefiles cached s!%d largefiles failed to download ) rTrrrr.rrrSr)r0rtonode totalsuccess totalmissingr<ryrr r r$ros roc st|||}|t||}tt|t|B}dur/tfdd|D}|i}td\} } |j} |d} |D]} tj j t ||| |j d}t| }tj j t ||||j d}| |r| |r| | rt| | | || |t| |}|dkr| | vr|j|jr| j| ddn| |j| dddd ||| <qF| | r|j| | vr| | | d 7} qFWdn1swY|||rfd d|D}D]}|jt||j|q|td t ||d||u|D]j} d }|!| }|r;t"||| s1q|j| dddd }t| }| |rx| #|j$d@}| #| }|j$}||d@krx|dM}|rp||d?d@t%j&@O}| '| |d }| |7} t(||| |qWdn 1swY|||r|td| | fWddSWddS1swYdS)zUpdate largefiles according to standins in the working directory If ``printmessage`` is other than ``None``, it means "print (or ignore, for false) message forcibly". Ncsg|]}|vr|qSr r r!r?)rr r$r rz updatelfiles..)rr)startrT) ignoremissing) p1_tracked wc_trackedpossibly_dirtyrcsg|]}|vr|qSr r r)droppedr r$r?rsgetting changed largefiles r)rr@irIs"%d largefiles updated, %d removed ))rgetstatuswriterrXopenlfdirstaterYr parentchangerbosrArelpathr backuppathr]rrcrtcopyfiler unlinkpathrrq get_entry any_trackedrl update_file normalizewritecurrenttransaction_map reset_staterrrP copyfromcachestatst_moderumaskchmodsynclfdirstate)r0rr printmessage normallookup statuswriter lfdirstater~r`updatedremovedrbwctxr lfileorigr standinorig expecthashr?update1 standinexecstmoder )rrr$ updatelfiless        1       $l$rslfpullrsrevs#pull largefiles for these revisionss--r REV... [-e CMD] [--remotecmd CMD] [SOURCE]defaultc Ks||_|dg}|sttdt||}d}|D]}|td|t|||\}}|t |7}q| td|dS)a0pull largefiles for the specified revisions from the specified source Pull largefiles that are referenced from local changesets but missing locally, pulling from a remote repository to the local cache. If SOURCE is omitted, the 'default' path will be used. See :hg:`help urls` for more information. .. container:: verbose Some examples: - pull largefiles for all branch heads:: hg lfpull -r "head() and not closed()" - pull largefiles on the default branch:: hg lfpull -r "branch(default)" r<sno revisions specifiedrs#pulling largefiles for revision %d s%d largefiles cached N) lfpullsourcerPrr9rr revrangenoterrrS) r0rr1rIr numcachedr<cachedrr r r$lfpullus  rs debuglfputsFILEcKs.t|}t||||d|dS)Ns%s r)rhashfilerrrr)r0rfilepathkwargsr@r r r$ debuglfputs r#)FFr)NNF)r)3__doc__ __future__rrrrtmercurial.i18nrmercurial.noderr mercurialrrrr r r r r r\rrrmercurial.utilsrrprrrrrsehcommandrrarrrrrrrrrror remoteoptsrr#r r r r$sp  4  ]   !  { $