HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/dulwich/__pycache__/graph.cpython-39.pyc
a

�~�_��@s4dZddlmZdd�Zdd�Zdd�Zd	d
�ZdS)z<
Implementation of merge-base following the approach of git
�)�dequecsg}i}d}d}d�d}�fdd�}t�}	|||<|	�|�|D]}
|||
<|	�|
�q@||	|�r�|	��}||}|||Bkr�||@s�||B}|||<|�|�|�B}||�}
|
rX|
D]0}||vr�|||B||<n|||<|	�|�q�qXg}|D]}||�@s�|�|�q�|S)N����cs(|D]}||vr||�@sdSqdS)NTF�)�wlst�cstates�cmt�Z_DNCr�//usr/lib/python3/dist-packages/dulwich/graph.py�_has_candidates's
z#_find_lcas.<locals>._has_candidates)r�append�popleft)Zlookup_parents�c1�c2sZcandsr	Z	_ANC_OF_1Z	_ANC_OF_2Z_LCAr
r�c2r
�flags�parentsZpcmtZresultsrrr�
_find_lcassD


rcCsR|sgS|d}t|�dks"|gS|dd�}||vr<|gS|��}t|j||�S)z�Find lowest common ancestors of commit_ids[0] and *any* of commits_ids[1:]

    Args:
      repo: Repository object
      commit_ids: list of commit ids
    Returns:
      list of lowest common ancestor commit_ids
    rrN)�len�parents_providerr�get_parents)�repo�
commit_idsrrrrrr�find_merge_baseUs	rc	Cs~|sgSt|�dkrt||�S|��}|dg}|dd�}|D]8}g}|D]}t|j||g�}|�|�qL|dd�}q@|S)z�Find lowest common ancestors of *all* provided commit_ids

    Args:
      repo: Repository
      commit_ids:  list of commit ids
    Returns:
      list of lowest common ancestor commit_ids
    rrrN)rrrrr�extend)	rrr�lcasZothersr
Z	next_lcasZca�resrrr�find_octopus_basejs


rcCs.||krdS|��}t|j||g�}||gkS)z�Is it possible to fast-forward from c1 to c2?

    Args:
      repo: Repository to retrieve objects from
      c1: Commit id for first commit
      c2: Commit id for second commit
    T)rrr)rrrrrrrr�can_fast_forward�s
r N)�__doc__�collectionsrrrrr rrrr�<module>s
8