��Qc@s�dZddlmZddlZdZd�Zd�Zd�Zd�Zd �Z d
�Z
d�Zd�Zd
�Z
d�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�(tnullrevNtCc#sr|s
dS|j}t|�}i}t|�}x:|D]2}||}ttg|j�D]$}|j�|kr[|j�^q[���g|j�D]6}|j�tkr�|j��kr�|j�^q�} x|| D]t}
|j|
�}|dkrt ||||
�}||
<n|s2�j
|
�q��j�fd�|D��q�W|j�t|�fVq8WdS(sGcset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples
This generator function walks through revisions (which should be ordered
from bigger to lower). 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.
Nc3s!|]}|�kr|VqdS(N((t.0tg(tparents(s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pys <genexpr>7s(
t changelogtmintsettsortedRtrevRtgettNonetgrandparenttappendtextendt CHANGESET(trepotrevstclt lowestrevtgpcachet knownrevsR tctxtptmparstmpartgp((Rs6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt dagwalkers(
*6
!ccs�t|�}xr|D]j}||}tg|j�D]$}|j�|kr3|j�^q3�}|j�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(RRtnodeR RR(RtnodestincludeRRRR((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyR;s
=c#s�g}i}d}i�x��jjd�D]�\}}d|kr+|jdd�\}}|dkr�|j�r�t|��j|i�|<q�|dkr�|j�r�|�j|i�|<q�q+q+W�r�j��fd��} n d�} x�D]�}
}}}
|
|kr@|j |
�|||
<|d7}n|j
|
�}|j|
�}|}g|
D]}||krl|^ql}||||d+xAt|�D]3\}}|s�|||<q�|||<|d7}q�Wg}x�t|�D]�\}}||krZ| |�}|j ||j
|�|||j
dd�|j
dd �f�q�|
kr�|
D]O}| |�}|j ||j
|�||j
dd�|j
dd �f�qmWq�W|
||||f|fV|}q�
S(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.
itgrapht.twidthtcolorcs�j�|j�i�S(N(R
tbranch(R (tconfigR(s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt<lambda>dscSsiS(N((R ((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyR%fsi�tN(tuitconfigitemstrsplittisdigittintt
setdefaulttisalnumtutiltlrucachefuncR
tindextpopt enumerateR
(tdagRtseentcolorstnewcolortkeytvalR#tsettingtgetconftcurttypetdataRtcolR"tnextRt
addparentstitedgestecolteidtbconf((R$Rs6/sys/lib/python2.7/site-packages/mercurial/graphmod.pytcoloredGs^
%
!c
Cs�t|g�}t�}t�}tt|�}x�|r�|j�}||kr3||kr3||kry|j|�n)|jg|j|�D]} | ^q��|j|�q3q3Wt|�S(s_Return all ancestors of head in roots which revision is
greater or equal to lowestrev.
(RtmaxRR1taddtupdatet
parentrevsR(
RRtrootstheadtpendingR4tkeptt
llowestrevtrR((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyR�s )ccs�||kr|j|�n|j|�}g}g}x7|D]/} | |kr`|j| �q>|j| �q>Wt|�}
|}||||d+g|D]'}|tkr�||j|�f^q�}
x�t|�dkr[|
j||f�|
j||df�d}|||||
|
|ffVd}g}|d7}|
d7}
g}
|d=q�Wt|�dkr�|
j||f�nt|�dkr�|
j||df�nt|�|
}||(|||||
|
|ffVdS(s9adds edge info to changelog DAG walk suitable for ascii()iis\iN(R
R0tlenR(R<tchartlinesR4R Rtnodeidxtknownparentst
newparentstparenttncolstnextseenRRBt nmorecols((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt
asciiedges�s>
4
cCsJxCt|�D]5\}\}}||kr
||df||<q
q
WdS(Ni(R2(RBRAtstarttend((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt_fixlongrightedges�scCs�|r�||kr�|dkr�|dkrtt|d|�}ddg||d}|jddg||�|Sddg||dSnddg||dSdS(Nii�it|t t/s\(RGR(t
node_indextp_node_indext n_columnstn_columns_difftp_difftfix_tailR\ttail((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt_getnodelineedgestail�scCsx|D]�}}||dkr8d|d|d<q||dkr]d|d|d<q||krzd|d|<qd|t|�kr�qnd|d|<||kr�||}}nx@td|dd|�D]#}||dkr�d||<q�q�WqWdS(NiRais\R_t+t-(RQtrange(RBtnodelinet interlineR\R]RA((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt
_drawedges�s"cCs�g}|jddg|�||df|ksE||f|krNd}nd}|j|dg�|jddg||d�|S(NR_R`i(R(tniRdRBtlinetc((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt_getpaddingline�s( cCs
ddgS(s=returns the initial value for the "state" argument to ascii()i((((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt
asciistatescCs�|\}}}} d| ko)dkns4t�| dkrMt|�nt|�dko�| dko�g|D]"\}
}|
d|krr|
^qr}t|�dko�|}
ddg|}|j|dg�|jt||d|| |d|
��ddg|}| dkr+d}d}n'| dkrFd}d}nd }d
}|j|dg�|j|dg||d�t|||�|g}|r�|jt|||��n|j|�x)t|�t|�kr�jd�q�Wt|�t|�krTddg|| }x,t|�t|�krP|j|�q(Wnt||| �}xTt ||�D]C\}}dd|dj
|�|f}|j|j�d
�qwW| |d<||d<dS(s�prints an ASCII graph of the DAG
takes the following arguments (one call per node in the graph):
- ui to write to
- Somewhere to keep the needed state in (init to asciistate())
- Column of the current node in the set of ongoing edges.
- Type indicator of node data, usually 'C' for changesets.
- Payload: (char, lines):
- Character to use as node's symbol.
- List of lines to display as the node's text.
- Edges; a list of (col, next_col) indicating the edges between
the current node and its parents.
- Number of columns (ongoing edges) in the current revision.
- The difference between the number of columns (ongoing edges)
in the next revision and the number of columns (ongoing edges)
in the current revision. That is: -1 means one column removed;
0 means no columns added or removed; 1 means one column added.
i�ii�iR_R`iRais\R&s%-*s %ss
N(
tAssertionErrorR^RQRRiRoR
RsRGtziptjointwritetrstrip(R'tstateR<RRttexttcoldatatidxRBRXtcoldifftxtytadd_padding_linetfix_nodeline_tailRmtshift_interlinetn_spacestedge_chRStextra_interlinetindentation_levelRqtlogstrtln((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pytasciisP"
/
(t__doc__tmercurial.nodeRR.RRRRFRR[R^RiRoRsRtR�(((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt<module>s " N +
|