/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Static Public Attributes | Properties
DybPython::svndiff::Delta Class Reference
Inheritance diagram for DybPython::svndiff::Delta:
Inheritance graph
[legend]
Collaboration diagram for DybPython::svndiff::Delta:
Collaboration graph
[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
 parent

Static Public Attributes

string req = 'label path div apath bpath abracket bbracket'
tuple ptn

Properties

 hdr = property(lambda self:"\n".join(self[0:4]))
 basename = property(lambda self:os.path.basename(self.meta['path']))
 name = property(lambda self:os.path.splitext(self.basename)[0])
 ext = property(lambda self:os.path.splitext(self.basename)[1])
 nchild = property(_nchild)
 smry = property(_smry)
 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 299 of file svndiff.py.


Constructor & Destructor Documentation

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

Reimplemented from DybPython::svndiff::Text.

Definition at line 315 of file svndiff.py.

00316                                        :
00317         Text.__init__(self, *args, **kwargs)
00318         self.parse_hdr()
00319         self.children = self.split_(Block, lambda l:Block.ptn.match(l), offset=0 )  ## offset controls where to divide ...  
00320         self.check(hdr=self.hdr)
        pass

Member Function Documentation

def DybPython::svndiff::Delta::parse_hdr (   self)
Line by line pattern matching of the header 

Definition at line 321 of file svndiff.py.

00322                        :
00323         """Line by line pattern matching of the header """
00324         for i,ptn in enumerate(self.ptn):
00325             m = self.ptn[i].match( self[i] )
00326             assert m, ( "failed to match patn %d to text \"%s\" %r " % (i,self[i], self.meta ) )
00327             self.meta.update( m.groupdict() )
00328         for req in self.req:
00329             assert req in self.meta, "required match parameter not found %s " % req
00330         assert self.meta['apath'] == self.meta['bpath'] == self.meta['path'] , ( "path mismatch", self.meta )
00331         del self.meta['apath']
00332         del self.meta['bpath']
00333         del self.meta['div']
        pass
def DybPython::svndiff::Delta::__repr__ (   self)

Reimplemented from DybPython::svndiff::Text.

Definition at line 334 of file svndiff.py.

00335                       :
00336         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 187 of file svndiff.py.

00187                                                :True, offset=0 ):
00188         divs = []
00189         for n,line in enumerate(self):
00190             if predicate(line):
00191                 divs.append(n+offset)
00192         self.divs = divs
00193         children = []
00194         for i, n in enumerate(divs):
00195             if i + 1 < len(divs):
00196                 m = divs[i+1]
00197             else:
00198                 m = len(self) 
00199             child = cls(self[n:m], index=i, begin=n+1, end=m)   ## 1-based begin/end numbering for direct vi "set nu" comparison 
00200             child.parent = self  
00201             children.append(child) 
00202         return children
00203 
def DybPython::svndiff::Text::__str__ (   self) [inherited]

Definition at line 212 of file svndiff.py.

00213                      :
        return "\n".join(self)
def DybPython::svndiff::Text::check (   self,
  verbose = False,
  hdr = None 
) [inherited]
Check can put together the split text 

Definition at line 223 of file svndiff.py.

00224                                              :
00225         """Check can put together the split text """ 
00226         rejo = self.rejoin 
00227         if hdr:
00228             rejo = "\n".join([ hdr, rejo])
00229 
00230         agree = str(self) == rejo
00231 
00232         if verbose or not(agree):
00233             print "." * 50 + " original " + "." * 50 
00234             print str(self)
00235             print "." * 50 + " recombined " + "." * 50 
00236             print rejo
00237             print "." * 100
00238         assert agree , ("mismatch for %s %r " % ( self.__class__.__name__, self) ) 


Member Data Documentation

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

Definition at line 307 of file svndiff.py.

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 308 of file svndiff.py.

Reimplemented from DybPython::svndiff::Text.

Definition at line 315 of file svndiff.py.

Definition at line 179 of file svndiff.py.

Definition at line 179 of file svndiff.py.

Definition at line 179 of file svndiff.py.


Property Documentation

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

Definition at line 314 of file svndiff.py.

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

Definition at line 337 of file svndiff.py.

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

Definition at line 338 of file svndiff.py.

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

Definition at line 339 of file svndiff.py.

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

Definition at line 206 of file svndiff.py.

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

Reimplemented in DybPython::svndiff::Hunk.

Definition at line 210 of file svndiff.py.

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

Definition at line 221 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 Fri May 16 2014 09:55:41 for DybPython by doxygen 1.7.4