|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/lib/python2.4/lib-old/ |
Upload File : |
mò
Ï=Ec @ sG d Z d k Z d k Td k Z h Z d d „ Z d „ Z d „ Z d S( s Efficiently compare files, boolean outcome only (equal / not equal).
Tricks (used in this order):
- Use the statcache module to avoid statting files more than once
- 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
N( t *i c C s
t t i | ƒ ƒ t t i | ƒ ƒ } } t | d ƒ p t | d ƒ o d Sn | o | | j o d Sn | d | d j o d Sn | d | } t
i | ƒ o9 t
| \ } } } | | j o | | j o | Sqç n t | | ƒ } | | | f t
| <| S( sß Compare two files, use the cache if possible.
May raise os.error if a stat or open of either fails.
Return 1 for identical files, 0 for different.
Raise exceptions if either file could not be statted, read, etc.i i i t N( t sigt statcachet statt f1t f2t s1t s2t S_ISREGt shallowt keyt cachet has_keyt cs1t cs2t outcomet do_cmp( R R R
R R R R R R ( ( t&