aQc@sdZddlmZddlZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdS(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|jD]$}|j|kr[|j^q[g|jD]6}|jtkr|jkr|j^q} x|| D]t} |j| } | dkrt |||| } || 7s( t changelogtmintsettsortedRtrevRtgettNonet grandparenttappendtextendt CHANGESET( trepotrevstclt lowestrevtgpcachet knownrevsR tctxtptmparstmpartgp((Rs6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt dagwalkers(     *6   !ccst|}xr|D]j}||}tg|jD]$}|j|kr3|j^q3}|jt|t|fVqWdS(scset 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 #sg}i}d}ixjjdD]\}}d|kr+|jdd\}}|dkr|jrt|j|i|dscSsiS(N((R ((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyR%fsitN(tuit configitemstrsplittisdigittintt setdefaulttisalnumtutilt lrucachefuncR tindextpopt enumerateR (tdagRtseentcolorstnewcolortkeytvalR#tsettingtgetconftcurttypetdataRtcolR"tnextRt addparentstitedgestecolteidtbconf((R$Rs6/sys/lib/python2.7/site-packages/mercurial/graphmod.pytcoloredGs^        %       !c Cst|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} xt|dkr[| j||f| j||dfd}||||| | |ffVd}g}|d7}| d7} g} |d=qWt|dkr| j||fnt|dkr| j||dfnt| | }| |(||||| | |ffVdS(s9adds edge info to changelog DAG walk suitable for ascii()iis\iN(R R0tlenR(R<tchartlinesR4R Rtnodeidxt knownparentst newparentstparenttncolstnextseenRRBt nmorecols((s6/sys/lib/python2.7/site-packages/mercurial/graphmod.pyt asciiedgess>    4   cCsJxCt|D]5\}\}}||kr ||df||s  " N  +