AϮddlmZddlZddlZddlmZddlZddlmZddl Z ddl Z ddl m Z m Z ddlmZmZmZmZddlmZmZmZmZmZddlmZdd lmZmZmZmZm Z m!Z!m"Z"dd l#m$Z$dd l%m&Z&ddl'm(Z)ddl*m+Z,d d l-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5d dl6m7Z7m8Z8m9Z9d dl:m;Z;mZ>ddl?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMddlNmOZOmPZPeJrddl mQZQddlRmSZSddlTmUZUddlmVZVeMeeeWeXfZYdZZGddee)j[eZ\dS)) ExitStackN)BytesIO)S_ISLNK) force_bytesdefenc)GitCommandError CheckoutErrorGitErrorInvalidGitRepositoryError)Blob SubmoduleTreeObjectCommit) Serializable) LazyMixinLockedFDjoin_path_nativefile_contents_roto_native_path_linux unbare_repo to_bin_sha)IStream)MemoryDB) entry_key write_cache read_cacheaggressive_tree_mergewrite_tree_from_cachestat_mode_to_index_mode S_IFGITLINKrun_commit_hook)BaseIndexEntry IndexEntry StageType)TemporaryFileSwappost_clear_cache default_indexgit_working_dir)AnyBinaryIOCallableDictIOIterableIteratorListNoReturnSequence TYPE_CHECKINGTupleTypeUnion) Commit_ishPathLike)Popen)Repo) Reference)Actor) IndexFiler r&cxeZdZdZdZdZeZdhdddeedfddfd Z d e ddffd Z defd Z e defd ZdidZdeddfdZdeefdZdjdededdfdZ dkdedefdeddfdZeedhdededefddfdZedddee efddfdZedddededdfdZ e!ddde"ede#efd Z$ dld"d#d$ed%ed&e%d'e&fd(e%eeegdfd)edede ffd*Z'd+fd,e%e(e)e*fgefde#e(e)e*ffd-Z+de,eee(e)e*fffd.Z-ed/ee.ee)fde(ee)ffd0Z/d1e#e*ddfd2Z0dmd3Z1defd4Z2d5eee d6e3d7fdeee d6e3d7ffd8Z4d9edefd:Z5d;e"eee*e.dZ7e!e8dee d?e%d(e%d@ee.dee.f dAZ9d!dBdd!dfd;e"eee*e.d dndLe dMee?dfdNedOedPdQedPdRee@j@e dfdSee@j@e dfdTedeAfdUZBdLe ddfdVZCdidWZDde fdXZEde fdYZFdjd"dZd[edeGfd\ZHeddd]fdedeIefdCed(e%dedede#ee"eff d^ZJe dod`eeAdae fdHededeIefdNededdf dbZKeLjMjNddfdcee3d7dddee dfdeeeee(ed'fdfdfededeLjOf fdg ZPxZQS)pr?ad Implements an Index that can be manipulated using a native implementation in order to save git command function calls wherever possible. It provides custom merging facilities allowing to merge without actually changing your index or your working tree. This way you can perform own test-merges based on the index only without having to deal with the working copy. This is useful in case of partial working trees. ``Entries`` The index contains an entries dict whose keys are tuples of type IndexEntry to facilitate access. You may read the entries dict or manipulate it using IndexEntry instance, i.e.:: index.entries[index.entry_key(index_entry_instance)] = index_entry_instance Make sure you use index.write() once you are done manipulating the index directly before operating on it using the git command)repoversionentries_extension_data _file_pathNrAr< file_pathreturncp||_|j|_d|_|p||_dS)aInitialize this Index instance, optionally from the given ``file_path``. If no file_path is given, we will be created from the current index file. If a stream is not given, the stream will be initialized from the current repository's index on demand.N)rA_VERSIONrBrD _index_pathrE)selfrArGs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/index/base.py__init__zIndexFile.__init__|s8  } "$-$C1A1A1C1CrJattrc|dkr tj|jtj}n#t$r i|_YdSwxYw t |dd}tj|n#tj|wxYw||dStt| |dS)NrCT)stream allow_mmap) osopenrEO_RDONLYOSErrorrCrclose _deserializesuperr? _set_cache_)rMrPfdrR __class__s rNr[zIndexFile._set_cache_s 9   WT_bk::   MO tt   )"TdKKK    f % % % % % )T " " . .t 4 4 4 4 4s$.AAA..Bcl|jjrt|jjdStd)Nindexz)No git directory given to join index path)rAgit_dirrrrMs rNrLzIndexFile._index_paths4 9  O#DI$5w?? ?!"MNN NrJc|jS)z3:return: Path to the index file we are representing)rEras rNpathzIndexFile.paths rJc. |`dS#t$rYdSwxYw)z5Safely clear the entries cache so it can be recreatedN)rCAttributeErrorras rN_delete_entries_cachezIndexFile._delete_entries_caches2      DD s  rRcLt|\|_|_|_}|S)zEInitialize this instance with index values read from the given stream)rrBrCrD)rMrR _conten_shas rNrYzIndexFile._deserializes%HRSYHZHZE dlD$8+ rJcTt|jdS)zK:return: list of entries, in a sorted fashion, first by path, then by stagec|j|jfSNrcstagees rNz+IndexFile._entries_sorted..sAFAG;LrJ)key)sortedrCvaluesras rN_entries_sortedzIndexFile._entries_sorteds'dl))++1L1LMMMMrJFignore_extension_datacf|}|j}|rd}t||||Srk)rtrDr)rMrRrurCextension_datas rN _serializezIndexFile._serializes?&&((-  "!NGV^444 rJcH|jt|p|j}|dd}d} |||d}|s|n#|s|wwxYw|| ||_dSdS)aWrite the current state to our file path or to the given one :param file_path: If None, we will write to our stored file path from which we have been initialized. Otherwise we write to the given file path. Please note that this will change the file_path of this index to the one you gave. :param ignore_extension_data: If True, the TREE type extension data read in the index will not be written to disk. NOTE that no extension data is actually written. Use this if you have altered the index and would like to use git-write-tree afterwards to create a tree representing your written changes. If this data is present in the written index, git-write-tree will instead write the stored/cached tree. Alternatively, use IndexFile.write_tree() to handle this case automatically :return: self # does it? or returns None?T)writerRFN)rCrrErUrxrollbackcommit)rMrGrulfdrRoks rNrzzIndexFile.writes8 y3DO44T22   OOF$9 : : :B        'DOOO ! s A''Brhsbasecgd}||||||jj||S)aMerge the given rhs treeish into the current index, possibly taking a common base treeish into account. As opposed to the :func:`IndexFile.from_tree` method, this allows you to use an already existing tree as the left side of the merge :param rhs: treeish reference pointing to the 'other' side of the merge. :param base: optional treeish reference pointing to the common base of 'rhs' and this index which equals lhs :return: self ( containing the merge and possibly unmerged entries in case of conflicts ) :raise GitCommandError: If there is a merge conflict. The error will be raised at the first conflicting path. If you want to have proper merge resolution to be done by yourself, you have to commit the changed index ( or make a valid tree from it ) and retry with a three-way index.from_tree call.) --aggressivez-iz-m)appendrAgit read_tree)rMrrargss rN merge_treezIndexFile.merge_treesW:+G*F*F   KK    C %%% rJtree_shacd|D}t|j|}||}ttd|Dd|D}||_|S)aMerge the given treeish revisions into a new index which is returned. This method behaves like git-read-tree --aggressive when doing the merge. :param repo: The repository treeish are located in. :param tree_sha: 20 byte or 40 byte tree sha or tree objects :return: New IndexFile instance. Its path will be undefined. If you intend to write such a merged Index, supply an alternate file_path to its 'write' method.cFg|]}tt|S)rstr).0ts rN z!IndexFile.new..$s&&L&L&Laz#a&&'9'9&L&L&LrJc32K|]}|j|jfVdSrkrlrros rN z IndexFile.new..+s+99q!&!'"999999rJc3>K|]}tj|VdSrk)r% from_basers rNrz IndexFile.new..,s-??Q%a((??????rJ)rodbdictziprC)clsrArtree_sha_bytes base_entriesinstrCs rNnewz IndexFile.news'M&L8&L&L&L,TX~FF s4yy:> 99L999??,???  ; ;   rJtreeishkwargsc t|dkst|dkrtdt|zg}t|dkr*|d|dt5}|t j|j}|d|jz| ||tt|jd |j j |i||||j}|j|cd d d S#1swxYwYd S) aSMerge the given treeish revisions into a new index which is returned. The original index will remain unaltered :param repo: The repository treeish are located in. :param treeish: One, two or three Tree Objects, Commits or 40 byte hexshas. The result changes according to the amount of trees. If 1 Tree is given, it will just be read into a new index If 2 Trees are given, they will be merged into a new index using a two way merge algorithm. Tree 1 is the 'current' tree, tree 2 is the 'other' one. It behaves like a fast-forward. If 3 Trees are given, a 3-way merge will be performed with the first tree being the common ancestor of tree 2 and tree 3. Tree 2 is the 'current' tree, tree 3 is the 'other' one :param kwargs: Additional arguments passed to git-read-tree :return: New IndexFile instance. It will point to a temporary index location which does not exist anymore. If you intend to write such a merged Index, supply an alternate file_path to its 'write' method. :note: In the three-way merge case, --aggressive will be specified to automatically resolve more cases in a commonly correct manner. Specify trivial=True as kwarg to override that. As the underlying git-read-tree command takes into account the current index, it will be temporarily moved out of the way to assure there are no unsuspected interferences.rz.Please specify between 1 and 3 treeish, got %irz--resetr)dirz--index-output=%sr_N)len ValueErrorrr enter_contexttempfileNamedTemporaryFiler`nameextendr'rrrrC)rrArrarg_liststack tmp_indexr_s rN from_treezIndexFile.from_tree3sF w<<1  G q 0 0MPST[P\P\\]] ].0 w<.raise_exc~sGrJ?*[)onerrorN) Exceptionr3rrAworking_tree_dirrTsepospisabsjoinlstatrst_modereplacerWrcexistsglob_iter_expand_pathswalk)rMrrrrsrcabs_pathstresolved_pathsfroot_dirsfiles rela_files rNrzIndexFile._iter_expand_pathsvsK  x      * + + Z( /( /D4yyH9X&& -8At,, Xh'' 2:&&"**2r22222     7>>(++ C8OOWZ^fWfWf!%8!4!4>11!44TYx5H5HII55!!ffnnR444444 /*,'(I*N*N*NHH&D%%*HH !ht||B';';YGGGGGGHH  / / /&&r2....... /M( /( /s%;B== C  C "A F11"GGTprocr;filepathitemfmakeexc. fprogressread_from_stdoutc||d|d}|jm |jd|ztn#t$r}||d}~wwxYw|j|r2|j+|j}||d||S)aiWrite path to proc.stdin and make sure it processes the item, including progress. :return: stdout string :param read_from_stdout: if True, proc.stdout will be read after the item was sent to stdin. In that case, it will return None :note: There is a bug in git-update-index that prevents it from sending reports just in time. This is why we have a version that tries to read stdout and one which doesn't. In fact, the stdout is not important as the piped-in files are processed anyway and just in time :note: Newlines are essential here, gits behaviour is somewhat inconsistent on this depending on the version, hence we try our best to deal with newlines carefully. Usually the last newline will not be sent, instead we will close stdin to break the pipe.FNz%s T) stdinrzencoderIOErrorflushstdoutreadlinestrip) rMrrrrrrrvalros rN_write_path_to_stdinzIndexFile._write_path_to_stdins.  (E4(((!% : ! (   &8"3!;!;F!C!CDDDD ( ( (hjja' ( J       2 7;''))//11D (D$''' s5A A( A##A(cdS)NTrrs rNrpzIndexFile.sdrJ predicatec#K|jD]@}||j}|j|_|j|f}||r|VAdS)aR :return: Iterator yielding tuples of Blob objects and stages, tuple(stage, Blob) :param predicate: Function(t) returning True if tuple(stage, Blob) should be yielded by the iterator. A default filter, the BlobFilter, allows you to yield blobs only if they match a given list of paths.N)rCrsto_blobrAsizerm)rMrentrybloboutputs rN iter_blobszIndexFile.iter_blobsss\((**  E==++D DIk4(Fy      rJcd}i}||D]5\}}||jg||f6|D]}||S)a :return: Dict(path : list( tuple( stage, Blob, ...))), being a dictionary associating a path in the index with a list containing sorted stage/blob pairs :note: Blobs that have been removed in one side simply do not exist in the given stage. I.e. a file removed on the 'other' branch whose entries are at stage 3 will not have a stage 3 entry. c|ddkS)Nrrrs rNrpz*IndexFile.unmerged_blobs..sQqTQYrJ)r setdefaultrcrrssort)rMis_unmerged_blobpath_maprmrlines rNunmerged_blobszIndexFile.unmerged_blobss/.AC??+;<< E EKE4    2 . . 5 5udm D D D DOO%%  D IIKKKKrJrct|Srk)r)rrs rNrzIndexFile.entry_keys %  rJrc|D]y}|jdf}||jvr$tdt|jzdD]"} |j|j|f=#t$rYwxYwt j||j|<z|S)aFResolve the blobs given in blob iterator. This will effectively remove the index entries of the respective path at all non-null stages and add the given blob as new stage null blob. For each path there may only be one blob, otherwise a ValueError will be raised claiming the path is already at stage 0. :raise ValueError: if one of the blobs already existed at stage 0 :return: self :note: You will have to write the index manually once you are done, i.e. index.resolve_blobs(blobs).write() rz!Path %r already exists at stage 0)rrFr)rcrCrrKeyErrorr% from_blob)rMrrstage_null_keyrms rN resolve_blobszIndexFile.resolve_blobss F FD"i^N-- !Ds49~~!UVVV#   di%788D ,6+?+E+EDL ( ( sA AAc.||S)zReread the contents of our index file, discarding all cached information we might have. :note: This is a possibly dangerious operations as it will discard your changes to index.entries :return: self)rfras rNupdatezIndexFile.update's ""$$$ rJc Ht}|}t||tdt |\}}|||jjt|j|d}||_ |S)aWrites this index to a corresponding Tree object into the repository's object database and return it. :return: Tree object representing this index :note: The tree will be written even if one or more objects the tree refers to does not yet exist in the object database. This could happen if you added Entries to the index directly. :raise ValueError: if there are no entries in the cache :raise UnmergedEntriesError:rrrc) rrtr slicer stream_copysha_iterrArr_cache)rMmdbrCbinsha tree_items root_trees rN write_treezIndexFile.write_tree2sjj&&((27Cq#g,,AWAWXX    666F444 % rJrzgit_diff.Diffablezgit_diff.Diffable.Indexcz |||n#t$rYnwxYw|Srk)popr_ IndexError)rMrs rN_process_diff_argszIndexFile._process_diff_argsKsO  HHTZZ%% & & & &    D  s (+ 88rcchtj|s|S|jjrt dt |t |jjstd|d|jjtj ||jjS)z :return: Version of path relative to our git directory or raise ValueError if it is not within our git directoryzrequire non-bare repositoryzAbsolute path z is not in git repository at ) rrrAbarer r startswithrrrTrcrelpath)rMrcs rN_to_relative_pathzIndexFile._to_relative_pathVsy K 9> K+,IJJ J4yy##C (B$C$CDD u*RVRVRVX\XaXrXrstt twtTY%?@@@rJitemsr cg}g}t|ttjfr|g}|D]}t|ttjfr)|||Lt|t tfr(|tj |t|tr||td|z||fS)z?Split the items into two lists of path strings and BaseEntries.zInvalid Type: %r) isinstancerrTr:rr r r r$r TypeError)rMr rrCrs rN_preprocess_add_itemszIndexFile._preprocess_add_itemsbs ec2;/ 0 0 GE ; ;D$bk 233 ; T33D99::::D4"344 ;~7==>>>>D.11 ;t$$$$ 2T 9:::g~rJctj}t|jrfd}nfd}|5}|d|jjttj |j |}|ddddn #1swxYwYtt|j|j dtfS)zStore file at filepath in the database and return the base index entry Needs the git_working_dir decorator active ! This must be assured in the calling codecntttjtS)N)encoding)rrrTreadlinkrrsrNrpz'IndexFile._store_path..~s('+bkZbNcNcntBuBuBu:v:vrJc$tdSNrb)rUrsrNrpz'IndexFile._store_path..s$x"6"6rJFTNr)rTrrrrArstorerr typest_sizer$r!rr)rMrrr open_streamrRistreams ` rN _store_pathzIndexFile._store_pathxs*Xh   2:   72v2v2v2vKK6666K []] 0f Ihx 0 0 0im))'$)RZ*P*PQQG Ihh / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' 33$X..     sAB##B'*B' path_rewriterrCc g}|r|D]}tj|r4|}|tt|jjdzd}n-|}|jjrtj|jj|}t|jtjttj |j t|} |tj| |dd=t|dksJ||D]+} ||| |,|S)Nrr)rrrrrArrr NULL_BIN_SHAr!rTstatrrrr$rrr) rMrrrrC entries_addedrcabspathgitrelative_pathrrs rN_entries_for_pathszIndexFile._entries_for_pathssf/1   ? ?9T??Y"G'+CDI4N0O0O,P,PST,T,V,V'W$$'+$y1Y"%(49+EGW"X"XI%+BGG,<,<,DEE()9:: ~7==>>>>aaa=!!Q&&&&//66 H HH  !1!1(I!F!F G G G GrJcdSrkrrs rNrpzIndexFile.DrJforcerzwrite_extension_datac ||\}g}|r+||||rdD} | rtddt Dr t d fd } | ||rCt D]3\} } t | j| j| j || f| <4t D]/\} } | v}|s$| j d | | j d | 0||D]%} tj | |j | j d f<&|r|| |S)a5Add files from the working tree, specific blobs or BaseIndexEntries to the index. :param items: Multiple types of items are supported, types can be mixed within one call. Different types imply a different handling. File paths may generally be relative or absolute. - path string strings denote a relative or absolute path into the repository pointing to an existing file, i.e. CHANGES, lib/myfile.ext, '/home/gitrepo/lib/myfile.ext'. Absolute paths must start with working tree directory of this index's repository to be considered valid. For example, if it was initialized with a non-normalized path, like `/root/repo/../repo`, absolute paths to be added must start with `/root/repo/../repo`. Paths provided like this must exist. When added, they will be written into the object database. PathStrings may contain globs, such as 'lib/__init__*' or can be directories like 'lib', the latter ones will add all the files within the directory and subdirectories. This equals a straight git-add. They are added at stage 0 - Blob or Submodule object Blobs are added as they are assuming a valid mode is set. The file they refer to may or may not exist in the file system, but must be a path relative to our repository. If their sha is null ( 40*0 ), their path must exist in the file system relative to the git repository as an object will be created from the data at the path. The handling now very much equals the way string paths are processed, except that the mode you have set will be kept. This allows you to create symlinks by settings the mode respectively and writing the target of the symlink directly into the file. This equals a default Linux-Symlink which is not dereferenced automatically, except that it can be created on filesystems not supporting it as well. Please note that globs or directories are not allowed in Blob objects. They are added at stage 0 - BaseIndexEntry or type Handling equals the one of Blob objects, but the stage may be explicitly set. Please note that Index Entries require binary sha's. :param force: **CURRENTLY INEFFECTIVE** If True, otherwise ignored or excluded files will be added anyway. As opposed to the git-add command, we enable this flag by default as the API user usually wants the item to be added even though they might be excluded. :param fprogress: Function with signature f(path, done=False, item=item) called for each path to be added, one time once it is about to be added where done==False and once after it was added where done=True. item is set to the actual item we handle, either a Path or a BaseIndexEntry Please note that the processed path is not guaranteed to be present in the index already as the index is currently being processed. :param path_rewriter: Function with signature (string) func(BaseIndexEntry) function returning a path for each passed entry which is the path to be actually recorded for the object created from entry.path. This allows you to write an index which is not identical to the layout of the actual files on your hard-disk. If not None and ``items`` contain plain paths, these paths will be converted to Entries beforehand and passed to the path_rewriter. Please note that entry.path is relative to the git repository. :param write: If True, the index will be written once it was altered. Otherwise the changes only exist in memory and are not available to git commands. :param write_extension_data: If True, extension data will be written back to the index. This can lead to issues in case it is containing the 'TREE' extension, which will cause the `git commit` command to write an old tree, instead of a new one representing the now changed index. This doesn't matter if you use `IndexFile.commit()`, which ignores the `TREE` extension altogether. You should set it to True if you intend to use `IndexFile.commit()` exclusively while maintaining support for third-party extensions. Besides that, you can usually safely ignore the built-in extensions when using GitPython on repositories that are not handled manually at all. All current built-in extensions are listed here: http://opensource.apple.com/source/Git/Git-26/src/git-htmldocs/technical/index-format.txt :return: List(BaseIndexEntries) representing the entries just actually added. :raise OSError: if a supplied Path did not exist. Please note that BaseIndexEntry Objects that do not have a null sha will be added even if their paths do not exist. c(g|]}|jdk |S)r)moders rNrz!IndexFile.add../s C C Cqqv{{{{{rJzXAt least one Entry has a null-mode - please use index.remove to remove files for claritycBg|]\}}|jtjk|Sr)rrr )riros rNrz!IndexFile.add..8s,#h#h#h$!QTZTgHgHgAHgHgHgrJrMr?rHNcD]O}|}||j}t|j|j|j|jf|<PdSrk)rrcr$r-rrm)rMei null_entry new_entryrCrnull_entries_indicess rNhandle_null_entriesz*IndexFile.add..handle_null_entries;sn2  %,R[ $($4$4Z_i$P$P '5 * ) 0 * 0 * ''  rJFTr)ru)rMr?rHN)rrr%r enumerater*r$r-rrmrcr%rrCrz)rMr r)rrrzr*rr"null_mode_entriesr5r/ror progress_sentrCr4s ` @@rNaddz IndexFile.adds#\33E::w.0   d  !8!8 yZa!b!b c c c 3 * C CG C C C    n$i#h)G2D2D#h#h#h # *        ! "$#D)))  _%g..__DAq!/17MMZ[L\L\0]!^!^GAJJ &g.. 7 75 !%9 9 $7Iej%777Iej$666   ) ) ) # H HE,6,@,G,GDL%*a ) )  G JJ1E-EJ F F FrJcg}t|ttjfr|g}|D]}t|tt t ffr.|||j St|tr)|||td|z|S)z|Returns a list of repo-relative paths from the given items which may be absolute or relative paths, entries or blobszInvalid item type: %r) r rrTr:r$r r rr rcr)rMr rrs rN_items_to_rela_pathszIndexFile._items_to_rela_pathsos  ec2;/ 0 0 GE @ @D$$ 1B CDD @ T33DI>>????D#&& @ T33D99:::: 7$ >??? rJ working_treec g}|s|d|d||}|jjj||fi|}d|DS)aRemove the given items from the index and optionally from the working tree as well. :param items: Multiple types of items are supported which may be be freely mixed. - path string Remove the given path at all stages. If it is a directory, you must specify the r=True keyword argument to remove all file entries below it. If absolute paths are given, they will be converted to a path relative to the git repository directory containing the working tree The path string may include globs, such as \*.c. - Blob Object Only the path portion is used in this case. - BaseIndexEntry or compatible type The only relevant information here Yis the path. The stage is ignored. :param working_tree: If True, the entry will also be removed from the working tree, physically removing the respective file. This may fail if there are uncommitted changes in it. :param kwargs: Additional keyword arguments to be passed to git-rm, such as 'r' to allow recursive removal of :return: List(path_string, ...) list of repository relative paths that have been removed effectively. This is interesting to know in case you have provided a directory or globs. Paths are relative to the repository.z--cachedz--c"g|] }|dd S)r)rps rNrz$IndexFile.remove..s ///A!B$///rJ)rr;rArrm splitlines)rMr r<rrr removed_pathss rNremovezIndexFile.removesV $ KK # # # D))%00( (u????JJLL 0/////rJ skip_errorsc g}|r|d||}t|dkrtd|d|dd}d|d<g}|jjj||fi|}ttt|dz t|D]n} ||  d} t| dksJd || z|| d d d| d fo|r|S|d|jjj||fi||S) aMRename/move the items, whereas the last item is considered the destination of the move operation. If the destination is a file, the first item ( of two ) must be a file as well. If the destination is a directory, it may be preceded by one or more directories or files. The working tree will be affected in non-bare repositories. :parma items: Multiple types of items are supported, please see the 'remove' method for reference. :param skip_errors: If True, errors such as ones resulting from missing source files will be skipped. :param kwargs: Additional arguments you would like to pass to git-mv, such as dry_run or force. :return: List(tuple(source_path_string, destination_path_string), ...) A list of pairs, containing the source file moved as well as its actual destination. Relative to the repository root. :raise ValueError: If only one item was given :raise GitCommandError: If git could not handle your requestz-krFzLPlease provide at least one source and one destination of the move operationdry_runnNTz to zToo many tokens in %sr r) rr;rrrrArmvrCrangeintsplit) rMr rFrrr was_dry_runoutmvlineslntokenss rNmovezIndexFile.moves>   KK   ))%00 u::>>kll ljjFJJsD,A,ABB  y"$)-"499&99DDFFCLL1,--s7||<< 3 3BR[&&v..Fv;;!###% committer author_date commit_date skip_hooksc z|sptd|||td|||}||} t j|j| ||||||| } |std|| S)aCommit the current default index file, creating a commit object. For more information on the arguments, see Commit.create_from_tree(). :note: If you have manually altered the .entries member of this instance, don't forget to write() your changes to disk beforehand. Passing skip_hooks=True is the equivalent of using `-n` or `--no-verify` on the command line. :return: Commit object representing the new commitz pre-commitz commit-msg)rXrYrZr[z post-commit) r#_write_commit_editmsg_commit_editmsg_filepath_read_commit_editmsg_remove_commit_editmsgrrcreate_from_treerA) rMrUrVrWrXrYrZr[r\treers rNr|zIndexFile.commits& * L$ / / /  & &w / / / L$0M0M0O0O P P P//11G  ' ' ) ) )  & I    ##     1 M4 0 0 0 rJct|d5}||tddddS#1swxYwYdS)Nwb)rUr_rzrr)rMrUcommit_editmsg_files rNr^zIndexFile._write_commit_editmsg+s $//114 8 8 > > > > > > > > > > > > > > > > > >s.AA"%A"cRtj|dSrk)rTrEr_ras rNraz IndexFile._remove_commit_editmsg/s$ $//1122222rJct|d5}|tcdddS#1swxYwYdSr)rUr_readdecoder)rMrfs rNr`zIndexFile._read_commit_editmsg2s $//114 8 8 =???rJ Popen[bytes] ignore_stdoutc|j}|r(||d}|s |jr|j}|jr-|j||S)NrJ)rrrXrriwait)rrrostdin_IOrs rN_flush_stdin_and_waitzIndexFile._flush_stdin_and_wait9s:   NN    NN    ( ([%%''F ;  K      IIKKK rJcdSrkrr's rNrpzIndexFile.Mr(rJc Pdg|rdgggdddttddffd }|d d |d <|dd d|jjji||dd dd|jD}|||St|tr|g}|jdd |d <tj |d<|jjjfi|fd}g}|D]} t|| } d } |j| dfn#t$rt| } | ds| dz } |jD]b} t| j| r9| j}|||||d ||d } cYnwxYw| s0|| | ||d || ! |d n #t*$rt-dgwxYw|||S)aCheckout the given paths or all files from the version known to the index into the working tree. :note: Be sure you have written pending changes using the ``write`` method in case you have altered the enties dictionary directly :param paths: If None, all paths in the index will be checked out. Otherwise an iterable of relative or absolute paths or a single path pointing to files or directories in the index is expected. :param force: If True, existing files will be overwritten even if they contain local modifications. If False, these will trigger a CheckoutError. :param fprogress: see :func:`IndexFile.add` for signature and explanation. The provided progress information will contain None as path and item if no explicit paths are given. Otherwise progress information will be send prior and after a file has been checked out :param kwargs: Additional arguments to be passed to git-checkout-index :return: iterable yielding paths to files which have been checked out and are guaranteed to match the version stored in the index :raise exc.CheckoutError: If at least one file failed to be checked out. This is a summary, hence it will checkout as many files as it can anyway. If one of files or directories do not exist in the index ( as opposed to the original git command who ignores them ). Raise GitCommandError if error lines could not be parsed - this truly is an exceptional state .. note:: The checkout is limited to checking out the files in the index. Files which are not in the index anymore and exist in the working tree will not be deleted. This behaviour is fundamentally different to *head.checkout*, i.e. if you want git-checkout like behaviour, use head.checkout instead of index.checkout. z--indexz--forcerrniter_checked_out_filesrHNc |j}|sdS|}|t}d}|D]}|dsG|ds1d}d}d} ||rA |dt|  |n||rS |t|| d |nk|| rA |dt|   | n|`|D]Y} || rB |dt|   | nZrtd d | r>tt|t z } td | dS) N)z already existsz is not in the cachez does not exist at stagez is unmergedzgit checkout-index: zgit-checkout-index: z is a directoryzunable to unlink old 'z already exists, no checkout'zgit-checkout-indexzMSome files could not be checked out from the index due to local modifications)stderrrirjrrCrendswithrrrfindrlistsetr )rrv stderr_IO stderr_bytesr|endingsris_a_dir unlink_issuealready_exists_issuero valid_files failed_filesfailed_reasons unknown_liness rN handle_stderrz)IndexFile.checkout..handle_stderrs I 0t(~~// !((00FG ))++  '=>>tWmGnGn0H#;L+I(}}X.. 3$++D1ACMM>1A,BCCC&--h7777663$++D\1B1BTZZPS__1T,UVVV&--l;;;;';<<3$++D1MC8L4M4M3M1M,NOOO&--.BCCCC%,,T222!A}}Q''$++Ds1vvg,>???&--a000 L%&=sFKKK "3'=#>#>\ARAR#RSS #c "   rJz--allr as_processFTc3$K|] }|jV dSrkrrs rNrz%IndexFile.checkout..s$??A??????rJz--stdinrcttdtzdjS)Nrzr{)rtupler|ri)rrsrNrpz$IndexFile.checkout..s0/Ft/TVY[_[f[k[k[m[mnnrJr/)r)rozWSome files could not be checked out from the index, probably because they didn't exist.)rr0r:rArcheckout_indexrqrCrsr r subprocessPIPErr rr}rcrrrsrr )rMrr)rrr rval_itermake_excchecked_out_filesrcco_pathpath_is_directoryfolderrrArrrrrs @@@@@rNcheckoutzIndexFile.checkoutHsud{  # KK " " "  3 3 QYHZ3 _c3 3 3 3 3 3 3 3 n = KK #$F< IdE4 ( ( (/49=/@@@D IIKKK IdD$ ' ' '??)<)<)>)>???I M$ * * * %%%  LL KK " " "#'F< *F9 /49=/????DnnnnnH02  6 6.t/E/Ed/K/KLL$)! 5L'1... 5 5 5 \\F!??3//&# !%!4!4!6!655uz??55f==5 % A 55dAq(Ihm5nnn-44Q77704- 55 5)6--dGT8Yin-ooo%,,W555 **4t*DDDD"   #m "   M$ 1 2 2 2$ $s(E88B/H*)H*"I::JHEADr|r=c "t||j|}|s |j|_nl|j}|D]b}||} t |d} || |j| <9#t $r |j| =n#t $rYnwxYwY_wxYw||r||d|r<|jj |j |d|z|S)aReset the index to reflect the tree at the given commit. This will not adjust our HEAD reference as opposed to HEAD.reset by default. :param commit: Revision, Reference or Commit specifying the commit we should represent. If you want to specify a tree only, use IndexFile.from_tree and overwrite the default index. :param working_tree: If True, the files in the working tree will reflect the changed index. If False, the working tree will not be touched Please note that changes to the working copy will be discarded without warning ! :param head: If True, the head will be set to the given commit. This is False by default, but if True, this method behaves like HEAD.reset. :param paths: if given as an iterable of absolute or repository-relative paths, only these will be reset to their state at the given commit'ish. The paths need to exist at the commit, otherwise an exception will be raised. :param kwargs: Additional keyword arguments passed to git-reset .. note:: IndexFile.reset, as opposed to HEAD.reset, will not delete anyfiles in order to maintain a consistent working tree. Instead, it will just checkout the files according to their state in the index. If you want git-reset like behaviour, use *HEAD.reset* instead. :return: selfrT)rr)z%s: Updating HEAD)logmsg) rrrArCr rrrzrrW set_commitr|) rMr|r<rrWrnew_instniercrqs rNresetzIndexFile.resetsIV::'' 6:: #+DLL"C  --d33#D!,,C(+CDL%% L--#   3 MMTM 2 2 2  e IN % %di&6&6v&>&>GZ]cGc % d d d s6 A:: B!B B! BB!BB! B!otherrr create_patchc |j|kr$td|z||jurt jSt|tr|j |}t|tr1| dd}| |d<|j|j||fi|S|td|ztt|j|||fi|S)aCDiff this index against the working copy or a Tree or Commit object For a documentation of the parameters and return values, see, Diffable.diff :note: Will only work with indices that represent the default git index as they have not been initialized with a stream. zECannot call %r on indices that do not represent the default git indexRFNzV>w>#>+>>>[>D4/4/Xh5G4/HU]L^4/4/4/[4/~"&&&&& & 3=) & XtX6<= && tSy &&&&RESN!5D#9":D"@A % 4( )$XtE)T/4J/K%K L.!u^Xy%HI!eT\^gTgNh!!![!!!;!!!!F    D2 5148Q3RRST  eC,d3L.MMN O     Ah A8 A A A AeHdNK$OPQ tH~tN33 4, H  n    ,%Cy% % % n% % n  %%%_[%T00>B%*vvhnkIJKvv v Xc8m4d:; v  v#v n vvvvpXxhi.W(XYYZ h*#4040hnkIJK4040 40 c 404040]40l"AAhnkIJKAA A eCHo  AAA]AL37'+*.;?;? (((j$./( ( m$ ( ' (8,c478(8,c478(( ((((T>S>T>>>>3333=c====@#@@@@    Y^    2600 q%q%T8H--.q%q% q%  q% tXh'();; < q%q%q%]q%h39"15 HHfk3./HHT8H--. H  H  H HHH]HZV^UfUlMQ" +Q+QT34fhTQR+QXtH~uXs]/CTIJ+Q +Q  +Q   +Q+Q+Q+Q+Q+Q+Q+Q+Q+QrJr?)] contextlibrrriorrTr!rrr git.compatrrgit.excrr r r git.objectsr r rrrgit.objects.utilrgit.utilrrrrrrr gitdb.basergitdb.dbrgit.diffrros.pathrcrfunrrrrr r!r"r#typr$r%r&utilr'r(r)r*typingr+r,r-r.r/r0r1r2r3r4r5r6r7r8 git.typesr9r:r;git.repor<git.refs.referencer=r>rrr__all__rr?rrJrNrs!   XWWWWWWWWWWW*)))))                     VUUUUUUUUUUU"+*******      ,,,,,, fc5( ) 6SQSQSQSQSQ 8,lSQSQSQSQSQrJ