6rh9ZdZddlmZddlZddlZddlZddlmZddlm Z ddl m Z ddl mZmZmZmZmZddlmZmZerddlmZd ZejZejZGd d eZd ed efded effdZd ed efded effdZd ed efded effdZdS)z!Module containing index utilities)wrapsN) TracebackType)is_win)AnyCallable TYPE_CHECKINGOptionalType)PathLike_T) IndexFile)TemporaryFileSwappost_clear_cache default_indexgit_working_dircveZdZdZdZdeddfdZd dZdee e d ee d ee de fd Z dS) rzUtility class moving a file to a temporary location within the same directory and moving it back on to where on object deletion.) file_path tmp_file_pathrreturnNc||_t|jtjdddz|_ t j|j|jdS#t$rYdSwxYw)N)rstrtempfilemktemprosrenameOSError)selfrs /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/util.py__init__zTemporaryFileSwap.__init__*sr" 008?2r23N3NN  Idnd&8 9 9 9 9 9    DD sA A('A(c|SN)rs r __enter__zTemporaryFileSwap.__enter__3s exc_typeexc_valexc_tbctj|jrXtr2tj|jrt j|jt j|j|jdS)NF) ospisfilerrexistsrrremover)rr&r'r(s r__exit__zTemporaryFileSwap.__exit__6sb :d( ) ) : *#*T^44 * $.))) Id($. 9 9 9ur%)rr)__name__ __module__ __qualname____doc__ __slots__r r r$r r BaseExceptionrboolr.r#r%rrr#s::/I(t 4 ./ -( '        r%rfunc.rc ltdddtdtdtffd }|S)aDecorator for functions that alter the index using the git command. This would invalidate our possibly existing entries dictionary which is why it must be deleted to allow it to be lazily reread later. :note: This decorator will not be required once all functions are implemented natively which in fact is possible, but probably not feasible performance wise. rr argskwargsrcH|g|Ri|}||Sr")_delete_entries_cache)rr8r9rvalr6s rpost_clear_cache_if_not_raisedz8post_clear_cache..post_clear_cache_if_not_raisedQs9tD*4***6** ""$$$ r%rrr )r6r=s` rrrGsY 4[[[PSXZ[ *)r%c ltdddtdtdtffd }|S)zDecorator assuring the wrapped method may only run if we are the default repository index. This is as we rely on git commands that operate on that index only.rr r8r9rc|j|krtdjz|g|Ri|S)NzECannot call %r on indices that do not represent the default git index) _file_path _index_pathAssertionErrorr/)rr8r9r6s rcheck_default_indexz*default_index..check_default_indexas\ ?d..00 0 0 WZ^Zgg tD*4***6***r%r>)r6rDs` rrr\sW  4[[+++c+S+R+++++[+ r%c ltdddtdtdtffd }|S)zDecorator which changes the current working dir to the one of the git repository in order to assure relative paths are handled correctlyrr r8r9rctj}tjt|jj |g|Ri|tj|S#tj|wxYwr")rgetcwdchdirrrepoworking_tree_dir)rr8r9cur_wdr6s rset_git_working_dirz,git_working_dir..set_git_working_dirrsv TY/00111 4.t...v.. HV    BHV    s  A!!A7r>)r6rLs` rrrnsW 4[[+cSR[ r%) r2 functoolsrrstructrtypesr git.compatros.pathpathr*typingrrrr r git.typesr r git.indexr __all__packunpackobjectrrrrr#r%rrZs''  @?????????????""""""""$###### X{  H*8CG,*#r'1B*****b)hsBw.?$(37+b0Ar%