Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/graphmod.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c@sDdZddklZdZd�Zd�Zd�Zd�ZdS(	s>supports walking the history as DAGs suitable for graphical output

The most basic format we use is that of::

  (id, type, data, [parentids])

The node and parent ids are arbitrary integers which identify a node in the
context of the graph returned. Type is a constant specifying the node type.
Data depends on type.
i�(tnullrevtCccs�|}x�||jos||}g}|i�D]*}|i�tjo||i�q1q1~}|t|t|�fV|d8}q	WdS(stcset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples

    This generator function walks through the revision history from revision
    start to revision stop (which must be less than or equal to start). It
    returns a tuple for each node. The node and parent ids are arbitrary
    integers which identify a node in the context of the graph returned.
    iN(tparentstrevRt	CHANGESETtsorted(trepotstarttstoptcurtctxt_[1]tpR((s%/sys/lib/python/mercurial/graphmod.pyt	revisionss
Dc
cs�t|i|��d}x�|djo�|i|d|�}g}|i�D]*}|i�|jo||i�qOqO~}|i�}	|	|jo|	t|t|�fVn|	|joPn|d8}qWdS(s�file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples

    This generator function walks through the revision history of a single
    file from revision start down to revision stop.
    iitfileidN(	tlentfiletfilectxRtpathtlinkrevRRR(
RRRRtfilerevtfctxRtfRR((s%/sys/lib/python/mercurial/graphmod.pytfilerevs'sD

ccs�t|�}xy|D]q}||}g}|i�D]*}|i�|jo||i�q4q4~}|i�t|t|�fVqWdS(s�cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples

    This generator function walks the given nodes. It only returns parents
    that are in nodes, too.
    N(tsetRtnodeRRR(RtnodestincludeRR
RRR((s%/sys/lib/python/mercurial/graphmod.pyR8s
Dc
cs�g}h}d}x�|D]�\}}}}||jo%|i|�|||<|d7}n|i|�}|i|�}	|}
g}|D]}||
jo||q�q�~}
|
|
||d+xCt|
�D]5\}}|p|	||<q�|||<|d7}q�Wg}x�t|�D]�\}}||
jo'|i||
i|�||f�q||jo8x5|D])}|i||
i|�||f�qrWqqW|||||	f|fV|
}qWdS(sxannotates a DAG with colored edge information

    For each DAG node this function emits tuples::

      (id, type, data, (col, color), [(col, nextcol, color)])

    with the following new elements:

      - Tuple (col, color) with column and color index for the current node
      - A list of tuples indicating the edges between the current node and its
        parents.
    iN(tappendtindextpopt	enumerate(tdagtseentcolorstnewcolorR	ttypetdataRtcoltcolortnextRRt
addparentstitedgestecolteid((s%/sys/lib/python/mercurial/graphmod.pytcoloredDs>



2



'
/N(t__doc__tmercurial.nodeRRR
RRR.(((s%/sys/lib/python/mercurial/graphmod.pys<module>s			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].