Ñò ô†³Kc @sdZddkZddklZddklZddklZddkZddkZdddd d d gZde fd „ƒYZ defd „ƒYZ de fd„ƒYZ d e fd„ƒYZ dded„Zed„Zddd„Zddd„Zd„Zd„ZdS(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(tfnmatch(tdatetime(tIterableUserDicttDifftSnapshottFiletDirtreport_expected_diffst show_diffcBs8eZdZd„Zd„Zd„Zeed„ZRS(s9 Represents the difference between two snapshots cCs ||_||_|iƒdS(N(tbeforetaftert _calculate(tselfR R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyt__init__s  cCs±|ii}|ii}h|_h|_|iƒ|_xq|iƒD]c\}}||jo||i|is (no changes)s (tappendR t base_patht calculatedR RtTrueRRRtsortt _space_prefixtFalsetsizetgetRtjointmaptreprtlen( R theadertdateststnametfilest show_sizetlastRRtttparts((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR2sD       $( t__name__t __module__t__doc__R R RRR"R(((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRs    cBszeZdZd d d ed„Zd„Zd„Zd„Zd„Zd„Z e i d d e d„Z d„Zd „ZRS( sx Represents a snapshot of a set of files. Has a dictionary-like interface, keyed relative to ``base_path`` cCs\||_||_||_||_d|_|ph|_|djo|iƒndS(N(Rtignore_wildcardst ignore_hiddent ignore_pathstNoneRRt find_files(R RR-R5R7R6((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR [s      cCs&|id|iƒtiƒ|_dS(s_ Find all the files under the base path, and put them in ``self.data`` RN(t_find_traverseRRtnowR(R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR9jscCsm||ijotS|io!tii|ƒidƒotSx&|iD]}t||ƒotSqJWt S(Nt.( R7RR6tosRtbasenamet startswithR5RR"(R tfntpat((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyt _ignore_filers&  cCsD||ijotS|io!tii|ƒidƒotStS(NR<(R7RR6R=RR>R?R"(R R@((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRB|s &cCsÀtii|i|ƒ}tii|ƒo{|ot|i|ƒ||s(no calculation done)(t __class__R2RR(R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyt__repr__‘sc CsOh}xB|D]:}|}|idƒ}||ijo.|o||ƒ} nd} | ||t| ƒt| ƒjodt| ƒt| ƒ} nd} | ||(RGR2RR(R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRHs (R2R3R4RRTR"tdirR RctpropertyRKRdRgRH(((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRÍs    cBsAeZdZeZeZd„Zd„Zd„Z e e ƒZ RS(s6 Represents a directory created by a command. cCs@||_||_tii||ƒ|_d|_d|_dS(NsN/A(RRR=R%RFR#R(R RR((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR s    cCsd|ii|i|ifS(Ns <%s %s:%s>(RGR2RR(R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRHs cCstd|ƒ‚dS(Ns!Directory %r doesn't have content(tNotImplementedError(R ((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRcs( R2R3R4R"RTRRhR RHRcRiRK(((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR s   cCs)|djotii}n|i|ƒ}|i|ƒ}g}x‰|o|oz|d|djoe|djo)|idt|dƒt|ƒƒn|id|ƒ|idƒ|idƒqDW|oD|odi|ƒ||i|ƒSdi|ƒ|i|ƒSn|i|ƒSdS(s¸ Anything shared by pref and full will be replaced with spaces in full, and full returned. Example:: >>> _space_prefix('/foo/bar', '/foo') ' /bar' it RN( R8R=RtseptsplitRR(tpopR%(tprefRFRlRRtpadding((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR!%s" # ) c Cs¹|pdS|iƒ}|iƒg}d}xd|D]\\}}t||dddtƒ}|ot|dƒ}n|}t|iƒƒdjoáttid|ƒi d ƒƒ}t |d |ƒ}|o”|d 7}x•|iƒD]u}|i ƒi d ƒot|d ƒ}n9|i ƒi dƒot|dƒ}nt|dƒ}||d 7}qçWq„|d |7}n|d|7}|i |ƒq5W|i dt|ƒƒd i|ƒS(sh Takes the output of compare_expected, and returns a string description of the differences. sNo differencesRRiRi is^[ ]*iis t+i t-i iRksFiles with differences: %s(RR R!R"t color_lineR(t splitlinestretsearchtgroupRRJR?RR%( tdiffstcolorizeR+R/RtdescR0t cur_indenttline((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRCs<   !  cCsÏ|d jo|d jodSg}|d jo|idƒnI|djo&|idƒ|idd|ƒn|idd|ƒ|d jo|idƒn|idd |ƒd d i|ƒS( s 0 black 1 red 2 green 3 yellow 4 blue 5 magenta (purple) 6 cyan 7 white (gray) Add 8 to get high-intensity ss[39mis[1ms[%imiis[49mi(sN(R8RR%(t foregroundt backgroundtcodes((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyt color_codehs     cCsAtid|ƒ}|idƒt||ƒ||iƒtƒS(Ns^(\s*)i(RuRvRwR€tend(R|R}R~tmatch((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRs†scCs6dig}|iƒD]}|d||q~ƒS(Ns Rk(R%Rt(Rttextt_[1]tl((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyR‹sc Csòg}|iƒD]$}|iƒo||iƒqq~}g}|iƒD]$}|iƒo||iƒqOqO~}t|ƒt|ƒjo djnod|d|dfS|p d|Sddk}di|i||ƒƒS(Nis %r not %risEmpty; should have: iÿÿÿÿs (RtRJR(tdifflibR%tndiff(RURSR„R…t actual_linest_[2]texpected_linesR†((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyRs''*  (R4R=RRtpaste.util.UserDict24RRYRut__all__tobjectRRRRR8RR!R"RR€RsRR(((s6/usr/lib/python2.6/site-packages/paste/debug/fsdiff.pyt s$    >y< %