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

In This Package:

DybPython::dbsvn Namespace Reference


Classes

class  Hook
class  Msg
class  DBIValidate

Functions

def main

Variables

tuple log = lambdamsg:sys.stderr.write(msg+"\n")
tuple cmd = lambda_:os.popen(_)

Function Documentation

def DybPython::dbsvn::main (  ) 

Definition at line 297 of file dbsvn.py.

00297           :
00298     from optparse import OptionParser
00299     op = OptionParser(usage=__doc__ )
00300     op.add_option("-v", "--verbose", action="store_true" )
00301     op.add_option("-m", "--message", help="Commit message to be validated, client side only. Default %default "  )
00302     op.add_option("-r", "--refpath", help="URL or filesystem path of cross reference checking repository. Default %default "  )
00303     op.add_option("-M", "--no-message-chk",  action="store_true",  help="Skip Commit message check, client side only. Default %default "  )
00304     op.add_option("-a", "--author",  help="Author identity, client side only. Default %default "  )
00305     op.add_option("-X", "--admins",  help="Comma separated list of SVN identity names of admins, server side. Default %default "  )
00306     op.set_defaults( verbose=False, message="no-message", author="unknown", admins="", no_message_chk=False , refpath="http://dayabay.ihep.ac.cn/svn/dybsvn" )
00307     (opts_ , args) = op.parse_args()
00308     opts = vars(opts_)
00309     if len(args)==0:args = [os.getcwd()]    ## default to current working directory 
00310 
00311     if len(args) == 1:
00312         if args[0] == "HOOK":
00313             print Hook()
00314             sys.exit(0)
00315         cmd = SVN(path=args[0], msg=opts['message'], author=opts['author'] ) 
00316     elif len(args) == 2:
00317         cmd = SVNLook(repo_path=args[0], txn_name=args[1], )
00318     else:
00319         print __doc__
00320         sys.exit(1) 
00321     
00322     admins = opts['admins'].split(",")
00323 
00324 
00325     author = cmd.author
00326     msg_ = cmd.msg 
00327 
00328     ## commit messages containing OVERRIDE by authors in the administrators list 
00329     ## short circuit the validations ... this is needed for non-standard operations such
00330     ## as adding or removing tables from the catalog 
00331     if msg_.find("OVERRIDE") > -1:
00332          if author in admins:
00333              sys.exit(0) 
00334          else:
00335              log("your identity %r is not in the admin users list  %r so you cannot use the OVERRIDE control  " % (author, admins) ) 
00336              sys.exit(1)
00337 
00338 
00339     lines = cmd.diff.split("\n")
00340 
00341     if not opts['no_message_chk']:
00342         msg = Msg( msg_ )
00343         log("commit msg: %r author: %r admins: %r  " % (msg,author,admins) )
00344         msg.validate_annotation_xref( opts['refpath'] )
00345     else:
00346         msg = None 
00347 
00348 
00349 
00350     maxl = 1000
00351     for i,line in enumerate(lines[0:maxl]):
00352         log("[%2d] %s " % (i+1, line))
00353     if len(lines) > maxl:
00354         log("TOTAL of %d lines truncated to max %d " %( len(lines), maxl) )  
00355 
00356 
00357     diff = Diff(lines)
00358     diff.dump()
00359 
00360     dbiv = DBIValidate( diff, msg, author )
00361     dbiv()
00362 
if __name__=='__main__':


Variable Documentation

tuple DybPython::dbsvn::log = lambdamsg:sys.stderr.write(msg+"\n") [static]

Definition at line 172 of file dbsvn.py.

tuple DybPython::dbsvn::cmd = lambda_:os.popen(_) [static]

Definition at line 173 of file dbsvn.py.

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

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