6hf8SrSSKJr SSKrSSKrSSKrSSKrSSKJr SSK J r SSK J r J r JrJrJrJrJrJrJrJrJr SSKJr SSKJr S r\S -rS r\R@S;S j5r!SSjr,S>Sjr-Sr.Sr/Sr0Sr1Sr2Sr3S?S jr4S!r5S"r6S#r7S$r8S%r9S&r:S'r;S(rS+r?S,r@S-rAS.rBS/rC"S0S1\D5rES2rFS3rGS4rHS5rIS6rJS7rK"S8S95rLS?S:jrMg)@zGlargefiles utility code: must not import other modules in this package.) annotationsN)_)hex) dirstateencodingerrorhttpconnectionmatchpycompat requirementsscmutilsparseutilvfs)hashutil) timestamps.hglf/ largefilesc#^# [USS5nXlSv X lg!X lf=f7f)NlfstatusF)getattrr)repovalueoldvalues 9/usr/lib/python3/dist-packages/hgext/largefiles/lfutil.pyrr,s*tZ/HM!   s-"-*-cUnU(dU(aUR[SUS9nU(a [U5nUc[R "[ S55eU$![a# [R "[ S5U-5ef=f)Nsminsize)defaults)largefiles: size must be number (not %s) s-minimum size for largefiles must be specified)configlongnamefloat ValueErrorrAbortr)ui assumelfilesoptrlfsizes r getminsizer'6s F l8ZA  6]F ~kk!LMNN M  ++?@6I  s A-B c.[R"[RR U55 [R "X5 g![ a [US5n[R"U5n[R"U5HnURU5 M SSS5 O!,(df  O=fSSS5 O!,(df  O=f[R"U[R"U5R5 gf=f)z@Try to create hardlink - if that fails, efficiently make a copy.rbN)rmakedirsospathdirnameoslinkOSErroropenatomictempfile filechunkiterwritechmodstatst_mode)srcdestsrcfdstfchunks rlinkr<FsMM"''//$'(- C - #t_d&9&9$&?4++D1 5!2'@&?&?___ rwws|++, -sAA D"C 9/B1( C 1 B? ;C  D C risdarwinisposixrr"osname)r#namer,rDappdatahomes rr?r?[s ==| ,D  D""&& X--11*=  77<<. .KL   P     ##G, 77<<j)TB BEF  J     ##$56 77<<+ +##G, 77<<i6 6KL   P   kk / 08?? B   ++a89D@t LLrBcV[X5n[RRU5$N)rAr+r,exists)r#r@r,s r inusercacherRs  "D 77>>$ rBc\[X5up#U(a)URR[S5U-5 U$[ URU5(aTURR[S5U-5 [ X5n[ [URU5U5 U$g)zReturn store path of the largefile with the specified hash. As a side effect, the file might be linked from user cache. Return None if the file can't be found locally.sfound %s in store sfound %s in system cache N) findstorepathr#noterrR storepathr<rA)rr@r,rQs rfindfilerWs!,LD   Q-.56 TWWd # #  Q45<=$ ]477D )40 rBcR^\rSrSrSrSrS U4SjjrU4SjrSrU4Sjr Sr U=r $) largefilesdirstateTs -large-filesc2>[TU][U5US9$)N) reset_copy)super set_trackedunixpath)selffr\ __class__s rr^largefilesdirstate.set_trackedsw"8A;:"FFrBc4>[TU][U55$rP)r] set_untrackedr_)r`rarbs rre largefilesdirstate.set_untrackedsw$Xa[11rBcgNF)r`ras r _dirignorelargefilesdirstate._dirignoresrBcR>U(aURSSS9 [TU] S5 g)Nslargefiles/dirstatesplain)location) addbackupr]r3)r`trrbs rr3largefilesdirstate.writes%  LL/(L C  drBriF) __name__ __module__ __qualname____firstlineno___large_file_dirstate_tr_key_suffixr^rerjr3__static_attributes__ __classcell__)rbs@rrYrYs($N G2rBrYc |^[TRSS5nUbU$TRn[n[R"UR U55n[ RTR ;n[UUTRTRRU4SjTRU5nU(aURUR US55(dTRSS9 URT5 [T5n TRR!U /SSS9n [#U 5S:aUR%U5 U H n ['U 5n UR)U S S S S 9 M" SSS5 SSS5 U$U$!,(df  N=f!,(df  U$=f![*R,a U$f=f) z Return a dirstate object that tracks largefiles: i.e. its root is the repo root, but it is saved in .hg/largefiles/dirstate. If a dirstate object already exists and is being used for a 'changing_*' context, it will be returned. _sub_dirstateNc0>[R"T5$rP)rmatcher)rsr openlfdirstate..st$rBsdirstateF)waitsubreposunknownignoredrT) p1_tracked wc_trackedpossibly_dirty)rrrrvfsmodr>r DIRSTATE_V2_REQUIREMENTrYroot _validate nodeconstantsrQwlockchanging_filesgetstandinmatcherwalklenr* splitstandinhacky_extension_update_filer LockError) r#rcreate sub_dirstater lfstorediropeneruse_dirstate_v2 lfdirstater}standinsstandinlfiles ` ropenlfdirstaters4==/4@L ((CJ ZZ, -F"::d>O>OOO#   $ Jcjj*k!BCC ')B)B4)H+D1==--b%.x=1$LL,'G(1E::#'#''+ ; (*I', :-*I)H'',       sIF#,F>A.F,F4F# F F F F# F##F;:F;cLUSn[R"5nURU/SSSS9upEnURURpUSn UHn U[ U 5n U (a'[U 5[URU 55:waURU 5 MSURU 5 XR5n U Rn U Rn[R"X5nUcMXU4nUR!U U5 M U$![ a Sn Nf=f)N.Frrcleanr)matchmodalwaysstatusmodifiedrr LookupError readasstandinhashfilewjoinappendlstatr6st_sizerreliable_mtime_of set_clean)rrpctxr unsuresmtime_boundaryrrwctxrfctxstmodesizemtime cache_datas rlfdirstatestatusrs :D OO E * 1 1 E!2!F~jj!''e :D 'D}T*htzz%7H.II OOE " LL ""$B::D::D//CE "%0 $$UJ7 H D sD D#"D#cUc [U5nXRU5Vs/sH=nUc,URRU5R(dM2[ U5PM? sn$s snf)zJreturn a list of largefiles in the working copy or the specified changeset)rrr get_entry any_trackedr)rrevr}ras r listlfilesr sg#D) ( (A ?dmm55a8DD  Q(  s 1A+A+cT[RR[XU55$)zBReturn true if a largefile with the given hash exists in the store)r+r,rQrVrr@ forcelocals rinstorers 77>>)D ; <rs rrVrV!sC $++--xx4@@ 88==4 ((rBc[XS5n[X5(aUS4$UR5(a[XS5(a[XS5S4$US4$)zSearch through the local store path(s) to find the file for the given hash. If the file is not found, its path in the primary store is returned. The return value is a tuple of (path, exists(path)). FT)rVrrrr@r,s rrTrT)sX T 'Dtd| 74t44T*D00 %=rBcURn[X5nUcgURURUR U555 [ US5oS"US5n[ [R"U5U5nSSS5 SSS5 WU:wa;URR[S5X$U4-5 URU5 gg!,(df  NX=f!,(df  Na=f)aCopy the specified largefile from the repo or system cache to filename in the repository. Return true on success or false if the file was not found in either cache (which should not happened: this is meant to be called only after ensuring that the needed largefile exists in the cache).NFr)swbs'%s: data corruption in %s with hash %s T) wvfsrWr*r-r>r0 copyandhashrr2r#warnrunlink)rr@filenamerr,srcfddestfdgothashs r copyfromcacher;s 99D D D |MM$,,tyy234 dD UD5$9Vd007@%: $  9 :w' (  H %:$9  s$ C$ !CC$ C! C$$ C2c URn[X5n[X5(agURU5(a[ XR U5U5 gUR R[S5X%4-5 g)Ns0%s: largefile %s not available from local store ) rrrrQcopytostoreabsoluter>r#rr)rctxfilefstandinrr@s r copytostorerTsi 99D  'Dt {{4D))D/48  B Cl  rBcXnUR5H4n[U5nUcMX2R5;dM([XXC5 M6 g)z4Copy all largefiles in a given revision to the storeN)filesrmanifestr)rnoderrrealfiles rcopyalltostorerbs@ *CIIK)  H $> 8 6 rBc\[URU5(a*[[URU5[ X55 g[ R "[RR[ X555 [US5n[ R"[ X5URRS9n[ R"U5HnURU5 M SSS5 SSS5 [!X5 g!,(df  N"=f!,(df  N+=f)Nr)) createmode)rRr#r<rArVrr*r+r,r-r0r1storerr2r3linktousercache)rrr@r9r:r;s rrrls477D!! ]477D )9T+@A bggooi&;<= $ $$$%$**2G2G!//5EJJu%6 #  s$3D/D 0D D D D+cZ[URU5n[[X5U5 g)zNLink / copy the largefile with the specified hash from the store to the cache.N)rAr#r<rVrs rrrzs# $ 'D4 %rBcURn[nSnU(avUR5(daUR5Vs/sHoRR X55PM nnU(dUR U5/n[ R "USXdS9nU$[ R "USUR U5/US9nU$s snf)zDReturn a match object that applies rmatcher to the standin directorycgrPri)ramsgs rr~#getstandinmatcher..s4rBN)badfn)r shortnamerrr>r r )rrmatcherr standindirrpatpatsr s rrrs 99DJ E))6>nn6FG6Fs **6FGIIj)*D d4j$< L d4j499Z+@*AO LHsB>cb^^[UT5nURmUU4SjnSUlX2lU$)zReturn a matcher that accepts standins corresponding to the files accepted by rmatcher. Pass the list of files in the matcher as the paths specified by the user.cV>T"U5=(a TR[U55$rP)matchfnr)ra isstandinrs rcomposedmatchfn.composestandinmatcher..composedmatchfns!|A 0 0a AArBT)rr_was_tampered_with)rrsmatcherrrs ` @rcomposestandinmatcherrs7!x0H  IB#'H& OrBc<[[R"U5-$)zHReturn the repo-relative path to the standin for the specified big file.)shortnameslashrpconvertrs rrrs DMM(3 33rBc,UR[5$)zoReturn true if filename is a big file standin. filename must be in Mercurial's internal form (slash-separated).) startswithrrs rrrs   ~ ..rBc[R"U5RSS5n[U5S:XaUS[:XaUS$g)Nrr)rrsplitrr)rbitss rrrsA == " ( (q 1D 4yA~$q'Y.AwrBcURU5nURRU5(a#[U5n[ U5n[ XXE5 g[ R"[S5U-5e)zRe-calculate hash value of lfile and write it into standin This assumes that "lfutil.standin(lfile) == standin", for efficiency. s%s: file not found!N) rrrQr getexecutable writestandinrr"r)rrrrr@ executables r updatestandinrs^ ::e D yy~"4( TD5kk!23e;<UR5R5$)ztread hex hash from given filectx of standin file This encapsulates how "standin" data is stored into storage layer.)datastrip)rs rrrs 99;   rBcRURXS-U=(a S=(d S5 g)z#write hash to / xrBN)wwrite)rrr@rs rrrsKKz':d'AcBrBc[R"S5nUH%nURU5 URU5 M' [ UR 55$)zRead bytes from instream (iterable) and write them to outfile, computing the SHA-1 hash of the data along the way. Return the hash.rB)rsha1updater3rdigest)instreamoutfilehasherr s rrrsG]]3 F d d v}} rBc[RRU5(dg[US5n[ U5sSSS5 $!,(df  g=f)NrBr))r+r,rQr0hexsha1)rfds rrrs7 77>>$   dD Rr{   s A Ac[R"U5RnU[R-=(a- U[R-=(a U[R -$rP)r+r5r6S_IXUSRS_IXGRPS_IXOTH)rrs rrrsI 778  $ $D   " DLL  " DLL rBc>SnU"X5nUH nU"XE5nM U$)NcvURS5(dUS- nURS5(aUSSnX-$)Nrr)endswithr)leftrights rr>urljoin..joins>}}T"" DLD   D ! !!"IE|rBri)firstsecondargr>urlas rurljoinr)s+ u C 3l JrBc[R"5n[R"U5HnUR U5 M [ UR 55$)zQhexsha1 returns the hex-encoded sha1 sum of the data in the file-like object data)rrrr2rrr)fileobjhr;s rrrs?  A##G, - qxxz?rBc0[R"XS5$)Nsrb)r httpsendfile)r#rs rr.r. s  & &rU ;;rBch[R"[RR U55$)z@Return a version of path normalized for use with the lfdirstate.)rrr+r,normpath)r,s rr_r_s ==))$/ 00rBcSUR;aJURR5H,nUR(dM[UR ;dM, g [ [URUS55$)z,Return true if the repo is a largefile repo.rTF) r r data_entries is_revlogr target_idanyrr#)rentrys r islfilesrepor7sX)))ZZ,,.E>U__#D/ ~dggtU3 44rBc\rSrSrSrSrg)storeprotonotcapablei cXlgrP storetypes)r`r<s r__init__storeprotonotcapable.__init__!s$rBr;N)rrrsrtrur=rxrirBrr9r9 s%rBr9c/n[U5nUSnURRU/SSS9H.n[U5n[ X45nUR XV45 M0 U$![ a SnN&f=f)NFr)rrrrrr/r)rrr}rrrr@s rgetstandinsstater@%sH%G :D==%%"eU&W%  /D  & O D s A## A21A2c[U5nX@R;aURUSSS9 gURRU5nURUURUR UR SS9 g)NF)rrT)rrp2_infor)rrrrtrackedrrB)rrr normallookup lfstandinr6s rsynclfdirstaterF5swI %..  /  '' 2.. }}''MM / rBcHUR5nURRU5 U"U5 [URU5nUR 5H n[ U5nUcM[X4US5 M" SSS5 [X25 g!,(df  N=frh) rrchanging_parentsrr#rrrFr)origrrrrrars r markcommittedrJHs{ 88:D  ' ' - T $DGGT2 A OE t> .041 . -s>B.B B!c[U5R[U55n/nUH"nUSU;dMURUS5 M$ U$)Nr)setsymmetric_differencer) oldstandins newstandinschangedstandinsfilelistras rgetlfilestoupdaterRfsN+&;;C [0R0"U5nSUlUR2mU=R$[5T5- sl/n UR$Hn [U 5n U T;dU T;aURR-U 5R(d-URR-U 5R(dMpO,URR-U 5R6(dMU R9U 5 M XlUUU4SjnXlU$!,(df  GN=f)zUpdate standins in the working directory according to specified match This returns (possibly modified) ``match`` object to be used for subsequent commit process. NFrTrc2>T"U5(aUT;$UT;$rPri)ralfiles origmatchfnrs rr&updatestandinsbymatch..matchfns q>>F? "= rB)r#rrrrunning_statusrrraddedremovedrrrrQrr _subdirlfsr_filesrrrrrCcopyrsortedrr)rr r# dirtymatchrrrr modifiedfilesrrr actualfilesrarrjrkrs @@@rupdatestandinsbymatchrws B  }  __& ]] ) )$ /'1J(2(9(9 ):) %F~0+agg5 A D!E%"5>99##H--yy''..%d8<  F#E??5;;=&9EL%T1H}}!!2ue"H   )JX&    & . . . $x 0 IIe E#E--K  LLF8$$LK \\1: ;(h.==**84<<}}..q199:]],,Q/;;1L! M Lw0 /s "K44 Lc$\rSrSrSrSrSrSrg)automatedcommithookiaStateful hook to update standins at the 1st commit of resuming For efficiency, updating standins in the working directory should be avoided while automated committing (like rebase, transplant and so on), because they should be updated before committing. But the 1st commit of resuming automated committing (e.g. ``rebase --continue``) should update them, because largefiles may be modified manually. cXlgrPresuming)r`r|s rr=automatedcommithook.__init__ s rBcLUR(aSUl[X5$U$rh)r|rw)r`rr s r__call__automatedcommithook.__call__s ==!DM(5 5LrBr{N)rrrsrtru__doc__r=rrxrirBrryrys !rBryctUc [US5(aURS$U(a UR$S$)aReturn the function to write largefiles specific status out If ``forcibly`` is ``None``, this returns the last element of ``repo._lfstatuswriters`` as "default" writer function. Otherwise, this returns the function to always write out (or ignore if ``not forcibly``) status. _largefilesenabledcgrPri)roptss rr~!getstatuswriter..'srB)hasattr_lfstatuswritersr)r#rforciblys rgetstatuswriterrs;GD*>??$$R(( 99 , ,rB)T) )NNrqrP)Nr __future__r contextlibrrr+r5mercurial.i18nrmercurial.noder mercurialrrrr r rr r r rrrrmercurial.utilsrmercurial.dirstateutilsrrrrcontextmanagerrr'r<rAr?rRrWrYrrrrrVrTrrrrrrrrrrrrrrrrr)rr.r_r7 Exceptionr9r@rFrJrRrgrwryrrirBrrsfN"     %-  T!   !!  -1$/Md  **24n 6 = )$2  7 $&&  4/  =C   <1 5%9%   &<8Bnb.-rB