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/svn/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�k�`_��@s�dZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
TddlmZmZmZmZmZmZmZddlmZdd	lmZdd
lmZddlmZmZmZddl m!Z!dd
l"m#Z#m$Z$m%Z%ddl&m'Z'dd�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.dd�Z/dd �Z0d3d!d"�Z1d#d$�Z2Gd%d&�d&e�Z3Gd'd(�d(e4�Z5Gd)d*�d*e�Z6Gd+d,�d,e�Z7Gd-d.�d.e�Z8d/d0�Z9Gd1d2�d2e:�Z;dS)4a�

Note about Unicode
------------------

The Subversion bindings are not unicode-aware and they expect to
receive UTF-8 encoded `string` parameters,

On the other hand, all paths manipulated by Trac are `str` objects.

Therefore:

 * before being handed out to SVN, the Trac paths have to be encoded
   to UTF-8, using `_to_svn()`

 * before being handed out to Trac, a SVN path has to be decoded from
   UTF-8, using `_from_svn()`

Whenever a value has to be stored as utf8, we explicitly mark the
variable name with "_utf8", in order to avoid any possible confusion.

Warning:
  `SubversionNode.get_content()` returns an object from which one can
  read a stream of bytes. NO guarantees can be given about what that
  stream of bytes represents. It might be some text, encoded in some
  way or another.  SVN properties *might* give some hints about the
  content, but they actually only reflect the beliefs of whomever set
  those properties...
�N)�quote)�ISystemInfoProvider)�
ListOption�ChoiceOption)�*)�	Changeset�Node�
Repository�IRepositoryConnector�InvalidRepository�NoSuchChangeset�
NoSuchNode)�CachedRepository)�embedded_numbers)�	threading)�exception_to_unicode�
to_unicode�to_utf8)�_)�from_utimestamp�to_datetime�utc)�HrefcCs0ddlmamamamatjtjtjtj	ia
dS)Nr)�fs�repos�core�delta)�svnrrrr�svn_node_dirr�	DIRECTORY�
svn_node_file�FILE�_kindmap�r#r#�C/usr/lib/python3/dist-packages/tracopt/versioncontrol/svn/svn_fs.py�_import_svnFs�r%cGst�d�|��d��d�|�S)z�Expect a pool and a list of `str` path components.

    Returns an UTF-8 encoded string suitable for the Subversion python
    bindings (the returned path never starts with a leading "/")
    �/�utf-8)r�svn_path_canonicalize�join�lstrip�encode)�pool�argsr#r#r$�_to_svnLs�r.cCst|t�r
t|d�}|S)z�Expect an UTF-8 encoded string and transform it to a `str` object

    But Subversion repositories built from conversion utilities can have
    non-UTF-8 byte strings, so we have to convert using `to_unicode`.
    r')�
isinstance�bytesr��pathr#r#r$�	_from_svnVs

r3cCst|��d�S)N�ascii)rr+)�valuer#r#r$�_quote_b`�r6cCs|r|�d�pdS)z(Remove leading "/", except for the root.r&)�stripr1r#r#r$�_normalize_pathesr9cCs^|dur+|�d�}|dkrt|�S|�d�}|d�|d�r-|t|�dd�p*dSdSdS)zdRemove the leading scope from repository paths.

    Return `None` if the path is not is scope.
    Nr&�)r*r9r8�
startswith�len��scope�fullpathr#r#r$�_path_within_scopeis

�r@cCs>|dkr|duS|r|�d�nd}|�d�}|d�|d�S)z>Check whether the given `fullpath` is within the given `scope`r&N�)r*r8r;r=r#r#r$�_is_path_within_scopevs

rBcCs(t��}||_t��}tj|_||_|S�N)r�svn_opt_revision_value_t�number�svn_opt_revision_t�svn_opt_revision_number�kindr5)�numr5�revisionr#r#r$�_svn_rev�srKcCst��}tj|_|SrC)rrF�svn_opt_revision_headrH)rJr#r#r$�	_svn_head�srMcCst�|ptj�SrC)r�Pool�application_pool)�parentr#r#r$rN�srNcCs |r|��r|��dSdSdSrC)�valid�destroy�r,r#r#r$�
_pool_destroy�s�rTc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�SvnCachedRepositoryz_Subversion-specific cached repository, zero-pads revision numbers
    in the cache tables.
    TcCsd|S)Nz%010dr#��self�revr#r#r$�db_rev�szSvnCachedRepository.db_revcCst|pd�S�Nr)�intrVr#r#r$�rev_db��zSvnCachedRepository.rev_dbcCs|j�|�SrC)r�
normalize_revrVr#r#r$r^�r]z!SvnCachedRepository.normalize_revN)�__name__�
__module__�__qualname__�__doc__�has_linear_changesetsrYr\r^r#r#r#r$rU�srUc@sneZdZeee�eddddd�Zeddddd�Ze	dd	gd
�dd�Z
dZd
d�Zdd�Z
dd�Zdd�ZdS)�SubversionConnectorr�branchesztrunk, branches/*z�Comma separated list of paths categorized as branches.
        If a path ends with '*', then all the directory entries found below
        that path will be included.
        Example: `/trunk, /branches/*, /projectAlpha/trunk, /sandbox/*`
        )�doc�tagsztags/*z�Comma separated list of paths categorized as tags.

        If a path ends with '*', then all the directory entries found below
        that path will be included.
        Example: `/tags/*, /projectAlpha/tags/A-1.0, /projectAlpha/tags/A-v1.1`
        �	eol_style)�native�LF�CRLF�CRaEnd-of-Line character sequences when `svn:eol-style` property is
        `native`.

        If `native`, substitute with the native EOL marker on the server.
        Otherwise, if `LF`, `CRLF` or `CR`, substitute with the specified
        EOL marker.

        (''since 1.0.2'')Nc
Cs�d|_zt�Wnty&}z||_|jjddd�WYd}~dSd}~ww|j�d�tjtj	tj
f}td|tjd�|_|ddkrPt
d	|jd
�|_dSdS)Nz"Failed to load Subversion bindingsT)�exc_infozSubversion bindings importeds%d.%d.%dr'rr:z-Subversion >= 1.0 required, found %(version)s)�version)�_versionr%�ImportError�error�log�info�debugr�
SVN_VER_MAJOR�
SVN_VER_MINOR�
SVN_VER_MICRO�str�SVN_VER_TAGr)rW�ernr#r#r$�__init__�s(
������zSubversionConnector.__init__ccs�|jrd|jfVdSdS)N�
Subversion)ro�rWr#r#r$�get_system_info�s��z#SubversionConnector.get_system_infoccs>�d}|jrd}d|dfVd|dfVd|dfVdS)Nr:����direct-svnfs��svnfsr�)rq)rW�prior#r#r$�get_supported_types�s�z'SubversionConnector.get_supported_typescCsJ|j|j|jd�|�d|j�t|||j�}|dkr#t|j||j�}|S)z�Return a `SubversionRepository`.

        The repository is wrapped in a `CachedRepository`, unless `type` is
        'direct-svnfs'.
        )rgrerhr�)	�updatergre�
setdefaultrh�SubversionRepositoryrrrU�env)rW�type�dir�paramsrr#r#r$�get_repository�sz"SubversionConnector.get_repository)r_r`ra�
implementsrr
rrergrrhrqr{r~r�r�r#r#r#r$rd�s"
��
�rdc@s�eZdZdZdZdd�Zd7dd�Zd8dd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd7dd�Zd8dd�Zd d!�Zd"d#�Zd9d%d&�Zd'd(�Zd)d*�Zd:d+d,�Zd;d.d/�Zd0d1�Zd8d2d3�Z	4d<d5d6�ZdS)=r�z2Repository implementation based on the svn.fs API.Tc

Cs�||_t�|_t|t�rt|�}t�|�dd��}t	�
|�d��}t|d�}t
�||j�}|dur9ttd|d���t|d�}||_z
t
�||j�|_
Wnt	jyc}zttd|t|�d���d}~wwt
�|j
�|_t�|j|j�|_d|j|f|_d|j|f}t�||||�||kr�|t|�d�|_|jd	dks�|jd7_nd|_|j�d�s�J�t j!d
kr�dnd}	t	�"|	t#|��|_$|�%�dS)
N�\r&r'z7%(path)s does not appear to be a Subversion repository.r1z;Couldn't open Subversion repository %(path)s: %(svn_error)s)r2�	svn_errorz	svn:%s:%sr�ntsfile:///sfile://)&rrrNr,r/r0r�	posixpath�normpath�replacerr(r+rxr�svn_repos_find_root_pathrrr2�svn_repos_open�SubversionExceptionr�svn_repos_fs�fs_ptrr�get_uuid�uuid�baser	r{r<r>r;�os�name�svn_uri_canonicalizer6�ra_url_utf8�clear)
rWr2r�rr�	path_utf8�root_path_utf8�	root_pathrzr��	ra_prefixr#r#r$r{�sX

��
������zSubversionRepository.__init__NcCs$d|_|dur
|�|�|_d|_dS)z'Reset notion of `youngest` and `oldest`N)�youngestr^�oldest)rW�youngest_revr#r#r$r�,s
zSubversionRepository.clearcCsD|s|j}|�|�}t�|j||�}t�|t||j|�|�}|tvS)z:Check if `path` exists at `rev` (or latest if unspecified))	r,r^r�
revision_rootr��
check_pathr.r>r")rWr2rXr,�rev_root�	node_typer#r#r$�has_node3s
�zSubversionRepository.has_nodecCst|�S)z`Take any path specification and produce a path suitable for
        the rest of the API
        )r9)rWr2r#r#r$�normalize_path=sz#SubversionRepository.normalize_pathc
Cs�|dust|t�r|��dvr|jSz$t|�}d|kr$|jkr%|WS|j�d||jp.d|j�Wt|��tt	fy[}z|j�d||jpIdt
|��WYd}~t|��d}~ww)zhTake any revision specification and produce a revision suitable
        for the rest of the API
        N)rA�head�latestr�rz-%r cannot be normalized in %s: out of [0, %r]z	(default)z!%r cannot be normalized in %s: %s)r/rx�lowerr�r[rrrt�reponame�
ValueError�	TypeErrorrr)rWrX�normrevrzr#r#r$r^Cs*�
��
���z"SubversionRepository.normalize_revcCs d|_d|_t|j�d|_dS)z=Dispose of low-level resources associated to this repository.N)rr�rTr,r}r#r#r$�closeYs

zSubversionRepository.closecCs|jS)z�Retrieve the base path corresponding to the Subversion
        repository itself.

        This is the same as the `.path` property minus the
        intra-repository scope, if one was specified.
        )r�r}r#r#r$�get_base`szSubversionRepository.get_basec	cs��|j�|g�D]I}|�d�r@t�|�}z"dd�|�|���D�}t|dd�d�D]}|jt	j
kr4|Vq)Wqty?Yqwz|�|�VWqtyQYqwdS)z Retrieve known branches or tags.rcSsg|]}|�qSr#r#)�.0�nr#r#r$�
<listcomp>osz>SubversionRepository._get_tags_or_branches.<locals>.<listcomp>cSst|j���SrC)rr2r�)r�r#r#r$�<lambda>pr7z<SubversionRepository._get_tags_or_branches.<locals>.<lambda>��keyN)r��get�endswithr��dirname�get_node�get_entries�sortedrHrr�	Exception)rW�pathsr2�folder�entries�noder#r#r$�_get_tags_or_branchesis(�

�����z*SubversionRepository._get_tags_or_branchesccsL�|�d�D]}d|j|jdfVq|�d�D]}d|j|j|jfVqdS)z|Retrieve known branches, as (name, id) pairs.

        Purposedly ignores `rev` and always takes the last revision.
        reNrg)r�r2�created_path�created_rev)rWrXr�r#r#r$�get_quickjump_entries|s��z*SubversionRepository.get_quickjump_entriescCs:|j�dd��d�}|rt|�}|r|�d�}||�SdS)zkRetrieve the "native" URL from which this repository is reachable
        from Subversion clients.
        �urlrAr&N)r�r��rstriprr*)rWr2rXr��hrefr#r#r$�get_path_url�s
�z!SubversionRepository.get_path_urlcCs|�|�}t|||j|j�S)zIProduce a `SubversionChangeset` from given revision
        specification)r^�SubversionChangesetr>r,rVr#r#r$�
get_changeset�s
z"SubversionRepository.get_changesetcCs
|j|fS)z7Build a value identifying the `rev` in this repository.)r�rVr#r#r$�get_changeset_uid�s
z&SubversionRepository.get_changeset_uidcCsL|pd}|r|dkr|ddkr|dd�}|�|�p|j}t||||j�S)z�Produce a `SubversionNode` from given path and optionally revision
        specifications. No revision given means use the latest.
        rAr&rN)r^r��SubversionNoder,�rWr2rXr#r#r$r��s
zSubversionRepository.get_nodec	CsL|�||�}g}|��D]\}}}||ks|r||kr|S|�|�q|S)z�Return the revisions affecting `path` between `first` and `last`
        revs. If `first` is not given, it goes down to the revision in which
        the branch was created.
        )r��get_history�append)	rWr2�last�firstr��revs�p�r�chgr#r#r$�_get_node_revs�s�z#SubversionRepository._get_node_revsc
CsZi}|D]&\}}|j}g}|��D]\}}}	||ks||kr n|�|�q|||<q|SrC)r2r�r�)
rW�
node_infos�	path_revsr�r�r2r�r�r�r�r#r#r$�_get_changed_revs�s
z&SubversionRepository._get_changed_revsccs��t||j|�}||kr||}}||fdkrdSt�|j||�}t�|||�tjkr-dSt|�}t|�}t�	|||�}	d}
|	rrt�
|	|
|�}	|��||}}|	rpt�|	|�\}}|��||krg	~~dSt
|�}||fV|	s@~~dS)z�`path` is a str path in the scope.

        Generator yielding `(path, rev)` pairs, where `path` is a `str`
        object. Must start with `(path, created rev)`.

        (wraps ``fs.node_history``)
        )r:rNr:)r.r>rr�r�r�r�
svn_node_nonerN�node_history�history_prevr��history_locationr3)rWr2�start�endr,r��root�tmp1�tmp2�history_ptr�cross_copiesrXr#r#r$�_history�s:�

�
�zSubversionRepository._historyrAcCs6|dkr|�|d|d|p|j�D]\}}|SdS�Nr:)r�r,)rWrXr2r,r�prevr#r#r$�
_previous_rev�s"z"SubversionRepository._previous_revcCs|jdurd|_|jS)z.Gives an approximation of the oldest revision.Nr:)r�r}r#r#r$�get_oldest_rev�s
z#SubversionRepository.get_oldest_revcCsR|js&t�|j|j�|_|jdkr&|�dd|j|j�D]
\}}||_|jS|jS)z]Retrieve the latest revision in the repository.

        (wraps ``fs.youngest_rev``)
        r&rAr:)r�rr�r�r,r>r�r�r#r#r$�get_youngest_rev�s
z%SubversionRepository.get_youngest_revcCs|�|�}|�||�S)ziReturn revision immediately preceeding `rev`, eventually below
        given `path` or globally.
        )r^r�)rWrXr2r#r#r$�previous_rev�s
z!SubversionRepository.previous_revFcCs�|�|�}|d}|j}t|j�}||kr>|��|�||d||�D]\}}|S|s6|�|||�s6|S|d7}||ksdS)zhReturn revision immediately following `rev`, eventually below
        given `path` or globally.
        r:N)r^r�rNr,r�r�r�)rWrXr2�find_initial_rev�nextr��subpoolrr#r#r$�next_revs

��	zSubversionRepository.next_revcCs|�|�|�|�kS)z9Check relative order between two revision specifications.)r^)rW�rev1�rev2r#r#r$�rev_older_thansz#SubversionRepository.rev_older_thanccsh�|�|�}|�|�}d}t|j�}d}|r�|r||kr�|��|�|||�r�|r6|d7}||dtjfVd}d}|�|d||�D]N\}	}
t	|j
|	�|
tjf}|j|
|d�}|r�|d7}|d|kro|d|dtj
fVn|j|d|d�}|d|dtjfV|d|ddf}n|}qB|r�|d7}|Vn	d}|j||d�}|r�|r||ksdSdSdSdS)zURetrieve creation and deletion events that happened on
        given `path`.
        Frr:NrS�unknownT)r�r^rNr,r�r�r�DELETEr�r@r>�ADDr��EDIT�COPY)rWr2rX�limit�expect_deletionr��numrevs�newer�olderr�r�r#r#r$�get_path_historysF�


�� �z%SubversionRepository.get_path_historyrccs.�d}}|�|�}|�|�}|�||�r|�||�}nt||d��|�||�r/|�||�}nt||d��|j|jkrJttd|j|||j||d���t|j�}|j	r�t
�}	t�|	|�\}
}t
�|j||�}t
�|j||�}
dd�}d}d}t�|t||j|�d	|
t||j|�|
|||d
|||�
tdd�|	jD�d
d�d�}|	j��|D]>\}}}d}}|tjkr�|�t�||�|�}|tjkr�|�t�||�|�}ntt
�|t||j|j�|�}||||fVq�dSt
�|j||�}t
�|j||�}
t
� |t||j|�|
t||j|�|��r||t!j"tj#fVdSdS)z�Determine differences between two arbitrary pairs of paths
        and revisions.

        (wraps ``repos.svn_repos_dir_delta``)
        NzThe Base for Diff is invalidzThe Target for Diff is invalidz�Diff mismatch: Base is a %(oldnode)s (%(oldpath)s in revision %(oldrev)s) and Target is a %(newnode)s (%(newpath)s in revision %(newrev)s).)�oldnode�oldpath�oldrev�newnode�newpath�newrevcSsdSr�r#)r�r2r,r#r#r$�authz_cbk�z2SubversionRepository.get_changes.<locals>.authz_cbrrAr:css$�|]
\}}}t|�||fVqdSrC�r3)r�r2rH�changer#r#r$�	<genexpr>{s��z3SubversionRepository.get_changes.<locals>.<genexpr>cSs|dSrZr#)�entryr#r#r$r�}sz2SubversionRepository.get_changes.<locals>.<lambda>r�)$r^r�r�r
rH�	TracErrorrrNr,�isdir�DiffChangeEditorr�make_editorrr�r�r�svn_repos_dir_deltar.r>r��deltas�__dict__r�rr�r�r)r�r"r�r2�contents_changedrr!r�)rW�old_path�old_rev�new_path�new_rev�ignore_ancestry�old_node�new_noder��editor�e_ptr�e_baton�old_root�new_rootr�text_deltas�entry_propsrr2rHrr#r#r$�get_changesJs��

��
���

�
������z SubversionRepository.get_changesrC�NN)rAN)rA)rAF)r)r_r`rarbrcr{r�r�r�r^r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr(r#r#r#r$r��s8
3

	





#



-�r�c@szeZdZddd�Zdd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS) r�Nc
Cs|j|_|j|_t|�|_|j}t||j|�|_|r||_n"zt�|j||�|_Wnt	j
y?}z	t||t|��|�d}~wwt�
|j|j|�}|tvrRt||��t�|j|j|�}t|�}	t�|j|j|�}
t|j|	�ry|
|_t|j|	�|_n|||_|_t�||||t|�dSrC)r�r>rNr,r.�_scoped_path_utf8r�rr�rr�r
rr�r"�node_created_pathr3�node_created_revrBr�r@r�rr{)rWr2rXrr,�parent_rootrzr��cp_utf8�cp�crr#r#r$r{�s0
��
zSubversionNode.__init__cCs|jrdSt|�S)z.Retrieve raw content as a "read()"able object.N)r�FileContentStreamr}r#r#r$�get_content�szSubversionNode.get_contentTcCs0|jrdS|dur|jj�d�n|}t|||�S)z4Retrieve processed content as a "read()"able object.Nrh)rrr�r�r1)rW�keyword_substitution�eol_hintrhr#r#r$�get_processed_content�s�z$SubversionNode.get_processed_contentccsb�|jrdSt|j�}t�|j|j|�}|D]}t�|j	t
|��}t||j|j
|j|j�VqdS)zoYield `SubversionNode` corresponding to entries in this directory.

        (wraps ``fs.dir_entries``)
        N)�isfilerNr,r�dir_entriesr�r*r�r)r2r3r�rXr)rWr,r��itemr2r#r#r$r��s�
��zSubversionNode.get_entriesc	cs��d}d}t|j�}d}|j�|jd|j|�D]A\}}t|j|�}|dkrP|rP||tj	f}|rN|d|dkr;tj
}ntj}|d|d|f}|d7}|V|}|rX||krXnq|rf|ra||krh|VdSdSdS)z.Yield change events that happened on this pathNrr:)rNr,rr�r2rXr@r>rr�r�r�)	rWrrrr,rr2rXrr#r#r$r��s.�
�
�zSubversionNode.get_historyc
s�g�|jr`�fdd�}z8t|j�}td�}t�|jjt|j��}t	�
|�}|jj�d|�ddl
m}|�||||||��|j�W�St	jtfy_}z
ttd|jt|�d��|�d}~ww�S)	zaReturn a list the last changed revision for each line.
        (wraps ``client.blame2``)
        cs��|�dSrC)r�)�line_norJ�author�date�liner,��annotationsr#r$�blame_receiver�r7z6SubversionNode.get_annotations.<locals>.blame_receiverrzopening ra_local session to %r)�clientz'svn blame failed on %(path)s: %(error)s)r2rqN)r6rKrXr�r)rr�r6r*rr�rrrsrr@�blame2�create_contextr,r��AttributeErrorrrr2r)rWr?rXr��
file_url_utf8r@rzr#r=r$�get_annotations�s6
�

�
��
����zSubversionNode.get_annotationscC�&t�|j|j|j�}dd�|��D�S)zdReturn `dict` of node properties at current revision.

        (wraps ``fs.node_proplist``)
        cSsi|]\}}t|�t|��qSr#r)r�r�r5r#r#r$�
<dictcomp>s�z1SubversionNode.get_properties.<locals>.<dictcomp>)r�
node_proplistr�r*r,�items�rW�propsr#r#r$�get_propertiess�zSubversionNode.get_propertiescCs|jrdSt�|j|j|j�S)zfRetrieve byte size of a file.

        Return `None` for a folder. (wraps ``fs.file_length``)
        N)rr�file_lengthr�r*r,r}r#r#r$�get_content_lengthsz!SubversionNode.get_content_lengthcCs|jrdS|�tj�S)zqRetrieve mime-type property of a file.

        Return `None` for a folder. (wraps ``fs.revision_prop``)
        N)r�	_get_propr�SVN_PROP_MIME_TYPEr}r#r#r$�get_content_type'szSubversionNode.get_content_typecCs2t�|j|jtj|j�}|sdStt�||j��S)ziRetrieve timestamp of last modification, in micro-seconds.

        (wraps ``fs.revision_prop``)
        N)	r�
revision_propr�r�r�SVN_PROP_REVISION_DATEr,r�svn_time_from_cstring)rW�_dater#r#r$�get_last_modified0s�z SubversionNode.get_last_modifiedcCst�|j|j||j�}t|�SrC)r�	node_propr�r*r,r)rWr�r5r#r#r$rO;s�zSubversionNode._get_propcCs&t�|j|j�}|rt�|d�SdS)z�Return the revision in which the node's path was created.

        (wraps ``fs.revision_root_revision(fs.closest_copy)``)
        rN)r�closest_copyr�r*�revision_root_revision)rW�
root_and_pathr#r#r$�get_branch_origin@s�z SubversionNode.get_branch_originc
Cs�g}|j|j|jf}|rt|\}}}d}t�||�}|rr|\}}|�d�}t�|�}	d}
||kr:|t|�d��d�}
t�	||�}|rr|\}	}|�d�}t�
|j|	|j�}|
r\|d|
7}t
|jt|��}|rm|�||	f�||	|f}|s|S)aRetrieve the list of `(path,rev)` copy ancestors of this node.
        Most recent ancestor first. Each ancestor `(path, rev)` corresponds
        to the path and revision of the source at the time the copy or move
        operation was performed.
        N�/)r*rXr�rrXr*rYr<r8�copied_fromr�r�r,r@r>r3r�)
rW�	ancestors�previous�
previous_pathr��
previous_rootr�r�r2rX�relpathr]�ui_pathr#r#r$�get_copy_ancestryIs4




�z SubversionNode.get_copy_ancestryr))TNrC)r_r`rar{r2r5r�r�rErLrNrQrVrOr[rdr#r#r#r$r��s
#

			r�c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)r�Nc
Cs�|j|_||_||_|j|_t|�|_z|�tj�}Wntj	y't
|��w|�tj�}t|�}t|�}|�tj
�}|rJt�||j�}t|�}	nd}	t�||||||	�dSrC)rrrXr>r�rNr,�_get_revpropr�SVN_PROP_REVISION_LOGr�r�SVN_PROP_REVISION_AUTHORr3rSrTrrr{)
rWrrXr>r,�messager:rU�tsr;r#r#r$r{ns&
�
zSubversionChangeset.__init__cCrF)zVRetrieve `dict` of Subversion properties for this revision
        (revprops)
        cSs2i|]\}}|tjtjtjfvrt|�t|��qSr#)rrfrgrSr3)r��k�vr#r#r$rG�s��z6SubversionChangeset.get_properties.<locals>.<dictcomp>)r�revision_proplistr�rXr,rIrJr#r#r$rL�s�z"SubversionChangeset.get_propertiesc#s��t|j�}t|�}t�|j|j|�}z
t�|j||�}Wnty/t�	|j|j|�}Ynwt
�||�\}}t�||||�d}ii}}	g}
i}|j
��D]�\}}
t|�}t|j|�s_qP|
j}|
j}t|�}t|�}|
j}t|
dd�}t|j|�s�d\}}|s�|s�|jdkr�tj}ne|r�|tjkr�|r�tj}||	|�d�<nQqP|
js�|s�tj}|r�|r�tj}|||�d�<n9tj}||vr�||}nt�|j||�}|||<|��t�|||�}t|�}t� |||�}t|j|�r�||}}t!|
j"}t#|j|p�|�}t#|j|�}|
�$|||||g�|d7}qP|j%��t&��|��D]\}}||	v�r7tj'|
|d<��(|	|��q �fdd	�t)|
�D�}
|
�*�|
D]}
t+|
�V�qJdS)
z`Retrieve file changes for a given revision.

        (wraps ``repos.svn_repos_replay``)
        r�actionN)Nrr&r:r�csg|]
\}}|�vr|�qSr#r#)r��ir��movesr#r$r��s�z3SubversionChangeset.get_changes.<locals>.<listcomp>),rNr,rr�r�rXr�ChangeCollectorrC�RevisionChangeCollectorrr�svn_repos_replay�changesrIr3rBr>r2�	base_path�base_rev�getattrrr��CHANGE_ACTION_DELETEr�r*�addedr�r�r�r+r,r"�	item_kindr@r�r�set�MOVE�add�	enumerate�sort�tuple)rWr,�tmpr�r!r"r#�idx�copies�	deletionsrt�revrootsr�rr�base_path_utf8r2rurv�
change_actionrm�b_root�cbase_path_utf8�
cbase_path�	cbase_revrHrjrkr#ror$r(�s��
�

�
�




��zSubversionChangeset.get_changesc
CsHzt�|j|j||j�WStjy#}z
|j�d||j��d}~ww)Nz %r of the %r cannot be retrieved)	rrRr�rXr,rr�rrrt)rWr�rzr#r#r$re�s��z SubversionChangeset._get_revproprC)r_r`rar{rLr(rer#r#r#r$r�ls


\r�cCsGdd�dtj�}|�S)Nc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)z*DiffChangeEditor.<locals>.DiffChangeEditorcSs
g|_dSrC)rr}r#r#r$r{�
z3DiffChangeEditor.<locals>.DiffChangeEditor.__init__cSs
dtjfS)Nr&)rr�)rW�
base_revision�dir_poolr#r#r$�	open_rootr�z4DiffChangeEditor.<locals>.DiffChangeEditor.open_rootcSs |j�|tjtjf�|tjfSrC)rr�rrrr�)rWr2�	dir_baton�
copyfrom_path�copyfrom_revr�r#r#r$�
add_directorys
z8DiffChangeEditor.<locals>.DiffChangeEditor.add_directorycSs||dfSr�r#)rWr2r�r�r�r#r#r$�open_directoryr]z9DiffChangeEditor.<locals>.DiffChangeEditor.open_directorycSs.|\}}|tjkr|j�|tj|f�dSdSrC)rr�rr�rr)rWr�r�r5r,r2rr#r#r$�change_dir_props
�z:DiffChangeEditor.<locals>.DiffChangeEditor.change_dir_propcSs|j�|dtjf�dSrC)rr�rr�)rWr2rJr�r,r#r#r$�delete_entrysz7DiffChangeEditor.<locals>.DiffChangeEditor.delete_entrycS�|j�|tjtjf�dSrC)rr�rr!rr�)rWr2r�r��copyfrom_revisionr�r#r#r$�add_filesz3DiffChangeEditor.<locals>.DiffChangeEditor.add_filecSr�rC)rr�rr!rr�)rWr2r��	dummy_rev�	file_poolr#r#r$�	open_filesz4DiffChangeEditor.<locals>.DiffChangeEditor.open_fileN)r_r`rar{r�r�r�r�r�r�r�r#r#r#r$rsr)r�Editor)rr#r#r$r�s!rc@seZdZgd�ddgddgddgdgd	gd
�Ze�ejeee�	���Z
e�d�Z
e�d�Zd
ddejdkr7dnd
d�ZdZdZdZdZd
Zd1dd�Zdd�Zdd�Zdd�Zd2dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Z d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$dS)3r1)�LastChangedRevision�Rev�Revision�LastChangedDate�Date�
LastChangedBy�Author�HeadURL�URL�Id�Header)rXr;r:r��id�headerz[ \t\v\n\b\r\f]+z%[abdDPrRu_%HI]�
s
�
r�)rjrkrlri�iNcCs�d|_d|_|j|_||_|j|_t�|_|r(|�|�t	j
��|_|�|j�|_
|j�|d�dkrB|�t	j�dkrBd|_|j||_t	�t�|j|j|j��|_dS)N��
riT)�
translated�bufferrr�r�rNr,�_get_keyword_valuesrOr�SVN_PROP_KEYWORDS�keywords�_build_keywords_re�keywords_re�NEWLINESr��SVN_PROP_EOL_STYLE�
native_eol�newline�Streamr�
file_contentsr�r*�stream)rWr�r3�eolr#r#r$r{;s&
��zFileContentStream.__init__cCs|SrCr#r}r#r#r$�	__enter__Pr
zFileContentStream.__enter__cCs|��dSrC)r�)rW�et�ev�tbr#r#r$�__exit__Sr]zFileContentStream.__exit__cCs d|_d|_t|j�d|_dSrC)r�r�rTr,r}r#r#r$r�Vs

zFileContentStream.closecCs>|jdur	td��|jdur|js|�|j|�S|�|j|�S)NzI/O operation on closed file)r�r�r�r��
_read_dumb�_read_substitute)rWr�r#r#r$�read\s

zFileContentStream.readcCst�|j|||j�SrC)rrRr�r,)rWr�rXr#r#r$redszFileContentStream._get_revpropcs��sdSttd|j�������sdS|j}t|jt�}|�|�}|�	|�}t
|j�}t|�
tj|j��}|j�d�}|j�||j�pD|}	|j�d|j�pNd}
d�|j|||f�}id|�d|�d|	�d|�d|�d	d�|	|||f��d
|�d|j�d|�d
|�d|�d|�d|
�d|	�dd�dd�d|�dd�||||f�i���fdd�}i}
|j��D]\�}t�fdd�|D��r�|
���fdd�|D��q��D]}d|vr�q�|�dd�\�}�|jvr�|j�||�|
�<q�|
r�dd�|
��D�SdS) Nr&rA� rXr:r�r;r�r�z%az%bz%dz%Dz%Pz%rz%Rz%uz%_z%%�%z%Iz%Hcs|�d�}��||�SrZ)�groupr�)�match)�datar#r$�expand�s
z5FileContentStream._get_keyword_values.<locals>.expandc3s�|]}|�vVqdSrCr#�r��kw)r�r#r$r�s�z8FileContentStream._get_keyword_values.<locals>.<genexpr>c3s�|]	}|��fVqdSrCr#r�)r�r�r#r$r�s��=r:cSs&i|]\}}|�d�t|��d��qS)r')r+rx)r�r�r5r#r#r$rG�s�z9FileContentStream._get_keyword_values.<locals>.<dictcomp>)�list�filter�KEYWORD_SPLIT_RE�splitr�r�
last_modifiedr�_format_shortdate�_format_longdaterxr�r3rerrgr2r*rr�rXr)r��KEYWORD_GROUPSrI�anyr��KEYWORDS�KEYWORD_EXPAND_RE�sub)rWr�r��mtime�	shortdate�longdater�r:r2r��root_url�id_r��values�aliases�keyword�
definitionr#)r�r�r�r$r�gs�



�������������������
�
��z%FileContentStream._get_keyword_valuescCs(|rt�dd�ttj|��tj�SdS)Ns�
                [$]
                (?P<keyword>%s)
                (?:
                    :[ ][^$
]+?[ ]   |
                    ::[ ](?P<fixed>[^$
]+?)[ #]
                )?
                [$]�|)�re�compiler)�map�escape�VERBOSE)rWr�r#r#r$r��s��
z$FileContentStream._build_keywords_recCs
|�d�S)Nz%Y-%m-%d %H:%M:%SZ)�strftime)rWr�r#r#r$r��r�z#FileContentStream._format_shortdatecCs2|�d�}d}d}|||��||jdd�S)Nz.%Y-%m-%d %H:%M:%S +0000 (%%(a)s, %d %%(b)s %Y))�Mon�Tue�Wed�Thu�Fri�Sat�Sun)�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decr:)�a�b)r��weekday�month)rWr��text�weekdays�monthsr#r#r$r��s
�z"FileContentStream._format_longdatecCs
|�|�SrC)r�)rWr�r�r#r#r$r��r�zFileContentStream._read_dumbcCs�|durd}|j}|j}	d|krt|�kr+nn||_||d�|_|d|�St|�|jkrF||�|j�p:d7}|sF||_d|_|S|jrN|�d�nd}|dkr^||�|�7}d}q|dkrs||�|d|��7}||d�}d}	|�dd�}|dkr�||�|�7}d}n ||jkr�|j�	|�}|r�n||�|d|��7}||d�}qv|dks�|s�q|d7}||�
|d|�|�7}||d�}q)NrTrr��$r:)r�r�r<�KEYWORD_MAX_SIZEr��
CHUNK_SIZEr��find�_translate_newliner��_translate_keyword)rWr�r�r�r��posr�r#r#r$r��sV
�z"FileContentStream._read_substitutecCs|jr
|�d|j�}|S)Nr�)r�r�r�)rWr�r#r#r$r
�sz$FileContentStream._translate_newlinecCs�|�d�}|j�|�}|dur|S|�d�}|dur0|jt|�d}|dkr.d|||fS|St|�}d|||||t|�krCdfSdfS)	Nr��fixed�rs$%s: %.*s $s$%s:: %-*.*s%s$�#� )r�r�r�rr<)rWrr�r�r5r
r�r#r#r$r�s

��z$FileContentStream._translate_keywordr)rC)%r_r`rar��	functools�reducer{�unionr�r�r�r�r�r�r�r�r�r�rrr�r�r�r{r�r�r�r�rer�r�r�r�r�r�r
rr#r#r#r$r1%sB�

�

36r1rC)<rbr�os.pathr�r�r��urllib.parser�trac.apir�trac.configrr�	trac.core�trac.versioncontrolrrr	r
rrr
�trac.versioncontrol.cacher�	trac.utilr�trac.util.concurrencyr�trac.util.textrrr�trac.util.translationr�trac.util.datefmtrrr�
trac.web.hrefrr%r.r3r6r9r@rBrKrMrNrTrU�	Componentrdr�r�r�r�objectr1r#r#r#r$�<module>sP$




O+Q&

https://t.me/RX1948 - 2025