ROOTPLOIT
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: ws67150586 (67150586)
PHP: 8.3.36
Disabled: NONE
Upload Files
File: //kunden/kunden/kunden/lib/python3/dist-packages/mercurial/__pycache__/dagop.cpython-313.pyc
�

6�h�����SSKJr SSKrSSKrSSKJr SSKJr \R(aSSKrSSKJ	r	 SSK
JrJrJ
r
JrJrJr \R"r\R$rSrS	rS)S
jrS)SjrSrS*S
jrSrSrSrS+SjrSr"SS5rSrS)Sjr Sr!S)Sjr"Sr#\RH"SSS9"SS55r%\RH"SSS9"SS55r&S r'S!r(S"r)S+S,S#jjr*S-S$jr+S%r,S&r-S+S'jr.S(r/g).�)�annotationsN)�List�)�attr)�nullrev)�error�mdiff�patch�pycompat�scmutil�smartsetlc#�# �UcSnUc[nUS:XagUS:a[R"S5eU(aSnOSnURU5 [	U5n/n[US5nUb[R"XuU-S45 Sn	U(a�[R"U5up�XZ-n
X�:Xa*[US5nUb[R"XuU-S45 X�:gnU(aX�:�aU
n	U
v� US-n
U(a;X�:a6U"U
5H*nU[:wdM[R"XuU-U
45 M, U(aM�gg7f)aWalk DAG using 'pfunc' from the given 'revs' nodes

'pfunc(rev)' should return the parent/child revisions of the given 'rev'
if 'reverse' is True/False respectively.

Scan ends at the stopdepth (exlusive) if specified. Revisions found
earlier than the startdepth are omitted.
Nrsnegative stopdepth���r)
�maxlogdepthr�ProgrammingError�sort�iter�next�heapq�heappush�heappopr)�pfunc�revs�
startdepth�	stopdepth�reverse�heapsign�irevs�pendingheap�inputrev�lastrev�currev�curdepth�foundnew�pdepth�prevs               �1/usr/lib/python3/dist-packages/mercurial/dagop.py�_walkrevtreer((s>������
����	��A�~���1�}��$�$�%:�;�;������	�I�I�g����J�E��K��E�4� �H���
���{��%8�!�$<�=��G�
� �=�=��5����"�����E�4�(�H��#����{��-@�!�,D�E��$����.��G��L��A�����*��f�
���7�?��N�N�;�D��&�0I�J�&��+�s�DE�&E�Ec#�B^^	# �0m/m	UU	4SjnU(aSnOSnUHnU"U5 M
 T(aa[R"T	5*nTRU5nXV4v� UH%nUR5SUHnU"U5 M
 M' T(aMaT	(aeg7f)z�Like filectx.ancestors(), but can walk from multiple files/revisions,
and includes the given fctxs themselves

Yields (rev, {fctx, ...}) pairs in descending order.
c�>�[R"U5nUT;a%[5TU'[R"TU*5 TURU5 g�N)r�intrev�setrr�add)�fctx�rev�visit�	visitheaps  ��r'�addvisit�"filectxancestors.<locals>.addvisitfsD����n�n�T�"���e����E�#�J��N�N�9�s�d�+�
�c�
���t��rN)rr�pop�parents)
�fctxs�followfirstr3�cut�cr"�curfctxs�parentr1r2s
        @@r'�filectxancestorsr>]s�����
�E��I�������
������
��=�=��+�,���9�9�V�$������A��)�)�+�d�s�+���� �,��	�%���=�y�s�BB�
Bc�:�S[X55n[USS9$)z�Like filectx.ancestors(), but can walk from multiple files/revisions,
and includes the given fctxs themselves

Returns a smartset.
c3�*# �UH	upUv� M g7fr+�)�.0r0�_css   r'�	<genexpr>�#filerevancestors.<locals>.<genexpr>�s���
D�C�8�3�3�C�s�F��iterasc)r>�generatorset)r8r9�gens   r'�filerevancestorsrJ~s"��E�/��C�
D�C���U�+�+r5c�^^^^^	�U(aSmOSmTRmUUU4Sjm	TcT	nOUU	4SjnURU4Sj5n[XaX4SS9$)Nrc�>�TRU5ST$![Ra  STUR5ST5s$f=f)Nc3�@# �UHoR5v� M g7fr+�r0�rB�pctxs  r'rD�7_genrevancestors.<locals>.plainpfunc.<locals>.<genexpr>�s���E�+D�4�H�H�J�J�+D���)�
parentrevsr�WdirUnsupportedr7)r0�clr:�repos ���r'�
plainpfunc�$_genrevancestors.<locals>.plainpfunc�sU���	F��=�=��%�d�s�+�+���$�$�	F�E�4��9�+<�+<�+>�t��+D�E�E�	F�s��1A�
Ac�^>�T"U5Vs/sHnT"U5(aMUPM sn$s snfr+rA)r0�r�cutfuncrWs  ��r'�<lambda>�"_genrevancestors.<locals>.<lambda>�s!���
�3��J��1�w�q�z�Q��J��Js�*�*c�>�T"U5(+$r+rA)r0r[s �r'r\r]�s���7�3�<�'7r5T�r)�	changelog�filterr()
rVrr9rrr[rrUr:rWs
`    ` @@@r'�_genrevancestorsrb�sN��������	
���B�F�����J���{�{�7�8����Z�D�I�Ir5c�0�[XX#XE5n[USS9$)aTLike revlog.ancestors(), but supports additional options, includes
the given revs themselves, and returns a smartset

Scan ends at the stopdepth (exlusive) if specified. Revisions found
earlier than the startdepth are omitted.

If cutfunc is provided, it will be used to cut the traversal of the DAG.
When cutfunc(X) returns True, the DAG traversal stops - revision X and
X's ancestors in the traversal path will be skipped. This could be an
optimization sometimes.

Note: if Y is an ancestor of X, cutfunc(X) returning True does not
necessarily mean Y will also be cut. Usually cutfunc(Y) also wants to
return True in this case. For example,

    D     # revancestors(repo, D, cutfunc=lambda rev: rev == B)
    |\    # will include "A", because the path D -> C -> A was not cut.
    B C   # If "B" gets cut, "A" might want to be cut too.
    |/
    A
FrF)rbrH)rVrr9rrr[rIs       r'�revancestorsrd�s$��0��K�Y��C���U�+�+r5c#�x# �U(aSnOSnURnUR5nU[:XaUv� UHnUv� M	 g[U5nUR	U5HRnXg;aUv� MURU5SUH,nU[:wdMX�;dMUR
U5 Uv�  MP MT g7f)Nr)r`�minrr-rrSr.)	rVrr9r:rU�first�i�seen�xs	         r'�_genrevdescendantsrk�s���������	
���B��H�H�J�E�������A��G���4�y�������A��y�����]�]�1�%�d�s�+����<�A�I��H�H�Q�K��G��	,�	 �s�BB:�B:�B:c�h�URn[U[U55Vs/sHn/PM nnURUS-5HcnUR	U5upxXq:�aXWU-
RU5 U(aM:U[:wdMFX�:�dMMXXU-
RU5 Me U$s snf)z6Build map of 'rev -> child revs', offset from startrevr)r`�range�lenrrS�appendr)	rV�startrevr9rU�_rev�descmapr"�p1rev�p2revs	         r'�_builddescendantsmapru�s���	
���B�#�H�c�"�g�6�7�6�d�r�6�G�7��'�'�(�Q�,�'���}�}�V�,������H�$�%�,�,�V�4��{�u��/�E�4E��H�$�%�,�,�V�4�(��N��8s�B/c�d^^�UR5m[UTU5mUU4Sjn[XQX4SS9$)Nc�>�TUT-
$r+rA)r0rrrps ��r'r�(_genrevdescendantsofdepth.<locals>.pfunc�s����s�X�~�&�&r5Fr_)rfrur()rVrr9rrrrrrps      @@r'�_genrevdescendantsofdepthry�s2����x�x�z�H�"�4��;�?�G�'���Z�E�J�Jr5c�j�UcUb
U[:�a
[XU5nO
[XX#U5n[USS9$)z�Like revlog.descendants() but supports additional options, includes
the given revs themselves, and returns a smartset

Scan ends at the stopdepth (exlusive) if specified. Revisions found
earlier than the startdepth are omitted.
TrF)rrkryrH)rVrr9rrrIs      r'�revdescendantsr{�sB����y�0�I��4L� ��[�9��'����
����T�*�*r5c#�# �[U5nU[:XaU"5HnUv� M	 g[U5nU"US-S9H;nU"U5H,nU[:wdMXe;dMURU5 Uv�  M9 M= g7f)a?Generate revision number descendants in revision order.

Yields revision numbers starting with a child of some rev in
``revs``. Results are ordered by revision number and are
therefore topological. Each revision is not considered a descendant
of itself.

``revsfn`` is a callable that with no argument iterates over all
revision numbers and with a ``start`` argument iterates over revision
numbers beginning with that value.

``parentrevsfn`` is a callable that receives a revision number and
returns an iterable of parent revision numbers, whose values may include
nullrev.
Nr��start)rfrr-r.)r�revsfn�parentrevsfnrgr0rir&s       r'�descendantrevsr��su��� 
��I�E�����8�C��I����t�9�D��E�A�I�&�� ��%�D��w��4�<�����
��	��	&�'�s�AA?�A?� A?c�@�\rSrSrSrSSjrSrSrSrSr	S	r
S
rg)�subsetparentswalkeria�Scan adjacent ancestors in the graph given by the subset

This computes parent-child relations in the sub graph filtered by
a revset. Primary use case is to draw a revisions graph.

In the following example, we consider that the node 'f' has edges to all
ancestor nodes, but redundant paths are eliminated. The edge 'f'->'b'
is eliminated because there is a path 'f'->'c'->'b' for example.

      - d - e -
     /         \
    a - b - c - f

If the node 'c' is filtered out, the edge 'f'->'b' is activated.

      - d - e -
     /         \
    a - b -(c)- f

Likewise, if 'd' and 'e' are filtered out, this edge is fully eliminated
since there is a path 'f'->'c'->'b'->'a' for 'f'->'a'.

       (d) (e)

    a - b - c - f

Implementation-wise, 'f' is passed down to 'a' as unresolved through the
'f'->'e'->'d'->'a' path, whereas we do also remember that 'f' has already
been resolved while walking down the 'f'->'c'->'b'->'a' path. When
processing the node 'a', the unresolved 'f'->'a' path is eliminated as
the 'f' end is marked as resolved.

Ancestors are searched from the tipmost revision in the subset so the
results can be cached. You should specify startrev to narrow the search
space to ':startrev'.
Nc���UbURSU5U-nURnU(aU"5nOZUR5(d:UR5(d%[R
"U5nUR
SS9 [U5nXlURUl
X l/Ul0Ul
0Ul0Ul[ UlXPl[ UlUR)5 g)Ns%d:nullTr_)r�fastdesc�isdescending�istopor
�basesetrr�_repor`�
_changelog�_subset�_tovisit�_pendingcnt�	_pointers�_parentsr�
_inputhead�
_inputtail�
_bottomrev�
_advanceinput)�selfrV�subsetrpr��desciters      r'�__init__�subsetparentswalker.__init__Cs������Y�Y�z�8�4�v�=�F��?�?����z�H��&�&�(�(������!�)�)�&�1�����D��)��F�|�H��
��.�.�������
���������
�!���"��!������r5c�L�[R"URU55$)zNLook up parents of the given revision in the subset, and returns
as a smartset)r
r�r7)r�r0s  r'�
parentsset�subsetparentswalker.parentsset`s��������S� 1�2�2r5c��URU5 [URRU/55VVs/sHup#UPM	 snn$s snnf)zpLook up parents of the given revision in the subset

The returned revisions are sorted by parent index (p1/p2).
)�_scanparents�sortedr��get)r�r0�_crZs    r'r7�subsetparentswalker.parentsesD��
	
���#��%�d�m�m�&7�&7��R�&@�A�B�A�e�b��A�B�B��Bs�Ac���URRU5nUS[:XaUSS$U$![Ra0 [SURSR555s$f=f)Nrc3�@# �UHoR5v� M g7fr+rNrOs  r'rD�2subsetparentswalker._parentrevs.<locals>.<genexpr>ts���K�0J������0J�rR)r�rSrrrT�tupler�r7)r�r0rs   r'�_parentrevs�subsetparentswalker._parentrevsmss��	L��?�?�-�-�c�2�D��B�x�7�"��C�R�y� ��K���$�$�	L��K��
�
�4�0@�0H�0H�0J�K�K�K�	L�s�,1�1�AA5�4A5c���UR[:ag[UR5Ulg![a" URUl[S-
Ulgf=f)zBAdvance the input iterator and set the next revision to _inputheadNr)r�rrr��
StopIterationr�)r�s r'r��!subsetparentswalker._advanceinputvsK���?�?�W�$��	*�"�4�?�?�3�D�O���	*�"�o�o�D�O�%��k�D�O�	*�s�2�)A�Ac�^�URmURnURnURnURnU(dUR
[:�GaURU5S:XagU(d1[R"X R
*5 UR5 UR
US*:�aG[R"X R
*5 UR5 UR
US*:�aMG[R"U5*nX`R:agXc;aXd;aM�UT;nURUS5 U(aXe;de/XV'URU0[545up�U(a�UR!5HQup�X:==S-ss'X:S:�deX�;aM"XZR#X�45 X:S:�dM@U	R%U
5 MS UR'5 U	V
s1sHo�U
S:�dM
U
iM n	n
UR)U5n[+U4SjU55n
U
(aU(dU	(Ga#[-U5S::aX�4/nO^X�4UR/5U	R/54/nUH5n
X:==S-
ss'USSU
==S-
ss'USSU
==S-
ss'M7 [1U5H�unnUU:de[R"UU*5 UU;aoUUunnX�up�UR!5H:up�U
U;a*X:==S-ss'X:S:�de[3UUU
5UU
'M5UUU
'M< UR5U	5 M�X�UU'M� [-U5S::aS/OSS/nU(aAU
(a:[1U5H unnUUnXVR#UU45 M" X6S:XdeO�U(az[1U5HWunnUUup�Xh;deUUnUT;a(XVR#UU45 U	R%U5 MGX6==S-
ss'X�U'MY SX6s=:aS::de eU(aGMUR
[:�aGMggs sn
f)	zFScan ancestors until the parents of the specified stoprev are
resolvedrNrc3�,># �UH	oT;v� M g7fr+rA)rB�pr�s  �r'rD�3subsetparentswalker._scanparents.<locals>.<genexpr>�s����#D��A��K��s��1�2r5�)r�r�r�r�r�r�rr�rrr�rr��
setdefaultr6r-�itemsror.�clearr��allrn�copy�	enumeraterf�update)r��stoprev�tovisit�
pendingcnt�pointersr7r0�	curactive�
unresolved�resolvedrZr;rS�bothparentsactive�parentpointersrhr��knownunresolved�
knownresolved�
chaincodesr�s                    @r'r�� subsetparentswalker._scanparents�sM���,�����-�-���%�%�
��>�>���-�-������G�3��~�~�g�&�!�+������w���(8�9��"�"�$��/�/�g�a�j�[�0����w���(8�9��"�"�$��/�/�g�a�j�[�0��=�=��)�)�C��_�_�$��� �S�%8���v�
�I��!�!�#�q�)���)�)�)�!���#+�<�<��b�#�%�[�#A� �J��&�,�,�.�D�A��M�Q�&�M�%�=�A�-�-�-��}� ��J�%�%�q�h�/�"�}�q�(� ���Q��/�� � �"�(0�E�x�!�a�=�1�3D�A�x��E��)�)�#�.�J� #�#D��#D� D��
%�
�h��z�?�a�'�'1�&<�%=�N�$�.�#���*�H�M�M�O�<�&�N�(��"�
��*�
�&�q�)�!�,�Q�/�4�7�/�&�q�)�!�,�Q�/�4�7�/�(�&�j�1�D�A�q��s�7�N�7��N�N�7�Q�B�/��H�}�:B�!��6���/=�/@�,�
�$.�$4�$4�$6�D�A� �O�3� *�
�� 2�
�'1�}�q�'8� 8�'8�58��O�A�<N�5O��� 2�56��� 2�%7�&�,�,�X�6�&4�&7����+2�4#&�j�/�Q�"6�#��T�4�L�J��.�%�j�1�D�A�q�"�1�
�A��L�'�'��A��/�2�
"��!�+�+�+��%�j�1�D�A�q�+3�A�;�(�J��0�0�0�"�1�
�A��F�{���+�+�Q��F�3� ���S�)�"��1�,��*+�3��2��:�?�/�a�/�/�/�/�/�_�g����G�3�3��RFs�=Q6�
Q6)
r�r�r�r�r�r�r�r�r�r�r+)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r�r�r7r�r�r��__static_attributes__rAr5r'r�r�s)��#�J�:3�
C�L�*�K0r5r�c���U(d/$[U5n[U5n[5n0nURnURn	URn
U(aQU
"5nX�;aU"U5 U(dM$U"U5nX�U'UHn
X�:�dM
X�;dMU	"U
5 M U(aMQU(d
[5$U(dU$[
U5HnX{Hn
X�;dM
U"U5 M M U$�zSee revlog.reachableroots)r-�listr.ror6r�r�)r�minroot�roots�heads�includepathr1�	reachableri�reached�dovisit�	nextvisitr0r7r=s              r'�_reachablerootspurer�s�����	���J�E���K�E���I�
�D��m�m�G��l�l�G��	�	�I���k���<��C�L�����*���S�	��F�� �V�%7������%���y������d�|���i�F��"���� ���r5c���U(d
[5$UR5n[U5n[U5nURR	XBX5n[U5nUR5 U$r�)r�rfr�r`�reachablerootsr)rVr�r�r�r�rs      r'r�r�2sW����y���i�i�k�G���K�E���K�E��>�>�(�(���L�D��4�=�D��I�I�K��Kr5c���[R"UR5UR5U5n[R"XB5upV[	SU55nXv4$)z�Return `(diffinrange, linerange1)` where `diffinrange` is True
if diff from fctx2 to fctx1 has changes in linerange2 and
`linerange1` is the new line range for fctx1.
c3�0# �UHupUS:Hv� M g7f)�!NrA)rB�_�stypes   r'rD� _changesrange.<locals>.<genexpr>Fs���C�N���e�t�m�N�s�)r	�	allblocks�data�
blocksinrange�any)�fctx1�fctx2�
linerange2�diffopts�blocks�filteredblocks�
linerange1�diffinranges        r'�
_changesranger�?sN��
�_�_�U�Z�Z�\�5�:�:�<��
B�F�!&�!4�!4�V�!H��N��C�N�C�C�K��"�"r5c#�d# �[R"URR5nUR	5nUR5UR
54XU440nU(a�UR[U55upgUR5nU(aUSSnU(dXg4v� MMSn	UHbn
[X�Xt5up�U	=(d Un	USUS:XaM*UR5U
lX�4XZR5U
R
54'Md U	(aXg4v� U(aM�gg7f)z_Yield ancestors of `fctx` with respect to the block of lines within
`fromline`-`toline` range.
NrFr)
r
r�r��ui�introfilectx�linkrev�filenoder6�maxr7r�r0�_descendantrev)
r/�fromline�toliner9r�r1r;r��pl�inranger��inrangepr�s
             r'�blockancestorsr�Js����~�~�d�j�j�m�m�,�H�����D��l�l�n�d�m�m�o�
.��&�7I�0J�K�E�
��	�	�#�e�*�-�
��
�Y�Y�[����B�Q��B���-������A�#0��z�#L� �H��)��G��!�}�
�1�
�-�� !�u�u�w�A��/0�}�E�)�)�+�q�z�z�|�+�,����-��1�%�s�D*D0�.D0c#�# �[[XU55up4X0:XaX44v� [R"UR
R5nUR5nUR5XU440nURUR5/5H�nURU5nSn	URU5Han
Xzup�[X;X�5up�U	=(d U
n	X�;a4XxSU:wa)[XGUS5up�[U5[!U54nX44Xx'Mc U	(dM�UW4v� M� g![a GNf=f![a M�f=f7f)zaYield descendants of `fctx` with respect to the block of lines within
`fromline`-`toline` range.
FrN)rr�r�r
r�r�r��filelog�filerev�descendants�filectxrS�KeyErrorr��ziprfr�)r/r�r�r;r�r��flrirhr�rjr�r�r��lbs�ubss                r'�blockdescendantsrlsI��� ��^�D�F�C�D�
��
�9��-���~�~�d�j�j�m�m�,�H�	
����B��L�L�N�T�f�#5�6�7�D�
�^�^�T�\�\�^�,�
-���L�L��O�������q�!�A�
� $��
��$1��z�#L� �H��)��G�
�y�T�W�Q�Z�:�5��z��7�1�:�6��� ��X�s�3�x�/�
��m�D�G�"� �7��Z�-��).���
��
���
��
�sS�E�D4�B#E�?E�A E�)E�4
E�>E�E�E�
E�E�E�ET)�slots�frozenc��\rSrSr\R
"5r\R
"5r\R
"SS9r\R
"SS9r	Sr
g)�annotatelinei�F)�defaultNrA)r�r�r�r�r�ibr/�lineno�skip�textr�rAr5r'rr�s4���7�7�9�D�
�W�W�Y�F��7�7�5�!�D��7�7�4� �Dr5rc��\rSrSr\R
"5r\R
"5r\R
"5r\R
"5r	Sr
g)�_annotatedfilei�rAN)r�r�r�r�rr
r8�linenos�skipsr
r�rAr5r'rr�s0��
�G�G�I�E��g�g�i�G��G�G�I�E��7�7�9�Dr5rc��URS5(aURS5$URS5[[U55-$)N�
)�endswith�count�int�bool)r
s r'�_countlinesr�s<���}�}�U����z�z�%� � ��:�:�e��s�4��:��.�.r5c�x�[U5n[R"SUS-5n[U/U-US/U-U5$)NrF)rr�	rangelistr)r
r/�nrs    r'�_decoratelinesr�s?���D��A�� � ��A��E�*�G��4�&�1�*�g��w��{�D�A�Ar5c
��UVs/sH/nU[R"URURUS94PM1 nnU(a!UVVs/sHupxU[U54PM nnnUHjupXUH_uup�p�n
U
S:XdMURX�URX�&UR
X�UR
X�&URX�URX�&Ma Ml U(Ga�UR5 UVVs/sH	up^U/4PM nnn[U5H�unupXUH�uup�p�nX�-
X�-
:�a�[X�5HtnURUU:XdM[U	UU-
-U
S-
5nURUURU'UR
UUR
U'SURU'Mv M�UUSRX�X�45 M� M� UH�upXUH�up�p�[X�5HtnURUU:XdM[U	UU-
-U
S-
5nURUURU'UR
UUR
U'SURU'Mv M� M� U$s snfs snnfs snnf)aT
Given parent and child fctxes and annotate data for parents, for all lines
in either parent that match the child, annotate the child with the parent's
data.

Additionally, if `skipchild` is True, replace all other lines with parent
annotate data as well such that child is never blamed for any lines.

See test-annotate.py for unit tests.
)�opts�=rT)r	r�r
r�r8rrrr�rmrfro)r7�	childfctx�child�	skipchildr�r=�pblocksr�r��a1�a2�b1�b2�t�_blocks�	remaining�idx�_t�bk�aks                    r'�
_annotatepairr/�sj�����F�
�������e�j�j�x�H�I����
�8?�@���!�A�t�F�|�$���@�"���#)���R�R�a��D�y�%+�\�\�"�%8����B�"�'-�~�~�b�'<��
�
�b�$�%+�\�\�"�%8����B�"�
$*�"��	����:A�A��o�f�f�b�\��	�A�%.�w�%7�!�C�!�&�(.�$� ���"��7�b�g�%�#�B�m�� �;�;�r�?�i�7�!$�R�2��7�^�R�!�V�!<�B�.4�l�l�2�.>�E�K�K��O�06���r�0B�E�M�M�"�-�.2�E�K�K��O�,��c�N�1�%�,�,�b�b�-=�>�)/�&8�(�N�F�"(������-�B��{�{�2��)�3� ��r�B�w���a��8��*0�,�,�r�*:����B��,2�N�N�2�,>��
�
�b�)�*.����B��(�#)�(��L��q��A��4Bs�6I/�	I4�2I:c��U/n0nUS0nU(adUR5nXu;aMU"U5nX�U'UH2n	URU	S5S-Xi'X�;dM!URU	5 M4 U(aMdU/USS&0n
U(a�USnXz;aUR5 M#SnXWnUHn	X�;dM
SnURU	5 M U(a�UR5 [UR	5U5nSn
UbUR
U;n
[
UV	s/sHo�U	PM	 sn	X|X�5nUHn	XiS:XaX�	Xi	MXi==S-ss'M X�U'XW	U(aM�X�n[URURUR[R"UR55Vs/sHn[U6PM
 sn$s sn	fs snf)zjCore algorithm for filectx.annotate()

`parents(fctx)` is a function returning a list of parent filectxs.
rrNrTF)r6r�rorr��	_changeidr/rr8rrr	�
splitnewlinesr
r)�baser7�skiprevsr�r1�pcache�needed�fr�r��hist�ready�currr"�arZs                r'�annotater<�s����F�E�
�F��A�Y�F�
��I�I�K���;��
�Q�Z���q�	��A��
�
�1�a�(�1�,�F�I������Q���
�%��v�E�!�H�
�D�
��"�I���9��I�I�K����
�Y���A��}������Q�����I�I�K�!�!�&�&�(�A�.�D��I��#��K�K�8�3�	� �"$�%�"�Q�a��"�%�q�	��D����9��>����	��I��N�I����G��	�;�%�>	
�
�A��Q�W�W�a�i�i����%�2E�2E�a�f�f�2M�N��N�A�	�a��N����&��s�G�0G
c#��# �URSS9 [U5n/U4/n/n[5n[R"U5 [Rn[R
nUGH�n	X�;aU"XY*5 UR
U	5 Sn
X�:wdM,U"U5*n
URU
5 [U5VVs/sHup�X�S;dMUPM n
nnU
(aVU
RS5nXNunnU
H#nXKnURUS5 UUS-nM% [U
5HnXK	M O[U5nUR/U
145 XNnX�:XaUSRU
5 USRU
5 U"U
5Vs/sHnU[:�dMUPM nnUSRU5 UH&nUU;dMUR
U5 U"UU*5 M( U(d[U5S:�aSnUSnOUSU-(dSnUb'UUS-nUSShv�N U(aXN	O/USSS&X�:waGM�GM� UHnUSShv�N M gs snnfs snfNEN7f)a�Yield revisions from heads to roots one (topo) branch at a time.

This function aims to be used by a graph generator that wishes to minimize
the number of parallel branches and their interleaving.

Example iteration order (numbers show the "true" order in a changelog):

  o  4
  |
  o  1
  |
  | o  3
  | |
  | o  2
  |/
  o  0

Note that the ancestors of merges are understood by the current
algorithm to be on the same branch. This means no reordering will
occur behind a merge.
Tr_Nrr)rr-r�heapifyrrr.�remover�r6�extend�reversedrnrorr�)r�parentsfunc�firstbranch�	unblocked�groupsr�
pendingsetrr�
currentrevr0rh�g�matching�	targetidx�trevs�tparents�grr�r7s                    r'�toposortrN;s����f	�I�I�d�I���K� �I�2�9�o�
�F��K���J�	�M�M�+���m�m�G��~�~�H��
��'��[�+�.��N�N�:�&������;�'�'�C����c�"�'0��&7�G�&7�d�a�3�A�$�;��&7�H�G��(%�L�L��O�	�"(�"3���x�!�A���B��L�L��A��'���1��%�H�"�"�(�+�A��	�,� ��K�	��
�
�r�C�5�k�*��"�B�� ��1����S�!��q�E�L�L���"-�c�"2�B�"2�Q�a�'�k�q�"2�G�B��q�E�L�L��!����J�&��N�N�1�%��[�1�"�-�� ��v�;��?� !�I����B����U�Y�&����~��R��U�"�	��a�5� � ���)�!�B�q�E�!�H�u����J���Q�4�����qH��bC�<!�	�s\�BI0�(I0�:I!�I!�B:I0�I'�I'�$I0�AI0�&I,�'I0�I0�I.�I0�.I0c��[U5n[1nURnUHnU"U"U55 M URU5 U$)a�Resolve the set of heads from a set of revisions.

Receives an iterable of revision numbers and a callbable that receives a
revision number and returns an iterable of parent revision numbers, possibly
including nullrev.

Returns a set of revision numbers that are DAG heads within the passed
subset.

``nullrev`` is never included in the returned set, even if it is provided in
the input set.
)r-rr��difference_update)r�	parentsfn�headrevsr7�upr0s      r'rRrRsF���4�y�H��i�G�	���B���
�9�S�>������w�'��Or5c���[5n[5n[5n[US-
US-
S5HKnXc;aURU5 OURU5 U"U5HnURU5 M MM US-
nU(aUXc;a"URU5 URU5 U"U5HnUR	U5 M US-
nU(aMUXT4$)zOCompute how the set of heads changed between
revisions `start-1` and `stop-1`.
rr)r-rmr?r.�discard)rQr~�stopr7�heads_added�
heads_removedr0r�s        r'�headrevsdiffrYs����e�G��%�K��E�M��T�A�X�u�q�y�"�-���>��N�N�3���O�O�C� ��3��A��K�K��N� �.��!�)�C�
��>����c�"��N�N�3���3��A��O�O�A�� ��A�g���'�
�'�'r5c� �Uc[n[U=(d /5nU1nU1nU"US-S9H]nU"U5HNnXt;a'Xc;aURU5 URU5 Xu;dM6Xs;dM=URU5 MP M_ U$)a}Returns the set of all revs that have no children with control.

``revsfn`` is a callable that with no arguments returns an iterator over
all revision numbers in topological order. With a ``start`` argument, it
returns revision numbers starting at that number.

``parentrevsfn`` is a callable receiving a revision number and returns an
iterable of parent revision numbers, where values can include nullrev.

``startrev`` is a revision number at which to start the search.

``stoprevs`` is an iterable of revision numbers that, when encountered,
will stop DAG traversal beyond them. Parents of revisions in this
collection will be heads.
rr})rr-r.r?)rr�rp�stoprevsr�r�r0r&s        r'�headrevssubsetr\6s��� �����8�>�r�"�H��
�I�
�J�E��H�q�L�)�� ��%�D�� ��&��M�M�#�&��	�	�#���}��!5����T�"�&�*��Lr5c���[[[X5SS95n[5n/nU(a�UR	5nUS:a.U*S-
nXS;a"URU5 UR
U5 OKURU*S-
5 U"U5H*nU[:Xd
X`;dXc;aMURU5 M, U(aM�[U5[U5:XdeU$)a�Linearize and topologically sort a list of revisions.

The linearization process tries to create long runs of revs where a child
rev comes immediately after its first parent. This is done by visiting the
heads of the revs in inverse topological order, and for each visited rev,
visiting its second parent, then its first parent, then adding the rev
itself to the output list.

Returns a list of revision numbers.
Tr_rr)	r�r�rRr-r6ror.rrn)rrQr1�finished�resultr0r&s       r'�	linearizer`[s���
����1�4�@�A�E��u�H�
�F�
��i�i�k����7��$��(�C��"��
�
�c�"����S�!��
�L�L�#����"�!�#����7�?�d�&6�$�:J�����T�"�	'��%�$�v�;�#�d�)�#�#�#��Mr5)F)FNNN)NN)�returnzList[annotateline])rA)0�
__future__rr�typingr�
thirdpartyr�
TYPE_CHECKING�noder�rr	r
rrr
r�rHrr(r>rJrbrdrkruryr{r�r�r�r�r�r�r�srrrrr/r<rNrRrYr\r`rAr5r'�<module>ris8��#��
���
��������
�
���$�$����2K�j�B,�J�,MQ�,�<�6
�K�
+� �@n0�n0�b!�H
�#� �D% �P���d�4� �!�!�!�!����d�4� ���!��/�B�C�L?�DB�J�.(�>"�J#r5