
    dvS                         d Z ddlmZmZ ddlmZmZ ddlmZ ddl	m
Z
mZmZmZ ddlmZmZmZmZmZmZ  G d d	e          Z G d
 de          Z G d de          Z G d de          ZdS )zTests for patch.py.    )BytesIOStringIO)SkipTestTestCase   )MemoryObjectStore)S_IFGITLINKBlobCommitTree)get_summarygit_am_patch_splitwrite_blob_diffwrite_commit_patchwrite_object_diffwrite_tree_diffc                       e Zd Zd ZdS )WriteCommitPatchTestsc                    t                      }t                      }dx|_        |_        dx|_        |_        dx|_        |_        d|_        t                      j
        |_        t          ||ddd           |                    d           |                                }|                     |d                             d	                     |                     |d
         d           |                     |d                             d                     |                     g d|dd                    |                     ddg|dd                     t%          |          dk    r|                     |d         d           d S d S )N   Jelmer <jelmer@samba.org>CKr   4   This is the first line
And this is the second line.
s   CONTENTS)   r   custom)versions-   From 0b0d34d1b5b596c928adc9a727a4b9e03d025298r   s    From: Jelmer <jelmer@samba.org>
r   s   Date: )s,   Subject: [PATCH 1/1] This is the first line
s   And this is the second line.
   
r   s   ---
      s   CONTENTS-- 
s   custom
   s    0 files changed
)r   r   	committerauthorcommit_timeauthor_timecommit_timezoneauthor_timezonemessager   idtreer   seek	readlines
assertTrue
startswithassertEquallen)selffcliness       \/home/feoh/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/tests/test_patch.pytest_simple_bytesioz)WriteCommitPatchTests.test_simple_bytesio"   s   IIHH!==ah(22011A-M	1afhGGGG	q			!H PQQ	
 	
 	
 	q#GHHHa++I66777   !A#J		
 		
 		
 	*K8%*EEEu::U1X'<=====     N)__name__
__module____qualname__r5    r6   r4   r   r   !   s#        > > > > >r6   r   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )ReadGitAmPatchc                 l   d}t          t          |                    d                    d          \  }}}|                     d|j                   |                     d|j                   |                     d|j                   |                     d|           |                     d|           d S )N  From ff643aae102d8870cac88e8f007e70f58f3a7363 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Thu, 15 Apr 2010 15:40:28 +0200
Subject: [PATCH 1/2] Remove executable bit from prey.ico (triggers a warning).

---
 pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 pixmaps/prey.ico

-- 
1.7.0.4
utf-8"   Jelmer Vernooij <jelmer@samba.org>:   Remove executable bit from prey.ico (triggers a warning).
    pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 pixmaps/prey.ico

   1.7.0.4)r   r   decoder.   r!   r"   r'   r0   textr2   diffr   s        r4   test_extract_stringz"ReadGitAmPatch.test_extract_stringC   s     .ht{{77K7K.L.LgVV4>LLL>IIINI	
 	
 	
 	
 	
 	
 	
 	W-----r6   c                 D   d}t          t          |                    \  }}}|                     d|j                   |                     d|j                   |                     d|j                   |                     d|           |                     d|           d S )Nr>   r@   rA   rB   rC   )r   r   r.   r!   r"   r'   rE   s        r4   test_extract_bytesz!ReadGitAmPatch.test_extract_bytesc   s     .gdmm<<4>LLL>IIINI	
 	
 	
 	
 	
 	
 	
 	W-----r6   c                     d}t          t          |          d          \  }}}|                     d|j                   d S )Ns6  From ff643aae102d8870cac88e8f007e70f58f3a7363 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Thu, 15 Apr 2010 15:40:28 +0200
Subject:  [Dulwich-users] [PATCH] Added unit tests for
 dulwich.object_store.tree_lookup_path.

* dulwich/tests/test_object_store.py
  (TreeLookupPathTests): This test case contains a few tests that ensure the
   tree_lookup_path function works as expected.
---
 pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 pixmaps/prey.ico

-- 
1.7.0.4
r?      Added unit tests for dulwich.object_store.tree_lookup_path.

* dulwich/tests/test_object_store.py
  (TreeLookupPathTests): This test case contains a few tests that ensure the
   tree_lookup_path function works as expected.
)r   r   r.   r'   rE   s        r4   test_extract_spacesz"ReadGitAmPatch.test_extract_spaces   sU    " .gdmmWEE4 I		
 		
 		
 		
 		
r6   c                     d}t          t          |          d          \  }}}|                     d|j                   |                     d|j                   d S )Nsa  From ff643aae102d8870cac88e8f007e70f58f3a7363 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Thu, 15 Apr 2010 15:40:28 +0200
Subject:  [Dulwich-users] [PATCH] Added unit tests for
 dulwich.object_store.tree_lookup_path.

From: Jelmer Vernooij <jelmer@debian.org>

* dulwich/tests/test_object_store.py
  (TreeLookupPathTests): This test case contains a few tests that ensure the
   tree_lookup_path function works as expected.
---
 pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 pixmaps/prey.ico

-- 
1.7.0.4
r?   s#   Jelmer Vernooij <jelmer@debian.org>rL   )r   r   r.   r"   r'   rE   s        r4   test_extract_pseudo_from_headerz.ReadGitAmPatch.test_extract_pseudo_from_header   sn    & .gdmmWEE4?JJJ I		
 		
 		
 		
 		
r6   c                 x    d}t          t          |          d          \  }}}|                     d |           d S )Ns  From ff643aae102d8870cac88e8f007e70f58f3a7363 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Thu, 15 Apr 2010 15:40:28 +0200
Subject:  [Dulwich-users] [PATCH] Added unit tests for
 dulwich.object_store.tree_lookup_path.

From: Jelmer Vernooij <jelmer@debian.org>

---
 pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
 1 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 pixmaps/prey.ico

r?   )r   r   r.   rE   s        r4   test_extract_no_version_tailz+ReadGitAmPatch.test_extract_no_version_tail   sC     .gdmmWEE4w'''''r6   c                      t          d          )Nz@git_am_patch_split doesn't handle Mercurial patches properly yet)r   r   r   r.   )r0   expected_diffrF   r2   rG   r   s         r4   test_extract_mercurialz%ReadGitAmPatch.test_extract_mercurial   s    Q
 
 	
r6   N)	r7   r8   r9   rH   rJ   rM   rO   rQ   rT   r:   r6   r4   r<   r<   B   sq        . . .@. . .@
 
 
<
 
 
B( ( (&+( +( +( +( +(r6   r<   c                   `    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )	DiffTestsz.Tests for write_blob_diff and write_tree_diff.c           	         t                      }t          |ddt          j        d          fddt          j        d          f           |                     g d|                                                                           d S )N   foo.txt  	   old
same
   bar.txt	   new
same
s   diff --git a/foo.txt b/bar.txts   index 3b0f961..a116b51 644s   --- a/foo.txt   +++ b/bar.txt   @@ -1,2 +1,2 @@s   -old   +news    samer   r   r
   from_stringr.   getvalue
splitlinesr0   r1   s     r4   test_blob_diffzDiffTests.test_blob_diff  s    II 0 @ @A 0 @ @A	
 	
 	

 		 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c           	          t                      }t          |dddt          j        d          f           |                     g d|                                                                           d S )NNNNr[   rY   r\      diff --git a/bar.txt b/bar.txt   new file mode 644s   index 0000000..a116b51   --- /dev/nullr^   s   @@ -0,0 +1,2 @@r`   s   +samera   re   s     r4   test_blob_addzDiffTests.test_blob_add  s    II 0 @ @A	
 	
 	

 		 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c                     t                      }t          |ddt          j        d          fd           |                     g d|                                                                           d S )Nr[   rY   r\   rh   rj      deleted file mode 644s   index a116b51..0000000   --- a/bar.txt   +++ /dev/nulls   @@ -1,2 +0,0 @@   -new   -samera   re   s     r4   test_blob_removezDiffTests.test_blob_remove0  s    II 0 @ @A	
 	
 	

 		 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c           
         t                      }t                      }t          j        d          }t          j        d          }t          j        d          }t          j        d          }t          j        d          }t	                      }|                    dd|j                   |                    dd|j                   |                    d	d|j                   t	                      }	|	                    d
d|j                   |	                    dd|j                   |	                    d	d|j                   |                    d ||	|||||fD                        t          |||j        |	j                   | 	                    g d|
                                                                           d S )Ns   add
s   removed
s   unchanged
removed
s   unchanged
added
s
   unchanged
s   removed.txtrY   s   changed.txts   unchanged.txts	   added.txtc                     g | ]}|d fS Nr:   .0os     r4   
<listcomp>z,DiffTests.test_tree_diff.<locals>.<listcomp>V  s,        D	  r6   )s"   diff --git a/added.txt b/added.txtrk   s   index 0000000..76d4bb8rl   s   +++ b/added.txts   @@ -0,0 +1 @@s   +adds&   diff --git a/changed.txt b/changed.txts   index bf84e48..1be2436 644s   --- a/changed.txts   +++ b/changed.txtr_   s
    unchanged   -removeds   +addeds&   diff --git a/removed.txt b/removed.txtrp   s   index 2c3f0b3..0000000s   --- a/removed.txtrr   s   @@ -1 +0,0 @@r}   )r   r   r
   rb   r   addr(   add_objectsr   r.   rc   rd   )
r0   r1   storeaddedremovedchanged1changed2	unchangedtree1tree2s
             r4   test_tree_diffzDiffTests.test_tree_diffE  s   II!## **"<00#$;<<#$9::$^44			.%444		.%555		"E8;777		,ux000		.%555		"E8;777    	
 	
 	
 	5%(EH555  0 JJLL##%%3	
 	
 	
 	
 	
r6   c                    t                      }t                      }t                      }|                    dt          d           t                      }|                    dt          d           |                    d ||fD                        t          |||j        |j                   |                     g d|	                                
                                           d S )Ns
   asubmodule(   06d0bdd9e2e20377b3180e4986b14c8549b393e4s(   cc975646af69f279396d4d5e1379ac6af80ee637c                     g | ]}|d fS rx   r:   ry   s     r4   r|   z6DiffTests.test_tree_diff_submodule.<locals>.<listcomp>  s    ===At9===r6   )s$   diff --git a/asubmodule b/asubmodules   index 06d0bdd..cc97564 160000s   --- a/asubmodules   +++ b/asubmodules   @@ -1 +1 @@s;   -Subproject commit 06d0bdd9e2e20377b3180e4986b14c8549b393e4s;   +Subproject commit cc975646af69f279396d4d5e1379ac6af80ee637)r   r   r   r~   r	   r   r   r(   r.   rc   rd   )r0   r1   r   r   r   s        r4   test_tree_diff_submodulez"DiffTests.test_tree_diff_submodule  s    II!##		7	
 	
 	

 		7	
 	
 	

 	==uen===>>>5%(EH555   JJLL##%%	
 	
 	
 	
 	
r6   c                    t                      }t          j        d          }t          j        d          }t                      }|                    |d f|d fg           t          ||dd|j        fdd|j        f           |                     g d|                                	                                           d S )NrZ   r\   rX   rY   r[   r]   
r   r
   rb   r   r   r   r(   r.   rc   rd   r0   r1   b1b2r   s        r4   test_object_diff_blobzDiffTests.test_object_diff_blob  s    IIn--n--!##B:Dz2333uz5"%0:ube2L	
 	
 	
 		 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c                 <   t                      }t                      }t          j        d          }|                    |           t          ||ddd|j        f           |                     g d|                                	                                           d S )Nr\   rh   r[   rY   ri   )
r   r   r
   rb   
add_objectr   r(   r.   rc   rd   )r0   r1   r   r   s       r4   test_object_diff_add_blobz#DiffTests.test_object_diff_add_blob  s    II!##n--!U$6UBE8RSSS	 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c                 <   t                      }t          j        d          }t                      }|                    |           t          ||dd|j        fd           |                     g d|                                	                                           d S )Nr\   r[   rY   rh   ro   
r   r
   rb   r   r   r   r(   r.   rc   rd   r0   r1   r   r   s       r4   test_object_diff_remove_blobz&DiffTests.test_object_diff_remove_blob  s    IIn--!##!UZ$>@RSSS	 	 	 JJLL##%%	
 	
 	
 	
 	
r6   c                    t                      }t          j        d          }t          j        d          }t                      }|                    |d f|d fg           t          ||dd|j        fdd|j        fd           |                     g d|                                	                                           d S )	N    PNG

   IHDR            PNG

   IHDR        ӳ   foo.pngrY      bar.pngT)diff_binary)   diff --git a/foo.png b/bar.png   index f73e47d..06364b7 644s   --- a/foo.pngs   +++ b/bar.pngs   @@ -1,4 +1,4 @@s    PNGs    s       s   -IHDR           \ No newline at end of files   +IHDR        ӳr   r   r   s        r4   test_object_diff_bin_blob_forcez)DiffTests.test_object_diff_bin_blob_force  s    II0
 
 0
 
 "##B:Dz2333&&	
 	
 	
 	
 	    JJLL##%%#	
 	
 	
 	
 	
r6   c                    t                      }t          j        d          }t          j        d          }t                      }|                    |d f|d fg           t          ||dd|j        fdd|j        f           |                     g d|                                	                                           d S )Nr   r   r   rY   r   )r   r   s+   Binary files a/foo.png and b/bar.png differr   r   s        r4   test_object_diff_bin_blobz#DiffTests.test_object_diff_bin_blob	  s    II0
 
 0
 
 "##B:Dz2333uz5"%0:ube2L	
 	
 	
 	  
 JJLL##%%	
 	
 	
 	
 	
r6   c                 <   t                      }t          j        d          }t                      }|                    |           t          ||ddd|j        f           |                     g d|                                	                                           d S )Nr   rh   r   rY   )s   diff --git a/bar.png b/bar.pngrk   s   index 0000000..06364b7s+   Binary files /dev/null and b/bar.png differr   )r0   r1   r   r   s       r4   test_object_diff_add_bin_blobz'DiffTests.test_object_diff_add_bin_blob&  s    II0
 
 "##!U$6UBE8RSSS   JJLL##%%	
 	
 	
 	
 	
r6   c                 <   t                      }t          j        d          }t                      }|                    |           t          ||dd|j        fd           |                     g d|                                	                                           d S )Nr   r   rY   rh   )s   diff --git a/foo.png b/foo.pngrp   s   index f73e47d..0000000s+   Binary files a/foo.png and /dev/null differr   r   s       r4    test_object_diff_remove_bin_blobz*DiffTests.test_object_diff_remove_bin_blob;  s    II0
 
 "##!UZ$>@RSSS   JJLL##%%	
 	
 	
 	
 	
r6   c                 <   t                      }t          j        d          }t                      }|                    |           t          ||dd|j        fd           |                     g d|                                	                                           d S )Nr\   r[   rY   )r[   i   r   )
rj   s   old file mode 644s   new file mode 160000s   index a116b51..06d0bdd 160000rq   r^   s   @@ -1,2 +1 @@rs   rt   s;   +Subproject commit 06d0bdd9e2e20377b3180e4986b14c8549b393e4r   r   s       r4   test_object_diff_kind_changez&DiffTests.test_object_diff_kind_changeP  s    IIn--!##&			
 		
 		
 	   JJLL##%%	
 	
 	
 	
 	
r6   N)r7   r8   r9   __doc__rf   rm   ru   r   r   r   r   r   r   r   r   r   r   r:   r6   r4   rV   rV     s        88
 
 
*
 
 
*
 
 
*9
 9
 9
v
 
 
<
 
 
.
 
 
(
 
 
(*
 *
 *
X
 
 
:
 
 
*
 
 
*
 
 
 
 
r6   rV   c                       e Zd Zd ZdS )GetSummaryTestsc                     t                      }dx|_        |_        dx|_        |_        dx|_        |_        d|_        t                      j	        |_
        |                     dt          |                     d S )Nr   r   r   r   zThis-is-the-first-line)r   r!   r"   r#   r$   r%   r&   r'   r   r(   r)   r.   r   )r0   r2   s     r4   test_simplezGetSummaryTests.test_simpleq  sn    HH!==ah(22011A-M	1;q>>BBBBBr6   N)r7   r8   r9   r   r:   r6   r4   r   r   p  s(        C C C C Cr6   r   N)r   ior   r   dulwich.testsr   r   object_storer   objectsr	   r
   r   r   patchr   r   r   r   r   r   r   r<   rV   r   r:   r6   r4   <module>r      s  *                   , , , , , , , , , , , , , , 5 5 5 5 5 5 5 5 5 5 5 5M M M M M M M M M M M M M M M M> > > > >H > > >B~( ~( ~( ~( ~(X ~( ~( ~(Bj
 j
 j
 j
 j
 j
 j
 j
ZC C C C Ch C C C C Cr6   