| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DybPython::svndiff::Delta Class Reference

Inheritance diagram for DybPython::svndiff::Delta:
[legend]
Collaboration diagram for DybPython::svndiff::Delta:
[legend]
List of all members.

Public Member Functions

def __init__
def parse_hdr
def __repr__
def split_
def __str__
def check

Public Attributes

 children
 meta
 divs

Static Public Attributes

string req = 'label path div apath bpath abracket bbracket'
tuple ptn
tuple hdr = property(lambda self:"\n".join(self[0:4]))
tuple basename = property(lambda self:os.path.basename(self.meta['path']))
tuple name = property(lambda self:os.path.splitext(self.basename)[0])
tuple ext = property(lambda self:os.path.splitext(self.basename)[1])
tuple nchild = property(_nchild)
tuple smry = property(_smry)
tuple rejoin = property(lambda self:"\n".join([str(c) for c in self.children]))

Detailed Description

Hold raw text of a single difference ... 
split into sub-Blocks using the block divider

adate and bdate are present for svnlook diffs 

Definition at line 254 of file svndiff.py.


Member Function Documentation

def DybPython::svndiff::Delta::__init__ (   self,
  args,
  kwargs 
)

Reimplemented from DybPython::svndiff::Text.

Definition at line 264 of file svndiff.py.

00264                                       : (?P<path>\S*)"),
00265            re.compile("^(?P<div>===================================================================)"),
00266            re.compile("^--- (?P<apath>\S*)\t(?P<adate>.*)\((?P<abracket>.*)\)"),
00267            re.compile("^\+\+\+ (?P<bpath>\S*)\t(?P<bdate>.*)\((?P<bbracket>.*)\)"),
00268          )
00269     hdr = property(lambda self:"\n".join(self[0:4]))

def DybPython::svndiff::Delta::parse_hdr (   self  ) 

Line by line pattern matching of the header 

Definition at line 270 of file svndiff.py.

00270                                        :
00271         Text.__init__(self, *args, **kwargs)
00272         self.parse_hdr()
00273         self.children = self.split_(Block, lambda l:Block.ptn.match(l), offset=0 )  ## offset controls where to divide ...  
00274         self.check(hdr=self.hdr)
00275         pass
00276     def parse_hdr(self):
00277         """Line by line pattern matching of the header """
00278         for i,ptn in enumerate(self.ptn):
00279             m = self.ptn[i].match( self[i] )
00280             assert m, ( "failed to match %s " % self[i] )
00281             self.meta.update( m.groupdict() )
00282         for req in self.req:
            assert req in self.meta, "required match parameter not found %s " % req

def DybPython::svndiff::Delta::__repr__ (   self  ) 

Reimplemented from DybPython::svndiff::Text.

Definition at line 283 of file svndiff.py.

00289                       :
        return Text.__repr__(self) + self.meta['path'] + " " + self.basename

def DybPython::svndiff::Text::split_ (   self,
  cls,
  predicate = lambda line:True,
  offset = 0 
) [inherited]

Definition at line 140 of file svndiff.py.

00144                                                :True, offset=0 ):
00145         divs = []
00146         for n,line in enumerate(self):
00147             if predicate(line):
00148                 divs.append(n+offset)
00149         self.divs = divs
00150         children = []
00151         for i, n in enumerate(divs):
00152             if i + 1 < len(divs):
00153                 m = divs[i+1]
00154             else:
00155                 m = len(self) 

def DybPython::svndiff::Text::__str__ (   self  )  [inherited]

Definition at line 164 of file svndiff.py.

00164                    :
00165         return "".join([c.smry for c in self.children])
    smry = property(_smry)    

def DybPython::svndiff::Text::check (   self,
  verbose = False,
  hdr = None 
) [inherited]

Check can put together the split text 

Definition at line 175 of file svndiff.py.

00177                                  :"\n".join([str(c) for c in self.children]))
00178 
00179     def check(self, verbose=False, hdr=None ):
00180         """Check can put together the split text """ 
00181         rejo = self.rejoin 
00182         if hdr:
00183             rejo = "\n".join([ hdr, rejo])
00184 
00185         agree = str(self) == rejo
00186 
00187         if verbose or not(agree):
00188             print "." * 50 + " original " + "." * 50 
00189             print str(self)
00190             print "." * 50 + " recombined " + "." * 50 
00191             print rejo


Member Data Documentation

string DybPython::svndiff::Delta::req = 'label path div apath bpath abracket bbracket' [static]

Definition at line 256 of file svndiff.py.

tuple DybPython::svndiff::Delta::ptn [static]

Initial value:

(
           re.compile("^(?P<label>\S*): (?P<path>\S*)"),
           re.compile("^(?P<div>===================================================================)"),
           re.compile("^--- (?P<apath>\S*)\t(?P<adate>.*)\((?P<abracket>.*)\)"),
           re.compile("^\+\+\+ (?P<bpath>\S*)\t(?P<bdate>.*)\((?P<bbracket>.*)\)"),
         )

Definition at line 257 of file svndiff.py.

tuple DybPython::svndiff::Delta::hdr = property(lambda self:"\n".join(self[0:4])) [static]

Definition at line 263 of file svndiff.py.

tuple DybPython::svndiff::Delta::basename = property(lambda self:os.path.basename(self.meta['path'])) [static]

Definition at line 286 of file svndiff.py.

tuple DybPython::svndiff::Delta::name = property(lambda self:os.path.splitext(self.basename)[0]) [static]

Definition at line 287 of file svndiff.py.

tuple DybPython::svndiff::Delta::ext = property(lambda self:os.path.splitext(self.basename)[1]) [static]

Definition at line 288 of file svndiff.py.

DybPython::svndiff::Delta::children

Reimplemented from DybPython::svndiff::Text.

Definition at line 267 of file svndiff.py.

tuple DybPython::svndiff::Text::nchild = property(_nchild) [static, inherited]

Definition at line 158 of file svndiff.py.

tuple DybPython::svndiff::Text::smry = property(_smry) [static, inherited]

Reimplemented in DybPython::svndiff::Hunk.

Definition at line 162 of file svndiff.py.

tuple DybPython::svndiff::Text::rejoin = property(lambda self:"\n".join([str(c) for c in self.children])) [static, inherited]

Definition at line 173 of file svndiff.py.

DybPython::svndiff::Text::meta [inherited]

Definition at line 135 of file svndiff.py.

DybPython::svndiff::Text::divs [inherited]

Definition at line 137 of file svndiff.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:13:03 2011 for DybPython by doxygen 1.4.7