• File: treesync.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/proc/self/root/lib64/python2.7/Tools/scripts/treesync.pyc
  • Date Modified: 11/09/2026 1:02 PM
  • File size: 5.85 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

Kjc@sdZddlZddlZddlZddlZdZdZdadada	dZ
dZdZdZ
dZdZd
ZddddZddZedkre
ndS(sScript 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

iNtasktyestnocCs)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|std|d	tsdG|GHd
G|GHdSdG|GHytj|Wn(tjk
r}dG|Gd
G|GHdSXdG|GHnd}g}tj	|}x|D]}tjj||}tjj||}|dkrJ|}qtjj|rtjj
|r|j||fqqW|r1tjj|d}	xt|	j
D]s}
|
jd}|ddkr|dr|d}tjj||}tjj||}
t||
qqWnx!|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				
				
	%
cCsyt|d}Wntk
r,d}nXyt|d}Wntk
rYd}nX|s|ssdG|GHdSdG|GHt||dtdS|sdG|GHdS|r|rt||rdSnt|}t|}||kr)|j|jdG|GHdG|GHt||dtdSd	G||Gd
GH|j	dt
|}|j|j|rdGHt||ddtnd
GHt||ddtdS(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



			

		


iicCsBx;|jt}|jt}||kr1dS|sPqqdS(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?x8|jt}|sPnd|ks4d|krdSqdS(Ns
tii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>sR7twbcCsdG|GHdG|GHtd|s%dSt||}t||}x)|jt}|s_Pn|j|qF|j|jdS(Ntcopyings     tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRO((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9s		
cCs|jj}|s)|ddkrYt|}|jj}|sYt}qYn|d dkrmdS|d dkrdSdGHt|S(NitnyitytnsYes or No please -- try again:(tstriptlowert	raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyRst__main__i@(t__doc__RRRJRRRRRRRR
R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyt<module>s"0		.	.