
                         b    S r SSKJr  SSKrSSKJr  SSKJrJr  SSK	J
r
Jr  Sr " S S	\5      rg)
zStash handling.    )absolute_importN)GitFile)commit_treeiter_fresh_objects)drop_reflog_entryread_reflogs
   refs/stashc                   l    \ rS rSrSr\4S jr\S 5       rS r	\
S 5       rS rS rSS
 jrS rS rSrg	)Stash&   zHA Git stash.

Note that this doesn't currently update the working tree.
c                     X l         Xl        g N_ref_repo)selfreporefs       lib/third_party/dulwich/stash.py__init__Stash.__init__,   s    	
    c                     [         R                  R                  U R                  R	                  5       S[         R
                  " U R                  5      5      $ )Nlogs)ospathjoinr   	commondirfsdecoder   r   s    r   _reflog_pathStash._reflog_path0   s8    ww||JJ  "FBKK		,B
 	
r   c                      [        U R                  S5       n[        [        [	        U5      5      5      sS S S 5        $ ! , (       d  f       g = f! [
         a    / s $ f = f)Nrb)r   r    reversedlistr   FileNotFoundError)r   fs     r   stashesStash.stashes6   sI    	**D1Q[^ 45 211  	I	s+   A ?	A 
A	A A AAc                     U " U5      $ )z&Create a new stash from a Repo object. )clsr   s     r   	from_repoStash.from_repo=   s     4yr   c                    [        U R                  S5       n[        X!SS9  SSS5        [        U 5      S:X  aB  [        R
                  " U R                  5        U R                  R                  U R                  	 gUS:X  a1  U S   R                  U R                  R                  U R                  '   gg! , (       d  f       N= f)z Drop entry with specified index.zrb+T)rewriteNr   )
openr    r   lenr   remover   refsr   new_sha)r   indexr'   s      r   drop
Stash.dropB   s    $##U+qa5 ,t9>IId''(

		*A:)-aDJJOODII&  ,+s   B33
Cc                 ,    [        U R                  5      er   )NotImplementedErrorpopr   r6   s     r   r;   	Stash.popM   s    !$((++r   Nc           	         0 nUb  XS'   Ub  X$S'   U R                   R                  5       nUR                  U R                   R                  5      nU R                   R                  " S	SUSU R                   R                  5       /SS.UD6n[        U R                   R                  [        U[        R                  " U R                   R                  5      U R                   R                  S95      nUc  SU R                   R                  5       -   nU R                   R                  5       U R                   R                  U R                  '   U R                   R                  " S	U R                  UUU/SS.UD6n	U	$ )
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commitrE   	do_commitheadr   r   r   fsencoder   r4   r   )
r   r?   r@   rB   commit_kwargsr6   index_tree_idindex_commit_idstash_tree_idcids
             r   push
Stash.pushP   sS     )2+&&,(#

%%'TZZ%<%<=**.. 
"*+
 
 $JJ##DJJOO,!ZZ44
 ?$tzz'88G &*ZZ__%6

		"jj"" 
		()
 
 
r   c                 :    [        U R                  5       5      U   $ r   )r%   r(   r<   s     r   __getitem__Stash.__getitem__   s    DLLN#E**r   c                 F    [        [        U R                  5       5      5      $ r   )r2   r%   r(   r   s    r   __len__Stash.__len__   s    4'((r   r   )NNN)__name__
__module____qualname____firstlineno____doc__DEFAULT_STASH_REFr   propertyr    r(   classmethodr-   r7   r;   rP   rS   rV   __static_attributes__r+   r   r   r
   r
   &   sX    
 "3  
 

  	9,3j+)r   r
   )r\   
__future__r   r   dulwich.filer   dulwich.indexr   r   dulwich.reflogr   r   r]   objectr
   r+   r   r   <module>rf      s3   *  & 	   : " c)F c)r   