idl dZddlmZddlmZddlmZmZddlm Z ddl m Z m Z m Z mZmZmZmZddlmZe rdd lmZeZd Zd Zd Zd ZdZdZGddeZGdde Z Gdde Z!Gdde!Z"dS)z.Module with additional types used by the index)b2a_hex)Path)packunpack)Blob) NamedTupleSequence TYPE_CHECKINGTupleUnioncastList)PathLike)Repo) BlobFilterBaseIndexEntry IndexEntry StageTypeii0i@i cReZdZdZdZdeeddfdZdee e fde fdZ dS)rz Predicate to be used by iter_blobs allowing to filter only return blobs which match the given list of directories or files. The given paths are given relative to the repository. pathsreturnNc||_dS)z :param paths: tuple or list of paths which are either pointing to directories or to files relative to the current repository N)r)selfrs B/opt/cloudlinux/venv/lib/python3.11/site-packages/git/index/typ.py__init__zBlobFilter.__init__.s  stage_blobc~|dj}t|tr|nt|}|jD]}t|tr|nt|}|j}|j}t |t |krWt dt||DrdSdS)Nrc3(K|] \}}||kVdS)N).0ijs r z&BlobFilter.__call__..@s*DDda16DDDDDDrTF)path isinstancerrpartslenallzip)rr blob_pathlike blob_pathpathliker' filter_parts blob_partss r__call__zBlobFilter.__call__6s",Q-"4 +5mT+J+Jc--PTUbPcPc    H%/$%?%?ST(^^D&*jL$-OJ<  3z??22DDc, &C&CDDDDD tt ur) __name__ __module__ __qualname____doc__ __slots__r rrr rrboolr2r"rrrr#swIhx0T 5D#9 d      rrceZdZUdZeed<eed<eed<eed<edddZ eed<edddZ eed <dZ eed <dZ eed <dZ eed <dZeed <dZeed<dS)BaseIndexEntryHelperzTyped namedtuple to provide named attribute access for BaseIndexEntry. Needed to allow overriding __new__ in child class to preserve backwards compat.modebinshaflagsr'>LLr ctime_bytes mtime_bytesdevinodeuidgidsizeN)r3r4r5r6int__annotations__bytesrrr?r@rArBrCrDrEr"rrr:r:EsWW III MMM JJJ NNNeQ**K***eQ**K***CLLLE3NNNCLLLCLLLD#MMMMMrr:ceZdZdZdeeeeeefeeeeeeeeeeeef fddffd Z de fdZ de fdZ e de fdZe defdZedd ed eddfd Zd ddefdZxZS)raqSmall Brother of an index entry which can be created to describe changes done to the index in which case plenty of additional information is not required. As the first 4 data members match exactly to the IndexEntry type, methods expecting a BaseIndexEntry can also handle full IndexEntries even if they use numeric indices for performance reasons. inp_tuplerc8tj|g|RS)zOOverride __new__ to allow construction from a tuple for backwards compatibility)super__new__)clsrJ __class__s rrMzBaseIndexEntry.__new__`s#uwws/Y////rc<d|j|j|j|jfzS)Nz %o %s %i %sr;hexshastager'rs r__str__zBaseIndexEntry.__str__jsDKTY OOOrc<d|j|j|j|jfzS)Nz(%o, %s, %i, %s)rQrTs r__repr__zBaseIndexEntry.__repr__ms!TY TZ$SSSrcPt|jdS)zhex version of our shaascii)rr<decoderTs rrRzBaseIndexEntry.hexshaps"t{##**7333rc0|jtztz S)aStage of the entry, either: * 0 = default stage * 1 = stage before a merge or common ancestor entry in case of a 3 way merge * 2 = stage of entries from the 'left' side of the merge * 3 = stage of entries from the right side of the merge :note: For more information, see http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html )r= CE_STAGEMASK CE_STAGESHIFTrTs rrSzBaseIndexEntry.stageus \)m;;rrblobrScN||j|j|tz|jfS)z9:return: Fully equipped BaseIndexEntry at the given stage)r;r<r]r')rNr^rSs r from_blobzBaseIndexEntry.from_blobs(sDIt{E],BDINOOOrreporcDt||j|j|jS)z7:return: Blob using the information of this index entry)rr<r;r')rras rto_blobzBaseIndexEntry.to_blobsD$+ty$)<<)rr rFrr?rTs rctimezIndexEntry.ctimes) E#s(OVE43C%D%DEEErcvttttftd|jS)z1See ctime property, but returns modification timer>)rr rFrr@rTs rmtimezIndexEntry.mtimes)E#s(OVE43C%D%DEEErbaserc tddd}t|j|j|j|j||dddddf S)z :return: Minimal entry as created from the given BaseIndexEntry instance. Missing values will be set to null-like values :param base: Instance of type BaseIndexEntryr>r)rrr;r<r=r')rNrntimes r from_basezIndexEntry.from_basesHE1a  49dk4:ty$PTVWYZ\]_`bcdeeerrr^rSc tddd}t|j|j|tz|j||dddd|jf S)z7:return: Minimal entry resembling the given blob objectr>r)rrr;r<r]r'rE)rNr^rSrps rr`zIndexEntry.from_blobsZE1a    &      rN)rnrrrrd) r3r4r5r6rfr rFrkrmrgrqrr`r"rrrrsIIFuS#XFFFXFFuS#XFFFXFfff[f  T # l   [   rrN)#r6binasciirpathlibrutilrr git.objectsrtypingr r r r r rr git.typesrgit.reporrFr__all__ CE_NAMEMASKr\ CE_EXTENDEDCE_VALIDr]objectrr:rrr"rrrs44 QPPPPPPPPPPPPPPPPP   F    D:"3=3=3=3=3=)3=3=3=l3 3 3 3 3 3 3 3 3 3 r