File: //usr/lib/python3/dist-packages/hgext/largefiles/__pycache__/proto.cpython-310.pyc
o
�]Lb> � @ s� d dl mZ d dlZd dlmZ d dlmZ d dlmZm Z m
Z
mZmZm
Z
mZ ddlmZ ejZejZdZe � � Zd d
� Zdd� Zd
d� Zdd� Ze�ed�dd� �Zdd� ZdS )� )�absolute_importN)�_)�open)�error� exthelper�httppeer�util�wireprototypes�wireprotov1peer�wireprotov1server� )�lfutilsa
This repository uses the largefiles extension.
Please enable it in your Mercurial config file.
c C sT |� � ��}t�| |�}t�tj�|�� tj|| j j
d�}zkz-|�� D ]}|�|� q#|j
�d� |t�|j
�kr@tdtd���|�� t�| |� W n7 ty� } z+| j�td�||jf � t�d|ri|�� nd�W Y d}~W |�� W d � S d}~ww W |�� n|�� w W d � n1 s�w Y t�d|r�|�� �S d�S )zcServer command for putting a largefile into a repository's local store
and into the user cache.)�
createmoder s$ largefile contents do not match hashs, largefiles: failed to put %s into store: %s
r � N)�mayberedirectstdior
� storepathr �makedirs�os�path�dirname�atomictempfile�storer �
getpayload�write�_fp�seek�hexsha1�IOErrorr �close�linktousercache�ui�warn�strerrorr �pushres�getvalue�discard)�repo�proto�sha�outputr �tmpfp�p�e� r- �8/usr/lib/python3/dist-packages/hgext/largefiles/proto.py�putlfile$ s:
�����
�
�r/ c sZ t �| |�}|st�td�| ��t|d�� t�� �� �d �� �fdd�}t j
|� d�S )z\Server command for retrieving a largefile from the repository-local
cache or user cache.s+ requested largefile %s not present in caches rb� c 3 s&