yL i`wdgZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl Z ddl mZmZmZm Z mZddlZddlmZddlmZdd lmZdd lmZmZmZmZd d lmZd d l m!Z!d dl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3e jhdk\rddl)m5Z5nddl6m5Z5ddl7m8Z8e1r ddl9m:Z:ddl;mZ?Gddeje$ee#ZAy)Commit) defaultdictN)BytesIO)PopenPIPE)altzonedaylight localtimetimetimezone)IStream)Git)Diffable)ActorStatsfinalize_process hex_to_bin)base)Tree) SerializableTraversableIterableObjaltz_to_utctz_strfrom_timestampparse_actor_and_date parse_date) AnyDictIOIteratorListSequenceTuple TYPE_CHECKINGUnioncast))Literal)PathLike)SymbolicReference)RepocTeZdZUdZdZdZdZdZdZe de d<dZ d Z e de d < d;d d dedeed fdeed fdeed fded efdeed fdeed fded efdeeed fd ee dd fdeed fdeed fdd ffd ZedddedfdZed d dddefdZdeddfdZd edd ffd! Zedej<fd"Zedej<fd#Z edeeeffd$Z!dra1Wraps a git commit object. See :manpage:`gitglossary(7)` on "commit object": https://git-scm.com/docs/gitglossary#def_commit_object :note: This class will act lazily on some of its attributes and will query the value on demand only if it involves calling the git binary. GIT_AUTHOR_DATEGIT_COMMITTER_DATEzi18n.commitencodingzUTF-8committype) treeauthor authored_dateauthor_tz_offset committercommitted_datecommitter_tz_offsetmessageparentsencodinggpgsighexshar:Nrepor,binshar2r3r4r5r6r7r8r9r;r<returncFt|||||_|#t|tsJdt |z|||_|||_|||_|||_ |||_ |||_ | | |_ | | |_ | | |_| | |_| | |_yy)aInstantiate a new :class:`Commit`. All keyword arguments taking ``None`` as default will be implicitly set on first query. :param binsha: 20 byte sha1. :param tree: A :class:`~git.objects.tree.Tree` object. :param author: The author :class:`~git.util.Actor` object. :param authored_date: int_seconds_since_epoch The authored DateTime - use :func:`time.gmtime` to convert it into a different format. :param author_tz_offset: int_seconds_west_of_utc The timezone that the `authored_date` is in. :param committer: The committer string, as an :class:`~git.util.Actor` object. :param committed_date: int_seconds_since_epoch The committed DateTime - use :func:`time.gmtime` to convert it into a different format. :param committer_tz_offset: int_seconds_west_of_utc The timezone that the `committed_date` is in. :param message: string The commit message. :param encoding: string Encoding of the message, defaults to UTF-8. :param parents: List or tuple of :class:`Commit` objects which are our parent(s) in the commit dependency graph. :return: :class:`Commit` :note: Timezone information is in the same format and in the same sign as what :func:`time.altzone` returns. The sign is inverted compared to git's UTC timezone. Nz(Tree needs to be a Tree instance, was %s)super__init__r? isinstancerr1r2r3r4r5r6r7r8r9r:r;r<)selfr>r?r2r3r4r5r6r7r8r9r:r;r< __class__s X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/git/objects/commit.pyrCzCommit.__init__ms~ v&  dD) b+UX\]aXb+b b)  DI   DK  $!.D   '$4D !  &DN  %"0D   *':D $  "DL  "DL  $DM   DK )r.c,t|jSN)tupler:)clsr0s rG_get_intermediate_itemszCommit._get_intermediate_itemssV^^$$rHct}|j||j}|jd|jj t |j||}|jS)zCalculate the sha of a commit. :param repo: :class:`~git.repo.base.Repo` object the commit should be part of. :param commit: :class:`Commit` object for which to generate the sha. r) r _serializetellseekodbstorer r1r?)rLr>r0stream streamlenistreams rG_calculate_sha_zCommit._calculate_sha_sX&!KKM  A((..9f!EF~~rHkwargsc L|jDcic]}|t||}}|D]}||jvstd|j||j|j |j fi|}|j|j ||_|Scc}w)zCreate new commit object from an existing commit object. Any values provided as keyword arguments will replace the corresponding attribute in the new object. zinvalid attribute name) __slots__getattr ValueErrorupdaterFr> NULL_BIN_SHArWr?)rErXkattrsattrname new_commits rGreplacezCommit.replaces/3nn=GD!$$== ;Ht~~- !9:: ;  V#T^^DIIt/@/@JEJ  00JG >sB!attrc |tjvrb|jjj |j \}}|_}|jt|jyt|-|yrJ) rrZr>rRrTr?size _deserializerreadrB _set_cache_)rErd_binsha _typenamerTrFs rGrizCommit._set_cache_s^ 6## #48IIMM4H4H4U 1GY 6   gfkkm4 5 G  %rHcBt|j|jSrJ)rr4r5rEs rGauthored_datetimezCommit.authored_datetimesd00$2G2GHHrHcBt|j|jSrJ)rr7r8rms rGcommitted_datetimezCommit.committed_datetimesd1143K3KLLrHct|jtr|jjdddS|jjdddS)z):return: First line of the commit message rr )rDr9strsplitrms rGsummaryzCommit.summarysJ dllC (<<%%dA.q1 1<<%%eQ/2 2rHpathsc *|rJt|jjj|jd|fi|j St|jjj|jfi|j S)aCount the number of commits reachable from this commit. :param paths: An optional path or a list of paths restricting the return value to commits actually containing the paths. :param kwargs: Additional options to be passed to :manpage:`git-rev-list(1)`. They must not alter the output style of the command, or parsing will yield incorrect results. :return: An int defining the number of reachable commits --)lenr>gitrev_listr= splitlines)rErwrXs rGcountz Commit.count sq" -tyy}}--dkk4Q&Q\\^_ _)499==))$++@@KKMNNrHcL|jjj|S)z :return: String describing the commits hex sha based on the closest :class:`~git.refs.reference.Reference`. :note: Mostly useful for UI purposes. )r>r{name_revrms rGrzCommit.name_revsyy}}%%d++rHrevr+c d|vr tddg}|r@t|ttjfr|f}n t |}|j ||jj||fddi|}|j||S)aFind all commits matching the given criteria. :param repo: The :class:`~git.repo.base.Repo`. :param rev: Revision specifier. See :manpage:`git-rev-parse(1)` for viable options. :param paths: An optional path or list of paths. If set only :class:`Commit`\s that include the path or paths will be considered. :param kwargs: Optional keyword arguments to :manpage:`git-rev-list(1)` where: * ``max_count`` is the maximum number of commits to fetch. * ``skip`` is the number of commits to skip. * ``since`` selects all commits since some date, e.g. ``"1970-01-01"``. :return: Iterator yielding :class:`Commit` items. prettyz<--pretty cannot be used as parsing expects single sha's onlyry as_processT) r\rDrtosr*rKextendr{r|_iter_from_process_or_stream)rLr>rrwrX args_list paths_tupprocs rG iter_itemszCommit.iter_items+s< v [\ \ &*F %#r{{!34"H !%L   Y '!txx  iKDKFK//d;;rHc ||jdd}|dk(rd}||d<|j|j||fi|S)aIterate *all* parents of this commit. :param paths: Optional path or list of paths limiting the :class:`Commit`\s to those that contain at least one of the paths. :param kwargs: All arguments allowed by :manpage:`git-rev-list(1)`. :return: Iterator yielding :class:`Commit` objects which are parents of ``self`` skiprr)getrr>)rErwrXrs rG iter_parentszCommit.iter_parents_sGzz&!$ 19Dvttyy$@@@rHcdttdtfd}|jsO|jjj |j dddddjdd}||}nb|jjj|jd j |j dddd j}||}tj|j|S) zCreate a git stat from changes between this commit and its first parent or from all changes done if this is the very first commit. :return: :class:`Stats` linesr@c d}t||t|dzdD]B\}}|jddd}|jd\}}}||d|d|d|dz }D|S)N rrr)ziprzru)rtext file_infoline change_type insertions deletionsfilenames rG process_linesz#Commit.stats..process_lines}s{D#&ueCJ!O4E.F#G \ 4'ood3A6r: 48JJt4D1Yk:yRZ[[ \KrHryT)numstat no_renamesrootrawrNr)rrr) r!rtr:r>r{ diff_treer=r}diffr_list_from_string)rErrrs rGstatsz Commit.statsts c s ||IIMM++ T4DtQU,jl12E!'DIIMM&& Q&& T4TX^b'jl !'D&&tyy$77rHctjdtd|jj Dcic] \}}||d c}}Scc}}w)alDeprecated. Get the trailers of the message as a dictionary. :note: This property is deprecated, please use either :attr:`trailers_list` or :attr:`trailers_dict`. :return: Dictionary containing whitespace stripped trailer information. Only contains the latest instance of each trailer key. zWCommit.trailers is deprecated, use Commit.trailers_list or Commit.trailers_dict insteadr) stacklevelr)warningswarnDeprecationWarning trailers_dictitems)rEr_vs rGtrailerszCommit.trailerssJ  e  %)$6$6$<$<$>?DAq1Q4???sAcgd}|jjj|dt}|j t |j jdjd}|j}|sgSg}|jdD]F}|jdd\}}|j|j|jfH|S) aGet the trailers of the message as a list. Git messages can contain trailer information that are similar to :rfc:`822` e-mail headers. See :manpage:`git-interpret-trailers(1)`. This function calls ``git interpret-trailers --parse`` onto the message to extract the trailer information, returns the raw trailer data as a list. Valid message with trailer:: Subject line some body information another information key1: value1.1 key1: value1.2 key2 : value 2 with inner spaces Returned list will look like this:: [ ("key1", "value1.1"), ("key1", "value1.2"), ("key2", "value 2 with inner spaces"), ] :return: List containing key-value tuples of whitespace stripped trailer information. )r{zinterpret-trailersz--parseT)rrVrutf8rr:r) r>r{executer communicatertr9encodedecodestripruappend)rEcmdrtrailer trailer_listtkeyvals rG trailers_listzCommit.trailers_listsB7"&))--"7"7 #8#  ''DLL(9(@(@(BCAFMMfU--/I t$ rrTrrr=_s rGrz#Commit._iter_from_process_or_streams( >6 *!%8N$$0'.. ^Z 0!"n5N#F??:DZZ\F6{R JJtQ/ v;"$ A&86&A A$dJv./ / >6 *!%8N ^ , +sC4C6parent_commitshead author_date commit_datec V| |jjg}n$|D]} t| |rtd| d||j } t j } |xstj| }|xstj| }tt} txrtjdkD}|rtnt }| j#|j$d}|rt'|\}}n|rt'|\}}n| |}}| j#|j(d}| rt'| \}}n|rt'|\}}n| |}}|j*j-d\}}| j/|||j0}t|t2s t5dt|t2r|j7|}|||j8|||||||||| }|j;|||_|r$ddl} |jjA|||S|S#t$rg}YwxYw#t$rd|jBjDjG||jjH|d |z}|jjK|d |zY|SwxYw) aCommit the given tree, creating a :class:`Commit` object. :param repo: :class:`~git.repo.base.Repo` object the commit should be part of. :param tree: :class:`~git.objects.tree.Tree` object or hex or bin sha. The tree of the new commit. :param message: Commit message. It may be an empty string if no message is provided. It will be converted to a string, in any case. :param parent_commits: Optional :class:`Commit` objects to use as parents for the new commit. If empty list, the commit will have no parents at all and become a root commit. If ``None``, the current head commit will be the parent of the new commit object. :param head: If ``True``, the HEAD will be advanced to the new commit automatically. Otherwise the HEAD will remain pointing on the previous commit. This could lead to undesired results when diffing files. :param author: The name of the author, optional. If unset, the repository configuration is used to obtain this value. :param committer: The name of the committer, optional. If unset, the repository configuration is used to obtain this value. :param author_date: The timestamp for the author field. :param commit_date: The timestamp for the committer field. :return: :class:`Commit` object representing the new commit. :note: Additional information about the committer and author are taken from the environment or from the git configuration. See :manpage:`git-commit-tree(1)` for more information. NzParent commit 'z' must be of type rr.z)conf_encoding could not be coerced to str)logmsgzcommit (initial): %szcommit: Switching to %s)&rr0r\rD config_readerrenvironrr6r3intr r r tm_isdstrr renv_author_daterenv_committer_date conf_encodingru get_valuedefault_encodingrt TypeErrorr2r^rWr?git.refs set_commitrefsHeadcreateref set_reference)rLr>r2r9rrr3r6rrpcrenv unix_timeis_dstoffsetauthor_date_str author_time author_offsetcommitter_date_strcommitter_timecommitter_offset enc_section enc_optionrrbr{masters rGcreate_from_treezCommit.create_from_tree1sv  ! $"&))"2"2!3 $ U!!S)$qe;McU%STT U   !jj4!4 +5<<+K 6ik22Q6"''#"5"5r: )3K)@ &K )3O)D &K)2FK!WWS%;%;R@ /9+/F ,N, /9:L/M ,N,/8&,N#&"3"3"9"9#"> Z [*c>R>RS --GH H dC 99T?D                 //jA    [ $$Z$@zA $!# $f [--IIMM1G; .  ''7PSY7Y'Z [s$H)H;) H87H8;A)J('J(rTc |j}|d|jzjd|jD]}|d|zjd|j}|j }|j }d}||d||j|jt|jfzj|j|j }||d||j|jt|jfzj|j|j|jk7r$|d|jzjd |jdrT|d |j j#d j%d D]}|d |zd zjd!|d t)|j*t,r-||j*j|j|S||j*|S#t&$rYnwxYw) Nztree %s asciiz parent %s z%s %s <%s> %s %s r3r6z encoding %s r<sgpgsigrr rs)writer2rr:r3namer6emailr4rr5r;r7r8r__getattribute__r<rstripruAttributeErrorrDr9rt) rErTrraanamecfmtsiglines rGrOzCommit._serializes  {TYY&..w78 7A =1$,,W5 6 7 KK NN" GG&&%d&;&;< fT]]#  GG''%d&>&>? fT]]#  ==D11 1 ?T]]2::7C D $$X.i #{{11$7==dCBG3=4/77@AB e  dllC ( $,,%%dmm4 5  $,,     s,A%H44 I?Ic v|j}t|jt|j dtj dzd|_g|_d} |}|jds|}n_|jjt||jt|j djdzt|j|_|}|}|}|jdrC|}|jd r|}|jd r|jdrC|j|_d|_|}|j!}|r|d d d k(r7||j#d dzdj|jd |_n|d ddk(r~||j#d dzddz} d} |} | sn$| d dd k7r| j!}d} n | | ddz } .| j%dj|jd |_| r|j!}|r t'|j|jd\|_|_|_ t'|j|jd\|_|_|_|j;|_ |j<j|jd|_|S#t.$r&t0j3d||jdYwxYw#t.$r&t0j3d||jdYwxYw#t.$r1t0j3d|j<|jdY|SwxYw)Nr rTsparentrrs mergetag  r s encoding ignoresgpgsig rsFrcz3Failed to decode author line '%s' using encoding %s)exc_infoz6Failed to decode committer line '%s' using encoding %sz/Failed to decode message '%s' using encoding %s)rrr>rrutree_idr2r: startswithrr1rrKrr;r<rfindrrr3r4r5UnicodeDecodeError_loggererrorr6r7r8rhr9) rErTr next_line parent_line author_linecommitter_lineencbufsigis_next_headersigbufs rGrgzCommit._deserializes??Jxz/?/?/A!/D$Et||WYGY[]^   "*K)))4'  LL   T 499jARARATUWAXA_A_`gAh6i j k T\\*  !J ""<0 I&&t,$J &&t,""<0--  iik1RyL( #CHHTNQ$6$8 9 @ @PX Y QqZ'#((4.1,./%7!&%ZF!a{d*$lln)-6!":%C"jj/66t}}hO !*""$C',  %[%7%7 y%QR   "%  %^%:%:4==)%TU  #({{}  <<..t}}iHDL K"  MME    "  MMH    "  MMA      s6&8L8M -+M>,M M  ,M;:M;>6N87N8cg}|jrMtjd|jtj}|D]}|j t ||S)aSearch the commit message for any co-authors of this commit. Details on co-authors: https://github.blog/2018-01-29-commit-together-with-co-authors/ :return: List of co-authors for this commit (as :class:`~git.util.Actor` objects). z^Co-authored-by: (.*) <(.*?)>$)r9refindall MULTILINErr)rE co_authorsresultsr3s rGrzCommit.co_authorsxsZ <<jj1  G " 2!!%.1 2rH) NNNNNNNNNNN)r)NFNNNN)9__name__ __module__ __qualname____doc__rrrrr1r)__annotations__rZ_id_attribute_r"bytesr%rrrfloatrtrC classmethodr#rMrWrrcripropertydatetimernrprvr*r~rr rrrrrrr!rrrrrboolrrrOrgr __classcell__)rFs@rGrrCsA(O-*M&D'( & IN h  #'%)*./3(,+/26+/37%)#'X!X!X!D$J X! eTk" X! S$Y' X! e ,X!%X!c4i(X!#4;/X!sE4'(X!x)4/0X!T "X!c4i X! X!t%X%% :N%%68$&&&&I8#4#4IIMH$5$5MM3sEz*33O58H+=!=>OsOWZO* ,# , , 68 1<1<3"55 61<Xx112 1<  1< (  1<1r?s *# " ==??   v)* '  H %J T[[0(LJ rH