ZH2ddlmZddlZddlmZddlZddlZddlZddlZddl m Z m Z m Z m Z ddl Z ddlZddlmZddlmZmZmZmZmZddlmZddlmZmZmZmZd d lmZm Z m!Z!m"Z"d d l#m$Z$m%Z%dd l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6dd l7m8Z8m9Z9m:Z:e1r ddl;mZ>hdZ?ej@eAZBeBCejDdZE d3d4d!ZFd5d$ZGd6d7d+ZHd6d8d/ZId0ZJer eJe jKzndZLGd1d2e$ZMdS)9) annotationsN)contextmanager)callPopenPIPEDEVNULL)dedent)defenc force_bytes safe_decodeis_posixis_win) CommandError) is_cygwin_gitcygpath expand_pathremove_password_if_present)GitCommandErrorGitCommandNotFoundUnsafeOptionErrorUnsafeProtocolError) LazyMixin stream_copy)AnyAnyStrBinaryIOCallableDictIOIteratorListMappingSequence TYPE_CHECKINGTextIOTupleUnioncastoverload)PathLikeLiteralTBD)Repo) DiffIndex> envshellistream as_process with_stdout output_streammax_chunk_sizewith_exceptionsstdout_as_stringkill_after_timeoutuniversal_newlineswith_extended_outputstrip_newline_in_stdout)GitTprocess'Git.AutoInterrupt' | Popenstdout_handlersUnion[None, Callable[[AnyStr], None], Callable[[List[AnyStr]], None], Callable[[bytes, 'Repo', 'DiffIndex'], None]]stderr_handlerEUnion[None, Callable[[AnyStr], None], Callable[[List[AnyStr]], None]] finalizerKUnion[None, Callable[[Union[subprocess.Popen, 'Git.AutoInterrupt']], None]]decode_streamsboolr9Union[None, float]returnNonec Rdd }t|drQtd|}t|jdd}|jr |jjnd}|jr |jjnd} n4tt |}t|dd}|j}|j} t|ttfs| }g} |r| d||f| r| d| |fg} | D]Q\} } }tj ||| | ||f}d|_|| |R| D]}|||rt|t$jr|nt+d|d|rQd|d}|s>t| t,r)tt.|}|}|||r ||SdS)aRegisters for notifications to learn that process output is ready to read, and dispatches lines to the respective line handlers. This function returns once the finalizer returns :return: result of finalizer :param process: subprocess.Popen instance :param stdout_handler: f(stdout_line_string), or None :param stderr_handler: f(stderr_line_string), or None :param finalizer: f(proc) - wait for proc to finish :param decode_streams: Assume stdout/stderr streams are binary and decode them before pushing their contents to handlers. Set it to False if `universal_newline == True` (then streams are in text-mode) or if decoding must happen later (i.e. for Diffs). :param kill_after_timeout: float or None, Default = None To specify a timeout in seconds for the git command, after which the process should be killed. cmdline List[str]namestrstreamUnion[BinaryIO, TextIO] is_decoderGhandler0Union[None, Callable[[Union[bytes, str]], None]]rIrJc  |D]N}|rJ|r=t|tsJ|t}||C||On~#t$rq}t d|dt|d|dt|vr&td|dgt|z||Yd}~nd}~wwxYw| dS#| wxYw)NzPumping z of cmd(z) failed due to: zI/O operation on closed file) isinstancebytesdecoder ExceptionlogerrorrrOrclose)rLrNrPrRrSlineline_strexs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/cmd.py pump_streamz*handle_process_output..pump_stream~sF  & && &)$66666#';;v#6#6))))  & i i i IImmm1KG1T1Tmmgimm n n n-SWW<<"$4$4$4$4#58RSZ8[8[#[]_``fhh=<<<< i LLNNNNNFLLNNNNs1AAC( CA'C C( CC((C>procGit.AutoInterruptargsNstdoutstderr)targetreT)timeoutzKThread join() timed out in cmd.handle_process_output(). kill_after_timeout=z secondsz?error: process killed because it timed out. kill_after_timeout=) rLrMrNrOrPrQrRrGrSrTrIrJ)hasattrr)getattrrcrgrhrrWtuplelistsplitappend threadingThreaddaemonstartjoinis_aliver= AutoInterrupt _terminate RuntimeErrorrrOencode)r>r@rBrDrFr9rbrLp_stdoutp_stderrpumpsthreadsrNrPrSt error_strs rahandle_process_outputr]sB2w "*G445> gt} - -"--//>@E; h.9:::; h.9:::&(G!&fg  Kwfn^e6f g g g  q** )*** ::<< *'3#455 ""$$$$"H+=HHH *uYkuuu&3*Xx*H*H3 $S) 4 4I ) 0 0 2 2Iy)))y!!!tstringrOc.|ddS)N_-)replace)rs radashifyrs >>#s # ##rselfobjectexclude Sequence[str]Dict[str, Any]c.fdjDS)Nc:i|]}|v|t|Sr)rl).0srrs ra z!slots_to_dict..s/ L L LA1G;K;KAwtQ;K;K;Kr) __slots__)rrs``ra slots_to_dictrs# L L L L L L L LLrdMapping[str, Any]excludedc|D]\}}t||||D]}t||ddSN)itemssetattr)rrrkvs ra$dict_to_slots_and__excluded_are_noners` 1a aric eZdZdZdZdZejdZddZ dd Z d Z e j d d Zd ZdZdZdZedddZeddZeedddZeedddZedddZedd Zedd$ZGd%d&eZGd'd(eZddfd* Zdd-Zdd/Z dfd1 Z!e"dd2Z#e"dd4Z$edd:Z%ed d;dd>Z%ed d d?ddAZ%eddCZ%eddEZ%dd dFd ddFddFd dde&j'dFf ddWZ%ddYZ(dd[Z)e*dd]Z+dd`Z,dddaZ-edddZ.ddfZ/eddiZ0eddkZ0eddmZ0ddnZ0ddqZ1ddtZ2ddwZ3ddyZ4ddzZ5dd|Z6dd~Z7ddZ8xZ9S)r=a The Git class manages communication with the Git binary. It provides a convenient interface to calling the Git binary, such as in:: g = Git( git_dir ) g.init() # calls 'git init' program rval = g.ls_files() # calls 'git ls-files' program ``Debugging`` Set the GIT_PYTHON_TRACE environment variable print each invocation of the command to stdout. Set its value to 'full' to see details about the returned values. ) _working_dir cat_file_allcat_file_header _version_info _git_options_persistent_git_options _environment)rrrz(.+)::.+rIrc.t||jS)N)r)r _excluded_rs ra __getstate__zGit.__getstate__ sT4?;;;;rrrJc4t|||jdS)N)r)rr)rrs ra __setstate__zGit.__setstate__s,T1tOOOOOOrgitGIT_PYTHON_TRACEFGIT_PYTHON_GIT_EXECUTABLEGIT_PYTHON_REFRESHNpathUnion[None, PathLike]rGc b|?tj|}tj|}n*tj|j|j}|j}||_d} | d}n#ttf$rYnwxYw|sytd|jz}||_|Htj|j d}gd}gd}gd} ||vrn||vs|| vrtd ||j d |d |d | |j |d fz}||vrt!d |znrt#|td |j d |d |d | fz}t#||j|_ntd||S)zWThis gets called by the refresh function (see the top level __init__). NFTa Bad git executable. The git executable must be specified in one of the following ways: - be included in your $PATH - be set via $%s - explicitly set via git.refresh() raise)quietqsilencernonen0)warnwwarning1)r\err2a6 %s All git commands will error until this is rectified. This initial warning can be silenced or aggravated in the future by setting the $%s environment variable. Use one of the following values: - %s: for no warning or exception - %s: for a printed warning - %s: for a raised exception Example: export %s=%s |rz WARNING: %sag %s environment variable has been set but it has been set with an invalid value. Use only the following values: - %s: for no warning or exception - %s: for a printed warning - %s: for a raised exception r)osr expanduserabspathenvironget_git_exec_env_var git_exec_namerversionrPermissionErrorr _refresh_env_varlowerruprint ImportError) clsrnew_gitold_githas_giterrmoderrr\s rarefreshz Git.refresh&sf  g((..Ggoog..GGjnnS%:C>C rc|j|}|r(|d}td|ddS)a Check for unsafe protocols. Apart from the usual protocols (http, git, ssh), Git allows "remote helpers" that have the form `::
`, one of these helpers (`ext::`) can be used to invoke any arbitrary command. See: - https://git-scm.com/docs/gitremote-helpers - https://git-scm.com/docs/git-remote-ext rzThe `zM::` protocol looks suspicious, use `allow_unsafe_protocols=True` to allow it.N)re_unsafe_protocolmatchgroupr)rrrprotocols racheck_unsafe_protocolszGit.check_unsafe_protocolss[&,,S11  {{1~~H%oooo   roptionsrMunsafe_optionscd|D}|D]E}t||D]2\}}||s||krt|d3FdS)z Check for unsafe options. Some options that are passed to `git ` can be used to execute arbitrary commands, this are blocked by default. c8g|]}|dS)r)lstrip)roptions ra z,Git.check_unsafe_options..s4    MM#     rz= is not allowed, use `allow_unsafe_options=True` to allow it.N)ziprr)rrrbare_unsafe_optionsr unsafe_option bare_options racheck_unsafe_optionszGit.check_unsafe_optionss  (     F.1.BU.V.V  * {$$]33v7L7L+(ggg8M   rcPeZdZUdZdZdZded<dd Zdd ZddZ ddZ dddZ dS)rdabKill/Interrupt the stored process instance once this instance goes out of scope. It is used to prevent processes piling up in case iterators stop reading. Besides all attributes are wired through to the contained process object. The wait method was overridden to perform automatic status code checking and possibly raise.rcrestatusrint_status_code_if_terminatercUnion[None, subprocess.Popen]rerrIrJc0||_||_d|_dSrr)rrcres ra__init__zGit.AutoInterrupt.__init__sDIDI,0DKKKrcR|jdS|j}d|_|jr|j|jr|j|jr|j |"|jp||_dSn2#t$r%}t d|Yd}~nd}~wwxYwtttdddS | |}|jp||_dS#t$r&}t d|Yd}~dSd}~wt$r4t r)t#dt%|jzdYdSYdSwxYw)z Terminate the underlying processNz(Ignored error after process had died: %rkillz"TASKKILL /F /T /PID %s 2>nul 1>nulT)r1)rcstdinr]rgrhpollrrOSErrorr[inforrl terminatewaitAttributeErrorrrrOpid)rrcr`rs rarxzGit.AutoInterrupt._terminate sy 9DDIz #   """{ $ !!###{ $ !!### I99;;*"&"@"ODIIKKDK4+ I I ICRHHHHHHHH IzWR66>t    "<F  I I ICRHHHHHHHHH!    =DH M" s694B00 C:CC6D:: F&E%%:F&%F&c.|dSr)rxrs ra__del__zGit.AutoInterrupt.__del__6s OO     rattrrOc,t|j|Sr)rlrc)rrs ra __getattr__zGit.AutoInterrupt.__getattr__9s49d++ +rrrhUnion[None, str, bytes]cL|dt|d|j&|j}|jj}n |j}d}d fd }|d krK||}t d |tt|j |||S) a/Wait for the process and return its status code. :param stderr: Previously read value of stderr, in case stderr is already closed. :warn: may deadlock if output or error pipes are used and not handled separately. :raise GitCommandError: if the return status is not 0Nrzutf-8)dataencodingrPUnion[IO[bytes], None]rIrXc|r@ t|zS#ttf$rpdcYSwxYwpdS)Nr)r readr ValueError)rPstderr_bs ra$read_all_from_possibly_closed_streamzDGit.AutoInterrupt.wait..read_all_from_possibly_closed_streamNsg+/'+fkkmm*D*DDD#Z0///'3.../$?s*s#)AArzAutoInterrupt wait stderr: )rPrrIrX) r rcr rhrr[debugrrre)rrhrr|rerrstrrs @rar zGit.AutoInterrupt.wait=s ~"AAAHy$))9+ + + + + + +{{==hGG VVEFFF%&@&K&KVU[\\\MrN)rcrrerrIrJrIrJ)rrOrIr)r)rhrrIr) __name__ __module__ __qualname____doc__rr__annotations__rrxr rr rrrarwzGit.AutoInterrupts  / *+!**** 1 1 1 1 * * * * Z     , , , ,       rrwcdeZdZUdZdZded<dd ZdddZdddZdddZ ddZ ddZ e Z ddZ dS)Git.CatFileContentStreamasObject representing a sized read-only stream returning the contents of an object. It behaves like a stream, but counts the data read and simulates an empty stream once our sized content region is empty. If not all data is read to the end of the objects's lifetime, we read the rest to assure the underlying stream continues to work)_stream_nbr_sizezTuple[str, ...]rsizerrP IO[bytes]rIrJcj||_||_d|_|dkr|ddSdS)Nrr)r%r'r&r)rr(rPs rarz!Git.CatFileContentStream.__init__ls<!DLDJDIqyy AyrrXc.|j|jz }|dkrdS|dkrt||}n|}|j|}|xjt |z c_|j|jz dkr|jd|S)Nrrr+r)r'r&minr%rlenrr( bytes_leftrs rarzGit.CatFileContentStream.readwsdi/JQsbyy:t,,"<$$T**D IIT "IIzDI%** !!!$$$KrcB|j|jkrdS|j|jz }|dkrt||}n|}|j|}|xjt |z c_|j|jz dkr|jd|S)Nrr+rr)r&r'r-r%readliner.rr/s rar2z!Git.CatFileContentStream.readlinesyDJ&&sdi/Jbyy:t,,!<((..D IIT "IIzDI%** !!!$$$Kr List[bytes]c|j|jkrgSg}d} |}|sn5|||dkr|t |z }||krnL|S)NrTr+)r&r'r2rpr.)rr(outnbrr^s ra readlinesz"Git.CatFileContentStream.readlinessyDJ&& CC }} 4   "993t99$CTzz Jr'Git.CatFileContentStream'c|Srrrs ra__iter__z!Git.CatFileContentStream.__iter__sKrc@|}|st|Sr)r2 StopIteration)rr^s ra__next__z!Git.CatFileContentStream.__next__s"==??D $##Krcf|j|jz }|r|j|dzdSdS)Nr)r'r&r%r)rr0s rar z Git.CatFileContentStream.__del__sDdi/J 2 !!*q.11111 2 2rN)r(rrPr)rIrJ)r+)r(rrIrX)r(rrIr3)rIr8)rIrXr)rrr r!rr"rrr2r7r:r=nextr rrraCatFileContentStreamr$as B B&B AAAA         (     ,     *         2 2 2 2 2 2rr@ working_dirctt|t||_d|_g|_i|_d|_d|_ dS)aDInitialize this instance with: :param working_dir: Git directory we should work in. If None, we always work in the current directory as returned by os.getcwd(). It is meant to be the working tree directory if available, or the .git directory in case of bare repositories.rN) superr=rrrrrrrr)rrA __class__s rarz Git.__init__sc c4!!###' 44?A24$-/26.2rrNrcTddkrtjSfdS)zA convenience method as it allows to call the command as if it was an object. :return: Callable object that will execute call _call_process with your arguments.rrc&jg|Ri|Sr) _call_process)rekwargsrNrs raz!Git.__getattr__..s%'9t'9$'P'P'P'P'P'Pr)rr)rrNs``rarzGit.__getattr__s8 7c>>(t44 4PPPPPPrrHc .|jdddi||_dS)a<Specify command line options to the git executable for subsequent subcommand calls :param kwargs: is a dict of keyword arguments. these arguments are passed as in _call_process but will be passed to the git command rather than the subcommand. split_single_char_optionsTNr)transform_kwargsrrrHs raset_persistent_git_optionszGit.set_persistent_git_optionss,(=t'<'f'fW['f_e'f'f$$$rrc |dkr|d}|dd}ttttttft d|dddD|_dStt| |dS)Nrr c3\K|]'}|t|V(dSr)isdigitr)rrs ra z"Git._set_cache_..s5TT Tc!ffTTTTTTr.) rGror)r'rrmrrCr= _set_cache_)rrprocess_versionversion_numbersrDs rarWzGit._set_cache_s ? " ""00;;O-33C88;O!%c3S()TTo&;&;C&@&@!&DTTTTT""D    #t   ( ( . . . . .rc|jS)z(:return: Git directory we are working on)rrs rarAzGit.working_dirs   rTuple[int, int, int, int]c|jS)z :return: tuple(int, int, int, int) tuple with integers representing the major, minor and additional version numbers as parsed from git version. This value is generated on demand and is cached)rrs ra version_infozGit.version_infos !!rcommandUnion[str, Sequence[Any]]r3 Literal[True]'AutoInterrupt'cdSrr)rr^r3s raexecutez Git.execute r)r3r8 Union[str, Tuple[int, str, str]]cdSrrrr^r3r8s rarcz Git.execute  r)r3r8$Union[bytes, Tuple[int, bytes, str]]cdSrrrgs rarcz Git.executerhrr;cdSrrrr^r;r3r8s rarcz Git.execute'  rrXcdSrrrls rarcz Git.execute2rmrTr2Union[None, BinaryIO]r7r5r9rHr4r:r1r0Union[None, Mapping[str, str]]r6rr<subprocess_kwargsDUnion[str, bytes, Tuple[int, Union[str, bytes], str], AutoInterrupt]c   t|}|jr:|jdks|r-td| |jpt j}t jt|t j sd}n#t$rd}YnwxYw| }t j } d| d<d| d<| |j|| |t rt"}|t%|dnt}| rt&n/t)t*ddpt-t jd }d }|rd }td ||| | | t3|f| |d |pt4t&|| dur| p|jt8| t:d |}t=t>|j |_ t=t>|j!|_!n#|$r}tE|||d}~wwxYw|r|#||Sd fd }|0tIj% tIj&|||j'f}d}d}d}| rdnd} ||(|)\}}|^|* +r6dd||fz}| s|,tZ}|.|r |r |dd }|.|r |dd }|j/}n| r| dkr| n t`j1} te|j | |j 3}|j!3}|.|r |dd }|4}|j 5|j!5n7#|j 5|j!5wxYw|jdkrd|}d!fd }|r5td||||tm|nE|r'td||||ntd|||r|dkrt%||||to|tpr|rtm|}|r||tm|fS|S)"aHandles executing the command on the shell and consumes and returns the returned information (stdout) :param command: The command argument list to execute. It should be a string, or a sequence of program arguments. The program to execute is the first item in the args sequence or string. :param istream: Standard input filehandle passed to subprocess.Popen. :param with_extended_output: Whether to return a (status, stdout, stderr) tuple. :param with_exceptions: Whether to raise an exception when git returns a non-zero status. :param as_process: Whether to return the created process instance directly from which streams can be read on demand. This will render with_extended_output and with_exceptions ineffective - the caller will have to deal with the details himself. It is important to note that the process will be placed into an AutoInterrupt wrapper that will interrupt the process once it goes out of scope. If you use the command in iterators, you should pass the whole process instance instead of a single stream. :param output_stream: If set to a file-like object, data produced by the git command will be output to the given stream directly. This feature only has any effect if as_process is False. Processes will always be created with a pipe due to issues with subprocess. This merely is a workaround as data will be copied from the output pipe to the given output stream directly. Judging from the implementation, you shouldn't use this flag ! :param stdout_as_string: if False, the commands standard output will be bytes. Otherwise, it will be decoded into a string using the default encoding (usually utf-8). The latter can fail, if the output contains binary data. :param env: A dictionary of environment variables to be passed to `subprocess.Popen`. :param max_chunk_size: Maximum number of bytes in one chunk of data passed to the output_stream in one invocation of write() method. If the given number is not positive then the default value is used. :param subprocess_kwargs: Keyword arguments to be passed to subprocess.Popen. Please note that some of the valid kwargs are already set by this method, the ones you specify may not be the same ones. :param with_stdout: If True, default True, we open stdout on the created process :param universal_newlines: if True, pipes will be opened as text, and lines are split at all known line endings. :param shell: Whether to invoke commands through a shell (see `Popen(..., shell=True)`). It overrides :attr:`USE_SHELL` if it is not `None`. :param kill_after_timeout: To specify a timeout in seconds for the git command, after which the process should be killed. This will have no effect if as_process is set to True. It is set to None by default and will let the process run until the timeout is explicitly specified. This feature is not supported on Windows. It's also worth noting that kill_after_timeout uses SIGKILL, which can have negative side effects on a repository. For example, stale locks in case of git gc could render the repository incapable of accepting changes until the lock is manually removed. :param strip_newline_in_stdout: Whether to strip the trailing ``\n`` of the command stdout. :return: * str(output) if extended_output = False (Default) * tuple(int(status), str(stdout), str(stderr)) if extended_output = True if output_stream is True, the stdout value will be your output stream: * output_stream if extended_output = False * tuple(int(status), output_stream, str(stderr)) if extended_output = True Note git is executed with LC_MESSAGES="C" to ensure consistent output regardless of system language. :raise GitCommandError: :note: If you add additional keyword arguments to the signature of this method, you must update the execute_kwargs tuple housed in this module.fullrPNCLANGUAGELC_ALLz9"kill_after_timeout" feature is not supported on Windows.rwbrJzz>Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)r+) r0cwdbufsizerrhrgr1 close_fdsr: creationflagsr rrIc|tddt|gtt}g}|j|jD]w}t |dkrP|d}|r"|t|x ttdtj }tj|||D](} tj||#t$rY%wxYwn#t$rYnwxYwdS)z"Callback method to kill a process.psz--ppid)rgr|NrSIGKILL)rrOrPROC_CREATIONFLAGSrgr.rorSrprrlsignalSIGTERMrrrset)r p child_pidsr^ local_pidsig child_pid kill_checks ra _kill_processz"Git.execute.._kill_processsXxS*0A Jx#H>>D4::<<((1,,%)ZZ\\1$5 $,,..>&--c)nn=== fi@@S!!!!+I 3////"         Fs679D,1DD, DD,DD,, D98D9)rerr  z6Timeout: the command "%s" did not complete in %d secs. stdout_valueUnion[bytes, str]rOc, rt|pdS)Nz)r )rr5s raas_textzGit.execute..as_textAs((F[-F-F[J[[rz$%s -> %d; stdout: '%s'; stderr: '%s'z%s -> %d; stdout: '%s'z%s -> %d)r rrIrJ)rrrIrO)9rrr[rrurrgetcwdaccessrOX_OKFileNotFoundErrorrcopyupdaterrrrrrl subprocessopendevnullrrr USE_SHELLr rr)rrgrhrrwrqEventTimerr rt communicatecancelis_setrzr endswith returncodeioDEFAULT_BUFFER_SIZErrr r]r rWrX)!rr^r2r;r7r3r5r8r9r4r:r1r0r6r<rqredacted_commandry inline_envcmd_not_found_exception stdout_sink istream_okrcrrwatchdogrr stderr_valuenewlinecmdstrrrs! ` @rarcz Git.execute=s#V6g>>   1d&;v&E&E&E HHSXX.// 0 0 0 #2ry{{C9SXXrw//     CCC  joo JH  4$%%%  ! JJz " " "  8&- #!-%$O. '8 #*mddwz9d/S/S/mW[\^\fhlWmWm   *)J L          6 ("4'1ECT^"#50  $  D&x55DKx55DKK ' E E E$%5s;; D E  5%%dG44 4      @  )"**J '9=PTPX{[[[H*- *- ,7$$%! $%1NN$$$-1-=-=-?-?* l%1OO%%%!((**G'bHH%566.f(  2G+7+>+>v+F+FL((1156M5#/#4L((115#/#4L3A!tnWXFXFX^`^tDKGGG#{//11 #{//11 ((115#/#4L K      K       K      K        F * *XX.//F \ \ \ \ \ \  5:GL)) --  516677>}} ~%m++,5!DL$,775(,tUU344 , }}.//e##(9(9%,T]]]]EE:;; rc g}|D][\}}t|ttfr |D]}|||||z }A|||||z }\|S)z=Transforms Python style kwargs into git command line options.)rrWrnrmr)rrKrHrerrrs rarLzGit.transform_kwargssLLNN N NDAq!dE]++ NVVED00E;TUUUDDV,,Q3LMMM rarg_listrcg}t|ttfr.|D]*}|||+n"|t ||Sr)rWrnrmextend _unpack_argsrprO)rroutlistargs rarzGit._unpack_argssu hu . . * 6 6s//445555 6 NN3x== ) ) )r'Git'c .|jdddi||_|S)anSpecify command line options to the git executable for a subcommand call :param kwargs: is a dict of keyword arguments. these arguments are passed as in _call_process but will be passed to the git command rather than the subcommand. ``Examples``:: git(work_tree='/tmp').difftool()rKTr)rLrrMs ra__call__z Git.__call__s*2D1[[D[TZ[[ rmethodrecdSrrrrrerHs rarGzGit._call_processrdr'Git.AutoInterrupt'cdSrr)rrr2r3rerHs rarGzGit._call_processrmrJUnion[str, bytes, Tuple[int, Union[str, bytes], str], 'Git.AutoInterrupt']cdSrrrs rarGzGit._call_processs  rc d|D}d|D}|dd}|jd i|}|d|D}|||z} nk ||} n6#t $r)} t d|dt |d| d} ~ wwxYw|d| d z|z|| d zdz} |jg} | j|j | j|j d |_ | j t|| j| |j | fi|S) aRun the given git command with the specified arguments and return the result as a String :param method: is the command. Contained "_" characters will be converted to dashes, such as in 'ls_files' to call 'ls-files'. :param args: is the list of arguments. If None is included, it will be pruned. This allows your commands to call git more conveniently as None is realized as non-existent :param kwargs: It contains key-values for the following: - the :meth:`execute()` kwds, as listed in :var:`execute_kwargs`; - "command options" to be converted by :meth:`transform_kwargs()`; - the `'insert_kwargs_after'` key which its value must match one of ``*args`` and any cmd-options will be appended after the matched arg. Examples:: git.rev_list('master', max_count=10, header=True) turns into:: git rev-list max-count 10 --header master :return: Same as ``execute`` if no args given used execute default (esp. as_process = False, stdout_as_string = True) and return strc,i|]\}}|tv||Srexecute_kwargsrrrs rarz%Git._call_process..s(NNN1!~:M:Mq!:M:M:Mrc,i|]\}}|tv||Srrrs rarz%Git._call_process..s(RRR1!>:Q:Qq!:Q:Q:Qrinsert_kwargs_afterNcg|]}||Srr)ras rarz%Git._call_process..s%G%G%GAarzCouldn't find argument 'z ' in args z to insert cmd options afterrr)rpoprLrindexrrOrrrrrprrc) rrrerH exec_kwargs opts_kwargsinsert_after_this_argopt_argsext_args args_listrrrs rarGzGit._call_processsFON NNN RR RRR +0Et L L)4(77;77$$%G%G%G%G%GHH ( 8+II  '<==    j,,,c(mmmm=  !519-88EAIKK;PPI./  D0111  D%&&& GFOO$$$ It|D00K000sB C($C  C header_lineTuple[str, str, int]c|}t|dkrS|s$td|ztd|dd|t|ddkrtd|z|d|dt |d fS) z :param header_line: type_string size_as_int :return: (hex_sha, type_string, size_as_int) :raise ValueError: if the header contains indication for an error due to incorrect input shaz+SHA could not be resolved, git returned: %rzSHA rz& could not be resolved, git returned: (zFailed to parse header: %rrrQ)ror.rstripr)rrtokenss ra_parse_object_headerzGit._parse_object_header%s""$$ v;;!   v !NR]RcRcReRe!fggg jU[\]U^U^U^`k`q`q`s`s`s!tuuu vay>>R  9KGHH Hq 6!9c&)nn55rrefrct|tr|d}n't|tst|}n|}|ds|dz }|t S)Nasciir)rWrXrYrOrrzr )rrrefstrs ra _prepare_refzGit._prepare_ref;sz c5 ! ! **W--FFC%% XXFFFt$$  dNF}}V$$$r attr_namecmd_namect||}||Stdd}|||j|g|Ri|}t |||t d|}|S)NT)r2r3rd)rlrrrGrr))rrrrerHcur_valrcmds ra_get_persistent_cmdzGit._get_persistent_cmdIs$ **  N"$77v d r?r@rArBrCrDrErFrGr9rHrIrJ)rrOrIrO)r)rrrrrIr)rrrrrrrIrJ)N __future__rr contextlibrrloggingrrrrrrrrqtextwrapr git.compatr r r r rgit.excrgit.utilrrrrexcrrrrutilrrtypingrrrrrr r!r"r#r$r%r&r'r(r)r* git.typesr+r,r- git.repo.baser.git.diffr/r getLoggerrr[ addHandler NullHandler__all__rrrrCREATE_NO_WINDOWCREATE_NEW_PROCESS_GROUPrr=rrrars #""""" %%%%%%  111111111111! TTTTTTTTTTTT\\\\\\\\\\\\&-,,,,,,,,,#""""""""""""  g!!"w"$$%%% &^b-1qqqqqh$$$$MMMMM ?EKz:::! \\\\\)\\\\\r