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

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


��c@s�dZddlmZmZddlmZddlZddlZdZdd�Z
d�Zd�Zd	�Z
ie
ged
�fd6ZdS(s-recreates hardlinks between repository clonesi�(thgtutil(t_Ntinternalc	KsRtjtd�s&tjtd�r>tjtd���ntj|j|j|pYd|pbd��}|jtd�|j	j
|j	j
f�|j|jkr�|jtd��dS|j�}zw|j�}zYt
t||��}t||j	j
|j	j
|�}t|j	j
|j	j
||�Wd|j�XWd|j�XdS(	s�recreate hardlinks between two repositories

    When repositories are cloned locally, their data files will be
    hardlinked so that they only use the space of a single repository.

    Unfortunately, subsequent pulls into either repository will break
    hardlinks for any files touched by the new changesets, even if
    both repositories end up pulling the same changes.

    Similarly, passing --rev to "hg clone" will fail to use any
    hardlinks, falling back to a complete copy of the source
    repository.

    This command lets you recreate those hardlinks and reclaim that
    wasted space.

    This repository will be relinked to share space with ORIGIN, which
    must be on the same local disk. If ORIGIN is omitted, looks for
    "default-relink", then "default", in [paths].

    Do not attempt any read operations on this repository while the
    command is running. (Both repositories will be locked against
    writes.)
    tsamefilet
samedevices*hardlinks are not supported on this systemsdefault-relinktdefaultsrelinking %s to %s
sthere is nothing to relink
N(RtsafehasattrtAbortRRt
repositorytbaseuit
expandpathtstatuststoretpathtroottlocktsortedtcollecttprunet	do_relinktrelease(	tuitrepotorigintoptstsrct	locallockt
remotelockt
candidatesttargets((s0/sys/lib/python2.7/site-packages/hgext/relink.pytrelinks$)!#c
Cs�ttjj�}g}t|dj��}|dd}|jj}d}|jtd�||f�x�j|�D]�}}}	|j	�|t|�|}
x�t
|	�D]�}|dd
kr�q�ntjtjj||��}tj
|j�sq�n|d	7}|jtjj|
|�|f�|jtd
�||td�|�q�Wq{W|jtd
�d�|jtd�t|��|S(Nttipiiis6tip has %d files, estimated total number of files: %s
i�s.ds.iit
collectingtfiless%collected %d candidate storage files
(s.ds.i(tlentosRtseptmanifestR
RRtwalktsortRtstattjointS_ISREGtst_modetappendtprogresstNone(
RRtseplenRtlivettotaltpostdirpathtdirnamest	filenamestrelpathtfilenametst((s0/sys/lib/python2.7/site-packages/hgext/relink.pyR?s.

"-c
Cs
d�}g}t|�}d}x�|D]�\}}	|d7}tjj||�}
tjj||�}||
||	�}|s�|jd|�q(n|j||jf�|jtd�||td�|�q(W|jtd�d�|j
td�t|��|S(NcSs�ytj|�}Wntk
r'tSXtj||�r>tStj||�shtjtd���n|j	|j	kr~tS|S(Ns/source and destination are on different devices(
R$R)tOSErrortFalseRRRRRtst_size(RtdstR9tts((s0/sys/lib/python2.7/site-packages/hgext/relink.pyt
linkfilter`s
iisnot linkable: %s
tpruningR"s,pruned down to %d probably relinkable files
(R#R$RR*tdebugR-R<R.RR/R(
RRR=RR?RR2R3tfnR9tsrcpathttgtR>((s0/sys/lib/python2.7/site-packages/hgext/relink.pyR_s"	
)cCs�d�}d}d}d}d}t|�}	x^|D]V\}
}|d7}tjj||
�}tjj||
�}
t|d�}t|
d�}|j|�}x8|r�|j|�}||kr�Pn|j|�}q�W|j�|j�|r
|jd|
�q4nyJ|||
�|jt	d�||
t	d�|	�|d7}||7}Wq4t
k
r�}|jd	|
t|�f�q4Xq4W|jt	d�d�|jt	d
�|tj|�f�dS(NcSsf|d}tj||�ytj||�Wn$tk
rTtj||��nXtj|�dS(Ns.bak(R$trenameRtoslinkR:tremove(RR=tbak((s0/sys/lib/python2.7/site-packages/hgext/relink.pyt
relinkfile�s

iiitrbsnot linkable: %s
t	relinkingR"s%s: %s
s!relinked %d files (%s reclaimed)
(R#R$RR*tfiletreadtcloseRAR.RR:twarntstrR/RRt	bytecount(RR=R"RRItCHUNKLENtrelinkedt
savedbytesR3R2tftsztsourceRDtsfptdfptsintdintinst((s0/sys/lib/python2.7/site-packages/hgext/relink.pyR�sB	

	


%
%s[ORIGIN]R(t__doc__t	mercurialRRtmercurial.i18nRR$R)t
testedwithR/RRRRtcmdtable(((s0/sys/lib/python2.7/site-packages/hgext/relink.pyt<module>s/	 	#	0

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.