^c`ddlZddlZddlZddlmZmZmZmZmZGddZ dZ dZ dS)N)errorhgobsoletescmutilutilc<eZdZdZdZdZdZdZdZdZ dZ d S) repoloaderzLoad repositories in background thread This is designed for a forking server. A cached repo cannot be obtained until the server fork()s a worker and the loader thread stops. c||_tj||_t j||_d|_tj |_ d|_ dS)N)max)maxlenF) copy_uir lrucachedict_cache collectionsdeque_inqueue _accepting threadingEvent _newentry_thread)selfuir s 5/usr/lib/python3/dist-packages/mercurial/repocache.py__init__zrepoloader.__init__s^7799'F333 $)888 "** c|jrJ|jjdkrdSd|_t j|j|_|jdS)NrT)target)rrr rrThread _mainloopstartrs rr#zrepoloader.start's]< = 1 $ $ F 't~>>>  rc|jsdSd|_|j|jd|_|j|jdS)NF)rrrsetjoinrclearrr$s rstopzrepoloader.stop0su|  F     rcl|j||jdS)z6Request to load the specified repository in backgroundN)rappendrr&rpaths rloadzrepoloader.load:s2 T""" rc|jr-|jrtjd|j|dS)zReturn a cached repo if available This function must be called after fork(), where the loader thread is stopped. Otherwise, the returned repo might be updated by the loader thread. s0cannot obtain cached repo while loader is activeN)ris_aliverProgrammingErrorrpeekr,s rgetzrepoloader.get?sU < DL1133 (C {d+++rcbjrtjjjrij jn#t$rYn)wxYwtj j fdjijdSdS)Nc.SN)_load)r-rsrz&repoloader._mainloop..\sDJJt4D4Dr) rgccollectrwaitr(rpopleft IndexErrorr callcatchrr,s`@rr"zrepoloader._mainloopLso F JLLL N   ! ! !/ F$$&&&=0022DD!E!$(,D,D,D,D,DEEE / Fo F F F F FsA11 A>=A>ctj} |j|}n<#t$r/t j|j|}YnwxYwt||j dd|tj|z |j ||dS)Ns repocaches&loaded repo into cache: %s (in %.3fs) ) rtimerrpopKeyErrorr repositoryr unfiltered _warmupcacherloginsert)rr-r#repos rr7zrepoloader._load^s  >;??4((DD > > >=400;;==DDD >T   6  JLL5    4&&&&&s06A)(A)N) __name__ __module__ __qualname____doc__rr#r)r.r3r"r7rrr r s  , , ,FFF$'''''rr c||j|jj|jj|jj|jjtjD]}tj |||j |dSr6) invalidateall changelogobsstore_all successors predecessorschildrenr cachefuncsgetrevs _phasecache loadphaserevs)rHnames rrErEqsNNMMMM#%%t$$$$""4(((((rc |j}|j}d|vr*|dx|d<}|jx|j_|j_d|vr|dx|d<}|j|j_d|vr |dx|d<}|j|j_dSdS)z/Copy cached attributes from srcrepo to destrepos changelogsobsstores _phasecacheN) _filecachesvfsobjopener _realopener)srcrepodestrepo destfilecache srcfilecacheces r copycacherf~s'M%L|##+7 +EE l#b-5]: *l""*6{*CC k"Rm %%-9.-II n%  &%r) rr9rrrrrrr rErfrMrrrhs W'W'W'W'W'W'W'W'v ) ) ) & & & & &r