/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::Block Class Reference
Inheritance diagram for DybPython::svndiff::Block:
Inheritance graph
[legend]
Collaboration diagram for DybPython::svndiff::Block:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Public Attributes

 children
 meta
 divs
 parent

Static Public Attributes

tuple ptn = re.compile("^@@ (?P<ablk>[-\+,\d]*) (?P<bblk>[-\+,\d]*) @@$")

Properties

 hdr = property(lambda self:self[0])
 nchild = property(_nchild)
 smry = property(_smry)
 rejoin = property(lambda self:"\n".join([str(c) for c in self.children]))

Detailed Description

Definition at line 255 of file svndiff.py.


Constructor & Destructor Documentation

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

Reimplemented from DybPython::svndiff::Text.

Definition at line 258 of file svndiff.py.

00259                                        :
00260         Text.__init__(self, *args, **kwargs)
00261         self.children = []
00262         self.parse_hdr()
00263         self.parse_body()
00264         self.check(verbose=False)
    

Member Function Documentation

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

Definition at line 265 of file svndiff.py.

00266                        :
00267         m = self.ptn.match(self[0])   
00268         assert m, ( "failed to match %s " % self[0] )
00269         self.meta.update( m.groupdict() )

def DybPython::svndiff::Block::parse_body (   self,
  verbose = False 
)
Looks for contiguous Hunks of text with the same first character.
records prior when transitions to new contiguous first char, avoids fake initial hunk

Definition at line 270 of file svndiff.py.

00271                                        :
00272         """
00273         Looks for contiguous Hunks of text with the same first character.
00274         records prior when transitions to new contiguous first char, avoids fake initial hunk
00275         """
00276         l,start  = "<",0
00277         index = 0
00278         for i,line in enumerate(self + [">"]):
00279             if len(line)>0:
00280                 c = line[0]
00281             else:
00282                 c = "."
00283             assert c in " >@+-."
00284             if verbose:
00285                 print "[%2d, %s,%s,%d] %s " % ( i+1,c,l,start+1, line)
00286             if c == l:
00287                 pass
00288             else:
00289                 if l == "<":
00290                     pass
00291                 else:
00292                     hnk = Hunk( self[start:i], c=l, begin=start+1 , end=i , index=index )
00293                     hnk.parent = self
00294                     self.children.append( hnk )
00295                     if hnk.smry != "":   ## only hunks with non empty summaries qualify for an index 
00296                         index += 1
00297                 l = c
00298                 start = i

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::__repr__ (   self) [inherited]

Reimplemented in DybPython::svndiff::Delta.

Definition at line 214 of file svndiff.py.

00215                       :
00216         try:
00217             label = "%(index)s[%(begin)s:%(end)s]" % self.meta
00218         except KeyError:
00219             label = "%r" % self.meta     
00220         return "%s %s (%d) %d [%s] " % ( self.__class__.__name__, label, len(self), self.nchild, self.smry  ) 

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

tuple DybPython::svndiff::Block::ptn = re.compile("^@@ (?P<ablk>[-\+,\d]*) (?P<bblk>[-\+,\d]*) @@$") [static]

Definition at line 256 of file svndiff.py.

Reimplemented from DybPython::svndiff::Text.

Definition at line 258 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::Block::hdr = property(lambda self:self[0]) [static]

Definition at line 257 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