o ]Lb@sdddlmZddlmZmZddlmZmZGdddejZ GdddejZ Gd d d e Z d S) )absolute_import)hexsha1nodeconstants) basestore shallowutilcsjeZdZfddZdddZejjdddZejjdd Z d d Z d d Z dddZ ddZ ZS)unionmetadatastorecs:tt|j|i|||_|d|_|dd|_dS)N writestoreallowincompleteF)superr__init__storesgetr r )selfargskwargs __class__C/usr/lib/python3/dist-packages/hgext/remotefilelog/metadatastore.pyr s zunionmetadatastore.__init__Nc sdurt|vr gSifdd}||fg}|rS|\}}z|j||d|||}||WntyP|jsE||f||fkrNYnw|sS)Returns as many ancestors as we're aware of. return value: { node: (p1, p2, linknode, copyfrom), ... } Nc s||fg}g}t}|rY|\}}||f|vrq |||f|}|s/|||fq |\}} } } |tjkrG|vrG|| pC||f| tjkrW| vrW||| f|s |SN)setpopaddrappendrnullid) curnamecurnodequeuemissingseennamenodevaluep1p2linknodecopyfrom ancestorsknownrrtraverse(s&     z1unionmetadatastore.getancestors..traverser+)rrupdate_getpartialancestorsextendKeyErrorr ) rr"r#r+r,r rr newmissingrr)r getancestorss0    zunionmetadatastore.getancestorsc CsD|jD]}z |j|||dWStyYqwt|t|f)Nr-)r r3r1r)rr"r#r+storerrrr/Ss  z'unionmetadatastore._getpartialancestorsc Cs@|jD]}z |||WStyYqwt|t|fr)r getnodeinfor1r)rr"r#r4rrrr5]s  zunionmetadatastore.getnodeinfocCtd)Ns5cannot add content only to remotefilelog contentstore RuntimeErrorrr"r#datarrrrgzunionmetadatastore.addcCs"|}|jD] }|r||}q|Sr)r getmissing)rkeysr r4rrrr<ls   zunionmetadatastore.getmissingcCs|jD]}|||qdSr)r markledger)rledgeroptionsr4rrrr>ss zunionmetadatastore.markledgercCsdd|jD}tj|S)NcSsg|]}|qSr) getmetrics).0srrr xsz1unionmetadatastore.getmetrics..)r rsumdicts)rmetricsrrrrAws zunionmetadatastore.getmetricsr)__name__ __module__ __qualname__r r3rbaseunionstore retriabler/r5rr<r>rA __classcell__rrrrr s  :    rc@s&eZdZdddZddZddZdS) remotefilelogmetadatastoreNcCs|||}t|}|S)r)_getdatar ancestormap)rr"r#r+r:r*rrrr3}s  z'remotefilelogmetadatastore.getancestorscC||||Srr3rr"r#rrrr5z&remotefilelogmetadatastore.getnodeinfocCr6)Ns7cannot add metadata only to remotefilelog metadatastorer7)rr"r#parentsr'rrrrr;zremotefilelogmetadatastore.addr)rGrHrIr3r5rrrrrrM|s  rMc@s@eZdZddZdddZddZdd Zd d Zdd d ZdS)remotemetadatastorecCs||_||_dSr) _fileservice_shared)rui fileservicesharedrrrr s zremotemetadatastore.__init__NcCs0|jj|t|fgdddd|jj|||dS)NTF)force fetchdata fetchhistoryr-)rVprefetchrrWr3)rr"r#r+rrrr3sz remotemetadatastore.getancestorscCrPrrQrRrrrr5rSzremotemetadatastore.getnodeinfocCr6)Nscannot add to a remote storer7r9rrrrszremotemetadatastore.addcCs|Srr)rr=rrrr<zremotemetadatastore.getmissingcCsdSrr)rr?r@rrrr>r_zremotemetadatastore.markledgerr) rGrHrIr r3r5rr<r>rrrrrUs rUN) __future__rmercurial.noderrrrrJrrMobjectrUrrrrs o