-í
è¶<c       s7   d  Z  d k Z h  Z d d „ Z d „  Z d „  Z d S(   sg  Efficiently compare files, boolean outcome only (equal / not equal).

Tricks (used in this order):
    - Files with identical type, size & mtime are assumed to be clones
    - Files with different type or size cannot be identical
    - We keep a cache of outcomes of earlier comparisons
    - We don't fork a process to run 'cmp' but read the files ourselves
Ni   c 	   s  t  t i |  ƒ ƒ t  t i | ƒ ƒ f \ } } | d d j p | d d j o d Sn | o
 | | j o d Sn | d  | d  j o d Sn |  | f } y9 t	 | \ } } } | | j o
 | | j o | Sn Wn t j
 o n Xt |  | ƒ } | | | f t	 | <| Sd S(   s¥   Compare two files, use the cache if possible.
    Return 1 for identical files, 0 for different.
    Raise exceptions if either file could not be statted, read, etc.i    i   i   i   N(   s   sigs   oss   stats   f1s   f2s   s1s   s2s   shallows   keys   caches   cs1s   cs2s   outcomes   KeyErrors   do_cmp(	   s   f1s   f2s   shallows   s2s   s1s   keys   outcomes   cs1s   cs2(    (    s!   /usr/lib/python2.2/lib-old/cmp.pys   cmp s$     0"c    s3   |  d d } |  d } |  d } | | | f Sd S(   s§   Return signature (i.e., type, size, mtime) from raw stat data
    0-5: st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid
    6-9: st_size, st_atime, st_mtime, st_ctimei    i   i   i   N(   s   sts   types   sizes   mtime(   s   sts   mtimes   sizes   type(    (    s!   /usr/lib/python2.2/lib-old/cmp.pys   sig- s
     

c    s~   d d } t |  d ƒ } t | d ƒ } xO d oG | i | ƒ } | i | ƒ } | | j o d Sn | o d Sn q+ Wd S(   s   Compare two files, really.i   i   s   rbi   i    N(	   s   bufsizes   opens   f1s   fp1s   f2s   fp2s   reads   b1s   b2(   s   f1s   f2s   fp1s   b1s   b2s   fp2s   bufsize(    (    s!   /usr/lib/python2.2/lib-old/cmp.pys   do_cmp6 s     
   (   s   __doc__s   oss   caches   cmps   sigs   do_cmp(   s   sigs   caches   oss   do_cmps   cmp(    (    s!   /usr/lib/python2.2/lib-old/cmp.pys   ? s
   			