File: //opt/alt/python27/lib/python2.7/site-packages/paste/debug/fsdiff.pyo
�
|��Wc           @   sD  d  Z  d d l Z d d l m Z d d l m Z y d d l m Z Wn! e k
 ri d d l m Z n Xd d l Z d d l	 Z	 d d d d	 d
 d g Z
 d e f d �  �  YZ d e f d
 �  �  YZ
 d e f d �  �  YZ d	 e f d �  �  YZ d d e d � Z e d � Z d d d � Z d d d � Z d �  Z d �  Z d S(   s  
Module to find differences over time in a filesystem
Basically this takes a snapshot of a directory, then sees what changes
were made.  The contents of the files are not checked, so you can
detect that the content was changed, but not what the old version of
the file was.
i����N(   t   fnmatch(   t   datetime(   t   IterableUserDictt   Difft   Snapshott   Filet   Dirt   report_expected_diffst	   show_diffc           B   s8   e  Z d  Z d �  Z d �  Z d �  Z e e d � Z RS(   s9   
    Represents the difference between two snapshots
    c         C   s    | |  _  | |  _ |  j �  d  S(   N(   t   beforet   aftert
   _calculate(   t   selfR	   R
   (    (    sC   /opt/alt/python27/lib/python2.7/site-packages/paste/debug/fsdiff.pyt   __init__   s    		c         C   s�   |  j  j } |  j j } i  |  _ i  |  _ | j �  |  _ xm | j �  D]_ \ } } | | k rq | |  j | <qF n  |  j | =| j | | j k  rF | | |  j | <qF qF Wd  S(   N(	   R	   t   dataR
   t   deletedt   updatedt   copyt   createdt   itemst   mtime(   R   R	   R
   t   patht   f(    (    sC   /opt/alt/python27/lib/python2.7/site-packages/paste/debug/fsdiff.pyR   $   s    		
c         C   s
   |  j  �  S(   N(   t   report(   R   (    (    sC   /opt/alt/python27/lib/python2.7/site-packages/paste/debug/fsdiff.pyt   __str__2   s    c      
   C   s�  g  } | r; | j  d |  j j |  j j |  j j f � n  xsd |  j t f d |  j t f d |  j t f g D]>\ } } } | ro | j  d | � | j	 �  } | j
 �  d } x� | D]� \ } }	 d t | | d d	 d
 t �}
 | } | r|	 j
 d k r|
 d |	 j
 7}
 n  | r�g  } |  j j | � rJ| j  |  j | j � n  |  j j | � rv| j  |  j | j � n  |
 d
 d j t t | � � 7}
 n  | j  |
 � q� Wqo qo Wt | � d k r�| j  d � n  d j | � S(   Ns   Difference in %s from %s to %s:R   R   R   s   -- %s: -------------------t    s     %st   indenti   t   include_seps   N/As     (%s bytes)s    (mtime: %s)s   ->i   s     (no changes)s   
(   t   appendR	   t	   base_patht
   calculatedR
   R   t   TrueR   R   R   t   sortt
   _space_prefixt   Falset   sizet   getR   t   joint   mapt   reprt   len(   R   t   headert   datest   st   namet   filest	   show_sizet   lastR   R   t   tt   parts(    (    sC   /opt/alt/python27/lib/python2.7/site-packages/paste/debug/fsdiff.pyR   5   s@    			"
#(	   t   __name__t
   __module__t   __doc__R
   R   R   R   R"