File: //usr/lib/python3/dist-packages/mercurial/cffi/__pycache__/mpatch.cpython-310.pyc
o
�]Lb� � @ sT d dl mZ ddlT ddlmZ ddlmZ ejZejZe�� dd� �Z d d
� Z
dS )� )�absolute_import� )�*)�mpatchError� )�_mpatchc C sb t �| �\}}t �d�}t �dt|| ��}|�|� t�|t|�d |�}|dk r-t jS |d S )Ns struct mpatch_flist*[1]� char[]r r ) �ffi�from_handle�new�str�append�lib�
mpatch_decode�len�NULL)�arg�pos�all�bins� container�to_pass�r� r �7/usr/lib/python3/dist-packages/mercurial/cffi/mpatch.py�cffi_get_next_item s
r c C s� t |�}g }|s
| S ||f}t�t�|�tjd|�}|s td��t�t | �|�}|dk r5t�|� td��t� d|�}t�
|| t | �|�dk rPt�|� td��t�||�d d � }t�|� |S )Nr s cannot decode chunks inconsistency detectedr s error applying patches)r r �mpatch_foldr �
new_handler r �mpatch_calcsize�mpatch_lfreer �mpatch_apply�buffer) �textr �lgtr r �patch�outlen�buf�resr r r �patches s&