Your IP : 18.188.211.58


Current Path : /lib64/python2.7/Tools/scripts/
Upload File :
Current File : //lib64/python2.7/Tools/scripts/treesync.pyo

�
�fc@s�dZddlZddlZddlZddlZdZdZdadada	d�Z
d�Zd�ZdZ
d�Zd�Zd
�Zdddd�Zdd�Zedkr�e
�ndS(s�Script to synchronize two source trees.

Invoke with two arguments:

python treesync.py slave master

The assumption is that "master" contains CVS administration while
slave doesn't.  All files in the slave tree that have a CVS/Entries
entry in the master tree are synchronized.  This means:

    If the files differ:
        if the slave file is newer:
            normalize the slave file
            if the files still differ:
                copy the slave to the master
        else (the master is newer):
            copy the master to the slave

    normalizing the slave means replacing CRLF with LF when the master
    doesn't use CRLF

i����NtasktyestnocCs)tjtjdd�\}}x�|D]�\}}|dkrGd}n|dkr\d}n|dkrq|an|dkr�|an|d	kr�|an|d
kr�|}n|dkr&|}aaaq&q&Wy|\}}Wn0tk
rdGtjd
p	dGdGdGHdSXt||�dS(Nisnym:s:d:f:a:s-yRs-nRs-ss-ms-ds-fs-as
usage: pythonistreesync.pys5[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]sslavedir masterdir(tgetopttsystargvtwrite_slavetwrite_mastertcreate_directoriest
ValueErrortprocess(toptstargstotatdefault_answertcreate_filestslavetmaster((s./usr/lib64/python2.7/Tools/scripts/treesync.pytmain#s0						
cCsYtjj|d�}tjj|�s9dG|GHdGHdSddGHdG|GHdG|GHtjj|�s�td|d	t�s�dG|GHd
G|GHdSdG|GHytj|�Wn(tjk
r�}dG|Gd
G|GHdSXdG|GHnd}g}tj	|�}x�|D]�}tjj||�}tjj||�}|dkrJ|}qtjj|�rtjj
|�r|j||f�qqW|r1tjj|d�}	x�t|	�j
�D]s}
|
jd�}|ddkr�|dr�|d}tjj||�}tjj||�}
t||
�q�q�Wnx!|D]\}}
t||
�q8WdS(NtCVSsskipping master subdirectorys-- not under CVSt-i(sslave Rscreate slave directory %s?tanswers-- no corresponding slavescreating slave directoryscan't make slave directoryt:smade slave directorytEntriest/iti(tostpathtjointisdirtokayRtmkdirterrortNonetlistdirtislinktappendtopent	readlinestsplittcompareR
(RRtcvsdirtmsgtsubdirstnamestnamet
masternamet	slavenametentriestetwordststm((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR
?sT				
				
	%
cCs�yt|d�}Wntk
r,d}nXyt|d�}Wntk
rYd}nX|s�|ssdG|GHdSdG|GHt||dt�dS|s�dG|GHdS|r�|r�t||�r�dSnt|�}t|�}||kr)|j�|j�dG|GHdG|GHt||dt�dSd	G||Gd
GH|j	d�t
|�}|j�|j�|r�dGHt||ddt�nd
GHt||ddt�dS(NtrtrbsNeither master nor slave existssCreating missing slaveRsNot updating missing mastersMaster             sis newer than slavesSlave issseconds newer than masteris#***UPDATING MASTER (BINARY COPY)***s***UPDATING MASTER***(R&tIOErrorR"tcopyRt	identicaltmtimetcloseRtseekt
funnycharsR(RRtsftmftsfttmfttfun((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR)msP



			

		


iicCsCx<|jt�}|jt�}||kr1dS|sPqqWdS(Nii(treadtBUFSIZE(R?R@tsdtmd((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR:�scCs tj|j��}|tjS(N(RtfstattfilenotstattST_MTIME(tftst((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR;�scCs@x9|jt�}|sPnd|ks4d|krdSqWdS(Ns
sii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>�sR7twbcCs�dG|GHdG|GHtd|�s%dSt||�}t||�}x*|jt�}|s_Pn|j|�qFW|j�|j�dS(Ntcopyings     tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRN((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9�s		
cCs�|j�j�}|s)|ddkrYt|�}|j�j�}|sYt}qYn|d dkrmdS|d dkr�dSdGHt|�S(NitnyitytnsYes or No please -- try again:(tstriptlowert	raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR�st__main__i@(t__doc__RRRJRRRRRRRR
R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyt<module>s"0		.	.			

?>