???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
¿œ^c           @   sã   d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z e e d ƒ s] d e _ n  d d d „  ƒ  YZ d d d „  ƒ  YZ	 d	 d
 Z
 d „  Z d „  Z i  Z d „  Z d „  Z d „  Z d „  Z e d k rß e ƒ  n  d S(   s!   Utilities for CVS administration.iÿÿÿÿNt   timezonei    t   Filec           B   s\   e  Z d  Z d	 d „ Z d „  Z d „  Z d „  Z d	 d „ Z d „  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
    c         C   sK   | r d | k r t  d ‚ n  | |  _ d |  _ |  _ |  _ d  |  _ d  S(   Nt   /s   no slash allowed in filei    (   t
   ValueErrort   filet   lseent   eseent   rseent   Nonet   proxy(   t   selfR   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   __init__9   s
    	c         C   s   t  |  j | j ƒ S(   N(   t   cmpR   (   R
   t   other(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   __cmp__@   s    c         C   sˆ   y& t  j |  j ƒ d \ |  _ |  _ Wn+ t  j k
 rS d  |  _ |  _ |  _ n( Xt j	 t
 |  j ƒ j ƒ  ƒ j ƒ  |  _ d |  _ d  S(   Niþÿÿÿi   (   t   ost   statR   t   lmtimet   lctimet   errorR   t   lsumt   md5t   newt   opent   readt   digestR   (   R
   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   getlocalC   s    &'c         C   s)  t  j | d ƒ } |  j r: | d |  j k r: t d ‚ n  | d |  _ | d |  _ d |  _ d |  _ d  |  _ |  _	 |  j d  d k r¥ d |  _ |  j d |  _ n  |  j d k rÉ d  |  _ d |  _ n0 | d } t
 | d	  ƒ |  _ t
 | d
 ƒ |  _	 | d |  _ |  j r|  j ƒ  n  d |  _ d  S(   NR   i   s   file name mismatchi   i    t   -t   0i   i   i   i   (   t   stringt   splitfieldsR   R   t   erevt   edeletedt   enewR   t   ectimet   emtimet   unctimet   extraR   t   getesumR   (   R
   t   linet   wordst   dates(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   getentryL   s*    				
	c         C   s¤   | r | |  _  n  y |  j  j |  j ƒ |  _ Wn# t j t f k
 rS d  |  _ n X|  j rx |  j  j |  j ƒ |  _	 n	 d  |  _	 |  j
 r— |  j ƒ  n  d |  _ d  S(   Ni   (   R	   t   headR   t   rrevR   R   t   IOErrorR   t   sumt   rsumR   R&   R   (   R
   R	   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt	   getremoted   s    			c         C   sa   |  j  |  j k r! |  j |  _ n< |  j  rT |  j |  j  f } |  j j | ƒ |  _ n	 d  |  _ d  S(   N(   R   R,   R/   t   esumR   R	   R.   R   (   R
   t   name(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR&   s   s    	c         C   s…   |  j  s d S|  j p d } |  j r2 d | } n  |  j rK d |  j } n  t |  j ƒ d t |  j ƒ } d |  j | | |  j f S(   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 "".
        t    R   R   s   Initial t    s   /%s/%s/%s/%s/
(	   R   R   R    R!   R   t   gmctimeR"   R#   R%   (   R
   t   revR)   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   putentry|   s    			c         C   sÙ   d d GHt  |  d „ } | d ƒ |  j rU | d t ƒ | d t ƒ | d t ƒ n  |  j r™ | d ƒ | d	 ƒ | d
 ƒ | d t ƒ | d t ƒ n  |  j rÕ | d ƒ | d t ƒ |  j rÕ | d t ƒ qÕ n  d  S(   NR   i2   c         S   sD   y | t  | |  ƒ ƒ } Wn t k
 r2 d } n Xd |  G| GHd  S(   Nt   ?s   %-15s:(   t   getattrt   AttributeError(   t   keyt   reprR
   t   value(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   r–   s
    
R   R   R   R   R   R!   R    R"   R#   R,   R/   R1   (   R<   R   t   hexifyR5   R   R   (   R
   R>   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   report”   s$    	
		


	
	N(   t   __name__t
   __module__t   __doc__R   R   R   R   R*   R0   R&   R7   R@   (    (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR      s   +							t   CVSc           B   s¶   e  Z d  Z e Z d d d d d d d d g Z d	 „  Z d
 „  Z d „  Z d „  Z	 d „  Z
 d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z RS(   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   *.pycc         C   s   i  |  _  d  |  _ d  S(   N(   t   entriesR   R	   (   R
   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR   Ã   s    	c         C   sC   | |  j  k r d  S| |  _  x  |  j j ƒ  D] } d | _ q, Wd  S(   Ni    (   R	   RE   t   valuesR   (   R
   R	   t   e(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   setproxyÇ   s
    	c         C   sl   i  |  _  |  j d ƒ } xC | j ƒ  } | s1 Pn  |  j ƒ  } | j | ƒ | |  j  | j <q W| j ƒ  d S(   s    Read the contents of CVS/Entriest   EntriesN(   RE   t   cvsopent   readlinet	   FileClassR*   R   t   close(   R
   t   fR'   RG   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt
   getentriesÎ   s    	 c         C   sJ   |  j  d d ƒ } x' |  j ƒ  D] } | j | j ƒ  ƒ q W| j ƒ  d S(   s   Write CVS/Entries backRI   t   wN(   RJ   RF   t   writeR7   RM   (   R
   RN   RG   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt
   putentriesÚ   s    c         C   sË   |  j  j ƒ  } t j t j ƒ } x? | D]7 } | | k r@ q( n  |  j | ƒ s( | j | ƒ q( q( W| j ƒ  xW | D]O } y |  j  | } Wn+ t k
 r¸ |  j	 | ƒ } |  j  | <n X| j
 ƒ  qt Wd  S(   N(   RE   t   keysR   t   listdirt   curdirt   ignoredt   appendt   sortt   KeyErrorRL   R   (   R
   t   listt   addlistR2   R   RG   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   getlocalfilesá   s    
c         C   sš   | r | |  _  n  |  j  s' t d ‚ n  |  j  j ƒ  } x] | D]U } y |  j | } Wn+ t k
 r |  j | ƒ } |  j | <n X| j |  j  ƒ q= Wd  S(   Ns   no RCS proxy(   R	   t   RuntimeErrort	   listfilesRE   RY   RL   R0   (   R
   R	   R[   R   RG   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   getremotefilesñ   s    	c         C   s.   x |  j  ƒ  D] } | j ƒ  q Wd d GHd  S(   NR   i2   (   RF   R@   (   R
   RG   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR@   þ   s    c         C   s   |  j  j ƒ  } | j ƒ  | S(   N(   RE   RS   RX   (   R
   RS   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRS     s    
c         C   s   |  d „ } t  | |  j ƒ  ƒ S(   Nc         S   s   | j  |  S(   N(   RE   (   R;   R
   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR=   	  s    (   t   mapRS   (   R
   R=   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRF     s    c         C   s   |  d „ } t  | |  j ƒ  ƒ S(   Nc         S   s   |  | j  |  f S(   N(   RE   (   R;   R
   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   item  s    (   R`   RS   (   R
   Ra   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   items  s    c         C   s%   t  j j d | ƒ } t  j j | ƒ S(   NRD   (   R   t   patht   joint   exists(   R
   R   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt	   cvsexists  s    R>   c         C   s>   t  j j d | ƒ } d | k r1 |  j | ƒ n  t | | ƒ S(   NRD   R>   (   R   Rc   Rd   t   backupR   (   R
   R   t   mode(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRJ     s    c         C   s[   t  j j | ƒ rW | d } y t  j | ƒ Wn t  j k
 rC n Xt  j | | ƒ n  d  S(   Nt   ~(   R   Rc   t   isfilet   unlinkR   t   rename(   R
   R   t   bfile(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRg     s    
  c         C   sD   t  j j | ƒ r t Sx' |  j D] } t j | | ƒ r  t Sq  Wt S(   N(   R   Rc   t   isdirt   Truet
   IgnoreListt   fnmatcht   False(   R
   R   t   pat(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRV   #  s      N(   RA   RB   RC   R   RL   Rp   R   RH   RO   RR   R\   R   R_   R@   RS   RF   Rb   Rf   RJ   Rg   RV   (    (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyRD   ®   s"   											s   %02xi   c         C   s'   |  d k r d St t t t |  ƒ ƒ S(   sD   Return a hex representation of a 16-byte string (e.g. an MD5 digest)R   N(   R   t   hexify_formatt   tupleR`   t   ord(   R.   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR?   -  s    c         C   sd   |  d k r d Sd } xG t d t |  ƒ d ƒ D]- } | t t j |  | | d !d ƒ ƒ } q/ W| S(   s*   Return the original from a hexified stringR   R3   i    i   i   N(   R   t   ranget   lent   chrR   t   atoi(   t   hexsumR.   t   i(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   unhexify3  s    +c         C   s  |  d k r d  St sn d d d d d d d d	 d
 d d d g } d } x% | D] } | d } | t | <qM Wn  t j |  ƒ } t j | d ƒ } t | d } t j | d ƒ } t t j t j | d d ƒ ƒ \ } }	 }
 |
 t j }
 t j	 | | | | |	 |
 d d d f	 ƒ S(   NR   t   Jant   Febt   Mart   Aprt   Mayt   Junt   Jult   Augt   Sept   Octt   Novt   Deci    i   i   i   i   t   :(
   R   t   unctime_monthmapR   t   splitRz   R`   R   t   timeR    t   mktime(   t   datet   monthsR|   t   mR(   t   yeart   montht   dayt   hht   mmt   ss(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR$   >  s      
+c         C   s&   |  d  k r d St j t j |  ƒ ƒ S(   NR   (   R   R   t   asctimet   gmtime(   t   t(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyR5   O  s     c          C   sš   t  t j ƒ  ƒ }  t j |  ƒ } t j | ƒ } d G|  G| GHd Gt j GHd Gt j |  ƒ GHt | ƒ } d G| GHt j | ƒ } d G| GHt j | ƒ GHd  S(   Nt   GMTR    t   locals	   unctime()s   ->(   t   intR   R™   R˜   R    t   ctimeR$   (   t   nowRš   t   att   ut   gu(    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   test_unctimeS  s    		c          C   sP   t  ƒ  }  |  j ƒ  |  j ƒ  d d  l } | j ƒ  } |  j | ƒ |  j ƒ  d  S(   Niÿÿÿÿ(   RD   RO   R\   t	   rcsclientt   openrcsclientR_   R@   (   t   xR¤   R	   (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   test`  s    	

t   __main__(    (    (   RC   R   R   R   R   Rq   t   hasattrR    R   RD   Rt   R?   R}   R‹   R$   R5   R£   R§   RA   (    (    (    s)   /usr/lib64/python2.7/Demo/pdist/cvslib.pyt   <module>   s&   ¢~
		
				