HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/testing/__pycache__/storage.cpython-310.pyc
o

�]Lb���@s�ddlmZddlZddlmZmZddlmZddlm	Z	m
Z
ddlmZddl
mZGd	d
�d
ej�ZGdd�de�ZGd
d�de�ZGdd�de�Zdd�Zdd�Zdd�ZdS)�)�absolute_importN�)�hex�nullrev)�getattr)�error�mdiff)�
repository)�storageutilc@s&eZdZeejdd�sejjZdSdS)�basetestcase�assertRaisesRegexFN)�__name__�
__module__�__qualname__r�unittest�TestCase�assertRaisesRegexpr�rr�;/usr/lib/python3/dist-packages/mercurial/testing/storage.pyrs
��rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ifileindextestsz�Generic 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	Cs�|��}|�t|�dd�|�t|�gd�t|�}|�t��t|�Wd�n1s.wY|�|�	d��|�|�	d��|�|�	t
��|�|�	|j��|�|�	d��|�|�	d��|�t|���g�t|���}|�t��t|�Wd�n1s�wY|�t|jdd��g�|�|�
|j�|j|jf�|�|�t
�t
t
f�|�tj��
|�
d�Wd�n1s�wYtd	d
�D]!}|t
kr�q�|�t��
|�|�Wd�n1s�wYq�|�|�|j�t
�|�|�t
�|j�|�tj��
|�d�Wd�n	1�swYtd	d
�D]%}|t
k�r2�q)|�t��
|�|�Wd�n	1�sHwY�q)|�|�|j�|j�|�|�t
�|j�|�|�t|j��|j�|�|�dt
�|j�|�tj��
|�d�Wd�n	1�s�wY|�tj��|�t|j�dd
��Wd�n	1�s�wY|�tj��
|�d�Wd�n	1�s�wY|�tj��
|�d�Wd�n	1�s�wY|�tj��
|�d�Wd�n	1�swY|�tj��
|�d�Wd�n	1�s'wYtd	d
�D]%}|t
k�r:�q1|�t��
|�|�Wd�n	1�sPwY�q1|�|�t
�t
�td	d
�D]%}|t
k�rn�qe|�t��
|�|�Wd�n	1�s�wY�qe|�|�t
��td	d
�D]%}|t
k�r��q�|�t��
|�|�Wd�n	1�s�wY�q�|�t|�|j|j��g�|�t��|�t|�g��g�Wd�n	1�s�wY|�t|�t
g��g�|�|��|jg�|�|�|j�|jg�|�|�d|jg�|jg�|�|�|j|jg�|jg�|�|�|j�g�|�tj��|�d�Wd�dS1�sNwYdS)Nrs&new file store has 0 length by defaultsiter yields nothing by default�0saaaaaaaaaaaaaaaaaaaa���start������%dsbadvalue��-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�genr,�irrr�	testempty)s�
�
�����
��������
��
��
���$�zifileindextests.testemptyc	Cs�|��}|���}|�dd|d|j|j�}Wd�n1swY|�t|�d�|�t|�dg�t|�}|�t|�d�|�	t
��t|�Wd�n1sUwY|�|�|��|�
|�t|���|�
|�t��|�
|�|j��|�
|�|dd���|�
|�t|�dd���|�t|���dg�|�t|jdd��g�|�t|jdd��dg�|�t|jdd��dg�|�t|jdd��dg�|�t|�dd��g�|�t|�dd��ddg�|�t|�dd��gd	��|�|�|�|j|jf�|�|�d�ttf�|�	tj��
|�d
�Wd�n	1�s,wY|�	t��
|�d�Wd�n	1�sGwY|�|�|�d�|�	tj��
|�d
�Wd�n	1�slwY|�|�d�|�|�	t��
|�d�Wd�n	1�s�wY|�|�|�|�|�|�d�|�|�|�d�|j�|�|�d�|�|�|�t|��|�|�	tj��|�t|�dd��Wd�n	1�s�wY|�	tj��
|�d
�Wd�n	1�s�wY|�	tj��
|�d�Wd�n	1�swY|�	tj��
|�d�Wd�n	1�s6wY|�	tj��
|�d�Wd�n	1�sRwY|�|�d�d�|�	t��
|�d�Wd�n	1�svwY|�
|�d��|�	t��
|�d�Wd�n	1�s�wY|�t|�dg��g�|�|��|g�|�|�|�|g�|�|j|gd�|g�|�	tj��|jd
gd�Wd�n	1�s�wY|�|�|�g�dS)N�initialr�rrr��stopr�rrBrr���r���rr )r!�_maketransactionfn�addr+r"r#r$r%r(r&r'�
assertTruer*r)rrr,r-r.rr/r1r2r3r4r5r6r9r:r;)r<r=�trr3r>rrr�testsinglerevision�s�
�
�������������z"ifileindextests.testsinglerevisionc
	Cs�d}|d}d|d}|��}|���*}|�|d|d|j|j�}|�|d|d||j�}|�|d|d||j�}Wd�n1sAwY|�t|�d�|�t|�gd��t|�}	|�t|	�d�|�t|	�d�|�t|	�d�|�	t
��t|	�Wd�n1s�wY|�t|���gd��|�t|�d��gd��|�t|�d��ddg�|�t|�d��dg�|�t|�d��g�|�t|jdd	��ddg�|�t|jdd	��gd��|�t|jdd	��gd��|�t|�dd��gd
��|�t|�dd��ddg�|�t|�dd��ddg�|�|�|�|j|jf�|�|�|�||jf�|�|�|�||jf�|�|�
d�ttf�|�|�
d�dtf�|�|�
d�dtf�|�|�|�d�|�|�|�d�|�|�|�d�|�	tj��
|�d�Wd�n	1�s�wY|�|�d�|�|�|�d�|�|�|�d�|�|�	t��
|�d�Wd�n	1�s�wY|�|�|�|�|�|�d�|�|�|�d�|�|�|�t|��|�|�|�|�|�|�|�d�|�|�|�d
�|�|�|�t|��|�|�|�d�d�|�|�d�d�|�|�d�d�|�	t��
|�d�Wd�n	1�sNwY|�|�d��|�|�d��|�|�d��|�	t��
|�d�Wd�n	1�s�wY|�|�||j�g�|�|�||�|g�|�|�||�|g�|�|�||�|g�|�|�||�|g�|�|�||�|g�|�t|�dg��ddg�|�t|�dg��dg�|�t|�ddg��ddg�|�|��|g�|�|�|�|g�|�|�|�|g�|�|�|�|g�|�|j|gd	�||g�|�|j|gd	�||g�|�|j||gd	�||g�|�	tj��|jdgd	�Wd�n	1�sZwY|�|�|�|g�|�|�|�|g�|�|�|�g�dS)N�xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx�y�zrrB��rrBrrrCrErrr )r!rHrIr+r"r#r$r%r(r&r'r,r-r.rr2rr/r3r1r4rr5r)r6r7r9r:r;)
r<�	fulltext0�	fulltext1�	fulltext2r=rK�node0�node1�node2r>rrr�testmultiplerevisions�s�
�
������z%ifileindextests.testmultiplerevisionsc		Cs�|��}|���K}|�dd|d|j|j�}|�dd|d||j�}|�dd|d||j�}|�dd|d||j�}|�d	d|d
||j�}|�dd|d||j�}Wd�n1sVwY|�t|�d
�|�t|�dg��gd��|�t|�dg��dg�|�t|�dg��g�|�t|�dg��d
g�|�t|�ddg��gd��|�t|�ddg��dd
g�|�|��|||g�|�|�|�|||g�|�|�|�|g�|�|�|�|g�|�|�|�|g�|�|�|�|g�|�|�|�|g�|�|j|gd�||||g�|�|j|gd�||||g�|�|�	|�|||g�|�|�	|�|g�|�|�	|�g�|�|�	|�|g�|�|�	|�g�|�|�	|�g�dS)Nrrr rB�2r�3rP�4��5r�)rBrrPr\rrC)
r!rHrIr+r"r#r$r9r:r;)	r<r=rKrUrVrW�node3�node4�node5rrr�testmultipleheadsjs>
�z!ifileindextests.testmultipleheadsN)r
rr�__doc__r@rLrXrbrrrrr sv\orc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ifiledatatestsz�Generic 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	Cs�|��}|�|��i�|�|jddd�ddd��|�|�t�d�tdd�D]!}|tkr/q(|�t��
|�|�Wd�n1sDwYq(|�|�|j	�d�|�|�
|j	�d�|�tj��
|�d�Wd�n1stwY|�|�
|j	�d�|�tj��
|�
d�Wd�n1s�wY|�|�|j	��|�tj��
|�
d�Wd�n1s�wY|�|�|j	d��|�|�|j	d	��|�tj��|�dd
�Wd�n1s�wY|�g�}|�t��t|�Wd�n	1�swY|�|j	g�}|�t��t|�Wd�n	1�s-wY|�tj��t|�dg��Wd�dS1�sMwYdS)NT��revisionscount�trackedsizer�srevisionscountstrackedsizerr�r�foo�
irrelevant)r!r"�storageinfo�sizerr0r&r1�revisionr+�rawdatarr/�readr)�renamedrJ�cmp�
emitrevisionsr'r(r$)r<r=r?r>rrrr@�sV�������

�
�$�zifiledatatests.testemptyc	Cs�d}|��}|���}|�|d|d|j|j�}Wd�n1s!wY|�|��i�|�|jddd�dt|�d��|�|�d�t|��|�t	��
|�d�Wd�n1s^wY|�|�
|�|�|�|�|�|�|�|�|�|�|�
|�|��|�
|�||��|�|�||d��|�|g�}t|�}|�|j|�|�|j|j�|�|j|j�|�|j�|�|j|j�|�|j�|�|j
�|�|j�|�t��t|�Wd�n1s�wY|j|gdd�}t|�}|�|j|�|�|j|j�|�|j|j�|�|j�|�|j|j�|�|j�|�|j
|�|�|j�|�t��t|�Wd�n	1�sMwY|�tj��t|�|d	g��Wd�dS1�snwYdS)
NrArTrerBrhsextra��revisiondatar)r!rHrIr+r"rlr#rmr&r1rnrorpr)rqrrrJrsr(r3�p1node�p2node�assertIsNone�linknode�basenode�baserevisionsize�deltar'rr/r$)r<�fulltextr=rKr3r>r2rrrrL�sb
���
�
�$�z!ifiledatatests.testsinglerevisionc	Cspd}|d}d|d}|��}|���*}|�|d|d|j|j�}|�|d|d||j�}|�|d|d||j�}Wd�n1sAwY|�|��i�|�|jddd�dt|�t|�t|�d	��|�|�d�t|��|�|�d�t|��|�|�d
�t|��|�t	��
|�d�Wd�n1s�wY|�|�
|�|�|�|�|�|�|�|�
|�|�|�|�|�|�|�|�
|�|�|�|�|�|�|�tj
��
|�
d�Wd�n1s�wY|�|�|�|�|�|�|�|�|�|�|�|�|�tj
��
|�d�Wd�n	1�s$wY|�|�|��|�|�|��|�|�|��|�tj
��
|�d�Wd�n	1�sXwY|�|�||��|�|�||��|�|�||��|�|�||��|�|�||��|�tj
��|�dd�Wd�n	1�s�wY|j|||gdd
�}	t|	�}
|�|
j|�|�|
j|j�|�|
j|j�|�|
j�|�|
j|j�|�|
j�|�|
j
|�|�|
j�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�|�t��t|	�Wd�n	1�szwY|j|||gdd
�}	t|	�}
|�|
j|�|�|
j|j�|�|
j|j�|�|
j�|�|
j|j�|�|
j�|�|
j
|�|�|
j�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�|�t��t|	�Wd�n	1�sRwY|�tj��t|jgdd��Wd�n	1�srwYt|j|||gdd��}|�t|�d�|�dd�|D�|||h�|j||gddd�}	t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j|j�|�|
j�|�|
j
|�|�|
j�t|	�}
|�|
j|�|�|
j|j�|�|
j|j�|�t��t|	�Wd�n	1�swY|j||hdd
�}	t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j|j�|�|
j�|�|
j
|�|�|
j�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�|�t��t|	�Wd�n	1�s�wY|j||gddd�}	t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j|�|�|
j�|�|
j
�|�|
jd|�|j|gdt j!d�}	t|	�}
|�|
j|�|�|
j|j�|�|
j|j�|�|
j|j�|�|
j�|�|
j
�|�|
jd|�|�t��t|	�Wd�n	1�s2wY|j||gdt j!d�}	t|	�}
|�|
j|�|�|
j|j�|�|
j|j�|�|
j|j�|�|
j�|�|
j
�|�|
jd|�t|	�}
|�|
j|�|�|
j|�|�|
j|j�|�|
j|�|�t��
t|	�Wd�dS1�s�wYdS)NrMrNrOrrBrPTrerhrrrkrtsssbad)�
nodesordersstoragecSsh|]}|j�qSr�r3)�.0�orrr�	<setcomp>�sz7ifiledatatests.testmultiplerevisions.<locals>.<setcomp>snodes)r~ru)ru�assumehaveparentrevisions)ru�	deltamodes)"r!rHrIr+r"rlr#rmr&r1rnrorr/rpr)rqrrrJrsr(r3rvrwrxryrzr{r|r'�ProgrammingErrorr$r	�CG_DELTAMODE_PREV)r<rRrSrTr=rKrUrVrWr>r2�resrrrrXs�
�����
�������
���
���
�
��
�
��
��
���
$�z$ifiledatatests.testmultiplerevisionsc
	Cs�d}d}d}ddd�}ddd�}d	�d
d|g�}d	�dd
|g�}|��}|���+}	|�|d|	d|j|j�}
|�|||	d|
|j�}|�|||	d|j|j�}Wd�n1sVwY|�|�d�t|��|�|�d�t|��|�|�|�|�|�|�	|�|�|�|�|�|�|�|�	|�|�|�|�
|�|�|�|�
|�|�|�|�|��|�|�|�d�|�
|�||��|�
|�||��|�|�||��|�
|�||��dS)Nrj�barsbaz�source0s(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa�scopyscopyrev�source1�(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbri�
copy: source0
s4copyrev: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

s
copy: source1
s4copyrev: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

rrBr)r����������������������)�joinr!rHrIr+r"rmr#rnrorpr)rqrJrr)
r<rRrSrT�meta1�meta2�stored1�stored2r=rKrUrVrWrrr�testrenamed*sR������
�zifiledatatests.testrenamedc
	Csrd}d}d}ddd�}d�dd	dd
g�}|��}|��� }|�|i|d|j|j�}|�|||d|j|j�}	Wd�n1s@wY|�|�d�t|�d
�|�|�d�t|��|�|�|�|�|�|�	|�|�|�|�|	�|�|�|�	|	�|�|�|�
|�|�|�|�
|	�|�|�|�||��|�
|�||��|�|�|	|��|�
|�|	|��dS)Ns
foos	


foos
barr�r�r�rir�scopyrev: %s
s

barrrBr\)r�r!rHrIr+r"rmr#rnrorpr)rrrJ)
r<rR�stored0rSr�r�r=rKrUrVrrr�testmetadataprefixds:���
�z!ifiledatatests.testmetadataprefixc
CsB|��}d}|d}|���#}|�|d|d|j|j�}d}|j|||||jd|d�Wd�n1s4wY|�t|�d�|�|�|�||jf�|�t	j
��
|�|�Wd�n1scwY|�t	j
��
|�|�Wd�n1s~wY|�t	j
��|�
|�Wd�dS1s�wYdS)N�xfoo
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���������������������rB��rawtextr)r!rHrIr+�_addrawrevisionfnr"r#r-r&r�StorageErrorrnrorp�r<r=rRrSrKrUrVrrr�testbadnoderead�s*
����"�zifiledatatests.testbadnodereadc
C��|��}d}|d}|���#}|�|d|d|j|j�}d}|j|||||jd|d�Wd�n1s4wY|�tj��
|�|�Wd�n1sOwY|�tj��|�|�Wd�dS1skwYdS�Nr�r�rr�rBr�)	r!rHrIr+r�r&rr�ror�rrr�testbadnoderevisionraw�� 
���"�z%ifiledatatests.testbadnoderevisionrawc
Cr�r�)	r!rHrIr+r�r&rr�rpr�rrr�testbadnoderevision�r�z"ifiledatatests.testbadnoderevisionc

Cs8|��}d}|d}|d}|���#}|�|d|d|j|j�}d}|j|||||jd|d�Wd�n1s8wY|�tj��
|�|�Wd�n1sSwYt	�
|||j�}|���}t�||�}	|j|||||jdd|	fd	�Wd�n1s�wY|�
t|�d
�|�
|�|�|�dS)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�sbaz
rr�rBr�r)r|rP)r!rHrIr+r�r&rr�rpr
�hashrevisionsha1r�textdiffr"r#)
r<r=rRrSrTrKrUrVrWr|rrr�testbadnodedelta�s.
���
��zifiledatatests.testbadnodedeltacCs0|��}t�ddid�}|���$}|�dd|d|j|j�}d}|j|||||jd|dd	�Wd�n1s7wY|�|�d��|�	t
j��
|�d�Wd�n1sZwY|�	t
j��
|�
d�Wd�n1suwY|�	t
j��|�d�Wd�dS1s�wYdS�
N�censored�	tombstonerirjrr�rBT��censored)r!r
�packmetarHrIr+r�rJr6r&r�CensoredNodeErrorrnrorp�r<r=r�rKrUrVrrr�testcensored�s.��
��
��"�zifiledatatests.testcensoredcCs�|��}t�ddid�}|���$}|�dd|d|j|j�}d}|j|||||jd|dd	�Wd�n1s7wY|�tj	��|�
d�Wd�dS1sSwYdSr�)r!r
r�rHrIr+r�r&rr�ror�rrr�testcensoredrawrevisions ��
��
"�z&ifiledatatests.testcensoredrawrevisionN)r
rrrcr@rLrXr�r�r�r�r�r�r�r�rrrrrd�s6@:+! rdc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ifilemutationtestsz�Generic 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	Cs�|��}|���,}|�dd|d|j|j�}|�dd|d|j|j�}|�dd|d|j|j�}Wd�n1s7wY|�||�|�||�|�t|�d�dS)NrjrrB)r!rHrIr+r"r#�r<r=rKrUrVrWrrr�testaddnoop?s
�zifilemutationtests.testaddnoopc
Cs�|��}|���4}|�tj��|jd|d|j|jdd�Wd�n1s'wYWd�dSWd�dS1s?wYdS)Nrjrrr)r!rHr&rr��addrevisionr+�r<r=rKrrr�testaddrevisionbadnodeKs
���"�z)ifilemutationtests.testaddrevisionbadnodec
Cs�|��}|���K}tddd�D]}d|>tj@rd|>}nq|�tj��|jd|d|j	|j	|d�Wd�n1s>wYWd�dSWd�dS1sVwYdS)N�rrFrBrj)�flags)
r!rHr0r	�REVISION_FLAGS_KNOWNr&rr�r�r+)r<r=rKr?r�rrr�testaddrevisionunknownflagTs
���"�z-ifilemutationtests.testaddrevisionunknownflagc
	s�|��}g��fdd��dd�}|���!}g���fdd�}�fdd�}|jgd|||d	�Wd�n1s8wY|��g�|��g�|�t|�d
�d}t�t|��|}|���}|�|d|d
|j|j�}Wd�n1swwY|��}||j|j|j|j|d
ifg}	|���!}g���fdd�}�fd
d�}|j|	||||d	�Wd�n1s�wY|��dg�|�t��d�|��d
d
d�d
�|�t	|�
��d
g�|�|��d
�d
�|�|�d
��d
�dS)Ncs��||f�dS�N)�append)�args�kwargs)�callbackargsrr�cbdsz1ifilemutationtests.testaddgroupsimple.<locals>.cbcS�dS�Nrrrrrr�
linkmappergsz9ifilemutationtests.testaddgroupsimple.<locals>.linkmapperc�"|�|�}��|��||�dSr��r3r���clr2r3�r��nodesrr�onchangesetm�

z:ifilemutationtests.testaddgroupsimple.<locals>.onchangesetc���|�|��dSr��r�r3�r�r2�r�rr�ondupchangesetr�z=ifilemutationtests.testaddgroupsimple.<locals>.ondupchangeset��
addrevisioncb�duplicaterevisioncbrrjcr�r�r�r�r�rrr��r�cr�r�r�r�r�rrr��r�sI�˱\�W�GkF��z���yrB)
r!rH�addgroupr"r#r�trivialdiffheaderrIr+r$r,r2r3)
r<r=r�rKr�r�rR�delta0rU�deltasr)r�r�r�r�testaddgroupsimple_sb
��
��
����z%ifilemutationtests.testaddgroupsimplec
s�|��}gd�}g}|���}|D]}|�|�|d|d|j|j��qWd�n1s-wY|��}g}t|�D] \}}t�t|��|}|�|||j|j|j|j|dif�q<|���"}g��fdd�}	|j	|dd�||	|	d�|�
�|�Wd�n1s�wY|�
t|�t|��|�
t|���gd��|�
|�
|d�d�|�
|�
|d	�d	�|�
|�
|d
�d
�|�
|�d�|d�|�
|�d	�|d	�|�
|�d
�|d
�dS)N)rjr�rMrcr�r�r�r���newnodesrrr��r�z<ifilemutationtests.testaddgroupmultiple.<locals>.onchangesetcSr�r�r��xrrr�<lambda>��z9ifilemutationtests.testaddgroupmultiple.<locals>.<lambda>r�rQrBr)r!rHr�rIr+�	enumeraterr�r#r�r"r$r,r2r3)
r<r=�	fulltextsr�rKr}r�r?r|r�rr�r�testaddgroupmultiple�sF
 ���
��z'ifilemutationtests.testaddgroupmultiplecCs|��}t�ddid�}|���$}|�dd|d|j|j�}d}|j|||||jd|dd	�Wd�n1s7wYt�d
d�}d||jd
||difg}|���0}|�	t
j��|�|dd�|�Wd�n1smwYWd�dSWd�dS1s�wYdS)Nr�r�rir�rr�rBTr�sxbar
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��������������������rcSr�r�rr�rrrr��r�z=ifilemutationtests.testdeltaagainstcensored.<locals>.<lambda>)
r!r
r�rHrIr+r�rr�r&r�CensoredBaseErrorr�)r<r=r�rKrUrVr|r�rrr�testdeltaagainstcensored�s.��
��
�
��"�z+ifilemutationtests.testdeltaagainstcensoredc	Cs0|��}|���*}|�dd|d|j|j�}|�dd|d||j�}|�dd|d||j�}Wd�n1s5wY|���}|�||�Wd�n1sOwY|�t|�d�|�t|���gd��|�|�	|�d�|�|�	|�d�|�
tj��|�	|�Wd�dS1s�wYdS)	Nr�rr�rBs�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
rrPrQ)
r!rHrIr+�censorrevisionr"r#r$r,rpr&rr�r�rrr�testcensorrevisionbasic�s 
�
�"�z*ifilemutationtests.testcensorrevisionbasicc
Cs�|��}|���}td�D]}|�d|d|||j|j�q
Wd�n1s(wYtd�D]}|�|�|�|t�f�q1dS�N�
r)r!rHr0rIr+r"�
getstrippoint�set)r<r=rKr2rrr�testgetstrippointnoparentss
���z-ifilemutationtests.testgetstrippointnoparentsc
Cs�|��}|���}|j}td�D]}|�d|d||||j�qWd�n1s*wYtd�D]}|�|�|�|t�f�q3dSr�)r!rHr+r0rIr"r�r��r<r=rK�p1r2rrr�testgetstrippointlinears
���z*ifilemutationtests.testgetstrippointlinearc	Cs�|��}|���@}|�dd|d|j|j�}|�dd|d||j�}|�dd|d||j�|�dd|d||j�|�d	d|d
||j�Wd�n1sKwYtd�D]}|�|�|�|t�f�qTdS)Nrrr rBrYrrZrPr[r\r)r!rHrIr+r0r"r�r�)r<r=rKrUrVr2rrr�testgetstrippointmultipleheads(s
��z1ifilemutationtests.testgetstrippointmultipleheadsc	Cs�|��}|���*}|�dd|d|j|j�}|�dd|d||j�|�dd|d||j�Wd�n1s5wY|�|�d�dt�f�|�|�d�dt�f�|�|�d�dt�f�|�|�d	�dt�f�|�|�d
�dt�f�|�|�d�dt�f�|�|�d�ddhf�|�|�d�ddhf�|�|�d
�ddhf�|�|�d�ddhf�|�|�d�ddhf�|�|�d�d	t�f�dS)Nrrr r�rYrrBrrPr\r^���	�)r!rHrIr+r"r�r�)r<r=rKrUrrr� testgetstrippointearlierlinkrevs5s$
�z3ifilemutationtests.testgetstrippointearlierlinkrevscCsP|��}|���}|�d|�Wd�n1swY|�t|�d�dSr�)r!rH�stripr"r#r�rrr�teststripemptyJs

�z!ifilemutationtests.teststripemptyc
Cs�|��}|���}|j}td�D]}|�d|d||||j�}qWd�n1s*wY|�t|�d�|���}|�d|�Wd�n1sLwY|�t|�d�dS)Nr�rr)r!rHr+r0rIr"r#r�r�rrr�teststripallRs
��
�zifilemutationtests.teststripallc	Cs
|��}|���,}|�dd|d|j|j�|�dd|d|j|j�}|�dd|d|j|j�}Wd�n1s7wY|�t|�d�|���}|�d|�Wd�n1sYwY|�t|�d�|���}|�d|�Wd�n1s{wY|�t|�d	�|�tj	��
|�
|�Wd�n1s�wY|���}|�d
|�Wd�n1s�wY|�t|�d	�|���}|�d|�Wd�n1s�wY|�t|�d�|�tj	��|�
|�Wd�dS1s�wYdS)Nrrr rrYr�rPr�rr^rB)r!rHrIr+r"r#r�r&rr/r2)r<r=rKrVrWrrr�teststrippartialas:
�
�
��
�
�"�z#ifilemutationtests.teststrippartialN)r
rrrcr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�6s 	P/

r�cC�|||d�}tdtf|�S)a9Create 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!rHr�r)�typer��
makefilefn�maketransactionfn�addrawrevisionfn�drrr�makeifileindextests�s
�rcCr�)Nr�rd)r�rdr�rrr�makeifiledatatests��
�rcCr�)Nr�r�)r�r�r�rrr�makeifilemutationtests�rr)�
__future__rrr3rr�pycompatr�rr�
interfacesr	�utilsr
rrrrdr�rrrrrrr�<module>s.t)R