Your IP : 18.117.72.230


Current Path : /lib64/python2.7/Demo/pdist/
Upload File :
Current File : //lib64/python2.7/Demo/pdist/cvslib.pyo

�
V
�Qc@s�dZddlZddlZddlZddlZddlZeed�s]de_nddd��YZddd��YZ	d	d
Z
d�Zd�ZiZ
d
�Zd�Zd�Zd�Zedkr�e�ndS(s!Utilities for CVS administration.i����NttimezoneitFilecBs\eZdZd	d�Zd�Zd�Zd�Zd	d�Zd�Z	d�Z
d�ZRS(
s�Represent a file's status.

    Instance variables:

    file -- the filename (no slashes), None if uninitialized
    lseen -- true if the data for the local file is up to date
    eseen -- true if the data from the CVS/Entries entry is up to date
             (this implies that the entry must be written back)
    rseen -- true if the data for the remote file is up to date
    proxy -- RCSProxy instance used to contact the server, or None

    Note that lseen and rseen don't necessary mean that a local
    or remote file *exists* -- they indicate that we've checked it.
    However, eseen means that this instance corresponds to an
    entry in the CVS/Entries file.

    If lseen is true:

    lsum -- checksum of the local file, None if no local file
    lctime -- ctime of the local file, None if no local file
    lmtime -- mtime of the local file, None if no local file

    If eseen is true:

    erev -- revision, None if this is a no revision (not '0')
    enew -- true if this is an uncommitted added file
    edeleted -- true if this is an uncommitted removed file
    ectime -- ctime of last local file corresponding to erev
    emtime -- mtime of last local file corresponding to erev
    extra -- 5th string from CVS/Entries file

    If rseen is true:

    rrev -- revision of head, None if non-existent
    rsum -- checksum of that revision, Non if non-existent

    If eseen and rseen are both true:

    esum -- checksum of revision erev, None if no revision

    Note
    cCsK|rd|krtd�n||_d|_|_|_d|_dS(Nt/sno slash allowed in filei(t
ValueErrortfiletlseenteseentrseentNonetproxy(tselfR((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt__init__9s
	cCst|j|j�S(N(tcmpR(R
tother((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt__cmp__@scCs�y&tj|j�d\|_|_Wn+tjk
rSd|_|_|_n(Xtj	t
|j�j��j�|_d|_
dS(Ni����i(toststatRtlmtimetlctimeterrorRtlsumtmd5tnewtopentreadtdigestR(R
((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytgetlocalCs&'cCs)tj|d�}|jr:|d|jkr:td�n|d|_|d|_d|_d|_d|_|_	|jd dkr�d|_|jd|_n|jdkr�d|_d|_n0|d}t
|d	 �|_t
|d
�|_	|d|_|jr|j
�nd|_dS(NRisfile name mismatchiit-t0iiii(tstringtsplitfieldsRRterevtedeletedtenewRtectimetemtimetunctimetextraRtgetesumR(R
tlinetwordstdates((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytgetentryLs*

				

	
cCs�|r||_ny|jj|j�|_Wn#tjtfk
rSd|_nX|jrx|jj|j�|_	n	d|_	|j
r�|j�nd|_dS(Ni(
R	theadRtrrevRRtIOErrorRtsumtrsumRR&R(R
R	((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt	getremoteds
			
cCsa|j|jkr!|j|_n<|jrT|j|jf}|jj|�|_n	d|_dS(N(RR,R/tesumRR	R.R(R
tname((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR&ss	cCs�|js
dS|jpd}|jr2d|}n|jrKd|j}n t|j�dt|j�}d|j|||jfS(s�Return a line suitable for inclusion in CVS/Entries.

        The returned line is terminated by a newline.
        If no entry should be written for this file,
        return "".
        tRRsInitial t s/%s/%s/%s/%s/
(	RRR R!RtgmctimeR"R#R%(R
trevR)((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytputentry|s		
	cCs�ddGHt|d�}|d�|jrU|dt�|dt�|dt�n|jr�|d�|d	�|d
�|dt�|dt�n|jr�|d
�|dt�|jr�|dt�q�ndS(NRi2cSsDy|t||��}Wntk
r2d}nXd|G|GHdS(Nt?s%-15s:(tgetattrtAttributeError(tkeytreprR
tvalue((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytr�s


RRRRRR!R R"R#R,R/R1(R<RthexifyR5RR(R
R>((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytreport�s$	
	

	



	

	N(t__name__t
__module__t__doc__RRRRR*R0R&R7R@(((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRs+							tCVScBs�eZdZeZddddddddgZd	�Zd
�Zd�Zd�Z	d
�Z
dd�Zd�Z
d�Zd�Zd�Zd�Zdd�Zd�Zd�ZRS(s�Represent the contents of a CVS admin file (and more).

    Class variables:

    FileClass -- the class to be instantiated for entries
                 (this should be derived from class File above)
    IgnoreList -- shell patterns for local files to be ignored

    Instance variables:

    entries -- a dictionary containing File instances keyed by
               their file name
    proxy -- an RCSProxy instance, or None
    s.*s@*s,*s*~s*.os*.as*.sos*.pyccCsi|_d|_dS(N(tentriesRR	(R
((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR�s	cCsC||jkrdS||_x |jj�D]}d|_q,WdS(Ni(R	REtvaluesR(R
R	te((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytsetproxy�s
	cCski|_|jd�}xB|j�}|s1Pn|j�}|j|�||j|j<q|j�dS(s Read the contents of CVS/EntriestEntriesN(REtcvsopentreadlinet	FileClassR*Rtclose(R
tfR'RG((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt
getentries�s	
cCsJ|jdd�}x'|j�D]}|j|j��qW|j�dS(sWrite CVS/Entries backRItwN(RJRFtwriteR7RM(R
RNRG((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt
putentries�scCs�|jj�}tjtj�}x?|D]7}||kr@q(n|j|�s(|j|�q(q(W|j�xW|D]O}y|j|}Wn+tk
r�|j	|�}|j|<nX|j
�qtWdS(N(REtkeysRtlistdirtcurdirtignoredtappendtsorttKeyErrorRLR(R
tlisttaddlistR2RRG((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt
getlocalfiles�s



cCs�|r||_n|js'td�n|jj�}x]|D]U}y|j|}Wn+tk
r�|j|�}|j|<nX|j|j�q=WdS(Nsno RCS proxy(R	tRuntimeErrort	listfilesRERYRLR0(R
R	R[RRG((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytgetremotefiles�s	

cCs.x|j�D]}|j�q
WddGHdS(NRi2(RFR@(R
RG((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR@�scCs|jj�}|j�|S(N(RERSRX(R
RS((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRSs
cCs|d�}t||j��S(NcSs|j|S(N(RE(R;R
((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR=	s(tmapRS(R
R=((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRFscCs|d�}t||j��S(NcSs||j|fS(N(RE(R;R
((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytitems(R`RS(R
Ra((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytitems
scCs%tjjd|�}tjj|�S(NRD(Rtpathtjointexists(R
R((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt	cvsexistssR>cCs>tjjd|�}d|kr1|j|�nt||�S(NRDR>(RRcRdtbackupR(R
Rtmode((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRJscCs[tjj|�rW|d}ytj|�Wntjk
rCnXtj||�ndS(Nt~(RRctisfiletunlinkRtrename(R
Rtbfile((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRgs
cCsDtjj|�rtSx'|jD]}tj||�r tSq WtS(N(RRctisdirtTruet
IgnoreListtfnmatchtFalse(R
Rtpat((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRV#sN(RARBRCRRLRpRRHRORRR\RR_R@RSRFRbRfRJRgRV(((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyRD�s"					
						s%02xicCs'|dkrdStttt|��S(sDReturn a hex representation of a 16-byte string (e.g. an MD5 digest)RN(Rt
hexify_formatttupleR`tord(R.((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR?-scCsd|dkrdSd}xGtdt|�d�D]-}|ttj|||d!d��}q/W|S(s*Return the original from a hexified stringRR3iiiN(RtrangetlentchrRtatoi(thexsumR.ti((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pytunhexify3s+cCs|dkrdStsndddddddd	d
ddd
g}d}x%|D]}|d}|t|<qMWntj|�}tj|d�}t|d}tj|d�}ttjtj|dd��\}}	}
|
tj}
tj	|||||	|
dddf	�S(NRtJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDeciiiiit:(
Rtunctime_monthmapRtsplitRzR`RttimeRtmktime(tdatetmonthsR|tmR(tyeartmonthtdaythhtmmtss((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR$>s 

+
cCs&|dkrdStjtj|��S(NR(RR�tasctimetgmtime(tt((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyR5OscCs�ttj��}tj|�}tj|�}dG|G|GHdGtjGHdGtj|�GHt|�}dG|GHtj|�}dG|GHtj|�GHdS(NtGMTRtlocals	unctime()s->(tintR�R�R�RtctimeR$(tnowR�tattutgu((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyttest_unctimeSs
		cCsPt�}|j�|j�ddl}|j�}|j|�|j�dS(Ni����(RDROR\t	rcsclientt
openrcsclientR_R@(txR�R	((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyttest`s	


t__main__(((RCRRR�RRqthasattrRRRDRtR?R}R�R$R5R�R�RA(((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyt<module>s&�~