ó V Qc@sãdZddlZddlZddlZddlZddlZeedƒs]de_nddd„ƒYZddd„ƒYZ d d Z d „Z d „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„Z RS( 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(tstringt splitfieldsRRterevtedeletedtenewRtectimetemtimetunctimetextraRtgetesumR(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 ƒ|d tƒ|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__RR RRR*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|jcCs>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(RARBRCRRLRpR RHRORRR\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 d d d g }d}x%|D]}|d}|t|s    + cCs&|dkrdStjtj|ƒƒS(NR(RRtasctimetgmtime(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->(tintRR™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__(((RCRRRRRqthasattrRRRDRtR?R}R‹R$R5R£R§RA(((s)/usr/lib64/python2.7/Demo/pdist/cvslib.pyts&      ¢~