Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/hgk.pyc

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


��c@s�dZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZddlm
Z
dZddd�Zdd�Zd	�Zddd
�Zdded
�Zd�Zd�Zd�Zd�Zieddde
d�e
d�fge
d�fd6eddde
d�fddde
d�fddde
d�fd d!de
d!�fd"d#de
d$�fd%d&de
d&�fge
d'�fd(6ed d!de
d!�fge
d)�fd*6ege
d+�fd,6ege
d-�fd.6edd/de
d0�fge
d1�fd26ed3d4de
d4�fd5d6de
d6�fdd7de
d7�fd8d9de
d9�fge
d:�fd;6Zejd<7_dS(=s�browse the repository in a graphical way

The hgk extension allows browsing the history of a repository in a
graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not
distributed with Mercurial.)

hgk consists of two parts: a Tcl script that does the displaying and
querying of information, and an extension to Mercurial named hgk.py,
which provides hooks for hgk to get information. hgk can be found in
the contrib directory, and the extension is shipped in the hgext
repository, and needs to be enabled.

The :hg:`view` command will launch the hgk Tcl script. For this command
to work, hgk must be in your search path. Alternately, you can specify
the path to hgk in your configuration file::

  [hgk]
  path=/location/of/hgk

hgk can make use of the extdiff extension to visualize revisions.
Assuming you had already configured extdiff vdiff command, just add::

  [hgk]
  vdiff=vdiff

Revisions context menu will now display additional entries to fire
vdiff on hovered and selected revisions.
i�N(tcommandstutiltpatchtrevlogtscmutil(tnullidtnullrevtshort(t_tinternalcs�g�fd�}xmtr�|dr�yEt�jd�}|d}t|�dkrc|d}nd
}Wq�tk
r~Pq�Xn|j|�}|r�|j|�}n|}|jj|�d}|drZ|dr�	�||d�nt
j|||�}tj
|||d	|d
tj�itd6��}	x4|	D]}
�j|
�q@Wn||||d|�|dsPqqWd
S(sdiff trees from two commitscs,|dk	st�||j�}||j�}tj|||�}|j|||�d \}}}	tt�}
x?|D]7}�jdt||�t||�||f�q}Wx5|D]-}�jd|
t||�||f�q�Wx5|	D]-}�jdt||�|
||f�q�S(Nis:100664 100664 %s %s M	%s	%s
s:000000 100664 %s %s N	%s	%s
s:100664 000000 %s %s D	%s	%s
(	tNonetAssertionErrortmanifestRtmatchtstatusRRtwrite(trepotnode1tnode2tfilestmmaptmmap2tmtmodifiedtaddedtremovedtemptytf(tui(s-/sys/lib/python2.7/site-packages/hgext/hgk.pyt
__difftree.s"
	,
	"
	tstdint iiRtprettytR
toptstgitRN(tTruet	raw_inputtsplittlenR
tEOFErrortlookupt	changelogtparentst	catcommitRR
RtdifftdiffoptsR(RRRRRR"RtlineRtchunkstchunk((Rs-/sys/lib/python2.7/site-packages/hgext/hgk.pytdifftree,s6	








cCs�d|}|dkr#||}n|jdt|j�d��x%|j�D]}|jd|�qQW|j�}|j�jdd�}|j�}	|	r�|	dj	d�r�|	dj
d	�d
j�}
nd}
|jd|j�t
|d�|d
f�|
dkr@|jd|
t
|d�|d
f�n|jd
|j��|jd|j��|jd|j��|dkr�|jd||jd|�j�f�n|j|d�|r�jd�ndS(Ns
stree %s
is
parent %s
tR!i�s
committer:s: isauthor %s %s %s
scommitter %s %s %s
srevision %d
s
branch %s
s
phase %s

s%s%s
(R
RRt	changesetR+tdatetdescriptiontreplacet
splitlinest
startswithR&trstriptusertinttrevtbranchtphasestrtstrip(RRtntprefixtctxtnlprefixtpR5R6tlinest	committer((s-/sys/lib/python2.7/site-packages/hgext/hgk.pyR,`s0

! .+ cCsN|j|�}|j|�}|jj||�}|jt|�d�dS(s"output common ancestor informations
N(R)R*tancestorRR(RRRRRA((s-/sys/lib/python2.7/site-packages/hgext/hgk.pytbase�scKsd}|drJy"t�jd�\}}d}Wq~tk
rFdSXn4|sX|r~|jtd��tj|d�nx�|r|dkr�|jtd	��d
S|j|�}t||||�|dr
yt�jd�\}}Wqtk
rPqXq�Pq�WdS(scat a specific revisionR!RRs    Ns(cat-file: type or revision not supplied
scat-filetcommits.aborting hg cat-file only understands commits
i(	R%R&R(twarnRRthelp_R)R,(RRttypetrR"RBRA((s-/sys/lib/python2.7/site-packages/hgext/hgk.pytcatfile�s,


	

ttreeics���fd�}d�}g}g}	g}
d}x~t|�D]p\}}
|
jd�r��j|
d�}|	j|�|
j|�q@|
dkr@|
j�j|
��q@q@Wx�t|
�D]�\}}|jt��|g}||j|�x�|r�|jd�}||	kr!q�x]�jj|�D]I}|||krk||j|�|j|�n||	kr4q4q4q4Wq��Wx_|�D]T\}}�jj	|�}||
||�}|r�d}|r@�jj|�}|dt
kr|dt|d�7}n|dt
kr@|dt|d�7}q@n�sf|jd	t|�|f�n^�d
kr�|jd	t|�|f�t
|�|d|�n�jj|�\}}tt|||f�\}}}t�jj||f�\}}|j�d}|jd|||f�||
||�}|tkrs|dkrs|jd
||f�fn||
||�}|tkr�|dkr�|jd
||f�n|jd�|r�||kr�Pn|d7}q�q�WdS(Nc3sAt��}|}dgd}d}xtr<||krI|}d}n
||8}xzt|�D]l}|||kr�dg|||||)Pn�dk	r��||||<||j�q`d||<q`WxVt|ddd�D]>}||dkr�|�dk	r||pdfVq��|dkr(Pq(q(WdS(Niidii�(R'R$txrangeR
R4(tcounttitlR1tx(tfullR(s-/sys/lib/python2.7/site-packages/hgext/hgk.pyt	chlogwalk�s,
		
,cSs^t|�dkrdSd}x;tt|��D]'}|||kr/|d|>O}q/q/W|S(Nii(R'RQ(tart	reachabletshatmaskRS((s-/sys/lib/python2.7/site-packages/hgext/hgk.pytis_reachable�sit^itHEADR!Rs%s%s
RJs    s%s %s:%ss%s:%s s
(t	enumerateR9R)tappendtsettaddtpopR*R+tnodeRRRR,tmapR=R5R(RtargsRRVtmaxnrR+RWR\RYt	stop_sha1t	want_sha1RRRStargtsRAtvisitRERCR[t	parentstrtpptp1tp2thth1th2ti1ti2R5((RVRs-/sys/lib/python2.7/site-packages/hgext/hgk.pytrevtree�st	

		 !!
cs��fd�}xk|D]c}|jdd�}|jd||d��t|�dkr|jd||d��qqWdS(	sparse given revisionscs+|dkrd}ntj�j|��S(NR^ttip(RthexR)(R=(R(s-/sys/lib/python2.7/site-packages/hgext/hgk.pytrevstrs	t:is%s
iis^%s
N(R&RR'(RRtrevsR"RyRNtrevrange((Rs-/sys/lib/python2.7/site-packages/hgext/hgk.pytrevparses
cOsW|drd}nd}g|D]}|^q }t|||||d|d�dS(sprint revisionstheaderRJt	max_countR+N(R
Rv(RRR{R"RVRUtcopy((s-/sys/lib/python2.7/site-packages/hgext/hgk.pytrevlist's

	cs/�fd�}|d�jddd��dS(sprint extension optionscs�jd||f�dS(Ns
k=%s
v=%s
(R(tnametvalue(R(s-/sys/lib/python2.7/site-packages/hgext/hgk.pytwriteopt2stvdiffthgkR!N(tconfig(RRR"R�((Rs-/sys/lib/python2.7/site-packages/hgext/hgk.pyR�0scOs�tj|j�djg|j�D]"\}}|r#d||f^q#�}|jddd�d|dj|�f}|jd|�tj|�dS(s start interactive history viewerRs--%s %sR�tpaths %s %ssrunning %s
N(	tostchdirtroottjoint	iteritemsR�tdebugRtsystem(RRtetcR"tktvtoptstrtcmd((s-/sys/lib/python2.7/site-packages/hgext/hgk.pytview8s
>,RTtlimitR!s!limit number of changes displayedtNUMshg view [-l LIMIT] [REVRANGE]s^viewRERsgenerate patchRNt	recursivetPR RkRtCR�s
detect copiestStsearchs2hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]...sdebug-diff-trees'hg debug-cat-file [OPTION]... TYPE FILEsdebug-cat-fileshg debug-configsdebug-configshg debug-merge-base REV REVsdebug-merge-basetdefaulttignoredshg debug-rev-parse REVsdebug-rev-parsetHR~tts
topo-orderR+RAs	max-counts$hg debug-rev-list [OPTION]... REV...sdebug-rev-lists debug-diff-tree debug-cat-file(t__doc__R�t	mercurialRRRRRtmercurial.nodeRRRtmercurial.i18nRt
testedwithR
R2R,RIROtFalseRvR}R�R�R�tcmdtablet	inferrepo(((s-/sys/lib/python2.7/site-packages/hgext/hgk.pyt<module>#sT(4 	&j						

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.