File: //kunden/lib/python3/dist-packages/dulwich/__pycache__/patch.cpython-39.pyc
a
�~�_�0 � @ s� d Z ddlmZ ddlZddlZddlmZmZm Z dZ
d%dd�Zdd � Zd
d� Z
d&dd�Zdd� Zdd� Zdd� Zd'dd�Zdd� Zdd� Zd(dd �Zd)d!d"�Zd*d#d$�ZdS )+z~Classes for dealing with git am-style patches.
These patches are basically unified diffs with some extra metadata tacked
on.
� )�SequenceMatcherN)�Blob�Commit�S_ISGITLINKi@ c
C sl |pt | dd�}t|t�r$|�|�}|\}}| �d|j d t�|j��|� d � | �d|j d � | �dt�
d��|� d � | �d ||f �|�|j d � | �d� | �d
� z"ddl}|j
d
g|j|jd�} W n ttfy� Y n$0 | �|�\}
}| �|
� | �d� | �|� | �d� |du �rTddlm} | �d| � n| �|�|�d � dS )z�Write a individual file patch.
Args:
commit: Commit object
progress: Tuple with current patch number and total.
Returns:
tuple with filename and contents
�encoding�asciis From � �
� From: s Date: z%a, %d %b %Y %H:%M:%S %ZzSubject: [PATCH %d/%d] � ---
r N�diffstat)�stdout�stdin� --
)�__version__s Dulwich %d.%d.%d
)�getattr�
isinstance�str�encode�write�id�time�ctimeZcommit_time�author�strftime�message�
subprocess�Popen�PIPE�ImportError�OSErrorZcommunicateZdulwichr )
�f�commit�contentsZprogress�versionr Znum�totalr �pr �_Zdulwich_version� r( �//usr/lib/python3/dist-packages/dulwich/patch.py�write_commit_patch( sL
������
�
r* c C s"