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__/objectspec.cpython-39.pyc
a

�~�_��@sldZdd�Zdd�Zdd�Zdd�Zdd
d�Zddd
�Zdd�Zdd�ZGdd�de	�Z
dd�Zdd�ZdS)zObject specification.cCst|dd�dur|�d�}|S)N�encode�ascii)�getattrr)�text�r�4/usr/lib/python3/dist-packages/dulwich/objectspec.py�to_bytess
rcCst|�}||S)z�Parse a string referring to an object.

    Args:
      repo: A `Repo` object
      objectish: A string referring to an object
    Returns: A git object
    Raises:
      KeyError: If the object can not be found
    )r)�repoZ	objectishrrr�parse_objects
r	cCs(t|�}||}|jdkr$||jS|S)z�Parse a string referring to a tree.

    Args:
      repo: A `Repo` object
      treeish: A string referring to a tree
    Returns: A git object
    Raises:
      KeyError: If the object can not be found
    scommit)rZ	type_nameZtree)rZtreeish�orrr�
parse_tree,s



rcCsVt|�}|d|d|d|d|d|dg}|D]}||vr4|Sq4t|��dS)z�Parse a string referring to a reference.

    Args:
      container: A RefsContainer object
      refspec: A string referring to a ref
    Returns: A ref
    Raises:
      KeyError: If the ref can not be found
    srefs/s
refs/tags/�refs/heads/s
refs/remotes/s/HEADN)r�KeyError)�	container�refspecZ
possible_refs�refrrr�	parse_ref=s

�
rFcCs�t|�}|�d�r"d}|dd�}d|vr:|�d�\}}n|}}|dkrPd}n
t||�}|dkrhd}n2zt||�}Wn"ty�d|vr�d|}Yn0|||fS)	aParse a reftuple spec.

    Args:
      lh_container: A RefsContainer object
      hh_container: A RefsContainer object
      refspec: A string
    Returns: A tuple with left and right ref
    Raises:
      KeyError: If one of the refs can not be found
    �+T�N�:��/r)r�
startswith�splitrr
)�lh_container�rh_containerr�forceZlhZrhrrr�parse_reftupleVs$

rc	Cs8t|t�s|g}g}|D]}|�t||||d��q|S)aXParse a list of reftuple specs to a list of reftuples.

    Args:
      lh_container: A RefsContainer object
      hh_container: A RefsContainer object
      refspecs: A list of refspecs or a string
      force: Force overwriting for all reftuples
    Returns: A list of refs
    Raises:
      KeyError: If one of the refs can not be found
    )r)�
isinstance�list�appendr)rr�refspecsr�retrrrr�parse_reftuplesys
�
r"cCs2t|t�s|g}g}|D]}|�t||��q|S)z�Parse a list of refspecs to a list of refs.

    Args:
      container: A RefsContainer object
      refspecs: A list of refspecs or a string
    Returns: A list of refs
    Raises:
      KeyError: If one of the refs can not be found
    )rrrr)rr r!rrrr�
parse_refs�s
r#cCst|�}tt||�g�S)a@Parse a string referring to a range of commits.

    Args:
      repo: A `Repo` object
      committishs: A string referring to a range of commits.
    Returns: An iterator over `Commit` objects
    Raises:
      KeyError: When the reference commits can not be found
      ValueError: If the range can not be parsed
    )r�iter�parse_commit)rZcommittishsrrr�parse_commit_range�sr&c@seZdZdZdd�ZdS)�AmbiguousShortIdzThe short id is ambiguous.cCs||_||_dS)N)�prefix�options)�selfr(r)rrr�__init__�szAmbiguousShortId.__init__N)�__name__�
__module__�__qualname__�__doc__r+rrrrr'�sr'cCsTg}|D]}|�|�r|�||�q|s2t|��t|�dkrF|dSt||��dS)z$Scan an object store for a short id.r�N)rrr
�lenr')�object_storer(r!Z	object_idrrr�scan_for_short_id�s
r3cCs�t|�}z
||WSty$Yn0z|t||�WStyHYn0t|�dkr�t|�dkr�zt|d�Wnty�Yn$0zt|j|�WSty�Yn0t|��dS)a&Parse a string referring to a single commit.

    Args:
      repo: A` Repo` object
      commitish: A string referring to a single commit.
    Returns: A Commit object
    Raises:
      KeyError: When the reference commits can not be found
      ValueError: If the range can not be parsed
    ��(�N)rr
rr1�int�
ValueErrorr3r2)rZ
committishrrrr%�s&
r%N)F)F)
r/rr	rrrr"r#r&�	Exceptionr'r3r%rrrr�<module>s
$�