
    	^c                         d dl Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZ  G d d	e j                  Z G d
 de          Z G d de          Z G d de          Zd Zd Zd ZdS )    N   )hexnullrev)getattr)errormdiff)
repository)storageutilc                   N    e Zd Z eej        dd          sej        j        ZdS dS )basetestcaseassertRaisesRegexFN)__name__
__module____qualname__r   unittestTestCaseassertRaisesRegexpr        ;/usr/lib/python3/dist-packages/mercurial/testing/storage.pyr   r      sB        78$&95AA 
0 	
 
r   r   c                   *    e Zd ZdZd Zd Zd Zd ZdS )ifileindextestszGeneric tests for the ifileindex interface.

    All file storage backends for index data should conform to the tests in this
    class.

    Use ``makeifileindextests()`` to create an instance of this type.
    c                 p   |                                  }|                     t          |          dd           |                     t          |          g d           t	          |          }|                     t                    5  t          |           d d d            n# 1 swxY w Y   |                     |	                    d                      |                     |	                    d                     |                     |	                    t                               |                     |	                    |j                             |                     |	                    d                     |                     |	                    d                     |                     t          |                                          g            t	          |                                          }|                     t                    5  t          |           d d d            n# 1 swxY w Y   |                     t          |                    d                    g            |                     |                    |j                  |j        |j        f           |                     |                    t                    t          t          f           |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   t#          d	d
          D ]U}|t          k    r|                     t$                    5  |                    |           d d d            n# 1 swxY w Y   V|                     |                    |j                  t                     |                     |                    t                    |j                   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   t#          d	d
          D ]U}|t          k    r|                     t$                    5  |                    |           d d d            n# 1 swxY w Y   V|                     |                    |j                  |j                   |                     |                    t                    |j                   |                     |                    t-          |j                            |j                   |                     |                    dt          z            |j                   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    t-          |j                  dd                    d d d            n# 1 swxY w Y   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   t#          d	d
          D ]U}|t          k    r|                     t                     5  |                    |           d d d            n# 1 swxY w Y   V|                     |                    t                    t                     t#          d	d
          D ]U}|t          k    r|                     t$                    5  |                    |           d d d            n# 1 swxY w Y   V|                     |                    t                               t#          d	d
          D ]U}|t          k    r|                     t$                    5  |                    |           d d d            n# 1 swxY w Y   V|                     t          |                    |j        |j                            g            |                     t4                    5  |                     t          |                    g                     g            d d d            n# 1 swxY w Y   |                     t          |                    t          g                    g            |                     |                                |j        g           |                     |                    |j                  |j        g           |                     |                    d |j        g          |j        g           |                     |                    |j        |j        g          |j        g           |                     |                    |j                  g            |                     t          j                  5  |                    d           d d d            d S # 1 swxY w Y   d S )Nr   s&   new file store has 0 length by defaults   iter yields nothing by default   0s   aaaaaaaaaaaaaaaaaaaa   start         %ds   badvalue      -2   1s&   11111111111111111111111111111111111111)_makefilefnassertEquallenlistiterassertRaisesStopIterationnextassertFalsehasnoder   nullidrevsparents
parentrevsr   LookupErrorrange
IndexErrorrevnodelookupr   linkrev
iscensoredcommonancestorsheads
ValueErrordescendantsheadschildren)selffgenr0   is        r   	testemptyzifileindextests.testempty(   s[   Q$MNNNa"&GHHH1gg}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	4)))1&&&7++,,,18,,---4)))9--... 	affhh,,,AFFHH~~}-- 	 	JJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	aff2f..//444 	18,,qx.BCCCg..'0BCCCu011 	$ 	$IIl###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ r1 	  	 AG||"":..    Q                              	qx'222!(333u011 	  	 EE,	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  r1 	 	AG||"":..  q			               	!(++QX666'**AH555#ah--00!(;;;%'/22AH===u011 	" 	"HH[!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" u011 	* 	*HHS]]1R4()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* u011 	 	HHUOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	 	HHTNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	 	HHTNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	@ 	@HH>???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ r1 	 	AG||"";//                 	7++W555r1 	 	AG||"":..  		!               	g..///r1 	  	 AG||"":..    Q                              	a44QXqxHHII2NNNz** 	: 	:T!--"3"344b999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	ammWI6677<<<QXJ///**QXJ777z22QXJ???AH:66
CCCAH--r222u011 	% 	%JJ|$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s2  B""B&)B&H33H7:H7L**L.1L.-NN	N	 QQ	QR''R+	.R+	.WWW:0X66X:=X: ZZ	Z,[[[8\\!\]&&]*-]*)__	_	a$$a(	+a(	c77c;	>c;	7f!!f%(f%l++l/2l/c           	         |                                  }|                                 5 }|                    dd |d|j        |j                  }d d d            n# 1 swxY w Y   |                     t          |          d           |                     t          |          dg           t          |          }|                     t          |          d           | 	                    t                    5  t          |           d d d            n# 1 swxY w Y   |                     |                    |                     |                     |                    t          |                               |                     |                    t                               |                     |                    |j                             |                     |                    |dd                              |                     |                    t          |          dd                              |                     t          |                                          dg           |                     t          |                    d                    g            |                     t          |                    d                    dg           |                     t          |                    d                    dg           |                     t          |                    d                    dg           |                     t          |                    dd                    g            |                     t          |                    dd                    ddg           |                     t          |                    dd                    g d	           |                     |                    |          |j        |j        f           |                     |                    d          t          t          f           | 	                    t&          j                  5  |                    d
           d d d            n# 1 swxY w Y   | 	                    t*                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |          d           | 	                    t&          j                  5  |                    d
           d d d            n# 1 swxY w Y   |                     |                    d          |           | 	                    t*                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |          |           |                     |                    d          |           |                     |                    d          |j                   |                     |                    d          |           |                     |                    t          |                    |           | 	                    t&          j                  5  |                    t          |          dd                    d d d            n# 1 swxY w Y   | 	                    t&          j                  5  |                    d           d d d            n# 1 swxY w Y   | 	                    t&          j                  5  |                    d           d d d            n# 1 swxY w Y   | 	                    t&          j                  5  |                    d           d d d            n# 1 swxY w Y   | 	                    t&          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    d          d           | 	                    t*                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    d                     | 	                    t*                    5  |                    d           d d d            n# 1 swxY w Y   |                     t          |                    dg                    g            |                     |                                |g           |                     |                    |          |g           |                     |                    |g          |g           | 	                    t&          j                  5  |                    d
g           d d d            n# 1 swxY w Y   |                     |                    |          g            d S )N   initialr      r"   r   r   stopr   r   rG   r   r   r   r#   r$   )r%   _maketransactionfnaddr/   r&   r'   r(   r)   r,   r*   r+   
assertTruer.   r-   r   r   r0   r1   r2   r   r3   r5   r6   r7   r8   r9   r:   r=   r>   r?   )r@   rA   trr7   rB   s        r   testsinglerevisionz"ifileindextests.testsinglerevision   s   $$&& 	F"55T2q!(AHEED	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Q###a1#&&&1ggcA&&&}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 			$(((3t99--...7++,,,18,,---4":..///3t99QrT?33444affhh!---aff1foo..333aff1foo..444aff!fnn--s333aff!fnn--s333affQll++R000affQll++aV444affQll++YYY777418QX*>???a7G*<===u011 	$ 	$IIl###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ z** 	 	LLOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	ta(((u011 	  	 EE,	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	D)))z** 	 	FF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	$...!d+++"qx000$...#d)),,d333u011 	& 	&HHSYYqt_%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& u011 	 	HHRLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	 	HHUOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	 	HHQKKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	 	HHTNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	1q)))z** 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	a)))z** 	 	LLOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	ammQC00112666TF+++///tf--v666u011 	) 	)GG,G(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	D))2.....s   %AA!A8DDD
R,,R03R0S33S7:S7U((U,/U,6WWW!+\\\]$$](+](^00^47^4_<<` ` &aaab88b<?b<d''d+.d+h++h/2h/c           	         d}|dz   }d|z   dz   }|                                  }|                                 5 }|                    |d |d|j        |j                  }|                    |d |d||j                  }|                    |d |d||j                  }d d d            n# 1 swxY w Y   |                     t          |          d           |                     t          |          g d           t          |          }	|                     t          |	          d           |                     t          |	          d           |                     t          |	          d           | 	                    t                    5  t          |	           d d d            n# 1 swxY w Y   |                     t          |                                          g d           |                     t          |                    d                    g d           |                     t          |                    d                    ddg           |                     t          |                    d                    dg           |                     t          |                    d                    g            |                     t          |                    d	                    ddg           |                     t          |                    d	                    g d           |                     t          |                    d	                    g d           |                     t          |                    dd                    g d
           |                     t          |                    dd                    ddg           |                     t          |                    dd                    ddg           |                     |                    |          |j        |j        f           |                     |                    |          ||j        f           |                     |                    |          ||j        f           |                     |                    d          t          t          f           |                     |                    d          dt          f           |                     |                    d          dt          f           |                     |                    |          d           |                     |                    |          d           |                     |                    |          d           | 	                    t           j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    d          |           |                     |                    d          |           |                     |                    d          |           | 	                    t&                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |          |           |                     |                    d          |           |                     |                    d          |           |                     |                    t+          |                    |           |                     |                    |          |           |                     |                    d          |           |                     |                    d          |           |                     |                    t+          |                    |           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           | 	                    t&                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    d                     |                     |                    d                     |                     |                    d                     | 	                    t&                    5  |                    d           d d d            n# 1 swxY w Y   |                     |                    ||j                  g            |                     |                    ||          |g           |                     |                    ||          |g           |                     |                    ||          |g           |                     |                    ||          |g           |                     |                    ||          |g           |                     t          |                    dg                    ddg           |                     t          |                    dg                    dg           |                     t          |                    ddg                    ddg           |                     |                                |g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |g	          ||g           |                     |                    |g	          ||g           |                     |                    ||g	          ||g           | 	                    t           j                  5  |                    dg	           d d d            n# 1 swxY w Y   |                     |                    |          |g           |                     |                    |          |g           |                     |                    |          g            d S )N   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   y   zr   rG      r   rG   r   r   rH   rJ   r   r   r$   )r%   rM   rN   r/   r&   r'   r(   r)   r,   r*   r+   r0   r1   r2   r   r6   r   r3   r7   r5   r8   r   r9   r-   r:   r;   r=   r>   r?   )
r@   	fulltext0	fulltext1	fulltext2rA   rP   node0node1node2rB   s
             r   testmultiplerevisionsz%ifileindextests.testmultiplerevisions   s   	$	9$t+	$$&& 	C"EE)T2q!(AHEEEEE)T2q%BBEEE)T2q%BBE	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C
 	Q###a))),,,1ggcA&&&cA&&&cA&&&}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	affhh333affQii)))444affQii1a&111affQii1#...affQii"---aff!fnn--1v666aff!fnn--yyy999aff!fnn--yyy999affQll++YYY777affQll++aV444affQll++aV4445))AHah+?@@@5))E18+<===5))E18+<===a7G*<===a1g,777a1g,777uq)))uq)))uq)))u011 	  	 EE,	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	E***E***E***z** 	 	FF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	%%000!e,,,$///#e**--u555%%000!e,,,$///#e**--u5551q)))1q)))1q)))z** 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	a)))a)))a)))z** 	 	LLOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	//qx@@"EEE//u==wGGG//u==wGGG//u==wGGG//u==wGGG//u==wGGGammQC0011Aq6:::ammQC0011A3777ammQF3344q!f===UG,,,%111%111%111
 	ug..???ug..???uen55u~FFFu011 	) 	)GG,G(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	E**UG444E**UG444E**B/////s~   A#B''B+.B+F((F,/F,!XX
X#[[	[	c))c-0c-f((f,/f,2sssc           	      	   |                                  }|                                 5 }|                    dd |d|j        |j                  }|                    dd |d||j                  }|                    dd |d||j                  }|                    dd |d||j                  }|                    d	d |d
||j                  }|                    dd |d||j                  }d d d            n# 1 swxY w Y   |                     t          |          d           |                     t          |                    dg                    g d           |                     t          |                    dg                    dg           |                     t          |                    dg                    g            |                     t          |                    dg                    d
g           |                     t          |                    ddg                    g d           |                     t          |                    ddg                    dd
g           |                     |                                |||g           |                     |                    |          |||g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |          |g           |                     |                    |g          ||||g           |                     |                    |g          ||||g           |                     |	                    |          |||g           |                     |	                    |          |g           |                     |	                    |          g            |                     |	                    |          |g           |                     |	                    |          g            |                     |	                    |          g            d S )Nr   r   r$   rG      2r      3rV      4      5r       )rG   r   rV   rc   r    rH   )
r%   rM   rN   r/   r&   r'   r(   r=   r>   r?   )	r@   rA   rP   r[   r\   r]   node3node4node5s	            r   testmultipleheadsz!ifileindextests.testmultipleheadsi  s   $$&& 	>"EE$b!QXqx@@EEE$b!UAH==EEE$b!UAH==EEE$b!UAH==EEE$b!UAH==EEE$b!UAH==E	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	Q###ammQC0011???CCCammQC0011A3777ammQC00112666ammQC0011A3777ammQF3344oooFFFammQF3344q!f===UE5$9:::%)>???%111%111%111%111%111 	ug..ue0LMMMug..ue0LMMME**UE5,ABBBE**UG444E**B///E**UG444E**B///E**B/////s   C C55C9<C9N)r   r   r   __doc__rD   rQ   r^   ri   r   r   r   r   r      sf         t% t% t%lZ/ Z/ Z/xm0 m0 m0^%0 %0 %0 %0 %0r   r   c                   T    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S )ifiledatatestszGeneric tests for the ifiledata interface.

    All file storage backends for data should conform to the tests in this
    class.

    Use ``makeifiledatatests()`` to create an instance of this type.
    c                    |                                  }|                     |                                i            |                     |                    dd          ddd           |                     |                    t                    d           t          dd          D ]U}|t          k    r|                     t                    5  |                    |           d d d            n# 1 swxY w Y   V|                     |                    |j	                  d           |                     |
                    |j	                  d           |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |j	                  d           |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |j	                             |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |j	        d                     |                     |                    |j	        d	                     |                     t          j                  5  |                    dd
           d d d            n# 1 swxY w Y   |                    g           }|                     t&                    5  t)          |           d d d            n# 1 swxY w Y   |                    |j	        g          }|                     t&                    5  t)          |           d d d            n# 1 swxY w Y   |                     t          j                  5  t+          |                    dg                     d d d            d S # 1 swxY w Y   d S )NTrevisionscounttrackedsizer   s   revisionscounts   trackedsizer   r    r   r      foo
   irrelevant)r%   r&   storageinfosizer   r4   r*   r5   revisionr/   rawdatar   r3   readr-   renamedrO   cmpemitrevisionsr+   r,   r(   )r@   rA   rC   rB   s       r   rD   zifiledatatests.testempty  s   "---MM4M@@ !155	
 	
 	

 	!,,,r1 	 	AG||"":..  q			               	AH--s33318,,c222u011 	% 	%JJ|$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	))3///u011 	! 	!FF<   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	18,,---u011 	! 	!FF<   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	ah,,---ah//000u011 	/ 	/EE,...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ oob!!}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ooqxj))}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	2 	2,00111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2s   C33C7	:C7	:FF #F 4HHH-JJJL88L<?L<2NNNO**O.1O.$QQ	Q	c           	      d
   d}|                                  }|                                 5 }|                    |d |d|j        |j                  }d d d            n# 1 swxY w Y   |                     |                                i            |                     |                    dd          dt          |          d           |                     |                    d          t          |                     |                     t                    5  |                    d           d d d            n# 1 swxY w Y   |                     |
                    |          |           |                     |                    |          |           |                     |                    |          |           |                     |                    |                     |                     |                    ||                     |                     |                    ||dz                        |                    |g          }t%          |          }|                     |j        |           |                     |j        |j                   |                     |j        |j                   |                     |j                   |                     |j        |j                   |                     |j                   |                     |j
                   |                     |j                   |                     t6                    5  t%          |           d d d            n# 1 swxY w Y   |                    |gd          }t%          |          }|                     |j        |           |                     |j        |j                   |                     |j        |j                   |                     |j                   |                     |j        |j                   |                     |j                   |                     |j
        |           |                     |j                   |                     t6                    5  t%          |           d d d            n# 1 swxY w Y   |                     t8          j                  5  t=          |                    |d	g                     d d d            d S # 1 swxY w Y   d S )
NrF   r   Trn   rG   rq   s   extrarevisiondatar   )r%   rM   rN   r/   r&   rt   r'   ru   r*   r5   rv   rw   rx   r-   ry   rz   rO   r{   r,   r7   p1nodep2nodeassertIsNonelinknodebasenodebaserevisionsizedeltar+   r   r3   r(   )r@   fulltextrA   rP   r7   rB   r6   s          r   rQ   z!ifiledatatests.testsinglerevision  s   $$&& 	D"554Q!(CCD	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	"---MM4M@@ !3x==AA	
 	
 	

 	CMM222z** 	 	FF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	D))84444(333x0004)))tX..///dHx$788999 ootf%%3ii4(((QX...QX...#,'''qx000#.///#,'''#)$$$}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ootf4o883ii4(((QX...QX...#,'''qx000#.///x000#)$$$}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u011 	8 	8$!566777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8sY   %AA #A D<<E E !M==NN-S		SS3%T%%T),T)c           	      D)   d}|dz   }d|z   dz   }|                                  }|                                 5 }|                    |d |d|j        |j                  }|                    |d |d||j                  }|                    |d |d||j                  }d d d            n# 1 swxY w Y   |                     |                                i            |                     |                    dd          dt          |          t          |          z   t          |          z   d	           |                     |                    d          t          |                     |                     |                    d          t          |                     |                     |                    d
          t          |                     |                     t                    5  |                    d           d d d            n# 1 swxY w Y   |                     |
                    |          |           |                     |                    |          |           |                     |
                    |          |           |                     |                    |          |           |                     |
                    |          |           |                     |                    |          |           |                     t          j                  5  |
                    d           d d d            n# 1 swxY w Y   |                     |                    |          |           |                     |                    |          |           |                     |                    |          |           |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    |                     |                     |                    |                     |                     |                    |                     |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    ||                     |                     |                    ||                     |                     |                    ||                     |                     |                    ||                     |                     |                    ||                     |                     t          j                  5  |                    dd           d d d            n# 1 swxY w Y   |                    |||gd          }	t)          |	          }
|                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j        |j                   |                     |
j                   |                     |
j
        |           |                     |
j                   t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              |                     t:                    5  t)          |	           d d d            n# 1 swxY w Y   |                    |||gd          }	t)          |	          }
|                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j        |j                   |                     |
j                   |                     |
j
        |           |                     |
j                   t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              |                     t:                    5  t)          |	           d d d            n# 1 swxY w Y   |                     t          j                  5  t?          |                    g d                     d d d            n# 1 swxY w Y   t?          |                    |||gd                    }|                     t          |          d           |                     d |D             |||h           |                    ||gdd          }	t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j
        |           |                     |
j                   t)          |	          }
|                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     t:                    5  t)          |	           d d d            n# 1 swxY w Y   |                    ||hd          }	t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j
        |           |                     |
j                   t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              |                     t:                    5  t)          |	           d d d            n# 1 swxY w Y   |                    ||gdd          }	t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j        |           |                     |
j                   |                     |
j
                   |                     |
j        d|z              |                    |gdt@          j!                  }	t)          |	          }
|                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j
                   |                     |
j        d|z              |                     t:                    5  t)          |	           d d d            n# 1 swxY w Y   |                    ||gdt@          j!                  }	t)          |	          }
|                     |
j        |           |                     |
j        |j                   |                     |
j        |j                   |                     |
j        |j                   |                     |
j                   |                     |
j
                   |                     |
j        d|z              t)          |	          }
|                     |
j        |           |                     |
j        |           |                     |
j        |j                   |                     |
j        |           |                     t:                    5  t)          |	           d d d            d S # 1 swxY w Y   d S )NrS   rT   rU   r   rG   rV   Trn   rq   r   r   rs   r}   s            s           s   bad)
nodesorders   storagec                     h | ]	}|j         
S r   r7   ).0os     r   	<setcomp>z7ifiledatatests.testmultiplerevisions.<locals>.<setcomp>  s    ...Q!&...r   s   nodes)r   r~   )r~   assumehaveparentrevisions)r~   	deltamodes              )"r%   rM   rN   r/   r&   rt   r'   ru   r*   r5   rv   rw   r   r3   rx   r-   ry   rz   rO   r{   r,   r7   r   r   r   r   r   r   r   r+   ProgrammingErrorr(   r	   CG_DELTAMODE_PREV)r@   rX   rY   rZ   rA   rP   r[   r\   r]   rB   r6   ress               r   r^   z$ifiledatatests.testmultiplerevisions  s   	$	9$t+	$$&& 	C"EE)T2q!(AHEEEEE)T2q%BBEEE)T2q%BBE	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C
 	"---MM4M@@#$ #Ii..!!i..!! 	
 	
 	
 	C	NN333C	NN333C	NN333z** 	 	FF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	E**I6665))9555E**I6665))9555E**I6665))9555u011 	% 	%JJ|$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 		222	222	222u011 	! 	!FF<   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	5))***5))***5))***u011 	$ 	$IIl###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	ui00111ui00111ui00111eY//000eY//000u011 	/ 	/EE,...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ ooueU3$oGG3ii5)))QX...QX...#,'''qx000#.///y111#)$$$3ii5)))U+++QX...#,'''u---#.///#,'''I?)K	
 	
 	

 3ii5)))U+++QX...#,'''u---#.///#,'''I?)K	
 	
 	

 }-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ooueU3$oGG3ii5)))QX...QX...#,'''qx000#.///y111#)$$$3ii5)))U+++QX...#,'''u---#.///#,'''I?)K	
 	
 	

 3ii5)))U+++QX...#,'''u---#.///#,'''I?)K	
 	
 	

 }-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u566 	9 	977888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9
 OOUE51jOII
 
 	S1%%%..#...u0EFFF ooENxd  
 
 3ii5)))U+++QX...qx000#.///y111#)$$$3ii5)))QX...QX... }-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 oouen4o@@3ii5)))U+++QX...qx000#.///y111#)$$$3ii5)))U+++QX...u---#.///#,'''I?)K	
 	
 	

 }-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ooEN  
 
 3ii5)))U+++QX...u---#.///#,'''I?)K	
 	
 	
 ooG$*2N  
 
 3ii5)))QX...QX...qx000#.///#,'''I?)K	
 	
 	

 }-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ooEN 2  
 
 3ii5)))QX...QX...qx000#.///#,'''I?)K	
 	
 	

 3ii5)))U+++QX...u---}-- 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A#B''B+.B+1HHH3MMM:PP #P >S  S$'S$W::W>W>d  d$'d$*qq
q
0%r!!r%(r%z''z+.z+BAB'B'AB+B.AB+J7AKKAKKAKQ8ARRARRARc           	         d}d}d}ddd}ddd}d	                     d
d|g          }d	                     dd|g          }|                                 }|                                 5 }	|                    |d |	d|j        |j                  }
|                    |||	d|
|j                  }|                    |||	d|j        |j                  }d d d            n# 1 swxY w Y   |                     |                    d          t          |                     |                     |                    d          t          |                     |                     |                    |          |           |                     |	                    |          |           |                     |                    |          |           |                     |	                    |          |           |                     |
                    |          |           |                     |
                    |          |           |                     |                    |                     |                     |                    |          d           |                     |                    ||                     |                     |                    ||                     |                     |                    ||                     |                     |                    ||                     d S )Nrr      bars   baz   source0s(   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas   copys   copyrev   source1(   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbr      
copy: source0
s4   copyrev: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

s   
copy: source1
s4   copyrev: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

r   rG   r   )r      )joinr%   rM   rN   r/   r&   ru   r'   rv   rw   rx   r-   ry   rO   rz   )r@   rX   rY   rZ   meta1meta2stored1stored2rA   rP   r[   r\   r]   s                r   testrenamedzifiledatatests.testrenamed)  sD   			  !
 
  !
 

 (((L
 
 (((L
 
 $$&& 	G"EE)T2q!(AHEEEEE)UB5!(CCEEE)UB18QXFFE	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	CLL111C	NN333E**G4445))7333E**G4445))7333	222	222 	5))***5))+EFFFeY//000eW--...ui00111eW--.....s   )A(CC!$C!c           	      t   d}d}d}ddd}d                     dd	dz  d
g          }|                                 }|                                 5 }|                    |i |d|j        |j                  }|                    |||d|j        |j                  }	d d d            n# 1 swxY w Y   |                     |                    d          t          |          dz              |                     |                    d          t          |                     |                     |                    |          |           |                     |	                    |          |           |                     |                    |	          |           |                     |	                    |	          |           |                     |
                    |          |           |                     |
                    |	          |           |                     |                    ||                     |                     |                    ||                     |                     |                    |	|                     |                     |                    |	|                     d S )Ns   
foos	   


foos   
barr   r   r   r   r   s   copyrev: %s
s   

barr   rG   rc   )r   r%   rM   rN   r/   r&   ru   r'   rv   rw   rx   r-   rz   rO   )
r@   rX   stored0rY   r   r   rA   rP   r[   r\   s
             r   testmetadataprefixz!ifiledatatests.testmetadataprefixc  s    	* 	!
 
 ((( I."
 
 $$&& 	G"EE)RQ!(CCEEE)UB18QXFFE	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G
 	C	NNQ$6777C	NN333E**G4445))7333E**G4445))7333	222	222ui00111eW--...ui00111eW--.....s   A	B$$B(+B(c           
         |                                  }d}|dz   }|                                 5 }|                    |d |d|j        |j                  }d}|                     |||||j        d|           d d d            n# 1 swxY w Y   |                     t          |          d           |                     |                    |          ||j        f           |                     t          j
                  5  |                    |           d d d            n# 1 swxY w Y   |                     t          j
                  5  |                    |           d d d            n# 1 swxY w Y   |                     t          j
                  5  |                    |           d d d            d S # 1 swxY w Y   d S )Nx   foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
   bar
r      rG   rawtextr   )r%   rM   rN   r/   _addrawrevisionfnr&   r'   r1   r*   r   StorageErrorrv   rw   rx   r@   rA   rX   rY   rP   r[   r\   s          r   testbadnodereadzifiledatatests.testbadnoderead  s   !	(	$$&& 	"EE)T2q!(AHEEE E""2ueQXq) #   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###5))E18+<=== u122 	 	JJu	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 u122 	 	IIe	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	FF5MMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sH   ABBBD##D'*D'E//E36E3F<<G G c           
      T   |                                  }d}|dz   }|                                 5 }|                    |d |d|j        |j                  }d}|                     |||||j        d|           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    |           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    |           d d d            d S # 1 swxY w Y   d S Nr   r   r   r   rG   r   )	r%   rM   rN   r/   r   r*   r   r   rw   r   s          r   testbadnoderevisionrawz%ifiledatatests.testbadnoderevisionraw  s    !	(	$$&& 	"EE)T2q!(AHEEE E""2ueQXq) #   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	IIe	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	IIe	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	6   ABBB.CCC:DD!$D!c           
      T   |                                  }d}|dz   }|                                 5 }|                    |d |d|j        |j                  }d}|                     |||||j        d|           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    |           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    |           d d d            d S # 1 swxY w Y   d S r   )	r%   rM   rN   r/   r   r*   r   r   rx   r   s          r   testbadnoderevisionz"ifiledatatests.testbadnoderevision  s    !	(	$$&& 	"EE)T2q!(AHEEE E""2ueQXq) #   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	FF5MMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	FF5MMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                 Z   |                                  }d}|dz   }|dz   }|                                 5 }|                    |d |d|j        |j                  }d}|                     |||||j        d|           d d d            n# 1 swxY w Y   |                     t          j                  5  |                    |           d d d            n# 1 swxY w Y   t          j
        |||j                  }|                                 5 }t          j        ||          }	|                     |||||j        dd|	f	           d d d            n# 1 swxY w Y   |                     t          |          d
           |                     |                    |          |           d S )N|   foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
r   s   baz
r   r   rG   r   r   )r   rV   )r%   rM   rN   r/   r   r*   r   r   rx   r
   hashrevisionsha1r   textdiffr&   r'   )
r@   rA   rX   rY   rZ   rP   r[   r\   r]   r   s
             r   testbadnodedeltazifiledatatests.testbadnodedelta  sd   !	(	(	$$&& 	"EE)T2q!(AHEEE E""2ueQXq) #   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u122 	 	FF5MMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ,YqxHH$$&& 	"N9i88E""2ueQXqE
 #   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q### 		22222s6   AB		BB3CCC9EEEc                 ^   |                                  }t          j        ddid          }|                                 5 }|                    dd |d|j        |j                  }d}|                     |||||j        d|d	           d d d            n# 1 swxY w Y   |                     |                    d                     | 	                    t          j                  5  |                    d           d d d            n# 1 swxY w Y   | 	                    t          j                  5  |                    d           d d d            n# 1 swxY w Y   | 	                    t          j                  5  |                    d           d d d            d S # 1 swxY w Y   d S 
N   censored	   tombstoner   rr   r   r   rG   Tcensored)r%   r
   packmetarM   rN   r/   r   rO   r:   r*   r   CensoredNodeErrorrv   rw   rx   r@   rA   r   rP   r[   r\   s         r   testcensoredzifiledatatests.testcensored  s   &\ 	
 
 $$&& 	"EE&$AqxBBE !E""2ueQXq'D #   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q(((u677 	 	JJqMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u677 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u677 	 	FF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sI    A	BBB'D		DD3EEE?F""F&)F&c                    |                                  }t          j        ddid          }|                                 5 }|                    dd |d|j        |j                  }d}|                     |||||j        d|d	           d d d            n# 1 swxY w Y   |                     t          j	                  5  |
                    d           d d d            d S # 1 swxY w Y   d S r   )r%   r
   r   rM   rN   r/   r   r*   r   r   rw   r   s         r   testcensoredrawrevisionz&ifiledatatests.testcensoredrawrevision  s~    &\ 	
 
 $$&& 	"EE&$AqxBBE !E""2ueQXq'D #   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 u677 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s%    A	BBB?C""C&)C&N)r   r   r   rj   rD   rQ   r^   r   r   r   r   r   r   r   r   r   r   r   rl   rl     s         42 42 42l>8 >8 >8@W W Wr8/ 8/ 8/t)/ )/ )/V  B  ,  ,3 3 3@  >    r   rl   c                   f    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 ZdS )ifilemutationtestszGeneric tests for the ifilemutation interface.

    All file storage backends that support writing should conform to this
    interface.

    Use ``makeifilemutationtests()`` to create an instance of this type.
    c           	         |                                  }|                                 5 }|                    dd |d|j        |j                  }|                    dd |d|j        |j                  }|                    dd |d|j        |j                  }d d d            n# 1 swxY w Y   |                     ||           |                     ||           |                     t          |          d           d S )Nrr   r   rG   )r%   rM   rN   r/   r&   r'   r@   rA   rP   r[   r\   r]   s         r   testaddnoopzifilemutationtests.testaddnoop>  s4   $$&& 	C"EE&$AqxBBEEE&$AqxBBEEE&$AqxBBE		C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	&&&&&&Q#####s   A-B""B&)B&c           
      @   |                                  }|                                 5 }|                     t          j                  5  |                    d|d|j        |j        d           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nrr   r   r   r   )r%   rM   r*   r   r   addrevisionr/   r@   rA   rP   s      r   testaddrevisionbadnodez)ifilemutationtests.testaddrevisionbadnodeJ  s   $$&& 	"""5#566  B18QXL                  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s5    B	&A;/B;A?	?BA?	BBBc           
         |                                  }|                                 5 }t          ddd          D ]}d|z  t          j         z  rd|z  } n|                     t          j                  5  |                    d|d|j	        |j	        |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )N   r   rK   rG   rr   )flags)
r%   rM   r4   r	   REVISION_FLAGS_KNOWNr*   r   r   r   r/   )r@   rA   rP   rC   r   s        r   testaddrevisionunknownflagz-ifilemutationtests.testaddrevisionunknownflagS  s   $$&& 	N"2q"%%  Fz>>> FEE ""5#566 N Nfb!QXqxuMMMN N N N N N N N N N N N N N N	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	Ns6   AC7&B)C)B-	-C0B-	1CCCc           	      |  
 |                                  }g 

fdd }|                                 5 }g fd}fd}|                    g d |||           d d d            n# 1 swxY w Y   |                     g            |                     
g            |                     t	          |          d           d}t          j        t	          |                    |z   }|                                 5 }|                    |d |d|j        |j                  }d d d            n# 1 swxY w Y   |                                  }||j        |j        |j        |j        |di fg}	|                                 5 }g fd}fd	}|                    |	||||           d d d            n# 1 swxY w Y   |                     d
g           |                     t	          
          d           |                     
d         d         d         d                    |                     t          |
                                          dg           |                     |                    d                   d           |                     |                    d          d                    d S )Nc                  6                         | |f           d S N)append)argskwargscallbackargss     r   cbz1ifilemutationtests.testaddgroupsimple.<locals>.cbc  s!    v/////r   c                     dS Nr   r   r   s    r   
linkmapperz9ifilemutationtests.testaddgroupsimple.<locals>.linkmapperf  s    1r   c                 t    |                      |          }                    |            | |           d S r   r7   r   clr6   r7   r   nodess      r   onchangesetz:ifilemutationtests.testaddgroupsimple.<locals>.onchangesetl  7    wws||T"""2tr   c                 X                         |                     |                     d S r   r   r7   r   r6   r   s     r   ondupchangesetz=ifilemutationtests.testaddgroupsimple.<locals>.ondupchangesetq  %    RWWS\\*****r   addrevisioncbduplicaterevisioncbr   rr   c                 t    |                      |          }                    |            | |           d S r   r   r   s      r   r   z:ifilemutationtests.testaddgroupsimple.<locals>.onchangeset  r   r   c                 X                         |                     |                     d S r   r   r   s     r   r   z=ifilemutationtests.testaddgroupsimple.<locals>.ondupchangeset  r   r   s   I˱\WG kFzyrG   )r%   rM   addgroupr&   r'   r   trivialdiffheaderrN   r/   r(   r0   r6   r7   )r@   rA   r   rP   r   r   rX   delta0r[   deltasr   r   r   s             @@@r   testaddgroupsimplez%ifilemutationtests.testaddgroupsimple^  s   	0 	0 	0 	0 	0	 	 	 $$&& 	"E     
+ + + + + JJ)$2    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	& 	###r***Q###	(Y889D$$&& 	F"EE)T2q!(AHEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F  AHah!(FArJ
 $$&& 	"E     
+ + + + + JJ)$2    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	& 	<	
 	
 	
 	\**A...a+A.a999affhh!---uQx!,,,E!H-----s5   (A**A.1A.>%D//D36D3(F55F9<F9c                   
 |                                  }g d}g }|                                 5 }|D ]9}|                    |                    |d |d|j        |j                             :	 d d d            n# 1 swxY w Y   |                                  }g }t          |          D ]`\  }}t          j        t          |                    |z   }|                    ||         |j        |j        |j        |j        |di f           a|                                 5 }g 

fd}	|	                    |d ||	|	           | 
                    
|           d d d            n# 1 swxY w Y   | 
                    t          |          t          |                     | 
                    t          |                                          g d           | 
                    |                    |d                   d           | 
                    |                    |d                   d           | 
                    |                    |d                   d           | 
                    |                    d          |d                    | 
                    |                    d          |d                    | 
                    |                    d          |d                    d S )	N)rr   r   rS   r   c                 X                         |                     |                     d S r   r   )r   r6   newnodess     r   r   z<ifilemutationtests.testaddgroupmultiple.<locals>.onchangeset  s%    -----r   c                     dS r   r   xs    r   <lambda>z9ifilemutationtests.testaddgroupmultiple.<locals>.<lambda>  s    ! r   r   rW   rG   r   )r%   rM   r   rN   r/   	enumerater   r   r'   r   r&   r(   r0   r6   r7   )r@   rA   	fulltextsr   rP   r   r   rC   r   r   r   s             @r   testaddgroupmultiplez'ifilemutationtests.testaddgroupmultiple  sc   
 
 
	 $$&& 	O"% O OQUU8T2q!(AHMMNNNNO	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O $Y// 	 	KAx+CMM::XEEMMq18QXqx5!RP    $$&& 	."H. . . . . JJ)$/     Xu---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	QV---affhh333uQx!,,,uQx!,,,uQx!,,,E!H---E!H---E!H-----s#   =A::A>A>9E$$E(+E(c                    |                                  }t          j        ddid          }|                                 5 }|                    dd |d|j        |j                  }d}|                     |||||j        d|d	           d d d            n# 1 swxY w Y   t          j        d
d          }d||j        d||di fg}|                                 5 }| 	                    t          j                  5  |                    |d |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r   r   rG   Tr   sx   bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
s|   bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
bar
baz
s   r   c                     dS r   r   r   s    r   r   z=ifilemutationtests.testdeltaagainstcensored.<locals>.<lambda>  s    Q r   )r%   r
   r   rM   rN   r/   r   r   r   r*   r   CensoredBaseErrorr   )r@   rA   r   rP   r[   r\   r   r   s           r   testdeltaagainstcensoredz+ifilemutationtests.testdeltaagainstcensored  s   &\ 	
 
 $$&& 	"EE-r1ahIIE !E""2ueQXq'D #   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 }.HII5!(L%2N
 $$&& 	4"""5#:;; 4 4

6;;3334 4 4 4 4 4 4 4 4 4 4 4 4 4 4	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4sI    A	BBB D69DD6D"	"D6%D"	&D66D:=D:c           	         |                                  }|                                 5 }|                    dd |d|j        |j                  }|                    dd |d||j                  }|                    dd |d||j                  }d d d            n# 1 swxY w Y   |                                 5 }|                    ||           d d d            n# 1 swxY w Y   |                     t          |          d           |                     t          |                                          g d           |                     |	                    |          d           |                     |	                    |          d           | 
                    t          j                  5  |	                    |           d d d            d S # 1 swxY w Y   d S )	Nr   r   r   rG   s   foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
r   rV   rW   )r%   rM   rN   r/   censorrevisionr&   r'   r(   r0   rx   r*   r   r   r   s         r   testcensorrevisionbasicz*ifilemutationtests.testcensorrevisionbasic  sl   $$&& 	G"EE-r1ahIIEEE-r1eQXFFEEE-r1eQXFFE	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G
 $$&& 	("R'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	Q###affhh333666666u677 	 	FF5MMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   A#BBB7CC!C0GGGc           
         |                                  }|                                 5 }t          d          D ])}|                    d|z  d |||j        |j                   *	 d d d            n# 1 swxY w Y   t          d          D ]9}|                     |                    |          |t                      f           :d S N
   r!   )r%   rM   r4   rN   r/   r&   getstrippointset)r@   rA   rP   r6   s       r   testgetstrippointnoparentsz-ifilemutationtests.testgetstrippointnoparents  s   $$&& 	F"Ryy F Feck4S!(AHEEEEF	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 99 	A 	ACQ__S11C<@@@@	A 	As   :A00A47A4c           
         |                                  }|                                 5 }|j        }t          d          D ]$}|                    d|z  d ||||j                   %	 d d d            n# 1 swxY w Y   t          d          D ]9}|                     |                    |          |t                      f           :d S r  )r%   rM   r/   r4   rN   r&   r  r	  r@   rA   rP   p1r6   s        r   testgetstrippointlinearz*ifilemutationtests.testgetstrippointlinear  s"   $$&& 	@"BRyy @ @eck4S"ah????@	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 99 	A 	ACQ__S11C<@@@@	A 	As   <A22A69A6c           	      X   |                                  }|                                 5 }|                    dd |d|j        |j                  }|                    dd |d||j                  }|                    dd |d||j                   |                    dd |d||j                   |                    d	d |d
||j                   d d d            n# 1 swxY w Y   t	          d          D ]9}|                     |                    |          |t                      f           :d S )Nr   r   r$   rG   r`   r   ra   rV   rb   rc   r    )r%   rM   rN   r/   r4   r&   r  r	  )r@   rA   rP   r[   r\   r6   s         r   testgetstrippointmultipleheadsz1ifilemutationtests.testgetstrippointmultipleheads'  s_   $$&& 	6"EE$b!QXqx@@EEE$b!UAH==EEE$b!UAH555EE$b!UAH555EE$b!UAH555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 88 	A 	ACQ__S11C<@@@@	A 	As   B!CCCc           	         |                                  }|                                 5 }|                    dd |d|j        |j                  }|                    dd |d||j                   |                    dd |d||j                   d d d            n# 1 swxY w Y   |                     |                    d          dt                      f           |                     |                    d          dt                      f           |                     |                    d          dt                      f           |                     |                    d	          dt                      f           |                     |                    d
          dt                      f           |                     |                    d          dt                      f           |                     |                    d          ddhf           |                     |                    d          ddhf           |                     |                    d          ddhf           |                     |                    d          ddhf           |                     |                    d          ddhf           |                     |                    d          d	t                      f           d S )Nr   r   r$   r  r`   r    rG   r   rV   rc   re         	      )r%   rM   rN   r/   r&   r  r	  )r@   rA   rP   r[   s       r    testgetstrippointearlierlinkrevsz3ifilemutationtests.testgetstrippointearlierlinkrevs4  s   $$&& 	6"EE$b!QXqx@@EEE$b"eQX666EE$b!UAH555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6
 	++aZ888++aZ888++aZ888++aZ888++aZ888++aZ888++a!X666++a!X666++a!X666++a!X666,,q1#h777,,q#%%j99999s   A#BBBc                     |                                  }|                                 5 }|                    d|           d d d            n# 1 swxY w Y   |                     t	          |          d           d S r   )r%   rM   stripr&   r'   r   s      r   teststripemptyz!ifilemutationtests.teststripemptyI  s    $$&& 	"GGArNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q#####s   AAAc           
         |                                  }|                                 5 }|j        }t          d          D ]$}|                    d|z  d ||||j                  }%	 d d d            n# 1 swxY w Y   |                     t          |          d           |                                 5 }|                    d|           d d d            n# 1 swxY w Y   |                     t          |          d           d S )Nr  r!   r   )r%   rM   r/   r4   rN   r&   r'   r  r  s        r   teststripallzifilemutationtests.teststripallQ  s   $$&& 	E"BRyy E EUU53;b#r18DDE	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E
 	Q$$$$$&& 	"GGArNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q#####s#   <A22A69A64CCCc           	         |                                  }|                                 5 }|                    dd |d|j        |j                   |                    dd |d|j        |j                  }|                    dd |d|j        |j                  }d d d            n# 1 swxY w Y   |                     t          |          d           |                                 5 }|                    d|           d d d            n# 1 swxY w Y   |                     t          |          d           |                                 5 }|                    d|           d d d            n# 1 swxY w Y   |                     t          |          d	           |                     t          j	                  5  |
                    |           d d d            n# 1 swxY w Y   |                                 5 }|                    d
|           d d d            n# 1 swxY w Y   |                     t          |          d	           |                                 5 }|                    d|           d d d            n# 1 swxY w Y   |                     t          |          d           |                     t          j	                  5  |
                    |           d d d            d S # 1 swxY w Y   d S )Nr   r   r$   r    r`   r  rV   r  r   re   rG   )r%   rM   rN   r/   r&   r'   r  r*   r   r3   r6   )r@   rA   rP   r\   r]   s        r   teststrippartialz#ifilemutationtests.teststrippartial`  sV   $$&& 	B"EE$b!QXqx888EE$b!QXqx@@EEE$b"ahAAE	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B
 	Q###$$&& 	"GGBOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###$$&& 	"GGBOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###u011 	 	EE%LLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 $$&& 	"GGArNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###$$&& 	"GGArNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###u011 	 	EE%LLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s~   A-B""B&)B&$DDD	E,,E03E09GG"G:HH!$H!JJ	JK22K69K6N)r   r   r   rj   r   r   r   r   r   r  r  r
  r  r  r  r  r  r  r   r   r   r   r   5  s        
$ 
$ 
$  	N 	N 	NN. N. N.`-. -. -.^4 4 4<  (	A 	A 	AA A AA A A: : :*$ $ $$ $ $" " " " "r   r   c                 <    | ||d}t          dt          f|          S )a9  Create a unittest.TestCase class suitable for testing file storage.

    ``makefilefn`` is a callable which receives the test case as an
    argument and returns an object implementing the ``ifilestorage`` interface.

    ``maketransactionfn`` is a callable which receives the test case as an
    argument and returns a transaction object.

    ``addrawrevisionfn`` is a callable which receives arguments describing a
    low-level revision to add. This callable allows the insertion of
    potentially bad data into the store in order to facilitate testing.

    Returns a type that is a ``unittest.TestCase`` that can be used for
    testing the object implementing the file storage interface. Simply
    assign the returned value to a module-level attribute and a test loader
    should find and run it automatically.
    r%   rM   r   r   )typer   
makefilefnmaketransactionfnaddrawrevisionfnds       r   makeifileindextestsr&    s1    & "/-	 	A
 !O#5q999r   c                 <    | ||d}t          dt          f|          S )Nr  rl   )r   rl   r!  s       r   makeifiledatatestsr(    s/    !/-	 	A
  >"3Q777r   c                 <    | ||d}t          dt          f|          S )Nr  r   )r   r   r!  s       r   makeifilemutationtestsr*    s0    !/-	 	A
 $'9&;Q???r   )r   r7   r   r   pycompatr    r   r   
interfacesr	   utilsr
   r   r   r   rl   r   r&  r(  r*  r   r   r   <module>r/     s                        $ # # # # #      
 
 
 
 
8$ 
 
 
o0 o0 o0 o0 o0l o0 o0 o0da
 a
 a
 a
 a
\ a
 a
 a
HM M M M M M M M`
: : :48 8 8@ @ @ @ @r   