
    .Ph                     \    d Z ddlZddlmZ ddlmZmZ ddlmZm	Z	 dZ
 G d d	          ZdS )
zStash handling.    N   )GitFile)commit_treeiter_fresh_objects)drop_reflog_entryread_reflogs
   refs/stashc                   x    e Zd ZdZefddZed             Zd Ze	d             Z
ddZd	 Zdd
Zd ZdefdZdS )StashzPA Git stash.

    Note that this doesn't currently update the working tree.
    returnNc                 "    || _         || _        d S N)_ref_repo)selfreporefs      M/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/dulwich/stash.py__init__zStash.__init__'   s    	


    c                     t           j                            | j                                        dt          j        | j                            S )Nlogs)ospathjoinr   	commondirfsdecoder   r   s    r   _reflog_pathzStash._reflog_path+   s4    w||DJ0022FBK	<R<RSSSr   c                     	 t          | j        d          5 }t          t          t	          |                              cd d d            S # 1 swxY w Y   d S # t
          $ r g cY S w xY w)Nrb)r   r   reversedlistr   FileNotFoundError)r   fs     r   stasheszStash.stashes/   s    	*D11 6Q[^^ 4 4556 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6  	 	 	III	s4   A )A A AA AA A)(A)c                      | |          S )z&Create a new stash from a Repo object. )clsr   s     r   	from_repozStash.from_repo6   s     s4yyr   c                 R   t          | j        d          5 }t          ||d           ddd           n# 1 swxY w Y   t          |           dk    r-t	          j        | j                   | j        j        | j        = dS |dk    r!| d         j	        | j        j        | j        <   dS dS )z Drop entry with specified index.zrb+T)rewriteNr   )
openr   r   lenr   remover   refsr   new_sha)r   indexr$   s      r   dropz
Stash.drop;   s    $#U++ 	6qa5555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6t99>>Id'(((
	*FA::)-aDJODI&&& :s   599c                 *    t          | j                  r   )NotImplementedErrorpopr   r1   s     r   r5   z	Stash.popF   s    !$(+++r   c           	      d   i }|||d<   |||d<   | j                                         }|                    | j         j                  } | j         j        d	d|d| j                                         gdd|}t          | j         j        t          |t          j	        | j         j
                  | j         j                            }|d| j                                         z   }| j                                         | j         j        | j        <    | j         j        d	| j        |||gdd|}	|	S )
zCreate a new stash.

        Args:
          committer: Optional committer name to use
          author: Optional author name to use
          message: Optional commit message
        N	committerauthors   Index stashT)r   treemessagemerge_heads	no_verify)object_stores   A stash on r'   )r   
open_indexcommitr>   	do_commitheadr   r   r   fsencoder   r/   r   )
r   r8   r9   r;   commit_kwargsr1   index_tree_idindex_commit_idstash_tree_idcids
             r   pushz
Stash.pushI   sa     )2M+&&,M(#
%%''TZ%<==.$*. 
"**+
 
 
 
 $J#DJO,,!Z4  
 
 ?$tz'8'88G &*Z__%6%6
	""dj" 
	()
 
 
 
 
r   c                 P    t          |                                           |         S r   )r"   r%   r6   s     r   __getitem__zStash.__getitem__~   s    DLLNN##E**r   c                 ^    t          t          |                                                     S r   )r-   r"   r%   r   s    r   __len__zStash.__len__   s     4''(((r   )r   N)NNN)__name__
__module____qualname____doc__DEFAULT_STASH_REFr   propertyr   r%   classmethodr)   r2   r5   rI   rK   intrM   r'   r   r   r
   r
   !   s         
 "3      T T XT     [	9 	9 	9 	9, , ,3 3 3 3j+ + +) ) ) ) ) ) )r   r
   )rQ   r   filer   r1   r   r   reflogr   r   rR   r
   r'   r   r   <module>rX      s   ,   				       2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2! a) a) a) a) a) a) a) a) a) a)r   