§
    |{Èck  ã                   óŠ   — d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZ d dl	m
Z
mZ  G d„ de¦  «        Z G d„ de¦  «        ZdS )é    N)Ú
FileLockedÚGitFileÚ_fancy_rename)ÚSkipTestÚTestCasec                   óF   ‡ — e Zd Zˆ fd„Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )ÚFancyRenameTestsc                 ó  •— t          ¦   «                              ¦   «          t          j        ¦   «         | _        |                      d¦  «        | _        |                      d¦  «        | _        |                      | j        d¦  «         d S )NÚfooÚbaró   foo contents)	ÚsuperÚsetUpÚtempfileÚmkdtempÚ_tempdirÚpathr   r   Úcreate©ÚselfÚ	__class__s    €ú9/usr/lib/python3/dist-packages/dulwich/tests/test_file.pyr   zFancyRenameTests.setUp#   sf   ø€ Ý‰Œ�Š‰ŒˆÝ Ô(Ñ*Ô*ˆŒØ—9’9˜UÑ#Ô#ˆŒØ—9’9˜UÑ#Ô#ˆŒØ�Š�D”H˜oÑ.Ô.Ð.Ð.Ð.ó    c                 óz   •— t          j        | j        ¦  «         t          ¦   «                              ¦   «          d S ©N©ÚshutilÚrmtreer   r   ÚtearDownr   s    €r   r   zFancyRenameTests.tearDown*   ó1   ø€ ÝŒ�d”mÑ$Ô$Ð$Ý‰Œ×ÒÑÔÐÐÐr   c                 óL   — t           j                             | j        |¦  «        S r   ©Úosr   Újoinr   ©r   Úfilenames     r   r   zFancyRenameTests.path.   ó   € ÝŒw�|Š|˜DœM¨8Ñ4Ô4Ð4r   c                 óx   — t          |d¦  «        }|                     |¦  «         |                     ¦   «          d S )NÚwb)ÚopenÚwriteÚclose)r   r   ÚcontentsÚfs       r   r   zFancyRenameTests.create1   s4   € Ý��tÑÔˆØ	�Š�ÑÔÐØ	�Š‰	Œ	ˆ	ˆ	ˆ	r   c                 ó¸  — |                       t          j                             | j        ¦  «        ¦  «         t          | j        | j        ¦  «         |                       t          j                             | j        ¦  «        ¦  «         t          | j        d¦  «        }|                      d| 	                    ¦   «         ¦  «         | 
                    ¦   «          d S )NÚrbr   )ÚassertFalser#   r   Úexistsr   r   r   r*   ÚassertEqualÚreadr,   ©r   Únew_fs     r   Útest_no_dest_existsz$FancyRenameTests.test_no_dest_exists6   sž   € Ø×Ò�œŸš¨¬Ñ1Ô1Ñ2Ô2Ð2Ý�d”h ¤Ñ)Ô)Ð)Ø×Ò�œŸš¨¬Ñ1Ô1Ñ2Ô2Ð2å�T”X˜tÑ$Ô$ˆØ×Ò˜¨%¯*ª*©,¬,Ñ7Ô7Ð7Ø�Š‰Œˆˆˆr   c                 ó€  — |                       | j        d¦  «         t          | j        | j        ¦  «         |                      t
          j                             | j        ¦  «        ¦  «         t          | j        d¦  «        }|  	                    d| 
                    ¦   «         ¦  «         |                     ¦   «          d S )Nó   bar contentsr0   r   )r   r   r   r   r1   r#   r   r2   r*   r3   r4   r,   r5   s     r   Útest_dest_existsz!FancyRenameTests.test_dest_exists?   s�   € Ø�Š�D”H˜oÑ.Ô.Ð.Ý�d”h ¤Ñ)Ô)Ð)Ø×Ò�œŸš¨¬Ñ1Ô1Ñ2Ô2Ð2å�T”X˜tÑ$Ô$ˆØ×Ò˜¨%¯*ª*©,¬,Ñ7Ô7Ð7Ø�Š‰Œˆˆˆr   c                 óò  — t           j        dk    rt          d¦  «        ‚|                      | j        d¦  «         t          | j        d¦  «        }|                      t          t          | j	        | j        ¦  «         | 
                    ¦   «          |                      t          j                             |                      d¦  «        ¦  «        ¦  «         t          | j	        d¦  «        }|                      d|                     ¦   «         ¦  «         | 
                    ¦   «          t          | j        d¦  «        }|                      d|                     ¦   «         ¦  «         | 
                    ¦   «          d S )NÚwin32z&platform allows overwriting open filesr9   r0   r   r   )ÚsysÚplatformr   r   r   r*   ÚassertRaisesÚOSErrorr   r   r,   Ú
assertTruer#   r   r2   r3   r4   )r   Údest_fr6   s      r   Útest_dest_openedz!FancyRenameTests.test_dest_openedH   s  € ÝŒ<˜7Ò"Ð"ÝÐCÑDÔDÐDØ�Š�D”H˜oÑ.Ô.Ð.Ý�d”h Ñ%Ô%ˆØ×Ò�'¥=°$´(¸D¼HÑEÔEÐEØ�Š‰ŒˆØ�Š�œŸš t§y¢y°Ñ'7Ô'7Ñ8Ô8Ñ9Ô9Ð9å�T”X˜tÑ$Ô$ˆØ×Ò˜¨%¯*ª*©,¬,Ñ7Ô7Ð7Ø�Š‰Œˆå�T”X˜tÑ$Ô$ˆØ×Ò˜¨%¯*ª*©,¬,Ñ7Ô7Ð7Ø�Š‰Œˆˆˆr   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r7   r:   rC   Ú__classcell__©r   s   @r   r	   r	   "   sœ   ø€ € € € € ð/ð /ð /ð /ð /ðð ð ð ð ð5ð 5ð 5ðð ð ð
ð ð ðð ð ðð ð ð ð ð ð r   r	   c                   ó^   ‡ — e Zd Zˆ fd„Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zˆ xZS )ÚGitFileTestsc                 ó  •— t          ¦   «                              ¦   «          t          j        ¦   «         | _        t          |                      d¦  «        d¦  «        }|                     d¦  «         |                     ¦   «          d S )Nr   r)   r   )	r   r   r   r   r   r*   r   r+   r,   )r   r.   r   s     €r   r   zGitFileTests.setUp[   sb   ø€ Ý‰Œ�Š‰ŒˆÝ Ô(Ñ*Ô*ˆŒÝ�—’˜5Ñ!Ô! 4Ñ(Ô(ˆØ	�Š�Ñ Ô Ð Ø	�Š‰	Œ	ˆ	ˆ	ˆ	r   c                 óz   •— t          j        | j        ¦  «         t          ¦   «                              ¦   «          d S r   r   r   s    €r   r   zGitFileTests.tearDownb   r    r   c                 óL   — t           j                             | j        |¦  «        S r   r"   r%   s     r   r   zGitFileTests.pathf   r'   r   c                 óŽ  — |                       d¦  «        }|                      t          t          |d¬¦  «         |                      t          t          |d¬¦  «         |                      t          t          |d¬¦  «         |                      t          t          |d¬¦  «         |                      t          t          |d¬¦  «         d S )Nr   Úr)ÚmodeÚabzr+bzw+bza+bU)r   r?   ÚIOErrorr   )r   r   s     r   Útest_invalidzGitFileTests.test_invalidi   sª   € Ø�iŠi˜ÑÔˆØ×Ò�'¥7¨C°cÐÑ:Ô:Ð:Ø×Ò�'¥7¨C°dÐÑ;Ô;Ð;Ø×Ò�'¥7¨C°eÐÑ<Ô<Ð<Ø×Ò�'¥7¨C°eÐÑ<Ô<Ð<Ø×Ò�'¥7¨C°fÐÑ=Ô=Ð=Ð=Ð=r   c                 óÎ  — t          |                      d¦  «        d¦  «        }|                      |t          j        ¦  «         |                      d|                     ¦   «         ¦  «         |                      d|                     ¦   «         ¦  «         |                     d¦  «         |                      d|                     ¦   «         ¦  «         |                     ¦   «          d S )Nr   r0   r   r   é   ó   contents)	r   r   ÚassertIsInstanceÚioÚIOBaser3   r4   Úseekr,   ©r   r.   s     r   Útest_readonlyzGitFileTests.test_readonlyq   s¯   € Ý�D—I’I˜eÑ$Ô$ dÑ+Ô+ˆØ×Ò˜a¥¤Ñ+Ô+Ð+Ø×Ò˜¨!¯&ª&©(¬(Ñ3Ô3Ð3Ø×Ò˜˜aŸfšf™hœhÑ'Ô'Ð'Ø	�Šˆq‰	Œ	ˆ	Ø×Ò˜ a§f¢f¡h¤hÑ/Ô/Ð/Ø	�Š‰	Œ	ˆ	ˆ	ˆ	r   c                 óÂ   — t          |                      d¦  «        ¦  «        }|                      d|                     ¦   «         ¦  «         |                     ¦   «          d S )Nr   r   )r   r   r3   r4   r,   r[   s     r   Útest_default_modezGitFileTests.test_default_modez   sJ   € Ý�D—I’I˜eÑ$Ô$Ñ%Ô%ˆØ×Ò˜¨!¯&ª&©(¬(Ñ3Ô3Ð3Ø	�Š‰	Œ	ˆ	ˆ	ˆ	r   c                 óÔ  — |                       d¦  «        }d|z  }t          |d¦  «        }|                      |                     ¦   «         d¦  «         |                     ¦   «          |                      t          j                              |¦  «        ¦  «         t          |d¦  «        }|                      |j	        ¦  «         |  
                    t          t          |d¦  «         |                      t          j                              |¦  «        ¦  «         |                     d¦  «         |                     d¦  «         |                     d	¦  «         |                     ¦   «          |                      t          j                              |¦  «        ¦  «         t          |d¦  «        }|                      d
|                     ¦   «         ¦  «         |                     ¦   «          d S )Nr   ú%s.lockr0   r   r)   Únot_a_file_propertys	   new stuffrU   rV   ó   new contents)r   r*   r3   r4   r,   r1   r#   r2   r   Úclosedr?   ÚAttributeErrorÚgetattrrA   r+   rZ   )r   r   Úfoo_lockÚorig_fr.   r6   s         r   Ú
test_writezGitFileTests.test_write   st  € Ø�iŠi˜ÑÔˆØ˜s‘?ˆå�c˜4‘”ˆØ×Ò˜Ÿš™œ¨Ñ8Ô8Ð8Ø�Š‰Œˆà×Ò�œŸš¨Ñ1Ô1Ñ2Ô2Ð2Ý�C˜ÑÔˆØ×Ò˜œÑ"Ô"Ð"Ø×Ò�.­'°1Ð6KÑLÔLÐLà�Š�œŸš xÑ0Ô0Ñ1Ô1Ð1Ø	�Š�ÑÔÐØ	�Šˆq‰	Œ	ˆ	Ø	�Š�ÑÔÐØ	�Š‰	Œ	ˆ	Ø×Ò�œŸš¨Ñ1Ô1Ñ2Ô2Ð2å�S˜$‘”ˆØ×Ò˜¨%¯*ª*©,¬,Ñ7Ô7Ð7Ø�Š‰Œˆˆˆr   c                 óø  — |                       d¦  «        }t          |d¦  «        }|                     d¦  «         	 t          |d¦  «        }|                      ¦   «          |                     ¦   «          n# t
          $ r Y nw xY w|                     d¦  «         |                     ¦   «          t          |d¦  «        }|                      d|                     ¦   «         ¦  «         |                     ¦   «          d S )Nr   r)   s   news	    contentsr0   rb   )	r   r   r+   Úfailr,   r   r*   r3   r4   )r   r   Úf1Úf2r.   s        r   Útest_open_twicezGitFileTests.test_open_twice—   sç   € Ø�iŠi˜ÑÔˆÝ�S˜$ÑÔˆØ
�Š�ÑÔÐð	Ý˜˜dÑ#Ô#ˆBØ�IŠI‰KŒKˆKð �HŠH‰JŒJˆJˆJøõ ð 	ð 	ð 	ØˆDð	øøøð 	�Š�ÑÔÐØ
�Š‰
Œ
ˆ
õ ��d‰OŒOˆØ×Ò˜¨!¯&ª&©(¬(Ñ3Ô3Ð3Ø	�Š‰	Œ	ˆ	ˆ	ˆ	s   ¼$A5 Á5
BÂBc                 ót  — |                       d¦  «        }d|z  }t          |d¦  «        }|                      |                     ¦   «         d¦  «         |                     ¦   «          t          |d¦  «        }|                     d¦  «         |                     ¦   «          |                      |j	        ¦  «         |  
                    t          j                              |¦  «        ¦  «         t          |d¦  «        }|                      |                     ¦   «         d¦  «         |                     ¦   «          d S )Nr   r`   r0   r   r)   rb   )r   r*   r3   r4   r,   r   r+   ÚabortrA   rc   r1   r#   r2   )r   r   rf   rg   r.   Ú
new_orig_fs         r   Ú
test_abortzGitFileTests.test_abortª   sý   € Ø�iŠi˜ÑÔˆØ˜s‘?ˆå�c˜4‘”ˆØ×Ò˜Ÿš™œ¨Ñ8Ô8Ð8Ø�Š‰Œˆå�C˜ÑÔˆØ	�Š�Ñ Ô Ð Ø	�Š‰	Œ	ˆ	Ø�Š˜œÑ!Ô!Ð!Ø×Ò�œŸš¨Ñ1Ô1Ñ2Ô2Ð2å˜#˜t‘_”_ˆ
Ø×Ò˜ŸšÑ*Ô*¨OÑ<Ô<Ð<Ø×ÒÑÔÐÐÐr   c                 ó¨  — |                       d¦  «        }t          |d¦  «        }|                     ¦   «          	 |                     ¦   «          n$# t          $ r |                      ¦   «          Y nw xY wt          |d¦  «        }|                     ¦   «          	 |                     ¦   «          d S # t          $ r |                      ¦   «          Y d S w xY w)Nr   r)   )r   r   ro   r,   r@   rj   ©r   r   r.   s      r   Útest_abort_closezGitFileTests.test_abort_close¼   sÑ   € Ø�iŠi˜ÑÔˆÝ�C˜ÑÔˆØ	�Š‰	Œ	ˆ	ð	Ø�GŠG‰IŒIˆIˆIøÝð 	ð 	ð 	Ø�IŠI‰KŒKˆKˆKˆKð	øøøõ �C˜ÑÔˆØ	�Š‰	Œ	ˆ	ð	Ø�GŠG‰IŒIˆIˆIˆIøÝð 	ð 	ð 	Ø�IŠI‰KŒKˆKˆKˆKˆKð	øøøs#   »A ÁA1Á0A1ÂB/ Â/CÃCc                 ó  — |                       d¦  «        }t          |d¦  «        }|j                             ¦   «          t	          j        |dz   ¦  «         |                     ¦   «          |                      |j        ¦  «         d S )Nr   r)   z.lock)	r   r   Ú_filer,   r#   Úremovero   rA   Ú_closedrs   s      r   Útest_abort_close_removedz%GitFileTests.test_abort_close_removedÌ   sl   € Ø�iŠi˜ÑÔˆÝ�C˜ÑÔˆà	Œ�Š‰ŒˆÝ
Œ	�#˜‘-Ñ Ô Ð à	�Š‰	Œ	ˆ	Ø�Š˜œ	Ñ"Ô"Ð"Ð"Ð"r   )rD   rE   rF   r   r   r   rS   r\   r^   rh   rm   rq   rt   ry   rG   rH   s   @r   rJ   rJ   Z   sØ   ø€ € € € € ðð ð ð ð ðð ð ð ð ð5ð 5ð 5ð>ð >ð >ðð ð ðð ð ð
ð ð ð0ð ð ð&ð ð ð$ð ð ð #ð #ð #ð #ð #ð #ð #r   rJ   )rX   r#   r   r=   r   Údulwich.filer   r   r   Údulwich.testsr   r   r	   rJ   © r   r   ú<module>r}      sã   ðð* 
€	€	€	Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€à ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;ðð ð ð ð ð ð ð ð5ð 5ð 5ð 5ð 5�xñ 5ô 5ð 5ðpz#ð z#ð z#ð z#ð z#�8ñ z#ô z#ð z#ð z#ð z#r   